:root {
  color-scheme: dark;
  --background: #0b1220;
  --surface: #131d33;
  --surface-raised: #182540;
  --surface-inset: #0f172a;
  --border: #24385f;
  --text: #e5eefc;
  --muted: #9fb2d5;
  --accent: #fb923c;
  --accent-hover: #ff8c3a;
  --accent-strong: #e96509;
  --success: #63d391;
  --danger: #ff7777;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--background); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--background); color: var(--text); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  padding: 14px clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(11,18,32,.94);
  backdrop-filter: blur(16px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: -.02em; }
.brand img { width: 34px; height: 34px; }
.topbar nav { display: flex; align-items: center; gap: 20px; }
.text-link { color: var(--muted); font-size: .94rem; }
.text-link:hover, footer a:hover, footer button:hover { color: var(--text); }

.reseller-button, .primary-button, .secondary-button, .manage-button {
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 750;
  cursor: pointer;
}
.reseller-button { background: var(--accent); color: #1a0b02; box-shadow: 0 8px 28px rgba(251,146,60,.14); }
.reseller-dot { width: 8px; height: 8px; border-radius: 50%; background: #e5eefc; box-shadow: 0 0 0 5px rgba(229,238,252,.14); }

.hero {
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  padding: 72px 0;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, .75fr);
  align-items: center;
  gap: clamp(42px, 8vw, 100px);
}

.eyebrow { display: inline-block; color: var(--accent); font-size: .75rem; font-weight: 850; letter-spacing: .17em; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 700px; margin: 18px 0 22px; font-size: clamp(3rem, 6.2vw, 5.5rem); line-height: .98; letter-spacing: -.065em; }
.hero-copy > p { max-width: 620px; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.2rem); line-height: 1.65; }
.trust-list { margin: 30px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; list-style: none; }
.trust-list li { padding: 9px 12px; border: 1px solid var(--border); border-radius: 999px; color: #d4e2f8; font-size: .85rem; background: var(--surface-inset); }

.setup-card, .dialog-shell {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(0,0,0,.46);
}
.setup-card { padding: clamp(22px, 3vw, 34px); }
.card-heading { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 24px; }
.step { flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 9px; color: var(--accent); font-size: .78rem; font-weight: 800; }
.card-heading h2, .manager-dialog h2 { margin-bottom: 5px; font-size: 1.45rem; letter-spacing: -.025em; }
.card-heading p, .manager-dialog p { color: var(--muted); line-height: 1.5; }

form { display: grid; gap: 15px; }
label { display: grid; gap: 8px; color: #d4e2f8; font-size: .85rem; font-weight: 700; }
input {
  width: 100%;
  height: 50px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0 14px;
  outline: none;
  background: var(--surface-inset);
  color: var(--text);
}
input::placeholder { color: #7185a8; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(251,146,60,.12); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.primary-button { width: 100%; border-color: var(--accent); background: var(--accent); color: #1a0b02; }
.primary-button:hover { background: var(--accent-hover); }
.primary-button:disabled, .secondary-button:disabled, .generate-access-button:disabled { opacity: .5; cursor: wait; }
.generate-access-button {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: var(--surface-raised);
  color: var(--text);
  font-weight: 750;
  cursor: pointer;
}
.generate-access-button:hover { border-color: var(--accent); }
.generate-access-button:focus-visible { outline: 3px solid rgba(251,146,60,.18); outline-offset: 2px; }
.credential-note { margin: -3px 0 1px; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.manage-button { width: 100%; margin-top: 10px; border-color: var(--border); background: transparent; color: var(--text); }
.manage-button:hover, .secondary-button:hover { border-color: var(--accent); background: var(--surface-raised); }
.security-note { margin: 15px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.player-notice { margin: 12px 0 0; padding: 12px 14px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: rgba(251,146,60,.055); color: #c8d7ee; font-size: .78rem; line-height: 1.5; }
.form-status { min-height: 18px; margin: 0; font-size: .82rem; color: var(--muted); }
.form-status.success { color: var(--success); }
.form-status.error { color: var(--danger); }

.reseller-section { width: min(1180px, calc(100% - 40px)); margin: 0 auto 80px; padding: 58px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.reseller-section h2 { margin: 12px 0 36px; font-size: clamp(2rem, 4vw, 3.4rem); letter-spacing: -.05em; }
.benefit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.benefit-grid article { min-height: 150px; padding: 23px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-inset); }
.benefit-grid strong { font-size: 1.05rem; }
.benefit-grid p { margin: 12px 0 0; color: var(--muted); line-height: 1.55; }
.secondary-button { width: max-content; margin-top: 24px; border-color: var(--border); background: transparent; color: var(--text); }

.legal-callout { width: min(1180px, calc(100% - 40px)); margin: 0 auto 80px; padding: 34px 40px; display: flex; align-items: center; justify-content: space-between; gap: 40px; border-left: 3px solid var(--accent); background: var(--surface-inset); }
.legal-callout h2 { margin: 10px 0 8px; font-size: clamp(1.5rem, 3vw, 2.2rem); letter-spacing: -.035em; }
.legal-callout p { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.6; }
.terms-button { min-height: 48px; flex: 0 0 auto; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--accent); border-radius: 10px; color: var(--text); font-weight: 750; }
.terms-button:hover { background: rgba(251,146,60,.08); }

footer { min-height: 150px; padding: 34px clamp(20px, 5vw, 72px); border-top: 1px solid var(--border); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 30px; color: var(--muted); font-size: .85rem; }
.footer-brand img { width: 28px; height: 28px; }
footer p { margin: 0; text-align: center; }
footer > div:last-child { display: flex; gap: 15px; }
footer button { border: 0; padding: 0; background: transparent; color: inherit; cursor: pointer; }

.manager-dialog { width: min(700px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; color: var(--text); overflow: auto; }
.manager-dialog::backdrop { background: rgba(0,0,0,.78); backdrop-filter: blur(7px); }
.dialog-shell { position: relative; padding: clamp(24px, 5vw, 42px); border: 0; box-shadow: none; }
.dialog-close { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-inset); color: var(--text); font-size: 1.5rem; cursor: pointer; }
.manager-dialog form { margin-top: 24px; }
.dashboard-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-top: 10px; }
.text-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0; }
.metrics article { padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-inset); }
.metrics span { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.metrics strong { display: block; margin-top: 7px; font-size: 1rem; }
.manager-list-form { margin-top: 22px; padding: 18px; border-radius: 12px; background: var(--surface-inset); box-shadow: inset 0 0 0 1px var(--border); }
.manager-list-form .primary-button { width: 100%; }
.list-format-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.list-format-heading > div:first-child { display: grid; gap: 3px; }
.list-format-heading span { color: var(--muted); font-size: .78rem; }
.list-format-tabs { padding: 4px; display: flex; border-radius: 9px; background: var(--surface); }
.list-format-tabs button { min-height: 38px; padding: 0 13px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.list-format-tabs button.active { background: var(--accent); color: #1a0b02; font-weight: 750; }
.xtream-fields { display: grid; grid-template-columns: 1.4fr .8fr .8fr; gap: 12px; }
.xtream-fields[hidden] { display: none; }
#m3u-field[hidden] { display: none !important; }
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.action-grid button { min-height: 112px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-inset); color: var(--text); text-align: left; cursor: pointer; }
.action-grid button:hover { border-color: var(--accent); background: var(--surface-raised); }
.action-grid strong, .action-grid span { display: block; }
.action-grid span { margin-top: 7px; color: var(--muted); font-size: .78rem; line-height: 1.4; }

.cookie-banner { position: fixed; z-index: 40; left: 18px; right: 18px; bottom: 18px; max-width: 1040px; margin: 0 auto; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 20px 70px rgba(0,0,0,.65); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 5px 0; color: var(--muted); font-size: .84rem; }
.cookie-banner a { color: #dfe3e6; font-size: .8rem; text-decoration: underline; }
.cookie-actions { display: flex; gap: 10px; flex: 0 0 auto; }
.cookie-actions .primary-button, .cookie-actions .secondary-button { width: auto; margin: 0; white-space: nowrap; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 56px 0; }
  .setup-card { order: -1; }
  h1 { font-size: clamp(3rem, 12vw, 5rem); }
  .benefit-grid { grid-template-columns: 1fr; }
  .reseller-section { padding: 32px; }
  .legal-callout { align-items: flex-start; flex-direction: column; }
  footer { grid-template-columns: 1fr; text-align: center; }
  footer > div { justify-content: center; }
}

@media (max-width: 620px) {
  .topbar { min-height: 66px; padding: 11px 16px; }
  .topbar .text-link { display: none; }
  .reseller-button { min-height: 42px; padding: 0 13px; font-size: .82rem; }
  .brand span { display: none; }
  .hero { width: min(100% - 28px, 1180px); min-height: auto; padding: 45px 0; }
  .field-row, .metrics, .action-grid, .manager-list-form, .xtream-fields { grid-template-columns: 1fr; }
  .list-format-heading { align-items: stretch; flex-direction: column; }
  .reseller-section { width: min(100% - 28px, 1180px); padding: 24px; }
  .legal-callout { width: min(100% - 28px, 1180px); padding: 24px; }
  .terms-button { width: 100%; }
  .secondary-button { width: 100%; text-align: center; }
  footer > div:last-child { flex-wrap: wrap; }
  .cookie-banner { align-items: stretch; flex-direction: column; }
  .cookie-actions { flex-direction: column; }
  .cookie-actions .primary-button, .cookie-actions .secondary-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
