/* PlayToken — midnight console with two light sources:
   amber = time you've bought (the "sun" hours), moon-blue = the live connection. */
:root {
  --night: #0e1226;
  --night-2: #151a35;
  --night-3: #1d2344;
  --line: #2b3260;
  --text: #e9ebf8;
  --muted: #9097c2;
  --sun: #ffb340;
  --sun-deep: #f0782a;
  --moon: #a9c1ff;
  --good: #6ee7b7;
  --bad: #ff8a8a;
  --display: Bahnschrift, "DIN Alternate", "Avenir Next Condensed", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(169, 193, 255, 0.12), transparent 60%),
    radial-gradient(900px 400px at 0% 110%, rgba(255, 179, 64, 0.08), transparent 60%),
    var(--night);
  color: var(--text);
  font: 16px/1.55 var(--body);
}
a { color: var(--moon); }
:focus-visible { outline: 2px solid var(--moon); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 600 22px/1 var(--display); letter-spacing: 0.01em; }
.brand-mark { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(90deg, var(--moon) 50%, var(--sun) 50%); }
.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.who { color: var(--muted); font-size: 14px; }

/* ---------- controls ---------- */
.btn {
  appearance: none; cursor: pointer; border: 1px solid var(--line); background: var(--night-3); color: var(--text);
  font: 600 15px/1 var(--body); padding: 12px 18px; border-radius: 6px;
}
.btn:hover:not(:disabled) { border-color: var(--moon); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sun { background: linear-gradient(180deg, var(--sun), var(--sun-deep)); border-color: transparent; color: #1c1206; }
.btn-sun:hover:not(:disabled) { border-color: transparent; filter: brightness(1.08); }
.btn-quiet { background: transparent; }
.btn-danger { border-color: #7a3a46; color: var(--bad); background: transparent; }
.btn-small { padding: 8px 12px; font-size: 14px; }
.btn-wide { width: 100%; }

label { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
  width: 100%; padding: 12px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--night); color: var(--text); font: 16px var(--body);
}
input:focus-visible { outline: 2px solid var(--moon); outline-offset: 0; border-color: var(--moon); }
.field-hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.msg { min-height: 22px; margin: 12px 0 0; font-size: 14px; }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--good); }

/* ---------- the hour gauge: one segment per token, drains in real time ---------- */
.gauge { display: flex; gap: 4px; align-items: stretch; height: 14px; }
.seg { flex: 1 1 0; min-width: 6px; max-width: 44px; border-radius: 3px; background: var(--night-3); overflow: hidden; position: relative; }
.seg > i { position: absolute; inset: 0 auto 0 0; width: calc(var(--fill, 0) * 100%); background: linear-gradient(90deg, var(--sun), var(--sun-deep)); }
.gauge-extra { align-self: center; margin-left: 6px; font: 600 13px var(--display); color: var(--sun); white-space: nowrap; }
.gauge.low .seg > i { background: var(--bad); }
.gauge-big { height: 22px; }
.gwrap { margin: 16px 0 6px; }
.balance { display: flex; align-items: center; gap: 10px; }
#top-gauge { width: clamp(80px, 14vw, 160px); }
#top-gauge .gauge { height: 10px; }

/* ---------- layout ---------- */
.shell { max-width: 1120px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 64px; }
.layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }
.panel { border: 1px solid var(--line); border-radius: 10px; background: var(--night-2); padding: 24px; }
.panel + .panel { margin-top: 20px; }
.panel h2 { margin: 0 0 14px; font: 600 20px/1.2 var(--display); }
.panel h3 { margin: 22px 0 8px; font: 600 16px/1.3 var(--display); }
.muted { color: var(--muted); }

/* ---------- console (session) ---------- */
.state-line { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.live { background: var(--good); box-shadow: 0 0 0 4px rgba(110, 231, 183, 0.18); }
.dot.wait { background: var(--sun); animation: pulse 1.4s ease-in-out infinite; }
.dot.off { background: var(--bad); }
.dot.free { background: var(--moon); }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .dot.wait { animation: none; } }
.state-text { font: 600 18px var(--display); }
.timer { font: 600 clamp(48px, 9vw, 76px)/1 var(--display); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; margin: 14px 0 4px; }
.timer.low { color: var(--bad); }
.console-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.notice { border-left: 3px solid var(--sun); padding: 10px 14px; background: rgba(255, 179, 64, 0.08); border-radius: 0 6px 6px 0; margin: 16px 0 0; font-size: 15px; }
.notice.bad { border-color: var(--bad); background: rgba(255, 138, 138, 0.08); }

/* ---------- connect steps ---------- */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 20px 44px; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font: 600 15px var(--display); color: var(--moon); border: 1px solid var(--moon);
}
.steps > li:last-child { padding-bottom: 0; }
.steps strong { display: block; margin-bottom: 2px; }
.copyrow { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
code, .code { font: 15px var(--mono); background: var(--night); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.pairrow { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.pairrow input { width: 120px; font: 600 22px var(--mono); letter-spacing: 0.3em; text-align: center; }

/* ---------- buy + history ---------- */
.packs { display: grid; gap: 10px; }
.pack {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left;
  padding: 14px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); color: var(--text); cursor: pointer; font: 16px var(--body);
}
.pack:hover:not(:disabled) { border-color: var(--sun); }
.pack:disabled { opacity: 0.5; cursor: not-allowed; }
.pack b { font: 600 20px var(--display); }
.pack span { color: var(--muted); }
.pack .price { color: var(--sun); font: 600 18px var(--display); }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.history li:first-child { border-top: 0; }
.history .plus { color: var(--good); font-variant-numeric: tabular-nums; white-space: nowrap; }
.history .minus { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.history time { color: var(--muted); display: block; font-size: 12px; }

/* ---------- landing ---------- */
.landing { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(28px, 6vw, 72px); align-items: center; min-height: calc(100vh - 70px); }
@media (max-width: 860px) { .landing { grid-template-columns: 1fr; min-height: 0; padding-top: 12px; } }
.landing h1 { font: 700 clamp(44px, 7vw, 84px)/0.98 var(--display); letter-spacing: -0.01em; margin: 0 0 18px; }
.lede { font-size: 19px; color: #c4c9ea; max-width: 34em; margin: 0 0 28px; }
.explain { margin-top: 34px; display: grid; gap: 14px; max-width: 34em; }
.explain p { margin: 0; color: var(--muted); }
.explain strong { color: var(--text); }
.authcard { border: 1px solid var(--line); border-radius: 12px; background: var(--night-2); padding: 26px; }
.tabs { display: flex; gap: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.tab { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer; font: 600 16px var(--display); padding: 10px 14px; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--sun); }

/* ---------- admin tables ---------- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; border-top: 0; }
td.num { font-variant-numeric: tabular-nums; }
.grant { display: flex; gap: 6px; }
.grant input { width: 84px; padding: 8px 10px; font-size: 14px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--night-3); border: 1px solid var(--moon);
  padding: 12px 18px; border-radius: 8px; font-size: 15px; max-width: calc(100vw - 32px); z-index: 10;
}
