/* O2 Champions — Prototype 3: "Console".
   Same content as Prototype 1, as a dark developer-style website: a top nav,
   a terminal hero, metric panels, log streams and data tables. Flat colours only. */
:root {
  --bg: #0e1014;
  --bg-2: #12151a;
  --surface: #161a20;
  --surface-2: #1d222a;
  --line: #2a303a;
  --line-strong: #3a4250;
  --text: #e6e9ef;
  --muted: #a3acbb;
  --faint: #737d8f;

  --green: #5aca7a;   /* O2 logo green: primary */
  --blue: #45a4f3;    /* O2 logo blue: links / info */
  --coral: #f45b49;   /* O2 logo coral: errors */
  --amber: #e5c07b;   /* warnings */
  --cyan: #56d4dd;
  --violet: #8e97ec;

  --brand: var(--green);
  --brand-2: var(--green);

  --radius: 4px;
  --radius-sm: 3px;
    --top-h: 64px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font: "IBM Plex Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  --display: var(--mono);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--text); text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--mono); font-weight: 700; line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.9rem, 4.2vw, 3rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.85rem); }
h3 { font-size: 0.98rem; }
p { margin: 0 0 1em; }
code, pre { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.accent-text { color: var(--green); }
.mono { font-family: var(--mono); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.eyebrow { display: inline-block; font-family: var(--mono); font-size: 0.78rem; color: var(--faint); margin-bottom: 8px; }
.eyebrow::before { content: "// "; color: var(--green); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[id] { scroll-margin-top: calc(var(--top-h) + 16px); }

/* =========================================================
   Website chrome: banner, sticky header with top nav, footer
   ========================================================= */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }

.proto-banner {
  font-family: var(--mono); font-size: 0.74rem; color: var(--amber); text-align: center;
  padding: 7px 16px; background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.proto-banner::before { content: "WARN "; font-weight: 700; }

.site-header { position: sticky; top: 0; z-index: 50; background: rgba(14, 16, 20, 0.96); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; gap: 28px; height: var(--top-h); position: relative; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; flex-shrink: 0; }
.logo:hover { color: var(--text); text-decoration: none; }
.logo img { height: 22px; width: auto; display: block; filter: invert(1) hue-rotate(180deg) brightness(1.1); }
.logo-divider { width: 1px; height: 18px; background: var(--line-strong); }
.logo-tag { font-family: var(--mono); font-size: 0.85rem; color: var(--green); }
.logo-tag::before { content: "~/"; color: var(--faint); }

.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  font-family: var(--mono); font-size: 0.84rem; color: var(--muted); padding: 8px 12px; border-radius: var(--radius-sm);
  position: relative;
}
.nav-links a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav-links a.active { color: var(--green); }
.nav-links a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -13px; height: 2px; background: var(--green); }
.nav-cta { display: flex; gap: 10px; align-items: center; }
.points-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 0.8rem; color: var(--text); background: var(--surface); white-space: nowrap;
}
.points-chip:hover { text-decoration: none; border-color: var(--green); color: var(--text); }
.points-chip .coin { width: 16px; height: 16px; }
.menu-btn {
  display: none; width: 38px; height: 38px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 1rem; cursor: pointer; flex-shrink: 0;
}

main { display: block; flex: 1 0 auto; width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px 72px; min-width: 0; }
main > .term:first-child { margin-top: 48px; }
@media (max-width: 720px) { main > .term:first-child { margin-top: 24px; } }

.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); padding-top: 48px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
.footer-brand p { color: var(--faint); font-size: 0.88rem; max-width: 380px; margin: 14px 0 0; }
.footer-col { display: grid; gap: 8px; align-content: start; }
.footer-label { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); margin-bottom: 4px; }
.footer-col a, .footer-col button {
  color: var(--muted); font-family: var(--mono); font-size: 0.84rem; background: none; border: 0; cursor: pointer; padding: 0; text-align: left;
}
.footer-col a:hover, .footer-col button:hover { color: var(--green); text-decoration: none; }
.footer-bottom { margin-top: 40px; padding-top: 18px; padding-bottom: 22px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 0.74rem; color: var(--faint); }
.footer-bottom .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; margin-right: 8px; }

