/* Two themes. "hyper" (default) takes its cues from HyperEVM's home, Hyperliquid: deep teal-black and mint.
   "cozy" is the warm light one. Components only use these tokens. */
:root, [data-theme="hyper"] {
  color-scheme: dark;
  --bg: #07171a;
  --bg-2: #0b1f23;
  --card: #0f262b;
  --raised: #133038;
  --ink: #e9fbf6;
  --muted: #86a8a3;
  --line: #1c3b41;
  --brand: #97fce4;      /* mint */
  --brand-ink: #04201b;
  --brand-soft: rgba(151, 252, 228, .12);
  --accent: #50d2c1;
  --accent-soft: rgba(80, 210, 193, .14);
  --plum: #9d8cff;
  --danger: #ed7088;
  --shadow: 0 0 0 1px rgba(151, 252, 228, .06), 0 8px 24px rgba(0, 0, 0, .35);
  --glow: 0 0 24px rgba(151, 252, 228, .18);
  --radius: 14px;
  --head: "Tiny5", ui-monospace, monospace;
  --px: rgba(0, 0, 0, .55);          /* hard pixel drop shadow */
  --px-light: rgba(255, 255, 255, .10); /* bevel highlight */
  --body: "Tiny5", ui-monospace, monospace;
  --mono: "Tiny5", ui-monospace, monospace;
}
[data-theme="cozy"] {
  color-scheme: light;
  --bg: #fbf5ec;
  --bg-2: #f3e9da;
  --card: #fffdf9;
  --raised: #fbf5ec;
  --ink: #2c2230;
  --muted: #7b6d74;
  --line: #eadccb;
  --brand: #e8743b;
  --brand-ink: #ffffff;
  --brand-soft: #fde3d2;
  --accent: #3fa98d;
  --accent-soft: #d8f0e8;
  --plum: #7a5aa6;
  --danger: #d8465f;
  --shadow: 0 1px 2px rgba(60, 35, 20, .06), 0 6px 20px rgba(60, 35, 20, .06);
  --glow: none;
  --radius: 18px;
  --head: "Tiny5", ui-monospace, monospace;
  --px: rgba(90, 50, 25, .22);
  --px-light: rgba(255, 255, 255, .45);
  --body: "Tiny5", ui-monospace, monospace;
}
[data-theme="hyper"] body { background-image: radial-gradient(900px 500px at 100% -10%, rgba(151, 252, 228, .07), transparent 60%), radial-gradient(700px 400px at -10% 110%, rgba(80, 210, 193, .05), transparent 60%); background-attachment: fixed; }
[data-theme="hyper"] .btn--hunt, [data-theme="hyper"] .btn--block { box-shadow: var(--glow); }
[data-theme="hyper"] .banner { background: radial-gradient(circle at 85% 30%, rgba(151, 252, 228, .14), transparent 55%), linear-gradient(135deg, var(--card), var(--bg-2)); border: 1px solid var(--line); }
[data-theme="hyper"] h1 { background: linear-gradient(90deg, var(--ink), var(--brand)); -webkit-background-clip: text; background-clip: text; color: transparent; }

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--body); overflow-x: hidden; }
[hidden] { display: none !important; }
a { color: var(--brand); }
button, input { font: inherit; color: inherit; }
code { font: 13px var(--mono); background: var(--bg-2); padding: 1px 6px; border-radius: 6px; word-break: break-all; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.grow { flex: 1; min-width: 0; }
.hint { color: var(--muted); font-size: 14.5px; margin: 10px 0; }
.empty { color: var(--muted); list-style: none; margin: 0; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; image-rendering: pixelated; }
body:not(.connected) .needs-wallet { display: none !important; }
body.connected .no-wallet { display: none !important; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 22px 18px; border-right: 1px solid var(--line); background: var(--bg-2); overflow-y: auto; }
.main { padding: 26px 32px 0; min-width: 0; max-width: 1180px; width: 100%; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 700 26px var(--head); }
.brand b { color: var(--brand); font-weight: 700; }
.brand canvas { width: 36px; height: 36px; image-rendering: pixelated; }
.nav { display: grid; gap: 4px; }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--muted); text-decoration: none; font: 600 17px var(--head); transition: background .15s, color .15s; }
.nav a:hover { background: var(--card); color: var(--ink); }
/* active item: tinted background, brand-coloured text and icon, and a bar on the left edge */
.nav a.on { background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 35%, transparent); }
.nav a.on::before { content: ""; position: absolute; left: -18px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.nav a.on svg { stroke: var(--brand); }
.nav a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.count { margin-left: auto; font: 700 12px var(--body); font-style: normal; color: var(--brand-ink); background: var(--brand); border-radius: 999px; padding: 1px 8px; }
.count:empty { display: none; }

.lives-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.lives-card header { display: flex; justify-content: space-between; align-items: baseline; font: 600 15px var(--head); color: var(--muted); }
.lives-card header b { color: var(--ink); font-size: 17px; }
.lives { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; margin: 12px 0 10px; }
.lives i { position: relative; aspect-ratio: 1; }
.lives svg { width: 100%; height: 100%; display: block; }
.lives .bg { fill: var(--line); }
.lives .fg { fill: var(--brand); }
.lives i.now .fg { fill: var(--accent); }
.lives i.now svg { animation: pawblink 1.6s steps(2) infinite; }
@keyframes pawblink { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .lives i.now svg { animation: none; } }
.mini { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini div { background: var(--bg); border-radius: 10px; padding: 6px 10px; min-width: 0; }
.mini dt { font-size: 12px; color: var(--muted); }
.mini dd { margin: 0; font: 600 15px var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phase { margin: 12px 0 0; text-align: center; font: 600 13px var(--head); padding: 6px; border-radius: 999px; background: var(--bg-2); color: var(--muted); }
.phase.live { background: var(--accent-soft); color: var(--accent); }
.phase.bad { background: var(--brand-soft); color: var(--danger); }

.side-foot { margin-top: auto; display: grid; gap: 10px; }
.net { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.net span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot.bad { background: var(--danger); }
.wallet-pill { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; cursor: pointer; text-align: left; box-shadow: var(--shadow); }
.wallet-pill:hover { border-color: var(--brand); }
#chip-addr { font: 13px var(--mono); }
#chip-bal { width: 100%; font-weight: 800; }
#chip-kind { font: 700 11px var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; }
#chip-kind:empty { display: none; }

/* theme switch sits right under the logo */
.theme-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--card); border: 2px solid var(--line); padding: 3px; margin-top: -4px; }
.theme-switch button { display: flex; align-items: center; justify-content: center; gap: 7px; border: 0; background: none; padding: 6px 8px; font: 600 14px var(--head); color: var(--muted); cursor: pointer; }
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-checked="true"] { background: var(--brand); color: var(--brand-ink); }
.sw { width: 10px; height: 10px; flex: none; box-shadow: 0 0 0 2px var(--px); }
.sw--hyper { background: #97fce4; }
.sw--cozy { background: #e8743b; }

/* mobile: sidebar becomes a top bar + bottom nav */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
  .brand { font-size: 22px; }
  .brand canvas { width: 30px; height: 30px; }
  .theme-switch { grid-column: 1 / -1; grid-row: 2; margin: 0; }
  .theme-switch button { padding: 5px 8px; }
  .side-foot { margin: 0; grid-column: 2; grid-row: 1; }
  .side-foot .net { display: none; }
  .wallet-pill { padding: 6px 10px; box-shadow: none; }
  #chip-bal { display: none; }
  .btn--block { width: auto; }
  .lives-card { grid-column: 1 / -1; grid-row: 3; }
  .nav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; grid-template-columns: repeat(5, 1fr); gap: 0; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 12.5px; border-radius: 10px; }
  .nav a.on { box-shadow: none; }
  .nav a.on::before { left: 25%; right: 25%; top: -6px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .nav .count { display: none; }
  .main { padding: 18px 16px 90px; }
}

/* ---------------------------------------------------------------- buttons, fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 11px 18px; font: 600 16px var(--head);
  background: var(--ink); color: var(--bg); cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .08s, filter .15s; }
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn--block { width: 100%; background: var(--brand); color: var(--brand-ink); }
.btn--accent { background: var(--accent); color: #fff; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn--ghost:hover:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--brand); filter: none; }
.btn--sm { padding: 8px 14px; font-size: 15px; border-radius: 10px; }
.btn--xs { padding: 3px 10px; font-size: 13px; border-radius: 8px; }
.btn--hunt { width: 100%; margin-top: 18px; padding: 16px; font-size: 20px; border-radius: 16px; background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 0 color-mix(in srgb, var(--brand) 60%, #000); }
.btn--hunt:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--brand) 60%, #000); }
.btn--hunt.stop { background: var(--plum); box-shadow: 0 6px 0 color-mix(in srgb, var(--plum) 60%, #000); }
.field { background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: 7px 12px; min-width: 0; width: 140px; }
.field:focus { outline: none; border-color: var(--brand); }
.check { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 12px; color: var(--muted); font-size: 14px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
input[type="range"] { flex: 1; min-width: 0; accent-color: var(--brand); }
output { min-width: 44px; text-align: right; font: 600 15px var(--head); }

/* ---------------------------------------------------------------- panels */
.panel { background: var(--card); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); min-width: 0; margin-bottom: 18px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 23px; }
.panel-head .more { margin-left: auto; font-weight: 700; text-decoration: none; font-size: 14px; }
.state { margin-left: auto; font: 600 13px var(--head); background: var(--bg-2); color: var(--muted); padding: 3px 10px; border-radius: 999px; }
.panel h3 { font-size: 19px; margin-bottom: 8px; }
.panel p { margin: 0 0 10px; }

/* banner */
.banner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; padding: 30px 34px; margin-bottom: 18px; border-radius: 26px;
  background: radial-gradient(circle at 85% 30%, var(--brand-soft), transparent 55%), var(--card); box-shadow: var(--shadow); }
