/* ASTROMATE - midnight blue, rich gold, warm ivory. Mobile first; sidebar layout from 900px. */
:root {
  --bg: #08102a; --bg2: #0c1738; --surface: #111e44; --surface2: #17275a; --surface3: #1d3170;
  --line: rgba(214, 168, 74, 0.22); --line2: rgba(255, 255, 255, 0.09);
  --gold: #d6a84a; --gold2: #f1d28a; --gold3: #9c7425; --ivory: #f6efdc; --text: #eef0f8; --muted: #a9b3d1; --faint: #7d88ad;
  --yes: #3ecf8e; --no: #ff6b6b; --maybe: #f2b84b; --blue: #6aa5ff;
  --yes-bg: rgba(62, 207, 142, 0.14); --no-bg: rgba(255, 107, 107, 0.14); --maybe-bg: rgba(242, 184, 75, 0.14);
  --radius: 16px; --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --nav-h: 64px; --top-h: 56px;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh; font-size: 16px; line-height: 1.5;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(214, 168, 74, 0.10), transparent 60%), radial-gradient(900px 500px at -10% 10%, rgba(106, 165, 255, 0.10), transparent 60%), var(--bg);
  background-attachment: fixed;
}
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: .01em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; color: var(--gold2); }
p { margin: 0 0 .8em; }
a { color: var(--gold2); }
small, .small { font-size: .82rem; } .muted { color: var(--muted); } .faint { color: var(--faint); } .gold { color: var(--gold2); } .center { text-align: center; }
.mono { font-family: ui-monospace, Consolas, monospace; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ------------------------------------------------------------ shell */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; padding-top: env(safe-area-inset-top); background: rgba(8, 16, 42, 0.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ivory); }
.topbar .title { flex: 1; font-weight: 600; font-size: .98rem; color: var(--ivory); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 32px; height: 32px; flex: none; }
.wordmark { display: flex; flex-direction: column; line-height: 1; }
.wordmark b { font-size: 1.05rem; letter-spacing: .22em; color: var(--ivory); font-weight: 700; }
.wordmark span { font-size: .55rem; letter-spacing: .34em; color: var(--gold); margin-top: 3px; font-weight: 600; }
.main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
.bottomnav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(10, 18, 46, 0.97); border-top: 1px solid var(--line); backdrop-filter: blur(14px); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); text-decoration: none; font-size: .68rem; font-weight: 600; letter-spacing: .02em; min-height: 48px; }
.bottomnav a svg { width: 22px; height: 22px; }
.bottomnav a.on { color: var(--gold2); }
.sidebar { display: none; }
@media (min-width: 900px) {
  .app { flex-direction: row; }
  .sidebar { display: flex; flex-direction: column; gap: 4px; width: 250px; flex: none; position: sticky; top: 0; height: 100vh; padding: 20px 14px; background: linear-gradient(180deg, #0b1534, #070e26); border-right: 1px solid var(--line); }
  .sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 20px; text-decoration: none; }
  .sidebar .logo { width: 40px; height: 40px; }
  .sidebar a.nav { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; }
  .sidebar a.nav svg { width: 20px; height: 20px; }
  .sidebar a.nav:hover { background: rgba(255, 255, 255, 0.05); color: var(--ivory); }
  .sidebar a.nav.on { background: linear-gradient(90deg, rgba(214, 168, 74, 0.22), rgba(214, 168, 74, 0.04)); color: var(--gold2); }
  .sidebar .sep { height: 1px; background: var(--line2); margin: 10px 6px; }
  .sidebar .foot { margin-top: auto; padding: 10px; font-size: .75rem; color: var(--faint); }
  .col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .bottomnav { display: none; }
  .topbar .brand { display: none; }
  .main { padding: 24px 28px 48px; }
}

@media (max-width: 480px) {
  .bottomnav a { font-size: .6rem; padding: 0 1px; text-align: center; line-height: 1.12; letter-spacing: 0; }
  .bottomnav a svg { width: 21px; height: 21px; }
  .wordmark b { letter-spacing: .15em; font-size: .95rem; } .wordmark span { letter-spacing: .27em; font-size: .5rem; }
  .topbar .title { display: none; } .topbar .tag { margin-left: auto; }
  .hero h1 { font-size: 1.75rem; letter-spacing: .2em; padding-left: .2em; } .hero .sub { font-size: .75rem; letter-spacing: .4em; }
  .verdict .word { font-size: 3rem; } .main { padding-left: 12px; padding-right: 12px; }
}

/* ------------------------------------------------------------ surfaces */
.card { background: linear-gradient(180deg, rgba(23, 39, 90, 0.78), rgba(17, 30, 68, 0.78)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; background: rgba(255, 255, 255, 0.03); border-color: var(--line2); }
.card h3 { display: flex; align-items: center; gap: 8px; color: var(--ivory); }
.card h3 .tag { margin-left: auto; }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: 1fr; } .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.tight { gap: 6px; }
.stack > * + * { margin-top: 12px; }
.hr { height: 1px; background: var(--line2); margin: 14px 0; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .03em; border: 1px solid var(--line); color: var(--gold2); background: rgba(214, 168, 74, 0.08); white-space: nowrap; }
.tag.yes { color: var(--yes); border-color: rgba(62, 207, 142, .5); background: var(--yes-bg); } .tag.no { color: var(--no); border-color: rgba(255, 107, 107, .5); background: var(--no-bg); } .tag.maybe { color: var(--maybe); border-color: rgba(242, 184, 75, .5); background: var(--maybe-bg); }
.tag.blue { color: var(--blue); border-color: rgba(106, 165, 255, .45); background: rgba(106, 165, 255, .1); } .tag.dim { color: var(--muted); border-color: var(--line2); background: rgba(255, 255, 255, .04); }

/* ------------------------------------------------------------ buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); color: var(--ivory); font-weight: 700; letter-spacing: .03em; cursor: pointer; text-decoration: none; transition: transform .08s, filter .15s; -webkit-tap-highlight-color: transparent; }
.btn:hover { filter: brightness(1.12); } .btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #231703; border-color: #f4dc9d; box-shadow: 0 6px 20px rgba(214, 168, 74, .28); }
.btn.danger { border-color: rgba(255, 107, 107, .55); color: #ffb0b0; background: rgba(255, 107, 107, .08); }
.btn.ghost { background: transparent; } .btn.small { min-height: 36px; padding: 0 12px; font-size: .84rem; border-radius: 10px; } .btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > label, .lbl { font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--gold2); }
.field .hint { font-size: .78rem; color: var(--faint); } .field .err { font-size: .8rem; color: #ff9a9a; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(5, 10, 28, 0.7); color: var(--text); outline: none; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(214, 168, 74, .2); }
input[type="checkbox"], input[type="radio"] { width: 20px; min-height: 20px; height: 20px; accent-color: var(--gold); }
select option { background: #0c1738; color: var(--text); }
.check { display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.fgrid { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; } .fgrid .full { grid-column: 1 / -1; } @media (min-width: 700px) { .fgrid.c3 { grid-template-columns: repeat(3, 1fr); } .fgrid.c4 { grid-template-columns: repeat(4, 1fr); } }
.combo { position: relative; }
.combo .list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 4px; max-height: 260px; overflow: auto; background: #0e1b40; border: 1px solid var(--gold3); border-radius: 12px; box-shadow: var(--shadow); }
.combo .list button { display: block; width: 100%; text-align: left; padding: 10px 12px; background: transparent; border: 0; border-bottom: 1px solid var(--line2); color: var(--text); cursor: pointer; }
.combo .list button:hover, .combo .list button:focus { background: rgba(214, 168, 74, .14); outline: none; }
.combo .list small { color: var(--faint); display: block; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { padding: 8px 14px; background: transparent; border: 0; color: var(--muted); font-weight: 700; cursor: pointer; min-height: 40px; }
.seg button.on { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #231703; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: thin; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .04); color: var(--muted); font-size: .85rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.on { border-color: var(--gold); color: #231703; background: linear-gradient(180deg, var(--gold2), var(--gold)); }
.chip b { margin-left: 6px; opacity: .8; }

/* ------------------------------------------------------------ data display */
.tablewrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line2); -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line2); vertical-align: top; }
th { position: sticky; top: 0; background: #14235a; color: var(--gold2); font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
tr:last-child td { border-bottom: 0; } td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; } td.nowrap { white-space: nowrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .9rem; } .kv dt { color: var(--faint); } .kv dd { margin: 0; color: var(--text); }
.meter { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; } .meter > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold3), var(--gold2)); }
.meter.pos > i { background: linear-gradient(90deg, #1f9f6b, var(--yes)); } .meter.neg > i { background: linear-gradient(90deg, #b64444, var(--no)); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 8px; font-size: .74rem; font-weight: 700; background: rgba(255, 255, 255, .08); }
.pos-t { color: var(--yes); } .neg-t { color: var(--no); } .neu-t { color: var(--muted); }
.list-plain { list-style: none; padding: 0; margin: 0; } .list-plain li { padding: 9px 0; border-bottom: 1px solid var(--line2); } .list-plain li:last-child { border-bottom: 0; }
.bul { list-style: none; padding: 0; margin: 0; } .bul li { position: relative; padding: 6px 0 6px 22px; font-size: .92rem; } .bul li::before { content: ""; position: absolute; left: 4px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.bul.pos li::before { background: var(--yes); } .bul.neg li::before { background: var(--no); }
.delta { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 3.2em; display: inline-block; }

/* ------------------------------------------------------------ welcome, auth, verdict */
.hero { text-align: center; padding: 28px 8px 8px; }
.hero .logo { width: 104px; height: 104px; margin: 0 auto 8px; display: block; }
.hero h1 { font-size: 2.2rem; letter-spacing: .26em; margin: 12px 0 2px; color: var(--ivory); padding-left: .26em; }
.hero .sub { font-size: .9rem; letter-spacing: .5em; color: var(--gold); font-weight: 700; padding-left: .5em; }
.hero .lead { color: var(--muted); max-width: 520px; margin: 14px auto 22px; }
.hero .tagline { color: var(--gold2); font-style: italic; margin: 6px auto 0; max-width: 520px; font-size: .95rem; }
.steps { display: grid; gap: 10px; margin: 18px 0; } @media (min-width: 700px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step { padding: 14px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .03); font-size: .88rem; color: var(--muted); } .step b { display: block; color: var(--gold2); margin-bottom: 2px; }
.authbox { max-width: 460px; margin: 0 auto; }
.verdict { text-align: center; padding: 22px 12px; border-radius: 20px; border: 2px solid var(--line); margin-bottom: 14px; }
.verdict .word { font-size: 3.6rem; font-weight: 800; letter-spacing: .12em; line-height: 1; padding-left: .12em; }
.verdict .q { margin-top: 10px; font-size: .95rem; color: var(--muted); }
.verdict.YES { border-color: rgba(62, 207, 142, .6); background: radial-gradient(400px 160px at 50% 0, rgba(62, 207, 142, .22), transparent), var(--yes-bg); } .verdict.YES .word { color: var(--yes); }
.verdict.NO { border-color: rgba(255, 107, 107, .6); background: radial-gradient(400px 160px at 50% 0, rgba(255, 107, 107, .22), transparent), var(--no-bg); } .verdict.NO .word { color: var(--no); }
.verdict.MAYBE { border-color: rgba(242, 184, 75, .6); background: radial-gradient(400px 160px at 50% 0, rgba(242, 184, 75, .22), transparent), var(--maybe-bg); } .verdict.MAYBE .word { color: var(--maybe); }
.sub-verdicts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.stagelist { list-style: none; margin: 0; padding: 0; }
.stagelist li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line2); opacity: .45; transition: opacity .2s; }
.stagelist li.running, .stagelist li.done { opacity: 1; } .stagelist li:last-child { border-bottom: 0; }
.stagelist .dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: var(--muted); }
.stagelist li.running .dot { border-color: var(--gold2); color: var(--gold2); animation: pulse 1s infinite; } .stagelist li.done .dot { background: var(--gold); border-color: var(--gold2); color: #231703; }
.stagelist .nm { font-weight: 700; color: var(--ivory); } .stagelist .sm { font-size: .84rem; color: var(--muted); margin-top: 2px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(214, 168, 74, .2); } }
.qcard { display: block; width: 100%; text-align: left; padding: 14px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .035); color: var(--text); cursor: pointer; margin-bottom: 10px; }
.qcard:hover { border-color: var(--gold); background: rgba(214, 168, 74, .07); } .qcard .n { display: inline-block; min-width: 2.2em; color: var(--gold); font-weight: 800; }
.qcard .meta { font-size: .76rem; color: var(--faint); margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 14px; scrollbar-width: thin; }
.tabs button { flex: none; padding: 9px 14px; border-radius: 10px 10px 0 0; border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: .86rem; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: #231703; background: linear-gradient(180deg, var(--gold2), var(--gold)); }
.chartbox { max-width: 460px; margin: 0 auto; } .chartbox svg { width: 100%; height: auto; display: block; }
.banner { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(214, 168, 74, .08); font-size: .88rem; margin-bottom: 14px; }
.banner.warn { border-color: rgba(242, 184, 75, .5); background: var(--maybe-bg); } .banner.bad { border-color: rgba(255, 107, 107, .5); background: var(--no-bg); } .banner.ok { border-color: rgba(62, 207, 142, .5); background: var(--yes-bg); }
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(2, 6, 20, .72); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; background: #0e1a3f; border: 1px solid var(--gold3); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.toast { position: fixed; z-index: 120; left: 50%; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: 92vw; padding: 11px 18px; border-radius: 12px; background: #1b2c66; border: 1px solid var(--gold); color: var(--ivory); box-shadow: var(--shadow); font-size: .9rem; }
@media (min-width: 900px) { .toast { bottom: 28px; } }
details.fold { border: 1px solid var(--line2); border-radius: 12px; margin-bottom: 10px; background: rgba(255, 255, 255, .025); } details.fold > summary { cursor: pointer; padding: 11px 14px; font-weight: 700; color: var(--ivory); list-style: none; display: flex; align-items: center; gap: 8px; } details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "+"; margin-left: auto; color: var(--gold); font-size: 1.2rem; } details.fold[open] > summary::after { content: "-"; } details.fold > .body { padding: 0 14px 14px; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; white-space: pre-wrap; word-break: break-word; background: rgba(0, 0, 0, .3); border-radius: 10px; padding: 10px; border: 1px solid var(--line2); }
.footer-note { margin: 24px 0 0; font-size: .76rem; color: var(--faint); text-align: center; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold2); animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; } @keyframes spin { to { transform: rotate(360deg); } }
.chart-planet { font: 700 13px system-ui, sans-serif; } .chart-small { font: 600 10px system-ui, sans-serif; }
@media print {
  body { background: #fff; color: #111; } .topbar, .bottomnav, .sidebar, .btn, .tabs, .noprint { display: none !important; }
  .card { background: #fff; color: #111; border: 1px solid #bbb; box-shadow: none; } .main { padding: 0; max-width: none; } h3, h4, th, .gold, .lbl { color: #5a4000 !important; } td, th { border-color: #ccc; } .muted, .faint { color: #444; }
}
