:root {
  --bg: #07090d;
  --panel: rgba(13, 17, 21, 0.82);
  --line: rgba(255, 222, 165, 0.15);
  --text: #fffaf0;
  --muted: #b9b4ae;
  --amber: #ffd27c;
  --lantern: #ee9a52;
  --ice: #99e7ff;
  --danger: #ff8a6a;
  --ok: #9dffc2;
  --font-pico: "Press Start 2P", ui-monospace, monospace;
  --font-body: Arial, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--text);
  background: radial-gradient(ellipse at 50% -6%, rgba(255, 184, 91, .19), transparent 37%), radial-gradient(ellipse at 83% 18%, rgba(81, 171, 206, .13), transparent 33%), linear-gradient(180deg, #15120e 0%, #080b0f 48%, #06080b 100%);
  overflow-x: hidden;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.sky {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: url("assets/pico-hero-flagless.jpg") center 30% / cover no-repeat;
  opacity: .34; filter: saturate(.65) brightness(.5) contrast(1.07);
}
.sky::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,9,11,.32), rgba(7,9,12,.72) 52%, #06080b 91%);
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 64px; padding: 10px clamp(16px, 3vw, 42px);
  background: rgba(7, 10, 13, .76);
  border-bottom: 1px solid rgba(255, 219, 163, .11);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 0 0 1px rgba(255,210,119,.25), 0 8px 18px rgba(0,0,0,.28); }