.kicker { margin: 0 0 8px; font: 600 14px var(--head); color: var(--accent); letter-spacing: .02em; }
.banner h1 { font-size: clamp(38px, 5.4vw, 64px); line-height: 1; margin-bottom: 14px; }
.banner p { max-width: 560px; color: var(--muted); margin: 0; }
.banner p b { color: var(--brand); }
.banner-cat { position: relative; width: clamp(150px, 20vw, 220px); }
.banner-cat canvas { width: 100%; aspect-ratio: 1; display: block; image-rendering: pixelated; border-radius: 50%; background: var(--bg-2); box-shadow: 0 0 0 8px var(--card), 0 0 0 10px var(--line); animation: breathe 4s ease-in-out infinite; }
.born-badge { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--ink); color: var(--bg); font: 600 13px var(--head); padding: 4px 12px; border-radius: 999px; }
@keyframes breathe { 50% { transform: scale(1.025); } }
@media (prefers-reduced-motion: reduce) { .banner-cat canvas { animation: none; } }
@media (max-width: 640px) {
  .banner { grid-template-columns: 1fr; padding: 22px; }
  .banner-cat { width: 130px; justify-self: center; order: -1; margin-bottom: 8px; }
}

/* hunt */
.hunt { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 18px; align-items: start; }
.hunt .panel { margin-bottom: 0; }
.hunt-side { display: grid; gap: 18px; }
@media (max-width: 1180px) { .hunt { grid-template-columns: 1fr; } }
.gauge-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 22px; align-items: center; }
@media (max-width: 520px) { .gauge-row { grid-template-columns: 1fr; justify-items: center; } }
.gauge { position: relative; width: 170px; aspect-ratio: 1; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 12; }
.gauge .track { stroke: var(--line); }
.gauge .arc { stroke: var(--brand); stroke-linecap: round; stroke-dasharray: 314.16; stroke-dashoffset: 314.16; transition: stroke-dashoffset .6s; }
.gauge-mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge-mid b { font: 700 30px var(--head); }
.gauge-mid span { font-size: 12px; color: var(--muted); }
.stats { margin: 0; display: grid; gap: 8px; width: 100%; }
.stats div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--bg); border-radius: 12px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font: 600 17px var(--head); white-space: nowrap; }
#s-rate { color: var(--accent); }
.controls { display: grid; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.ctl { display: flex; align-items: center; gap: 12px; }
.lbl { width: 72px; flex: none; font: 600 15px var(--head); color: var(--muted); }
.toggle { display: inline-flex; background: var(--bg-2); border-radius: 12px; padding: 3px; }
.toggle button { border: 0; background: none; padding: 6px 16px; border-radius: 9px; font: 600 15px var(--head); color: var(--muted); cursor: pointer; }
.toggle button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.toggle button:disabled { opacity: .4; cursor: not-allowed; }
.notice { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--ink); }
.notice.ok { background: var(--accent-soft); }
.logbox { margin-top: 14px; }
.logbox summary { cursor: pointer; font: 600 15px var(--head); color: var(--muted); }
.log { list-style: none; padding: 0; margin: 8px 0 0; max-height: 240px; overflow-y: auto; font-size: 13.5px; }
.log li { display: flex; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.log time { color: var(--muted); font: 12px var(--mono); flex: none; padding-top: 2px; }
.log .win { color: var(--accent); font-weight: 700; }
.log .err { color: var(--danger); }

.born { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.born .kit { background: var(--bg); border-radius: 14px; padding: 8px; cursor: pointer; text-align: center; border: 0; color: inherit; }
.born .kit:hover { outline: 2px solid var(--brand); }
.born .kit.fresh { animation: pop .9s ease-out; }
@keyframes pop { from { transform: scale(.85); background: var(--brand-soft); } }
.born img { width: 100%; aspect-ratio: 1; border-radius: 10px; image-rendering: pixelated; display: block; }
.born b { display: block; font: 600 15px var(--head); margin-top: 4px; }
.born span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.born .me { color: var(--brand); font-weight: 800; }
.board { list-style: none; padding: 0; margin: 0; counter-reset: n; }
.board li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.board li::before { counter-increment: n; content: counter(n); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); font: 600 13px var(--head); }
.board li:nth-child(1)::before { background: #ffd66b; color: #3a2a00; }
.board li:nth-child(2)::before { background: #d9d6dc; color: #333; }
.board li:nth-child(3)::before { background: #e9b48a; color: #3a1f0c; }
.board li.empty::before { display: none; }
.board a { font: 13.5px var(--mono); text-decoration: none; color: var(--ink); }
.board .me a { color: var(--brand); font-weight: 700; }
.board li span:last-child { margin-left: auto; font: 600 16px var(--head); }

/* cards (cat grids) */
.toolbar, .actionbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 0; background: var(--bg-2); padding: 7px 14px; border-radius: 999px; font: 600 14px var(--head); color: var(--muted); cursor: pointer; }
.chips button[aria-checked="true"] { background: var(--ink); color: var(--bg); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.cards--sm { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.card { position: relative; border: 0; background: var(--bg); border-radius: 16px; padding: 8px 8px 10px; cursor: pointer; text-align: left; color: inherit; transition: transform .12s; }
.card:hover { transform: translateY(-2px); }
.card.sel { box-shadow: 0 0 0 3px var(--brand); }
.card img { width: 100%; aspect-ratio: 1; display: block; border-radius: 12px; image-rendering: pixelated; }
.card b { display: block; margin: 6px 2px 0; font: 600 16px var(--head); }
.card span { display: block; margin: 0 2px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .zz { position: absolute; top: 14px; right: 14px; background: var(--plum); color: #fff; font: 600 12px var(--head); padding: 2px 8px; border-radius: 999px; }
.card .zz.free { background: var(--accent); }
.cards + .hint { margin-top: 18px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 18px; }

/* nap */
.kpis, .tiles4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 760px) { .kpis, .tiles4 { grid-template-columns: repeat(2, 1fr); } }
.kpis div, .tiles4 div { background: var(--bg); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.kpis span, .tiles4 span { display: block; font-size: 13px; color: var(--muted); }
.kpis b, .tiles4 b { display: block; font: 600 20px var(--head); overflow-wrap: anywhere; }
.kpis .hl, .tiles4 .hl { background: var(--accent-soft); }
.naps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .naps { grid-template-columns: 1fr; } }
.naps label { position: relative; display: block; background: var(--bg); border-radius: 16px; padding: 16px; cursor: pointer; border: 2px solid transparent; }
.naps label:has(input:checked) { border-color: var(--plum); background: color-mix(in srgb, var(--plum) 10%, var(--bg)); }
.naps input { position: absolute; opacity: 0; }
.naps .moon { display: block; color: var(--plum); font-size: 20px; letter-spacing: 2px; }
.naps b { display: block; font: 600 19px var(--head); }
.naps em { font-style: normal; color: var(--muted); font-size: 14px; }

/* guide */
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }
.steps li { counter-increment: s; background: var(--bg); border-radius: 16px; padding: 14px; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font: 700 16px var(--head); margin-bottom: 8px; }
.steps b { display: block; font: 600 17px var(--head); margin-bottom: 4px; }
.steps span { color: var(--muted); font-size: 14.5px; }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.guide-grid .wide { grid-column: 1 / -1; }
@media (max-width: 860px) { .guide-grid { grid-template-columns: 1fr; } }
.guide-grid p { color: var(--muted); }
.split { display: flex; height: 16px; border-radius: 999px; overflow: hidden; margin: 6px 0 10px; }
.split i { flex: var(--w); }
.split i:nth-child(1), .legend li:nth-child(1) i { background: var(--plum); }
.split i:nth-child(2), .legend li:nth-child(2) i { background: var(--brand); }
.split i:nth-child(3), .legend li:nth-child(3) i { background: var(--accent); }
.legend { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; font-size: 14.5px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { color: var(--muted); font: 600 13px var(--head); }
td:last-child { text-align: right; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font: 600 17px var(--head); }
.faq details p { color: var(--muted); margin: 8px 0 0; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13.5px; padding: 18px 0 30px; }
.foot .links { display: flex; gap: 16px; flex-wrap: wrap; }
.foot { align-items: center; }

/* ---------------------------------------------------------------- dialogs */
dialog { background: var(--card); color: var(--ink); border: 0; border-radius: 22px; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(40, 25, 20, .45); backdrop-filter: blur(4px); }
.dlg { padding: 20px 22px 22px; }
.dlg header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.dlg header h3 { font-size: 22px; }
.x { background: var(--bg-2); border: 0; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.wallets { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.wallets button { width: 100%; display: flex; gap: 12px; align-items: center; background: var(--bg); border: 1.5px solid transparent; border-radius: 14px; padding: 12px; cursor: pointer; text-align: left; font-weight: 700; }
.wallets button:hover { border-color: var(--brand); }
.wallets img, .wallets .ico { width: 34px; height: 34px; border-radius: 10px; flex: none; }
.wallets .ico { background: var(--brand); display: grid; place-items: center; color: #fff; }
.wallets small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.rows { margin: 0 0 12px; }
.rows div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rows dt { color: var(--muted); }
.rows dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.secret { display: block; margin-top: 4px; padding: 10px; color: var(--danger); }
#cat-dlg { width: min(780px, calc(100vw - 32px)); }
.catview { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; }
@media (max-width: 640px) { .catview { grid-template-columns: 1fr; } }
.catview .art img { width: 100%; aspect-ratio: 1; border-radius: 18px; image-rendering: pixelated; display: block; }
.traits { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.traits li { background: var(--bg); border-radius: 999px; padding: 4px 12px; font-size: 13.5px; }
.traits li b { color: var(--muted); font-weight: 600; margin-right: 4px; }

/* ================================================================ pixel layer
   Square corners, 2px borders, hard offset shadows and bevelled buttons, so the UI matches the pixel cats. */
*:not(.dot), *::before, *::after { border-radius: 0 !important; }
/* One pixel face (Tiny5) for everything. It ships one weight: never let the browser fake a bold one */
body, button, input, code, dialog { font-synthesis: none; font-family: var(--body); }
* { font-weight: 400 !important; }
body { font-size: 16px; letter-spacing: .02em; }
code { font-size: 14px; }
h1, h2, h3, .brand, .brand b, .btn, .nav a, .kv dd, .mini dd, .stats dd, .kpis b, .tiles4 b, .card b, .born b, .theme-switch button, .state, .phase,
.gauge-mid b, .naps b, .steps b, .faq summary, output, .lbl, .toggle button, .chips button, .lives-card header, .lives-card header b, .born-badge, .zz, .logbox summary { font-weight: 400 !important; }
.panel, .banner, .lives-card, dialog, .wallet-pill { border: 2px solid var(--line); box-shadow: 5px 5px 0 0 var(--px); }
.card, .born .kit, .kpis > div, .tiles4 > div, .mini > div, .stats > div, .naps label, .steps li, .wallets button { box-shadow: 3px 3px 0 0 var(--px); }
.card:hover, .born .kit:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 0 var(--px); }
.card.sel { box-shadow: 0 0 0 3px var(--brand), 3px 3px 0 3px var(--px); }
.card:focus-visible, .kit:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.btn { box-shadow: inset -3px -3px 0 0 rgba(0, 0, 0, .28), inset 3px 3px 0 0 var(--px-light), 3px 3px 0 0 var(--px); letter-spacing: .02em; }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: inset -3px -3px 0 0 rgba(0, 0, 0, .28), inset 3px 3px 0 0 var(--px-light), 1px 1px 0 0 var(--px); }
.btn--ghost { box-shadow: inset 0 0 0 2px var(--line), 3px 3px 0 0 var(--px); }
.btn--ghost:hover:not(:disabled) { box-shadow: inset 0 0 0 2px var(--brand), 3px 3px 0 0 var(--px); }
.btn--hunt, [data-theme="hyper"] .btn--hunt { box-shadow: inset -4px -4px 0 0 rgba(0, 0, 0, .25), inset 4px 4px 0 0 var(--px-light), 5px 5px 0 0 var(--px); }
.btn--hunt:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: inset -4px -4px 0 0 rgba(0, 0, 0, .25), inset 4px 4px 0 0 var(--px-light), 2px 2px 0 0 var(--px); }
[data-theme="hyper"] .btn--block { box-shadow: inset -3px -3px 0 0 rgba(0, 0, 0, .28), inset 3px 3px 0 0 var(--px-light), 3px 3px 0 0 var(--px); }
.toggle, .chips button, .field, .theme-switch, .state, .phase, .count, #chip-kind, .born-badge, .zz { box-shadow: 2px 2px 0 0 var(--px); }
.nav a.on { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand) 45%, transparent), 3px 3px 0 0 var(--px); }
.banner-cat canvas { box-shadow: 0 0 0 4px var(--card), 0 0 0 8px var(--line), 8px 8px 0 4px var(--px); }
.gauge .arc { stroke-linecap: butt; }
h1, h2, h3, .brand, .btn, .nav a { font-family: var(--head); }
h1 { letter-spacing: 0; }
.split { box-shadow: 3px 3px 0 0 var(--px); }
.lives svg, .token-logo, .sw { image-rendering: pixelated; }

/* links to the explorer */
a.xl { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
a.xl:hover { color: var(--brand); text-decoration-style: solid; }
.board a.xl, .rows a.xl, table a.xl { font-family: var(--mono); }
.log a.xl { color: var(--brand); }

/* $YARN logo */
.with-logo { display: flex; align-items: center; gap: 10px; }
.token-logo { width: 34px; height: 34px; }
.contracts { margin-top: 6px; }

/* ================================================================ cursors (pixel arrow, paw on anything clickable) */
html, body { cursor: var(--cur); }
[data-theme] a, [data-theme] button, [data-theme] summary, [data-theme] label, [data-theme] [role="button"], [data-theme] [role="radio"],
[data-theme] input[type="range"], [data-theme] input[type="checkbox"], [data-theme] input[type="radio"], [data-theme] .feed img { cursor: var(--cur-hand); }
[data-theme] input[type="search"], [data-theme] input:not([type]), [data-theme] .field { cursor: text; }
[data-theme] button:disabled, [data-theme] .btn:disabled { cursor: not-allowed; }

/* ================================================================ proof of work */
.banner .pow-badge { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 5px 10px; background: var(--brand); color: var(--brand-ink);
  font: 400 14px var(--head); letter-spacing: .04em; text-transform: uppercase; box-shadow: 3px 3px 0 0 var(--px); }
.banner .pow-badge svg { width: 14px; height: 14px; fill: currentColor; shape-rendering: crispEdges; }
.banner p b { color: var(--brand); }
.pow-steps { list-style: none; counter-reset: p; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 760px) { .pow-steps { grid-template-columns: 1fr; } }
.pow-steps li { counter-increment: p; position: relative; background: var(--card); border: 2px solid var(--line); box-shadow: 4px 4px 0 0 var(--px); padding: 12px 14px 12px 54px; min-width: 0; }
.pow-steps li::before { content: counter(p); position: absolute; left: 12px; top: 12px; width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink); font: 400 18px var(--head); box-shadow: 2px 2px 0 0 var(--px); }
.pow-steps b { display: block; font: 400 17px var(--head); }
.pow-steps span { color: var(--muted); font-size: 14px; }
.pow-steps code { font-size: 12px; }

.cards--xs { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-bottom: 12px; }
.cards--xs .card { padding: 4px 4px 6px; }
.cards--xs .card b { font-size: 13px; margin-top: 3px; }
a.xl { cursor: var(--cur-hand); }

/* CURSORS:start (generated by tools/cursors.mjs) */
[data-theme="hyper"] { --cur: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAgCAYAAAAIXrg4AAAAe0lEQVR4nGNgUZD+D8IMtAJ0s4BmFtHNgul/noAx1S2iuwVUt2jALKCaRQNuAcUWDRoLyLZo0FlAskWD1gKiLRr0FhC0aNBZEHDpIBijV1Q4K64BswBdHN1ggslzwCxAN4Bii+hmAS4NQ8cCYtWRbBHNLSAWEJ2x6G0BAGGGowYvr6IHAAAAAElFTkSuQmCC") 0 0, auto; --cur-hand: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAiElEQVR4nGNgIBKwKEj/R8aExCkGdLMQZtD0P09QMCHxwW8hLgOJxSRbTDcL0RMBpRYStJhuFpKbOMhOTHSzkNigIzbjEzJn6FiICw8+C8lNNIQcRvVUSrGFw7+kIRS0hHDApYNY8aiF9LcQ3WJcBhHCRFs0YBaSazHZFg2YhegWE8IUW0RtCwH3AZFc2n2W5wAAAABJRU5ErkJggg==") 14 4, pointer; }
[data-theme="cozy"] { --cur: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAgCAYAAAAIXrg4AAAAe0lEQVR4nGPQUTL4D8IMtAJ0s4BmFtHNghcl1mBMdYvobgHVLRowC6hm0YBbQLFFg8YCsi0adBaQbNGgtYBoiwa9BQQtGnQW7AiWB2P0igpnxTVgFqCLoxtMMHkOmAXoBlBsEd0swKVh6FhArDqSLaK5BcQCojMWvS0AACMyFeoJ/ivtAAAAAElFTkSuQmCC") 0 0, auto; --cur-hand: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAiElEQVR4nGNgIBLoKBn8R8aExCkGdLMQZtCLEmsUTEh88FuIy0BiMckW081C9ERAqYUELaabheQmDrITE90sJDboiM34hMwZOhbiwoPPQnITDSGHUT2VUmzh8C9pCAUtIbwjWB4rHrWQ/haiW4zLIEKYaIsGzEJyLSbbogGzEN1iQphii6htIQDZMJl9tOtvZQAAAABJRU5ErkJggg==") 14 4, pointer; }
/* CURSORS:end */

/* just born: a plain table */
.born-table { width: 100%; }
.born-table th { font-size: 13px; }
.born-table td { padding: 8px; }
.born-table td:last-child, .born-table th:last-child { text-align: right; color: var(--muted); white-space: nowrap; }
.born-table tbody tr[role="button"]:hover { background: var(--brand-soft); }
.born-table tbody tr.fresh { animation: rowpop 1.2s ease-out; }
@keyframes rowpop { from { background: var(--brand-soft); } }
.born-table .me a.xl { color: var(--brand); }
.born-table .empty { text-align: left; color: var(--muted); }

/* popup */
#ask-dlg { width: min(460px, calc(100vw - 32px)); }
.ask-body p { margin: 0 0 10px; color: var(--muted); }
.ask-body code { display: inline-block; font-size: 13px; color: var(--ink); }
.ask-cat { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: center; margin-bottom: 10px; }
.ask-cat img { width: 96px; aspect-ratio: 1; image-rendering: pixelated; display: block; box-shadow: 3px 3px 0 0 var(--px); }
.ask-cat b { color: var(--ink); }
.ask-input { width: 100%; margin: 4px 0 0; padding: 10px 12px; }
.ask-err { margin: 8px 0 0; color: var(--danger); font-size: 14px; }
.ask-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.born-table td.thumb { width: 44px; padding: 5px 4px 5px 0; }
.born-table td.thumb img { width: 36px; height: 36px; display: block; image-rendering: pixelated; box-shadow: 2px 2px 0 0 var(--px); }
.traits li.special { background: var(--brand); color: var(--brand-ink); }
.traits li.special b { color: var(--brand-ink); }

/* ================================================================ responsive fixes (phones and tablets) */
@media (max-width: 980px) {
  /* compact status: fixed-size paws, the four numbers in one row, slim theme switch */
  .side { gap: 10px; padding: 10px 14px 12px; }
  .theme-switch { padding: 2px; }
  .theme-switch button { padding: 4px 8px; font-size: 13px; }
  .lives-card { padding: 10px 12px; box-shadow: 3px 3px 0 0 var(--px); }
  .lives { display: flex; justify-content: space-between; margin: 8px 0; }
  .lives i { width: clamp(18px, 6vw, 30px); }
  .mini { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .mini div { padding: 4px 7px; }
  .mini dt { font-size: 11px; }
  .mini dd { font-size: 13px; }
  .phase { margin-top: 8px; padding: 3px; font-size: 12px; }
  .main { padding-top: 14px; }
  .panel { padding: 16px; }
  .banner { padding: 20px; }
}
@media (max-width: 420px) {
  .mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  /* cat grids: two per row on phones */
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cards--sm { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cards--xs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card { padding: 6px 6px 8px; }
  .card b { font-size: 14px; }
  .card span { font-size: 11.5px; }
  /* litter toolbar: chips + search on one line, the explanation below */
  .toolbar { gap: 8px; }
  .toolbar > .grow { order: 3; flex-basis: 100%; }
  .toolbar .field { flex: 1; width: auto; min-width: 90px; }
  .pager { gap: 8px; }
  /* banner badge stays on one line */
  .banner .pow-badge { font-size: 12px; padding: 4px 8px; gap: 6px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .banner h1 { font-size: 40px; }
  .pow-steps li { padding-left: 50px; }
  /* tables and long values never push the page sideways */
  .rows dd, .tiles4 b, .kpis b { overflow-wrap: anywhere; }
  .born-table td { padding: 6px 4px; }
  .born-table th:nth-child(4), .born-table td:nth-child(4) { display: none; } /* life column */
  .actionbar .btn { flex: 1 1 auto; }
  dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .dlg { padding: 16px; }
  .catview { gap: 14px; }
  .catview .art img { max-width: 240px; margin: 0 auto; }
}
