/* TOPFISH's own pieces: the tank, the crown timer, the burn jar, the hi-score board, steel-framed panels and pixel
   buttons. Reads tokens.css. Every panel is a steel frame with its corners notched one step, like a pixel UI. */

body { background: var(--bg); }
/* no ligatures anywhere: the pixel face's "fi" reads as an A. Important, because every font shorthand resets it. */
*, *::before, *::after { font-variant-ligatures: none !important; }
h1, h2, .display { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: 1; }
h3, .h3 { font-family: var(--font-text); font-weight: 700; }
.accent { color: var(--accent); }
.lede { color: var(--ink-2); }
.label { color: var(--muted); }
.kicker { color: var(--ink-2); }
.kicker-dot { width: 8px; height: 8px; border-radius: 0; background: var(--accent); box-shadow: 2px 2px 0 var(--edge); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
svg[shape-rendering="crispEdges"] { image-rendering: pixelated; }

/* ---------- frames: the one panel style ---------- */
.card, .ca-card, .coin-stats .stat, .faq details, .wallet-row, .menu, .modal-panel, .step, .rule, .guide-item, .level,
.board-wrap, .banner, .enter-preview, .crown-timer, .holder, .specimen, .closing, .note {
  border: var(--border);
  border-radius: 0;
  background: var(--surface);
  clip-path: var(--notch);
  box-shadow: inset 3px 3px 0 rgba(255, 255, 255, 0.05), inset -3px -3px 0 rgba(0, 0, 0, 0.22);
}
.card { padding: 22px; }

/* ---------- header, nav, buttons ---------- */
#top { background: color-mix(in srgb, var(--bg) 92%, transparent); border-bottom: 3px solid var(--frame); }
.brand { gap: 12px; }
.brand-mark { width: 36px; height: 36px; border: 0; border-radius: 0; image-rendering: pixelated; }
.brand-word { height: 20px; width: auto; image-rendering: pixelated; }
.foot-brand img { height: 22px; width: auto; image-rendering: pixelated; }
.nav a { white-space: nowrap; border-radius: 0; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); background: var(--surface-2); clip-path: var(--notch); }
.demo-strip { background: var(--surface-2); color: var(--ink-2); border-bottom: 3px solid var(--frame); }
.demo-strip b { color: var(--warn); }