@media (max-width: 1060px) {
  .menu-btn { display: inline-grid; place-items: center; }
  .nav { gap: 12px; }
  .nav-cta { margin-left: auto; }
  .nav-links {
    position: absolute; top: var(--top-h); left: 0; right: 0; margin: 0; flex-direction: column; gap: 2px;
    background: var(--bg-2); border-bottom: 1px solid var(--line); padding: 10px 16px 14px; display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a.active { background: var(--surface); }
  .nav-links a.active::after { display: none; }
}
@media (max-width: 720px) {
  .container, main { padding-left: 16px; padding-right: 16px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .nav-cta .btn { display: none; }
  .logo-divider, .logo-tag { display: none; }
}

/* Page heading: a website-style page hero */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 56px 0 28px; margin-bottom: 32px; border-bottom: 1px solid var(--line);
}
.page-head h1 { margin-bottom: 10px; }
.page-head p { color: var(--muted); max-width: 680px; margin: 0; font-size: 1.05rem; }
@media (max-width: 720px) { .page-head { padding-top: 36px; } }

/* =========================================================
   Buttons, badges, inputs
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-family: var(--mono); font-weight: 500; font-size: 0.84rem; cursor: pointer; white-space: nowrap;
  background: var(--surface); color: var(--text); transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; color: var(--text); }
.btn-primary { background: var(--green); border-color: var(--green); color: #07130b; font-weight: 700; }
.btn-primary:hover { background: #73d78f; border-color: #73d78f; color: #07130b; }
.btn-ghost:hover { border-color: var(--green); color: var(--green); }
.btn-sm { padding: 5px 11px; font-size: 0.76rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; }
.link-btn:hover { color: var(--text); text-decoration: underline; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 1px 7px; border: 1px solid var(--line-strong); border-radius: 2px;
  font-family: var(--mono); font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); background: var(--bg-2); white-space: nowrap; line-height: 1.6;
}
.badge-ok { color: var(--green); border-color: rgba(90, 202, 122, 0.45); background: rgba(90, 202, 122, 0.08); }
.badge-warn { color: var(--amber); border-color: rgba(229, 192, 123, 0.45); background: rgba(229, 192, 123, 0.08); }
.badge-err { color: var(--coral); border-color: rgba(244, 91, 73, 0.45); background: rgba(244, 91, 73, 0.08); }
.badge-brand { color: var(--cyan); border-color: rgba(86, 212, 221, 0.45); background: rgba(86, 212, 221, 0.08); }
.badge-info { color: var(--blue); border-color: rgba(69, 164, 243, 0.45); background: rgba(69, 164, 243, 0.08); }

.form { display: grid; gap: 16px; }
.field label, .field .label { display: block; font-family: var(--mono); font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; }
.field label .req { color: var(--coral); }
.field .hint { font-size: 0.8rem; color: var(--faint); margin-top: 6px; }
.input, textarea.input, select.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-family: var(--mono); font-size: 0.86rem;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.input[disabled] { opacity: 0.6; }
.input.invalid { border-color: var(--coral); box-shadow: 0 0 0 1px var(--coral); }
textarea.input { min-height: 84px; resize: vertical; }
select.input { width: auto; cursor: pointer; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 13px; border: 1px solid; border-left-width: 3px; border-radius: var(--radius-sm); font-size: 0.86rem; font-family: var(--mono); }
.alert-err { border-color: var(--coral); background: rgba(244, 91, 73, 0.07); color: #ffb4aa; }
.alert-ok { border-color: var(--green); background: rgba(90, 202, 122, 0.07); color: #b4ecc4; }
.alert-info { border-color: var(--blue); background: rgba(69, 164, 243, 0.07); color: #b8dcfb; }

.robot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 320px; user-select: none;
  padding: 9px 13px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg);
}
.robot-left { display: flex; align-items: center; gap: 12px; cursor: pointer; font-family: var(--mono); font-size: 0.84rem; }
.robot-box { width: 20px; height: 20px; border: 1px solid var(--faint); border-radius: 2px; display: grid; place-items: center; flex-shrink: 0; }
.robot.loading .robot-box { border-color: var(--green); border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.robot.checked .robot-box { background: var(--green); border-color: var(--green); }
.robot.checked .robot-box::after { content: "✓"; color: #07130b; font-weight: 800; font-size: 0.78rem; }
.robot-brand { font-size: 0.6rem; color: var(--faint); text-align: right; line-height: 1.2; font-family: var(--mono); }
@keyframes spin { to { transform: rotate(360deg); } }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--muted); font-family: var(--mono); font-size: 0.76rem; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip.active, .chip[aria-pressed="true"] { color: var(--green); border-color: var(--green); background: rgba(90, 202, 122, 0.07); }

.tabs { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.tab { padding: 7px 14px; border: 0; background: var(--surface); color: var(--muted); font-family: var(--mono); font-size: 0.8rem; cursor: pointer; }
.tab + .tab { border-left: 1px solid var(--line-strong); }
.tab.active { background: var(--green); color: #07130b; font-weight: 700; }

/* =========================================================
   Panels
   ========================================================= */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; min-height: 42px;
}
.panel-title { font-family: var(--mono); font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0; }
.panel-head .spacer { margin-left: auto; }
.panel-body { padding: 16px; }
.panel-body.flush { padding: 0; }
.panel-sub { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }
.query { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); padding: 7px 14px; border-bottom: 1px dashed var(--line); background: var(--bg-2); overflow-x: auto; white-space: nowrap; }
.query .kw { color: var(--violet); } .query .str { color: var(--amber); } .query .num { color: var(--cyan); }
.panel-foot { padding: 8px 14px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }

.stack { display: grid; gap: 16px; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.section { margin-top: 64px; }
.section-head { margin-bottom: 18px !important; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 4px 0 0; }
@media (max-width: 1000px) { .cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .cols-2 { grid-template-columns: 1fr; } }

/* Metric panels */
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; position: relative; }
.metric .m-label { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.metric .m-value { font-family: var(--mono); font-weight: 700; font-size: 2rem; line-height: 1.15; color: var(--text); }
.metric .m-value.ok { color: var(--green); }
.metric .m-sub { font-size: 0.82rem; color: var(--faint); }
.metric .m-sub strong { color: var(--text); }
.metric.accent { border-top: 2px solid var(--green); }
.metric .spark { display: flex; align-items: flex-end; gap: 3px; height: 26px; margin-top: 6px; }
.metric .spark span { flex: 1; background: rgba(90, 202, 122, 0.35); min-height: 2px; }
@media (max-width: 720px) { .metrics { grid-template-columns: 1fr; } }

/* =========================================================
   Terminal window
   ========================================================= */
.term { background: #0a0c0f; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.term-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.term-dots { display: flex; gap: 6px; }
.term-dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.term-dots i:nth-child(1) { background: var(--coral); }
.term-dots i:nth-child(2) { background: var(--amber); }
.term-dots i:nth-child(3) { background: var(--green); }
.term-title { font-family: var(--mono); font-size: 0.74rem; color: var(--faint); margin-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-body { padding: 36px 40px 40px; font-family: var(--mono); }
.prompt { font-size: 0.9rem; color: var(--muted); word-break: break-word; }
.prompt .ps { color: var(--green); font-weight: 700; margin-right: 8px; }
.prompt .host { color: var(--blue); }
.caret { display: inline-block; width: 8px; height: 1.05em; background: var(--green); vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.term-out { margin-top: 18px; padding-left: 16px; border-left: 1px solid var(--line); }
.term-out .comment { color: var(--faint); font-size: 0.8rem; margin-bottom: 10px; }
.term-out h1 { font-size: clamp(2.1rem, 5.4vw, 3.8rem); margin-bottom: 18px; line-height: 1.1; }
.term-out .lead { font-family: var(--font); font-size: 1.04rem; color: var(--muted); max-width: 640px; }
.term-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.term-sample { margin-top: 22px; display: grid; gap: 4px; font-size: 0.78rem; color: var(--muted); }
.term-sample .ln { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 5px 0; border-top: 1px dashed var(--line); }
.term-sample .k { color: var(--violet); min-width: 64px; }
.term-sample .mini-bar { width: 90px; height: 6px; border: 1px solid var(--line); background: var(--bg); display: inline-block; }
.term-sample .mini-bar span { display: block; height: 100%; background: var(--green); }
.term .typed.pending { visibility: hidden; }
@media (max-width: 560px) { .term-body { padding: 16px 14px 20px; } .term-out { padding-left: 10px; } }

/* Command-line style input */
.cmd { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #0a0c0f; overflow: hidden; }
.cmd:focus-within { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.cmd .cmd-ps { display: flex; align-items: center; padding: 0 10px 0 12px; font-family: var(--mono); font-size: 0.82rem; color: var(--green); white-space: nowrap; border-right: 1px solid var(--line); background: var(--bg-2); }
.cmd .cmd-ps em { font-style: normal; color: var(--faint); margin-left: 6px; }
.cmd input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font-family: var(--mono); font-size: 0.88rem; padding: 11px 12px; }
.cmd input:focus { outline: none; }
.cmd .btn { border-radius: 0; border-width: 0 0 0 1px; }
@media (max-width: 560px) {
  .cmd { flex-wrap: wrap; }
  .cmd .cmd-ps { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px 12px; }
  .cmd .cmd-ps em { display: none; }
  .cmd .btn { width: 100%; border-width: 1px 0 0; }
}

/* =========================================================
   Log stream
   ========================================================= */
.live { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 0.7rem; color: var(--green); }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: blink 1.4s steps(1) infinite; }
.logs { font-family: var(--mono); font-size: 0.78rem; max-height: 340px; overflow: auto; background: #0a0c0f; }
.log-line { display: grid; grid-template-columns: 150px 52px minmax(0, 1fr); gap: 12px; padding: 5px 14px; border-bottom: 1px solid rgba(42, 48, 58, 0.6); align-items: baseline; }
.log-line:hover { background: var(--surface); }
.log-line .ts { color: var(--faint); white-space: nowrap; }
.log-line .lvl { font-weight: 700; color: var(--green); }
.log-line .lvl.warn { color: var(--amber); } .log-line .lvl.err { color: var(--coral); }
.log-line .msg { color: var(--muted); overflow-wrap: anywhere; }
.log-line .msg strong { color: var(--text); font-weight: 500; }
.log-line .msg .kv { color: var(--cyan); }
.log-line.tail .msg { color: var(--faint); }
.log-line.enter { animation: logIn .35s ease both; }
@keyframes logIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .log-line { grid-template-columns: 52px minmax(0, 1fr); gap: 4px 10px; }
  .log-line .ts { grid-column: 1 / -1; font-size: 0.7rem; }
}

/* =========================================================
   Tables
   ========================================================= */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.table th {
  text-align: left; color: var(--faint); font-family: var(--mono); font-weight: 500; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 8px 14px; border-bottom: 1px solid var(--line-strong); background: var(--bg-2); white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.table th.num { font-weight: 500; }
.table .mono { font-family: var(--mono); font-size: 0.8rem; }
.table .nowrap { white-space: nowrap; }
.table .cell-sub { font-size: 0.78rem; color: var(--faint); }
.table .clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table tr.hl td { background: rgba(90, 202, 122, 0.06); }
.table tr.hl td:first-child { box-shadow: inset 2px 0 0 var(--green); }
.sort-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.sort-btn:hover { color: var(--text); }
.sort-btn .ind { color: var(--line-strong); }
.sort-btn[aria-sort="ascending"] .ind, .sort-btn[aria-sort="descending"] .ind, th[aria-sort="ascending"] .ind, th[aria-sort="descending"] .ind { color: var(--green); }
.pos { color: var(--green); } .neg { color: var(--coral); }
.thumb { width: 34px; height: 34px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 1.15rem; flex-shrink: 0; border: 1px solid var(--line); }
.name-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.name-cell strong { font-family: var(--mono); font-size: 0.86rem; font-weight: 500; }
.inline-bar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.inline-bar .track { flex: 1; height: 6px; background: var(--bg); border: 1px solid var(--line); }
.inline-bar .track span { display: block; height: 100%; background: var(--green); }
.inline-bar .track span.amber { background: var(--amber); }
.inline-bar small { font-family: var(--mono); font-size: 0.7rem; color: var(--faint); white-space: nowrap; }

.progress { height: 8px; border-radius: 1px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green); transition: width 1s cubic-bezier(.2, .8, .2, 1); }

.avatar {
  width: 32px; height: 32px; border-radius: var(--radius-sm); display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 0.75rem; color: #0b0d10; flex-shrink: 0;
}
.avatar.lg { width: 52px; height: 52px; font-size: 1.05rem; }

.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); color: inherit; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 26px 14px; color: var(--faint); font-family: var(--mono); font-size: 0.84rem; }

/* =========================================================
   Pipeline diagram
   ========================================================= */
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; counter-reset: node; position: relative; }
.node { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; }
.node::before {
  counter-increment: node; content: "stage " counter(node, decimal-leading-zero);
  display: block; font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--green); margin-bottom: 10px;
}
.node + .node::after {
  content: ""; position: absolute; top: 26px; left: -29px; width: 28px; height: 1px; background: var(--green);
}
.node .port { position: absolute; top: 22px; width: 9px; height: 9px; border: 1px solid var(--green); background: var(--bg); border-radius: 50%; }
.node .port.in { left: -5px; } .node .port.out { right: -5px; }
.node:first-child .port.in, .node:last-child .port.out { display: none; }
.node .icon { font-size: 1.4rem; margin-bottom: 6px; }
.node h3 { margin-bottom: 6px; }
.node p { color: var(--muted); font-size: 0.88rem; margin: 0; }
@media (max-width: 900px) {
  .pipeline { grid-template-columns: 1fr; gap: 18px; }
  .node + .node::after { top: -19px; left: 26px; width: 1px; height: 18px; }
  .node .port { top: auto; }
  .node .port.in { left: 22px; top: -5px; } .node .port.out { left: 22px; right: auto; bottom: -5px; }
}

