:root {
  color-scheme: light;
  --ink: #181a1c;
  --muted: #5f666d;
  --line: #dde1e4;
  --accent: #00b83f;
  --accent-dark: #007d2c;
  --surface: #f6f8f7;
}

* { box-sizing: border-box; }

html { background: #fff; }

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: 0;
}

a { color: var(--accent-dark); }

.site-header,
main,
footer {
  width: min(100% - 40px, 760px);
  margin-inline: auto;
}

.site-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.site-header nav a {
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 19px;
  font-weight: 700;
}

.brand-icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  background: var(--accent);
  clip-path: polygon(17% 4%, 17% 96%, 92% 50%);
  border-radius: 7px;
}

.home-main { padding: 90px 0 100px; }

.intro { max-width: 670px; }

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
}

h1 {
  margin: 0 0 24px;
  font-size: 42px;
  line-height: 1.18;
  letter-spacing: 0;
}

.intro > p:last-child,
.lead {
  color: var(--muted);
  font-size: 20px;
  line-height: 1.65;
}

.document-list {
  margin-top: 54px;
  border-top: 1px solid var(--line);
}

.document-list a {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.document-list strong,
.document-list small { display: block; }

.document-list strong { font-size: 21px; }

.document-list small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 15px;
}

.document-list .arrow {
  color: var(--accent-dark);
  font-size: 27px;
}

.document { padding: 64px 0 96px; }

.document h2 {
  margin: 48px 0 10px;
  font-size: 23px;
  line-height: 1.4;
  letter-spacing: 0;
}

.document p { margin: 0 0 18px; }

footer {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 14px;
}

footer a { text-decoration: none; }