.btn {
  height: 44px; padding: 0 18px; border-radius: 0; border: 3px solid var(--frame-2); background: var(--surface-2); color: var(--ink);
  font-weight: 700; clip-path: var(--notch);
  box-shadow: inset 3px 3px 0 rgba(255, 255, 255, 0.12), inset -3px -4px 0 rgba(0, 0, 0, 0.3);
  transition: transform var(--t-fast) steps(2, end), background var(--t-fast) steps(2, end);
}
.btn:hover { background: #22406a; border-color: var(--frame-2); }
.btn:active { transform: translateY(2px); box-shadow: inset 3px 3px 0 rgba(0, 0, 0, 0.25); }
.btn:focus-visible { outline: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--edge); box-shadow: inset 3px 3px 0 rgba(255, 255, 255, 0.45), inset -3px -4px 0 var(--accent-2); }
.btn.primary:hover { background: #ffd666; filter: none; }
.btn.primary:focus-visible { border-color: var(--ink); }
.btn.sm { height: 34px; padding: 0 12px; }
.btn.lg { height: 52px; padding: 0 24px; }
.icon-btn { border-radius: 0; }
.icon-btn:hover { background: var(--surface-2); }
.link-arrow { color: var(--ink-2); font-family: var(--font-mono); font-size: 14px; }
.link-arrow:hover { color: var(--accent); }

.chip { border: 2px solid var(--frame-2); border-radius: 0; background: var(--surface-2); color: var(--ink-2); clip-path: polygon(2px 0, calc(100% - 2px) 0, calc(100% - 2px) 2px, 100% 2px, 100% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 100%, 2px 100%, 2px calc(100% - 2px), 0 calc(100% - 2px), 0 2px, 2px 2px); }
.chip.demo { color: var(--warn); border-color: currentColor; background: #2a2416; }
.chip.done { color: var(--good); border-color: currentColor; background: #12301f; }
.seg, .chips button, .seg button { border-radius: 0; }

.input, .prefix { border: 3px solid var(--frame); border-radius: 0; background: var(--bg-2); }
.input:focus, .prefix:focus-within { border-color: var(--accent); }
.drop { border: 3px dashed var(--frame); border-radius: 0; background: var(--bg-2); }
.ca { border: 2px dashed var(--frame-2); border-radius: 0; background: var(--surface); }
.ca-soon { color: var(--accent); font-weight: 500; }
.modal-veil { background: rgba(3, 8, 15, 0.7); }
.toast { border-radius: 0; background: var(--ink); color: var(--bg); clip-path: var(--notch); box-shadow: none; }
#foot { border-top: 3px solid var(--frame); background: var(--bg-2); }
.foot-base { border-top: 2px solid var(--line-2); }
.tabbar { border: 3px solid var(--frame) !important; border-radius: 0 !important; background: var(--surface) !important; clip-path: var(--notch); }
.tabbar a { border-radius: 0 !important; }
.tabbar a[aria-current] { background: var(--accent) !important; color: var(--on-accent) !important; }
.h3.sub { margin-bottom: 14px; }

/* ---------- home: the hero and the crown timer ---------- */
.aquarium { padding-top: clamp(28px, 4vw, 52px); }
.hero-row { display: grid; grid-template-columns: 1fr auto; gap: 36px; align-items: start; }
.hero-copy h1 { font-size: clamp(46px, 7vw, 96px); line-height: 0.95; text-shadow: 4px 4px 0 var(--edge); }
.hero-copy .lede { margin-top: 20px; max-width: 34em; }
.hero-copy .ctas { margin-top: 26px; }

.crown-timer { display: grid; justify-items: center; gap: 12px; padding: 20px 22px 18px; min-width: 300px; margin-top: 8px; }
.timer-head { display: inline-flex; align-items: center; gap: 10px; }
.timer-crown svg { width: 33px; height: auto; }
.timer-digits svg { height: 64px; width: auto; }
.timer-bar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; width: 100%; height: 14px; padding: 2px; background: var(--edge); }
.timer-bar i { background: var(--surface-2); }
.timer-bar i.on { background: var(--accent); }
.timer-round { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }

/* the contract-address card, under the buttons */
.ca-card { display: grid; gap: 8px; margin-top: 24px; padding: 14px 16px; max-width: 560px; }
.ca-card-addr { font-size: 15px; font-weight: 500; text-align: left; word-break: break-all; border: 0; padding: 8px 10px; border-radius: 0; background: var(--bg-2); color: var(--ink); cursor: copy; user-select: all; }
.ca-card.soon .ca-card-addr { color: var(--accent); cursor: default; background: none; padding: 0; font: 700 22px/1 var(--font-display); }
.ca-card-note { font-size: 13px; color: var(--ink-2); }
.ca-card-actions { gap: 8px; }

/* ---------- the tank ---------- */
.tank-frame { position: relative; margin-top: 30px; }
.tank-lid, .tank-base { position: relative; z-index: 3; display: flex; align-items: center; gap: 14px; background: var(--frame); border: 3px solid var(--edge); }
.tank-lid { height: 40px; padding: 0 14px; clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%, 0 8px); box-shadow: inset 0 3px 0 var(--frame-2); }
.tank-lid .mono { font-size: 12px; color: var(--ink-2); letter-spacing: 0.06em; text-transform: uppercase; }
.tank-lid .chip { margin-left: auto; height: 24px; }
.lid-plate { display: inline-grid; place-items: center; height: 24px; padding: 0 10px; background: var(--edge); }
.lid-plate img { height: 14px; width: auto; image-rendering: pixelated; }
.tank-base { min-height: 64px; padding: 10px 14px; justify-content: flex-start; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px)); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.3); }
.tank { position: relative; height: clamp(420px, 48vw, 600px); overflow: hidden; container-type: size; background: var(--water-2); border-left: 6px solid var(--frame); border-right: 6px solid var(--frame); outline: 3px solid var(--edge); outline-offset: 0; }
.tank::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; background: linear-gradient(100deg, rgba(255, 255, 255, 0.06) 0 6%, transparent 6% 9%, rgba(255, 255, 255, 0.04) 9% 11%, transparent 11%); }
.tank-bg { position: absolute; inset: 0; }
.tank-scene { display: block; }
.tank-school { position: absolute; inset: 0; z-index: 2; container-type: size; }
.tank-empty { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; color: var(--ink); font: 700 22px/1.3 var(--font-display); text-align: center; padding: 20px 16%; text-shadow: 3px 3px 0 var(--edge); }
.tank-empty[hidden] { display: none; }