/* =========================================================
   Shop
   ========================================================= */
.query-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.query-bar .q-label { font-family: var(--mono); font-size: 0.74rem; color: var(--violet); }
.query-bar .push { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.view-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.view-toggle button { padding: 6px 10px; border: 0; background: var(--surface); color: var(--muted); font-family: var(--mono); font-size: 0.76rem; cursor: pointer; }
.view-toggle button + button { border-left: 1px solid var(--line-strong); }
.view-toggle button[aria-pressed="true"] { background: var(--surface-2); color: var(--green); }
.balance-strip { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 16px; }
.balance-strip .big { font-family: var(--mono); font-weight: 700; font-size: 1.5rem; color: var(--green); }
.gift-row.target td { background: rgba(90, 202, 122, 0.1); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1px; background: var(--line); }
.tile { background: var(--surface); padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tile.target { box-shadow: inset 0 0 0 1px var(--green); }
.tile-top { display: flex; align-items: center; gap: 10px; }
.tile-top .thumb { width: 44px; height: 44px; font-size: 1.5rem; }
.tile h3 { font-size: 0.84rem; margin: 0; font-weight: 500; }
.tile .price { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--line); }
.pts-val { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-weight: 700; color: var(--green); white-space: nowrap; }
.pts-val .coin { width: 16px; height: 16px; }

/* Slide-over */
.slide-back { position: fixed; inset: 0; background: rgba(5, 6, 8, 0.7); z-index: 100; opacity: 0; pointer-events: none; transition: opacity .2s; }
.slide-back.open { opacity: 1; pointer-events: auto; }
.slide {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); z-index: 101; background: var(--surface);
  border-left: 1px solid var(--line-strong); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s ease;
  visibility: hidden;
}
.slide.open { transform: none; visibility: visible; }
.slide-head { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.slide-head .thumb { width: 48px; height: 48px; font-size: 1.6rem; }
.slide-body { padding: 18px 16px; overflow-y: auto; flex: 1; }
.icon-btn { margin-left: auto; width: 32px; height: 32px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); cursor: pointer; font-family: var(--mono); flex-shrink: 0; }
.icon-btn:hover { color: var(--coral); border-color: var(--coral); }
.kv-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-family: var(--mono); font-size: 0.8rem; margin: 0 0 16px; padding: 12px; border: 1px dashed var(--line); background: var(--bg-2); }
.kv-list dt { color: var(--faint); } .kv-list dd { margin: 0; color: var(--text); text-align: right; }

