:root {
  --bg: #0b0f14;
  --bg-2: #10161e;
  --panel: #141b24;
  --panel-2: #1a2330;
  --line: #243041;
  --text: #e6edf3;
  --muted: #93a1b2;
  --accent: #f5a524;
  --accent-ink: #1a1203;
  --signal: #3ddc97;
  --danger: #ff6b6b;
  --info: #5aa9ff;
  --radius: 12px;
  --mono: ui-monospace, 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

/* ---- header ---- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 15, 20, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.brand small { font-family: var(--mono); color: var(--muted); font-weight: 500; font-size: .8rem; }
.nav { display: flex; gap: 20px; margin-left: auto; align-items: center; }
.nav a { color: var(--muted); font-size: .95rem; }
.nav a:hover, .nav a.active { color: var(--text); text-decoration: none; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 10px; }
@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--bg-2); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .nav a { padding: 10px 0; }
}

/* ---- buttons & forms ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: 600 .95rem var(--sans);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: #36475e; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: transparent; border-color: #5a2a2a; color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; font-size: .85rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
label .opt { color: var(--muted); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(245, 165, 36, .5); outline-offset: 1px; border-color: var(--accent); }
textarea { min-height: 110px; resize: vertical; }
.field { margin-bottom: 16px; }
.field .hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-bottom: 12px; }
.check input { margin-top: 5px; accent-color: var(--accent); }

.alert { padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 16px; background: var(--panel); }
.alert.error { border-color: #6b2b2b; background: #2a1414; color: #ffc9c9; }
.alert.ok { border-color: #1f5a41; background: #0f2a1f; color: #c5f5df; }
.alert.warn { border-color: #6b4f16; background: #2a200b; color: #ffe2a8; }

/* ---- hero ---- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(600px 300px at 80% 20%, rgba(245, 165, 36, .14), transparent 70%),
    radial-gradient(500px 300px at 10% 90%, rgba(61, 220, 151, .08), transparent 70%);
}
.hero .wrap { position: relative; padding: 88px 0 72px; display: grid; grid-template-columns: 1.2fr .8fr; gap: 48px; align-items: center; }
@media (max-width: 900px) { .hero .wrap { grid-template-columns: 1fr; padding: 56px 0 48px; } }
.eyebrow { font-family: var(--mono); font-size: .8rem; color: var(--signal); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 10px var(--signal); }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); margin-bottom: 18px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { font-size: 1.15rem; color: #c3cdd8; max-width: 38em; margin-bottom: 28px; }

.spec-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; font-family: var(--mono); font-size: .9rem; }
.spec-card .row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.spec-card .row:last-child { border-bottom: 0; }
.spec-card .k { color: var(--muted); }
.spec-card .v { color: var(--text); text-align: right; }
.spec-card .v.hot { color: var(--accent); font-weight: 700; }

/* ---- sections ---- */
section { padding: 72px 0; }
section.alt { background: var(--bg-2); border-block: 1px solid var(--line); }
.section-head { max-width: 720px; margin-bottom: 36px; }
.section-head p { color: var(--muted); font-size: 1.05rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card .icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: rgba(245, 165, 36, .12); color: var(--accent); margin-bottom: 14px; }
.card .icon svg { width: 20px; height: 20px; }
.card p:last-child { margin-bottom: 0; }
.card p { color: #c3cdd8; }

.radios { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 960px) { .radios { grid-template-columns: 1fr; } }
.radio-card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.radio-card .art { height: 170px; display: grid; place-items: center; background: linear-gradient(160deg, #18212d, #0f151d); border-bottom: 1px solid var(--line); }
.radio-card .art svg { height: 140px; }
.radio-card .body { padding: 22px; flex: 1; display: flex; flex-direction: column; }
.radio-card .maker { font-family: var(--mono); font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.radio-card h3 { font-size: 1.35rem; margin: 4px 0 10px; }
.radio-card ul { padding-left: 18px; margin: 0 0 16px; color: #c3cdd8; }
.radio-card ul li { margin-bottom: 4px; }
.radio-card .foot { margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--line); font-size: .85rem; color: var(--muted); }
.tag { display: inline-block; align-self: flex-start; font: 600 .72rem var(--mono); padding: 3px 8px; border-radius: 999px; background: rgba(61, 220, 151, .12); color: var(--signal); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .05em; }

.rules { counter-reset: rule; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; padding: 0; margin: 0; list-style: none; }
.rules li { counter-increment: rule; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 18px 60px; position: relative; color: #c3cdd8; }
.rules li::before { content: counter(rule, decimal-leading-zero); position: absolute; left: 18px; top: 18px; font: 700 .9rem var(--mono); color: var(--accent); }
.rules li strong { color: var(--text); display: block; margin-bottom: 2px; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; counter-reset: step; }
.step { counter-increment: step; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.step::before { content: 'STEP ' counter(step); display: block; font: 700 .75rem var(--mono); color: var(--signal); letter-spacing: .1em; margin-bottom: 10px; }
.step p { color: #c3cdd8; margin: 0; }

.faq details { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 16px 20px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-family: var(--mono); color: var(--accent); font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq .answer { padding: 0 20px 18px; color: #c3cdd8; }
.faq .answer p:last-child { margin-bottom: 0; }

.cta-band { text-align: center; }
.cta-band .btn-row { justify-content: center; }

.site-footer { border-top: 1px solid var(--line); padding: 36px 0; color: var(--muted); font-size: .88rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* ---- auth / forms page ---- */
.page { padding: 56px 0 80px; }
.narrow { width: min(520px, 100% - 32px); margin-inline: auto; }
.medium { width: min(760px, 100% - 32px); margin-inline: auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
@media (max-width: 520px) { .panel { padding: 20px; } }
.panel h1 { font-size: 1.7rem; }

/* ---- app (portal/admin) ---- */
.app-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.app-head h1 { font-size: 1.9rem; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .n { font: 700 1.7rem var(--mono); }
.stat .l { color: var(--muted); font-size: .85rem; }
.stat.hot .n { color: var(--accent); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); font: 600 .95rem var(--sans); padding: 10px 14px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs .badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; margin-left: 6px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; background: var(--panel-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; }
td .sub { color: var(--muted); font-size: .82rem; }
.pill { display: inline-block; font: 600 .72rem var(--mono); padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); text-transform: uppercase; }
.pill.green { background: rgba(61, 220, 151, .14); color: var(--signal); }
.pill.amber { background: rgba(245, 165, 36, .15); color: var(--accent); }
.pill.red { background: rgba(255, 107, 107, .14); color: var(--danger); }
.pill.blue { background: rgba(90, 169, 255, .14); color: var(--info); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=text] { max-width: 280px; }
.toolbar select { width: auto; }

.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.dl-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.dl-card.mine { border-color: rgba(245, 165, 36, .55); }
.dl-card h3 { margin-bottom: 4px; }
.dl-card .meta { color: var(--muted); font-size: .85rem; margin-bottom: 14px; }
.dl-card .btn { width: 100%; margin-bottom: 8px; justify-content: flex-start; white-space: normal; text-align: left; }

.idcard { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.idcard .k { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.idcard .v { font: 600 1.05rem var(--mono); word-break: break-word; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 0; width: min(720px, 100% - 32px); }
.radio-row { display: grid; grid-template-columns: 100px 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 10px; }
@media (max-width: 640px) { .radio-row { grid-template-columns: 1fr 1fr; } }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog .dlg-body { padding: 24px; max-height: 80vh; overflow: auto; }
dialog h2 { font-size: 1.3rem; }

.secret { font: 700 1.15rem var(--mono); background: var(--bg-2); border: 1px dashed var(--accent); padding: 10px 14px; border-radius: 8px; display: inline-block; user-select: all; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 18px; border-radius: 8px; z-index: 100; box-shadow: 0 8px 30px rgba(0, 0, 0, .4); }

/* ---- use agreement ---- */
.agreement h2 { font-size: 1.4rem; }
.agreement h3 { font-size: 1.02rem; margin: 22px 0 8px; }
.agreement ul { padding-left: 20px; margin: 0; color: #c3cdd8; }
.agreement li { margin-bottom: 6px; }
.agreement-box { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 16px 20px; background: var(--bg-2); margin-bottom: 18px; }
.key-value { font: 600 .95rem var(--mono); word-break: break-all; background: var(--bg-2); border: 1px dashed var(--accent); padding: 8px 10px; border-radius: 6px; user-select: all; }

/* ---- programming guide ---- */
.guide h2 { font-size: 1.5rem; margin-top: 8px; scroll-margin-top: 24px; }
.guide h3 { font-size: 1.08rem; margin: 26px 0 8px; }
.guide p, .guide li { color: #c3cdd8; }
.guide ol, .guide ul { padding-left: 22px; }
.guide li { margin-bottom: 8px; }
.guide section { margin-bottom: 40px; }
.guide .panel { margin-bottom: 20px; }
.guide .path { font: 600 .88em var(--mono); color: var(--text); background: var(--bg-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.guide .toc { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.guide .toc a { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); font-weight: 600; }
.guide .toc a small { display: block; color: var(--muted); font-weight: 400; }
.guide .toc a:hover { border-color: var(--accent); text-decoration: none; }
.guide .toc a.mine { border-color: rgba(245, 165, 36, .55); }