/* the air stone's bubbles */
.tank-bubbles { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.tank-bubbles span { position: absolute; width: 4px; height: 4px; background: rgba(214, 242, 255, 0.75); box-shadow: 4px 0 0 rgba(214, 242, 255, 0.25); opacity: 0; animation: rise calc(3.4s + var(--i) * 0.45s) linear calc(var(--i) * -0.9s) infinite; }
.tank-bubbles span:nth-child(3n) { width: 8px; height: 8px; background: transparent; box-shadow: inset 0 0 0 2px rgba(214, 242, 255, 0.6); }
@keyframes rise { 0% { opacity: 0; transform: translate(0, 0); } 8% { opacity: 1; } 50% { transform: translate(4px, calc(var(--rise) / 2)); } 92% { opacity: 1; } 100% { opacity: 0; transform: translate(0, var(--rise)); } }

.swimmer { position: absolute; display: grid; justify-items: center; gap: 6px; width: calc(var(--px, 4px) * 24); transition: width 1.2s var(--ease-soft), top 1s var(--ease-soft), left 1s var(--ease-soft); animation: swim var(--swim, 28s) ease-in-out var(--delay, 0s) infinite; }
.flip { display: block; width: 100%; animation: flip var(--swim, 28s) linear var(--delay, 0s) infinite; }
.bob { position: relative; display: block; animation: bob var(--bob, 4s) steps(2, end) infinite; }
.swimmer-art { display: block; }
.swimmer-art svg { width: 100%; height: auto; filter: drop-shadow(0 calc(var(--px, 4px) * 2) 0 rgba(5, 12, 22, 0.28)); }
.swimmer-crown { display: none; position: absolute; left: calc(var(--px, 4px) * 11); top: calc(var(--px, 4px) * -7); width: calc(var(--px, 4px) * 11); }
.swimmer-crown svg { width: 100%; height: auto; }
.swimmer.champ .swimmer-crown { display: block; animation: glint 2.4s steps(1, end) infinite; }
.swimmer-tag { font: 500 11.5px/1 var(--font-mono); padding: 5px 7px; background: var(--edge); color: var(--ink); white-space: nowrap; }
.swimmer.champ .swimmer-tag { background: var(--accent); color: var(--on-accent); }
.swimmer:hover .swimmer-tag, .swimmer:focus-visible .swimmer-tag { box-shadow: 0 0 0 2px var(--ink); }
/* the swimmer and its tag travel together; only the art turns round at each end */
@keyframes swim { 0%, 100% { transform: translateX(0); } 48%, 52% { transform: translateX(var(--d)); } }
@keyframes flip { 0%, 49.9% { transform: scaleX(1); } 50%, 99.9% { transform: scaleX(-1); } }
@keyframes bob { 50% { transform: translateY(calc(var(--px, 4px) * -1)); } }
@keyframes glint { 0%, 90% { filter: none; } 92% { filter: brightness(1.5); } }

/* a burn landed: a burst of bubbles from the middle */
.burst { position: absolute; left: 50%; top: 62%; z-index: 4; pointer-events: none; }
.burst span { position: absolute; width: 8px; height: 8px; box-shadow: inset 0 0 0 2px #e6f7ff; opacity: 0; animation: burst 2.4s linear calc(var(--i) * 0.08s) 1 both; }
@keyframes burst { 0% { opacity: 1; transform: translate(0, 0); } 100% { opacity: 0; transform: translate(calc(var(--x) * 14px), -260px); } }

/* the crown holder, on the tank's base */
.holder { display: inline-flex; align-items: center; gap: 12px; padding: 6px 14px 6px 8px; background: var(--edge); border-color: var(--edge); box-shadow: none; font-size: 14.5px; line-height: 1.35; }
a.holder:hover { background: #0c1a2c; }
.holder b { color: var(--accent); }
.holder-crown svg { width: 33px; height: auto; }
.holder-crown.empty { opacity: 0.35; filter: grayscale(1); }

/* ---------- steps: four levels ---------- */
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 24px; }
.level, .steps .step { display: grid; gap: 10px; align-content: start; padding: 20px; }
.level-top { display: flex; align-items: center; justify-content: space-between; }
.level-icon svg { width: 48px; height: auto; }
.level-n, .step-n { font-size: 12px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.level p, .steps .step p { color: var(--ink-2); }

/* ---------- the burn jar and the coin ---------- */
.jar-card { display: grid; grid-template-columns: 108px 1fr; gap: 22px; align-items: center; }
.jar svg { width: 100%; height: auto; display: block; }
.jar-copy { display: grid; gap: 8px; align-content: start; }
.jar-copy p { color: var(--ink-2); }
.split { display: flex; height: 34px; border-radius: 0; overflow: hidden; border: 3px solid var(--edge); margin-top: 4px; }
.split span { display: grid; place-items: center; background: var(--surface-2); font: 12px var(--font-mono); color: var(--ink-2); }
.split span + span { border-left: 3px solid var(--edge); }
.split .champ-side { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--ink); }
.coin-stats .stat { padding: 16px; }

/* ---------- the board: hi-scores ---------- */
.board-wrap { overflow-x: auto; padding: 0; }
.board { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 720px; }
.board th { text-align: left; font: 500 11px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); background: var(--frame); padding: 13px 16px; }
.board td { padding: 9px 16px; border-bottom: 2px solid var(--line); vertical-align: middle; }
.board tr:last-child td { border-bottom: 0; }
.board .n { text-align: right; }
.board .rank { width: 70px; font: 700 20px/1 var(--font-display); white-space: nowrap; }
.rank-crown { display: inline-block; vertical-align: -2px; margin-right: 6px; }
.rank-crown svg { width: 22px; height: auto; }
.board tr.champ td { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.board tr.champ .rank { color: var(--accent); }
.board tbody tr:hover td { background: var(--surface-2); }
.who { display: inline-flex; align-items: center; gap: 12px; }
.who-id { display: grid; line-height: 1.25; }
.who-id .muted { font-size: 13px; }
.board-note { margin-top: 14px; max-width: 70ch; }
.creature { display: inline-block; flex: none; }
.creature svg { width: 100%; height: 100%; }
.down { color: var(--bad); }

/* ---------- the burn log ---------- */
.burns { display: grid; border-top: 3px solid var(--frame); }
.burn-row { display: grid; grid-template-columns: 22px 1fr auto 110px 70px; gap: 14px; align-items: center; padding: 13px 0; border-bottom: 2px solid var(--line); font-size: 14.5px; }
.burn-dot { width: 10px; height: 10px; background: #ff5f3a; box-shadow: 0 -4px 0 #ffc83d, 2px 2px 0 var(--edge); justify-self: center; }
.burn-text { color: var(--ink-2); }
.burn-text b { color: var(--ink); }
.tx { justify-self: end; }
.seasons { display: grid; border-top: 3px solid var(--frame); }
.season-row { display: grid; grid-template-columns: 110px 220px 1fr auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 2px solid var(--line); font-size: 14.5px; }

/* ---------- lists (hall of fame) ---------- */
.records { margin-top: 0; margin-bottom: 22px; }
.list { display: grid; }
.list li { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 2px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .who { gap: 10px; }

/* ---------- closing band ---------- */
.closing { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: clamp(28px, 5vw, 52px); background: var(--water-3); border-color: var(--frame-2); }
.closing-copy { display: grid; justify-items: start; gap: 18px; }
.closing .lede { color: #d5ecfb; }
.closing h2 { text-shadow: 3px 3px 0 var(--edge); }
.closing-art .creature { width: 168px !important; height: 112px !important; }

/* ---------- the name plate ---------- */
.specimen { display: grid; gap: 2px; width: max-content; max-width: 100%; padding: 12px 18px; background: #2a2416; border-color: #8a6a2a; color: var(--ink); }
.specimen-hole { display: none; }
.specimen-latin { font: 700 18px/1.2 var(--font-display); color: var(--accent); }
.specimen-name { font-weight: 700; font-size: 14px; }
.specimen-meta { font-size: 11.5px; color: var(--ink-2); }

/* ---------- creature page ---------- */
.creature-head { display: grid; grid-template-columns: minmax(260px, 440px) 1fr; gap: 40px; align-items: center; padding-top: 36px; padding-bottom: 12px; }
.portrait { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border: 6px solid var(--frame); outline: 3px solid var(--edge); background: var(--water-2); }
.portrait .tank-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.portrait-fish { position: relative; z-index: 1; display: block; width: 60%; }
.portrait-fish .creature { width: 100% !important; height: auto !important; }
.portrait-crown { position: absolute; left: 46%; top: -22%; width: 46%; }
.portrait-crown svg { width: 100%; height: auto; }
.champ-chip { position: absolute; top: 8px; left: 8px; z-index: 2; background: var(--accent); color: var(--on-accent); border-color: var(--edge); }
.creature-title { display: grid; gap: 16px; justify-items: start; }
.creature-title h1 { font-size: clamp(38px, 4.8vw, 64px); }
.sym { font: 500 0.4em var(--font-mono); color: var(--ink-2); letter-spacing: 0; vertical-align: middle; }
.chart-line { stroke: var(--accent); stroke-width: 2.5; }
.chart-area { fill: color-mix(in srgb, var(--water) 40%, transparent); }
.chart-window { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.banner.good { color: var(--good); border-color: currentColor; }

/* ---------- enter ---------- */
.enter-grid { display: grid; grid-template-columns: 1fr 380px; gap: 26px; align-items: start; }
.enter-form h2 { margin-bottom: 4px; }
.enter-preview { position: sticky; top: calc(var(--top-h) + 20px); display: grid; gap: 14px; padding: 18px; }
.preview-tank { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; background: var(--water-2); border: 3px solid var(--edge); }
.preview-tank .tank-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.preview-tank > .creature, .preview-tank > .preview-q { position: relative; z-index: 1; }
.preview-q { font: 700 72px/1 var(--font-display); color: var(--ink); text-shadow: 4px 4px 0 var(--edge); }
.preview-copy { display: grid; gap: 4px; }
.preview-species { font: 700 28px/1.1 var(--font-display); }
.enter-preview.taken .preview-species { color: var(--bad); }

/* ---------- how ---------- */
.steps.big { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 22px; }
.rule { padding: 20px; display: grid; gap: 6px; align-content: start; }
.guide-note { margin-top: 8px; }
.guide { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-top: 20px; }
.guide-item { display: grid; justify-items: center; gap: 8px; padding: 18px 8px 14px; font-size: 14px; font-weight: 700; background: var(--water-3); }

/* ---------- loading: three bubbles ---------- */
.loading-bubbles { display: flex; gap: 8px; }
.loading-bubbles span { width: 12px; height: 12px; box-shadow: inset 0 0 0 3px var(--ink-2); animation: bob 1.2s steps(2, end) infinite; --px: 4px; }
.loading-bubbles span:nth-child(2) { animation-delay: 0.2s; }
.loading-bubbles span:nth-child(3) { animation-delay: 0.4s; }

/* ---------- phones ---------- */
@media (max-width: 980px) {
  .creature-head, .enter-grid { grid-template-columns: 1fr; }
  .levels { grid-template-columns: 1fr 1fr; }
  .enter-preview { position: static; }
}
@media (max-width: 860px) {
  .burn-row { grid-template-columns: 22px 1fr 56px; }
  .burn-row > .num, .burn-row .tx { display: none; }
  .season-row { grid-template-columns: 1fr auto; }
  .season-row > :nth-child(2) { display: none; }
}
@media (max-width: 760px) {
  .hero-row { grid-template-columns: 1fr; gap: 24px; }
  .crown-timer { min-width: 0; margin-top: 0; grid-template-columns: auto 1fr; justify-items: start; align-items: center; column-gap: 16px; }
  .timer-head { grid-column: 1 / -1; }
  .timer-digits svg { height: 44px; }
  .timer-bar { grid-column: 2; }
  .timer-round { grid-column: 1 / -1; }
  .tank { height: 560px; }
  .tank-lid .mono { display: none; }
  .swimmer-tag { font-size: 10px; padding: 3px 5px; }
  .levels { grid-template-columns: 1fr; }
  .jar-card { grid-template-columns: 80px 1fr; gap: 16px; }
  .list li { grid-template-columns: 40px 1fr auto; }
  .closing { grid-template-columns: 1fr; }
  .closing-art { display: none; }
  .holder { font-size: 13px; }
}