.portal-page { min-height: 100vh; color: #f7f8fb; background: radial-gradient(circle at 78% -10%, rgba(255,190,55,.12), transparent 33%), radial-gradient(circle at 8% 28%, rgba(47,111,255,.10), transparent 25%), #07080d; }
.portal-shell { width: min(100% - 40px, 1120px); padding: 30px 0 46px; }
.portal-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.portal-kicker { color: #ffd34e; font-size: 12px; font-weight: 800; letter-spacing: 1.5px; }
.portal-header h1 { margin: 3px 0 0; font-size: clamp(25px, 4vw, 38px); }
.portal-actions { display: flex; gap: 10px; }
.portal-actions a { padding: 8px 13px; color: #dfe4ef; border: 1px solid #292e3c; border-radius: 11px; text-decoration: none; font-size: 13px; }
.portal-notice { display: flex; align-items: center; gap: 12px; margin: 24px 0 22px; padding: 10px 14px; color: #ffd884; background: linear-gradient(90deg, rgba(111,45,35,.82), rgba(52,40,22,.62)); border: 1px solid rgba(255,198,83,.23); border-radius: 10px; }
.portal-notice p { margin: 0; font-size: 13px; line-height: 1.55; }
.notice-icon { flex: 0 0 auto; font-size: 18px; }
.portal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.portal-card { overflow: hidden; background: #11141c; border: 1px solid #252a37; border-radius: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.32); }
.portal-art { position: relative; min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; overflow: hidden; text-align: center; }
.portal-cover { min-height: 0; padding: 0; aspect-ratio: 1 / .76; background: #eaf5ff; }
.portal-cover img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center 42%; }
.portal-cover::after { height: 24%; }
.portal-art::after { position: absolute; inset: auto 0 0; height: 48%; background: linear-gradient(transparent, #11141c); content: ""; }
.art-primary { background: radial-gradient(circle at 50% 38%, #dceeff 0, #72beff 32%, #3277df 62%, #101a31 100%); }
.art-secondary { background: radial-gradient(circle at 50% 38%, #fff0d5 0, #ffbd65 32%, #ef6e3d 62%, #281417 100%); }
.portal-art strong, .portal-art small { position: relative; z-index: 1; text-shadow: 0 2px 12px rgba(0,0,0,.38); }
.portal-art strong { margin-top: 18px; font-size: clamp(26px, 4vw, 38px); line-height: 1.15; }
.portal-art small { margin-top: 8px; color: rgba(255,255,255,.82); font-size: 13px; }
.portal-badge { position: absolute; top: 14px; right: 14px; z-index: 2; padding: 5px 10px; color: #332600; background: #ffd64d; border-radius: 999px; font-size: 11px; font-weight: 800; }
.portal-tv { position: relative; z-index: 1; width: 104px; height: 76px; display: grid; place-items: center; background: linear-gradient(145deg,#1684ff,#4b42ef); border: 5px solid rgba(255,255,255,.92); border-radius: 20px; box-shadow: 0 14px 30px rgba(8,48,140,.38); }
.portal-tv::before, .portal-tv::after { position: absolute; top: -25px; width: 4px; height: 29px; background: #fff; border-radius: 6px; content: ""; }
.portal-tv::before { left: 39px; transform: rotate(-38deg); } .portal-tv::after { right: 39px; transform: rotate(38deg); }
.portal-tv span { width: 0; height: 0; margin-left: 7px; border-top: 15px solid transparent; border-bottom: 15px solid transparent; border-left: 24px solid #fff; }
.portal-card-body { position: relative; z-index: 2; padding: 0 18px 18px; }
.portal-cover + .portal-card-body { padding-top: 14px; }
.portal-card-body code { display: block; margin-bottom: 13px; padding: 11px 12px; overflow: hidden; color: #aeb7c9; background: #0a0c12; border: 1px solid #242a38; border-radius: 10px; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.portal-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.portal-buttons-single { grid-template-columns: 1fr; }
.portal-import { min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 9px; color: #fff; border-radius: 12px; text-decoration: none; font-size: 14px; font-weight: 750; transition: transform .15s ease, filter .15s ease; }
.portal-import:hover { transform: translateY(-2px); filter: brightness(1.08); }
.portal-import b { width: 28px; height: 28px; display: grid; place-items: center; background: rgba(255,255,255,.16); border-radius: 8px; }
.portal-import img { width: 30px; height: 30px; display: block; border-radius: 8px; object-fit: cover; }
.portal-copy { width: 100%; margin-top: 10px; padding: 9px; color: #aeb7c9; background: transparent; border-color: #303747; }
.portal-guide { display: grid; grid-template-columns: auto repeat(3,1fr); align-items: center; gap: 14px; margin-top: 22px; padding: 18px; background: #0e1118; border: 1px solid #242a37; border-radius: 15px; }
.portal-guide h2 { margin: 0 8px 0 0; font-size: 17px; }
.portal-guide div { display: flex; align-items: center; gap: 9px; }
.portal-guide div span { width: 26px; height: 26px; display: grid; place-items: center; flex: 0 0 auto; color: #151000; background: #ffd34e; border-radius: 50%; font-size: 12px; font-weight: 800; }
.portal-guide p { margin: 0; color: #aeb5c3; font-size: 12px; line-height: 1.45; }
.portal-footer { width: 100%; min-height: auto; display: block; margin-top: 24px; padding: 18px 0 0; color: #727887; border-color: #242832; font-size: 11px; text-align: center; }
.portal-footer p { margin: 0 0 5px; }
.portal-refresh { position: fixed; right: 22px; bottom: calc(22px + env(safe-area-inset-bottom)); width: 48px; height: 48px; color: #211800; background: #ffd34e; border: 0; border-radius: 50%; box-shadow: 0 8px 24px rgba(0,0,0,.34); cursor: pointer; font-size: 26px; }
.browser-warning[hidden] { display: none; }
.browser-warning { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; }
.browser-warning-backdrop { position: absolute; inset: 0; background: rgba(2,4,10,.82); backdrop-filter: blur(10px); }
.browser-warning-card { position: relative; width: min(100%, 420px); padding: 25px; color: #f6f7fb; background: #12151d; border: 1px solid #303747; border-radius: 20px; box-shadow: 0 24px 80px rgba(0,0,0,.55); }
.browser-warning-label { color: #ffd34e; font-size: 12px; font-weight: 800; }
.browser-warning-card h2 { margin: 5px 0 10px; font-size: 23px; line-height: 1.3; }
.browser-warning-card p { margin: 0 0 19px; color: #aeb5c3; font-size: 14px; line-height: 1.7; }
.browser-warning-card button { width: 100%; min-height: 48px; border: 0; border-radius: 12px; cursor: pointer; font: inherit; font-weight: 750; }
#copy-page-url { color: #221900; background: #ffd34e; }
.browser-warning-card .browser-warning-close { margin-top: 9px; color: #c5cad4; background: #252a35; }
@media (max-width: 700px) { .portal-shell { width: min(100% - 24px,1120px); padding-top: 20px; } .portal-header { align-items: center; } .portal-actions a { padding: 7px 10px; } .portal-grid { grid-template-columns: 1fr; } .portal-art { min-height: 220px; } .portal-guide { grid-template-columns: 1fr; } .portal-guide h2 { margin-bottom: 3px; } .portal-refresh { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); } }

.header-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.source-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 3%, rgba(0, 184, 63, 0.10), transparent 34%),
    linear-gradient(180deg, #fbfdfb 0%, #f3f7f4 100%);
}

.source-main { padding: 72px 0 86px; }

.source-hero { max-width: 650px; }

.source-hero h1 { margin-bottom: 18px; }

.source-hero > p:last-child {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 19px;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 46px;
}

.source-card {
  padding: 28px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(28, 45, 35, 0.10);
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(25, 67, 41, 0.08);
}

.source-card-head {
  display: flex;
  align-items: center;
  gap: 15px;
}

.source-number {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: var(--accent);
  border-radius: 15px;
  font-size: 14px;
  font-weight: 800;
}

.source-card h2,
.source-help h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
}

.source-card-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.source-address {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 20px;
  padding: 11px 12px 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.source-address code {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: #39413c;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-button {
  padding: 6px 10px;
  color: var(--accent-dark);
  background: #fff;
  border: 1px solid #cbd8cf;
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.import-actions { display: grid; gap: 11px; }

.import-button {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 15px;
  color: #fff;
  border-radius: 16px;
  text-decoration: none;
  transition: transform 0.16s ease, filter 0.16s ease;
}

.import-button:hover { transform: translateY(-1px); filter: brightness(1.04); }
.import-button:active { transform: scale(0.985); }
.tubo-button { background: linear-gradient(135deg, #1478ff, #5455ee); }
.m3uhub-button { background: linear-gradient(135deg, #00b83f, #008f35); }

.button-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 11px;
  font-size: 19px;
  font-weight: 800;
}

.play-mark::before {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 13px solid #fff;
  content: "";
}

.import-button strong,
.import-button small { display: block; }
.import-button strong { font-size: 16px; }
.import-button small { margin-top: 1px; color: rgba(255, 255, 255, 0.76); font-size: 12px; }

.source-help {
  margin-top: 28px;
  padding: 26px 28px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.70);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 14px;
}

.source-help h2 { color: var(--ink); font-size: 19px; }
.source-help ol { margin: 14px 0; padding-left: 21px; }
.source-help p { margin: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 10;
  padding: 10px 16px;
  color: #fff;
  background: rgba(20, 24, 21, 0.90);
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-size: 14px;
}

.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 600px) {
  .site-header,
  main,
  footer { width: min(100% - 32px, 760px); }

  .site-header { min-height: 66px; }
  .home-main { padding: 58px 0 72px; }
  .source-main { padding: 48px 0 66px; }
  .document { padding: 48px 0 72px; }
  h1 { font-size: 34px; }
  .intro > p:last-child,
  .lead { font-size: 18px; }
  .source-hero > p:last-child { font-size: 17px; }
  .source-grid { grid-template-columns: 1fr; margin-top: 34px; }
  .source-card { padding: 22px; border-radius: 20px; }
  footer {
    padding: 24px 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

/* Keep portal components isolated from the legacy source-page rules below. */
.portal-page .portal-card.source-card { padding: 0; background: #11141c; border-color: #252a37; }
.portal-page .portal-copy.copy-button { color: #aeb7c9; background: transparent; border-color: #303747; }