.brand strong { font-family: var(--font-pico); font-size: 11px; letter-spacing: .08em; }
.top-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.lang { background: rgba(13,18,22,.88); color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
.wallet-chip, .primary, .ghost, .max-btn, .flip {
  font-family: var(--font-pico);
  letter-spacing: .02em;
  cursor: pointer;
}
.wallet-chip {
  font-size: 9px; line-height: 1.4;
  padding: 11px 14px; border-radius: 10px;
  color: #fffaf0; background: linear-gradient(180deg,rgba(37,48,56,.96),rgba(17,23,29,.96));
  border: 1px solid rgba(132, 205, 229, .56); box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.wallet-chip:hover { border-color: var(--ice); }
.page { max-width: 620px; margin: 0 auto; padding: clamp(26px, 4vw, 48px) 18px 96px; }
.masthead { text-align: center; margin: 0 auto 24px; }
.kicker { display: flex; justify-content: center; align-items: center; gap: 9px; color: #dec9a4; letter-spacing: .22em; font-size: 11px; text-transform: uppercase; }
.peak-mark { color: var(--amber); font-size: 10px; text-shadow: 0 0 12px rgba(255,196,101,.7); }
h1 {
  margin: 9px 0 7px;
  font-family: var(--font-pico);
  font-size: clamp(16px, 4.4vw, 22px);
  line-height: 1.7;
  color: var(--amber);
  text-shadow: 0 2px 0 rgba(64,35,12,.65), 0 0 30px rgba(255,160,67,.24);
}
.sub { font-family: var(--font-pico); font-size: 9px; color: #efe3d4; line-height: 1.8; margin: 0; opacity: .9; }
.post-layout { display: grid; grid-template-columns: 1fr; gap: 18px; }
.rail-left { display: none; }
.rail-right {
  background: linear-gradient(135deg, rgba(21,30,34,.78), rgba(12,15,20,.7));
  border: 1px solid rgba(148, 214, 231, .18);
  border-radius: 14px;
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 16px 35px rgba(0,0,0,.15);
}
.rail-kicker {
  margin: 0 0 12px; color: #b8eaff; letter-spacing: .19em;
  font-size: 10px;
  text-transform: uppercase;
}
.rail-title {
  margin: 0 0 10px;
  font-family: var(--font-pico);
  font-size: 11px;
  line-height: 1.7;
  color: var(--amber);
}
.rail-copy { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.rail-copy.quiet { margin-top: 12px; margin-bottom: 0; font-size: 12px; }
.rail-facts { margin: 0; display: grid; gap: 8px; }
.rail-facts div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.rail-facts dt { color: var(--muted); }
.rail-facts dd { margin: 0; color: #fff8ef; font-variant-numeric: tabular-nums; }
.panel {
  position: relative; overflow: hidden;
  background: linear-gradient(145deg, rgba(45,32,19,.9), rgba(16,18,21,.96) 32%, rgba(9,13,17,.97));
  border: 1px solid rgba(255,207,119,.36); border-radius: 18px; padding: 20px;
  box-shadow: 0 28px 75px rgba(0,0,0,.46), 0 0 0 5px rgba(5,7,10,.22), inset 0 1px 0 rgba(255,240,205,.13);
}
.panel::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(120deg, rgba(255,209,123,.09), transparent 25%, transparent 78%, rgba(116,219,255,.06)); }
.terminal-cap { position: relative; z-index: 1; display: flex; gap: 5px; margin: -2px 0 18px; }
.terminal-cap span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,213,137,.5); box-shadow: 0 0 8px rgba(255,195,93,.23); }
.terminal-cap span:nth-child(2) { background: rgba(152,226,255,.45); }
.terminal-cap span:nth-child(3) { background: rgba(255,255,255,.22); }
.panel > :not(.terminal-cap) { position: relative; z-index: 1; }
.panel > .flip-wrap { z-index: 10; }
.leg { background: linear-gradient(180deg, rgba(6,10,14,.74), rgba(11,13,16,.86)); border: 1px solid rgba(255,225,171,.14); border-radius: 12px; padding: 16px; box-shadow: inset 0 1px 0 rgba(255,255,255,.035); }
.leg-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; letter-spacing: .12em; }
.row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.row input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: none;
  color: #fff; font-size: clamp(18px, 5vw, 28px); font-variant-numeric: tabular-nums;
}
.meta b.route { font-weight: 500; font-size: 12px; line-height: 1.45; text-align: right; max-width: 62%; }
.impact-warn { color: var(--danger) !important; }
.leg-top span:last-child { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-align: right; max-width: 60%; }
.token {
  display: flex; align-items: center; gap: 8px;
  background: #16131c; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 12px; font-weight: 700;
}
.token img { width: 22px; height: 22px; border-radius: 50%; }
.max-btn {
  font-size: 8px; padding: 7px 8px; border-radius: 8px;
  background: #231c16; color: var(--amber); border: 1px solid rgba(255,197,106,.35);
}
.flip-wrap {
  display: flex; justify-content: center; margin: -11px 0;
  position: relative; z-index: 8; pointer-events: none;
}
.flip {
  position: relative; z-index: 9; pointer-events: auto;
  width: 50px; height: 50px; border-radius: 15px;
  border: 1px solid rgba(255,205,112,.68);
  background: linear-gradient(145deg,#3a2a18,#17191a); color: var(--amber); font-size: 18px;
  box-shadow: 0 0 0 7px rgba(9,13,17,.98), 0 10px 24px rgba(0,0,0,.58), inset 0 1px 0 rgba(255,235,190,.14);
  transition: transform .18s ease, border-color .18s ease, color .18s ease, background .18s ease, box-shadow .18s ease;
}
.flip:hover,
.flip:focus-visible {
  transform: translateY(-2px) scale(1.06);
  color: #fff6dc;
  border-color: #ffd67e;
  background: linear-gradient(145deg,#62401b,#282016);
  box-shadow: 0 0 0 7px rgba(9,13,17,.98), 0 0 0 9px rgba(255,201,99,.2), 0 13px 30px rgba(0,0,0,.68), 0 0 24px rgba(255,184,72,.34), inset 0 1px 0 rgba(255,246,216,.25);
}
.flip:focus-visible { outline: 2px solid #fff2ce; outline-offset: 10px; }
.flip:active { transform: translateY(0) scale(.98); }
}
.meta { margin-top: 0; display: grid; gap: 0; font-size: 13px; color: #d3d5d1; }
.meta div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(173,225,237,.1); }
.meta div:first-child { border-top: 0; padding-top: 0; }
.meta b { font-variant-numeric: tabular-nums; color: #fff; font-weight: 600; }
.warn { margin-top: 10px; color: var(--danger); font-size: 13px; min-height: 1.2em; }
.primary { width: 100%; margin-top: 18px; min-height: 58px;
  font-size: 10px; line-height: 1.5; padding: 14px 12px;
  border-radius: 12px; border: 1px solid #ffe3aa; background: linear-gradient(180deg, #ffe0a1, #e89a48); color: #2a1608;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 9px 22px rgba(171,90,31,.22);
}
.primary:disabled { opacity: .55; cursor: not-allowed; filter: grayscale(.15); }
.primary[data-tone="ice"] { background: linear-gradient(180deg,#c6f4ff,#5ab4d8); border-color:#d7f7ff; color:#062028; }
.primary[data-tone="ok"] { background: linear-gradient(180deg,#c8ffd8,#67c58a); border-color:#dcffe6; color:#062012; }
.ghost {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; font-size: 8px; padding: 10px 13px; border-radius: 10px;
  color: #efe3d4; text-decoration: none; border: 1px solid var(--line); background: rgba(14,18,21,.74);
}
.notes { margin-top: 16px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.notes.below { margin-top: 20px; }
.notes a { color: var(--ice); }
.foot { margin-top: 28px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.bottom-nav { padding: 10px; border: 1px solid rgba(255,221,158,.12); border-radius: 14px; background: rgba(8,12,15,.66); backdrop-filter: blur(12px); }
.bottom-nav .ghost { flex: 1; min-width: 145px; }
.bottom-nav .blaze-link { color: #bcefff; border-color: rgba(138,221,246,.25); }
.complete { margin-top: 14px; padding: 14px; border-radius: 12px; border: 1px solid rgba(157,255,194,.3); background: rgba(20,40,28,.45); }
.complete a { color: var(--ice); }
.settings { margin-top: 10px; }
.settings summary { cursor: pointer; color: #d7c3a8; }
.settings label { display: block; margin: 8px 0 4px; font-size: 12px; color: var(--muted); }
.settings input, .settings select {
  width: 100%; background: #120f14; color: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px;
}
dialog.review {
  color: #fff; background: #0c1422; border: 1px solid #66d4ff; border-radius: 14px;
  padding: 24px; max-width: min(560px, calc(100vw - 32px));
  font: 400 1rem/1.65 system-ui, sans-serif;
}
dialog.review::backdrop { background: #000b; }
dialog.review .actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
dialog.review button { font: inherit; padding: 10px 14px; border-radius: 8px; cursor: pointer; }
dialog.review .go { background: #a6e7fa; border: 0; color: #07141c; }
dialog.review .no { background: transparent; color: #fff; border: 1px solid #42617d; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (min-width: 1080px) {
  .page {
    max-width: 1210px; padding: 40px 28px 86px;
  }
  .masthead { margin-bottom: 10px; }
  .post-layout {
    grid-template-columns: minmax(218px, 246px) minmax(460px, 536px) minmax(238px, 286px);
    justify-content: center;
    align-items: start;
    gap: 28px;
  }
  .rail-left {
    display: block;
    padding: 20px 18px; border: 1px solid rgba(255,197,106,.17); border-radius: 14px;
    background: linear-gradient(145deg, rgba(45,31,16,.54), rgba(9,14,17,.6)); box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
  }
  .rail-right {
    padding: 20px 18px;
  }
  .panel { padding: 22px; }
  .notes.below { display: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 8px 12px; }
  .page { padding: 22px 14px 28px; max-width: 100%; width: 100%; overflow-x: hidden; }
  .post-layout, .panel, .rail-right, .leg, .row { max-width: 100%; min-width: 0; }
  .row input { font-size: 22px; min-width: 0; }
  .primary { font-size: 9px; }
  .token { padding: 8px 10px; }
  .panel { border-radius: 16px; padding: 15px; }
  .terminal-cap { margin-bottom: 14px; }
  .leg { padding: 14px; }
  .masthead { margin-bottom: 18px; }
  .bottom-nav { position: sticky; bottom: 10px; z-index: 8; margin: 22px -2px 0; }
  .bottom-nav .ghost { min-width: 0; }
}