/* =========================================================
   Leaderboard
   ========================================================= */
.top3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.rank-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; }
.rank-card .rk { font-family: var(--mono); font-weight: 700; font-size: 2.4rem; line-height: 1; grid-row: span 2; }
.rank-card.r1 { border-top: 2px solid var(--amber); } .rank-card.r1 .rk { color: var(--amber); }
.rank-card.r2 { border-top: 2px solid var(--blue); } .rank-card.r2 .rk { color: var(--blue); }
.rank-card.r3 { border-top: 2px solid var(--coral); } .rank-card.r3 .rk { color: var(--coral); }
.rank-card .who { display: flex; gap: 10px; align-items: center; min-width: 0; }
.rank-card .who strong { font-family: var(--mono); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-card .m-value { font-size: 1.6rem; }
.rank-card .meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 4px; font-family: var(--mono); font-size: 0.74rem; color: var(--faint); }
@media (max-width: 820px) { .top3 { grid-template-columns: 1fr; } }
.rank-num { font-family: var(--mono); color: var(--faint); }

/* =========================================================
   Earn
   ========================================================= */
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.sticky { position: sticky; top: calc(var(--top-h) + 16px); }
@media (max-width: 1040px) { .split { grid-template-columns: 1fr; } .sticky { position: static; } }
.seg { display: grid; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg-opt { display: grid; grid-template-columns: 18px 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; background: var(--bg); border-bottom: 1px solid var(--line); }
.seg-opt:last-child { border-bottom: 0; }
.seg-opt:hover { background: var(--surface-2); }
.seg-opt input { margin: 0; accent-color: var(--green); width: 15px; height: 15px; }
.seg-opt .emoji { font-size: 1.2rem; text-align: center; }
.seg-opt strong { font-family: var(--mono); font-size: 0.84rem; font-weight: 500; display: block; }
.seg-opt .desc { font-size: 0.8rem; color: var(--faint); display: block; }
.seg-opt .pts { font-family: var(--mono); font-weight: 700; color: var(--green); white-space: nowrap; font-size: 0.86rem; }
.seg-opt.selected { background: rgba(90, 202, 122, 0.07); box-shadow: inset 2px 0 0 var(--green); }
.seg-opt:focus-within { outline: 2px solid var(--blue); outline-offset: -2px; }
.step-label { font-family: var(--mono); font-size: 0.86rem; margin-bottom: 10px; }
.step-label .n { color: var(--green); margin-right: 6px; }
.json { margin: 0; padding: 14px 16px; background: #0a0c0f; font-size: 0.8rem; line-height: 1.65; overflow-x: auto; white-space: pre; color: var(--muted); }
.json .k { color: var(--blue); } .json .s { color: var(--amber); } .json .n { color: var(--cyan); } .json .p { color: var(--faint); } .json .nul { color: var(--violet); }
.earn-sum { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.earn-sum .m-value { font-family: var(--mono); font-weight: 700; font-size: 2rem; line-height: 1; color: var(--green); }
.rules-list { list-style: none; padding: 0; margin: 0; font-size: 0.86rem; color: var(--muted); }
.rules-list li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding: 7px 14px; border-bottom: 1px solid var(--line); }
.rules-list li:last-child { border-bottom: 0; }
.rules-list li::before { content: attr(data-lvl); font-family: var(--mono); font-size: 0.68rem; font-weight: 700; color: var(--blue); padding-top: 2px; }

.success { text-align: center; padding: 30px 16px; }
.success .big-emoji { font-size: 3.2rem; display: block; margin-bottom: 8px; }

/* =========================================================
   Points dashboard
   ========================================================= */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-12 { grid-column: span 12; }
@media (max-width: 1100px) { .span-3, .span-4 { grid-column: span 6; } .span-5, .span-7 { grid-column: span 12; } }
@media (max-width: 720px) { .dash > * { grid-column: span 12 !important; } }
.who-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; }
.who-bar h2 { margin: 0; }
.gauge { display: flex; gap: 3px; margin-top: 10px; }
.gauge span { flex: 1; height: 22px; background: var(--bg); border: 1px solid var(--line); position: relative; }
.gauge span.on { background: rgba(90, 202, 122, 0.25); border-color: rgba(90, 202, 122, 0.5); }
.gauge span.cur { background: var(--green); border-color: var(--green); }
.levels { display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; font-family: var(--mono); font-size: 0.7rem; color: var(--faint); margin-top: 6px; }
.levels .on { color: var(--green); }
.lookup-panel { max-width: 720px; }

/* =========================================================
   FAQ as log entries + docs
   ========================================================= */
.log-faq { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #0a0c0f; }
details.faq { border-bottom: 1px solid var(--line); }
details.faq:last-child { border-bottom: 0; }
details.faq summary {
  cursor: pointer; list-style: none; display: grid; grid-template-columns: 14px 44px minmax(0, 1fr); gap: 10px; align-items: baseline;
  padding: 10px 14px; font-family: var(--mono); font-size: 0.84rem;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: "▸"; color: var(--green); transition: transform .15s; display: inline-block; }
details.faq[open] summary::before { transform: rotate(90deg); }
details.faq summary:hover { background: var(--surface); }
details.faq .qid { color: var(--blue); font-size: 0.72rem; font-weight: 700; }
details.faq p { color: var(--muted); margin: 0; padding: 0 14px 14px 82px; font-size: 0.9rem; }
@media (max-width: 560px) { details.faq summary { grid-template-columns: 14px minmax(0, 1fr); } details.faq .qid { display: none; } details.faq p { padding-left: 38px; } }

.doc { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.doc-toc { position: sticky; top: calc(var(--top-h) + 16px); font-family: var(--mono); font-size: 0.76rem; }
.doc-toc a { display: block; padding: 4px 0 4px 10px; color: var(--muted); border-left: 1px solid var(--line); }
.doc-toc a:hover { color: var(--green); border-left-color: var(--green); text-decoration: none; }
.doc-body { max-width: 760px; }
.doc-body section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.doc-body section:last-child { border-bottom: 0; }
.doc-body h3 { font-size: 1rem; }
.doc-body h3::before { content: "## "; color: var(--faint); }
.doc-body p { color: var(--muted); margin: 0; font-size: 0.98rem; line-height: 1.7; }
@media (max-width: 820px) { .doc { grid-template-columns: 1fr; } .doc-toc { position: static; display: flex; flex-wrap: wrap; gap: 4px 12px; } }

/* CTA strip */
.cta-strip { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--bg-2); }
.cta-strip h2 { margin: 0 0 4px; }
.cta-strip p { margin: 0; }

/* =========================================================
   Misc
   ========================================================= */
.skeleton { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 24px); opacity: 0; z-index: 200;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--green); border-radius: var(--radius-sm);
  padding: 10px 16px; font-family: var(--mono); font-size: 0.8rem; transition: all .25s; max-width: calc(100% - 32px);
}
.toast::before { content: "[INFO] "; color: var(--green); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; top: -10px; width: 8px; height: 8px; z-index: 300; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); } }
.reveal { opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Fixed-layout tables inside narrow dashboard panels */
.table.fixed { table-layout: fixed; }
.table.fixed th.num, .table.fixed td.num { width: 118px; }
.table.fixed .clip, .table.fixed .cell-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table.fixed .name-cell > div { min-width: 0; overflow: hidden; }
.name-cell .badge { margin-left: 6px; }
