:root {
  --bg: #fff8ec;
  --bg-2: #ffeccc;
  --surface: #ffffff;
  --surface-2: #fff6e6;
  --text: #2a1f14;
  --muted: #8a7760;
  --line: rgba(60, 40, 10, 0.1);
  --accent: #f97316;
  --accent-2: #fb923c;
  --accent-ink: #ffffff;
  --ada: #0033ad;
  --good: #16a34a;
  --gold: #f59e0b;
  --shadow: 0 10px 30px -12px rgba(120, 60, 0, 0.25);
  --shadow-lg: 0 24px 60px -20px rgba(120, 60, 0, 0.35);
  --radius: 18px;
  --info-w: 230px;
  --dog-w: 54px;
  --finish-w: 14px;
  --start-w: 34px;  /* room behind the dog at the start, e.g. for a poop */
  --tick: 1000ms;
  --lane-base: #ffffff;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17120d;
    --bg-2: #231a10;
    --surface: #241c14;
    --surface-2: #2d2319;
    --text: #fbf1e3;
    --muted: #b4a089;
    --line: rgba(255, 230, 200, 0.1);
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
    --lane-base: #1c150f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17120d;
  --bg-2: #231a10;
  --surface: #241c14;
  --surface-2: #2d2319;
  --text: #fbf1e3;
  --muted: #b4a089;
  --line: rgba(255, 230, 200, 0.1);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--bg-2), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}
h1, h2, .brand, .btn, .phase-pill, .trait-banner, .timer, .lane-num, .lane-name, .podium-name, .result-headline {
  font-family: Fredoka, Inter, system-ui, sans-serif;
}

/* ------------------------------------------------------------ buttons */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.7em 1.2em;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 80%, transparent), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}
.btn-primary:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 14px 28px -10px var(--accent); }
.btn-ghost { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line), var(--shadow); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-xl { font-size: 1.4rem; padding: 0.75em 2.4em; }
.btn-block { width: 100%; justify-content: center; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--line);
  cursor: pointer;
  font-size: 1.05rem;
}

/* ------------------------------------------------------------ top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; font-weight: 700; }
.brand-name span { color: var(--accent); }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #fdba74, #f97316);
  position: relative;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.12);
}
.brand-logo::after { content: "🐕"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.score-chip {
  display: flex; gap: 6px; align-items: baseline;
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 0.9rem;
}
.muted { color: var(--muted); }

/* ------------------------------------------------------------ wallet */
.wallet { position: relative; }
.btn-wallet {
  background: var(--ada);
  color: #fff;
  box-shadow: 0 8px 20px -10px var(--ada);
  padding: 0.55em 1.1em 0.55em 0.6em;
}
.btn-wallet:hover { filter: brightness(1.12); }
.btn-wallet.connected { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); padding-left: 0.7em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88rem; }
.ada-dot {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.18); font-size: 0.95rem;
}
.wallet-icon { width: 22px; height: 22px; border-radius: 6px; object-fit: contain; }
.wallet-icon.lg { width: 38px; height: 38px; border-radius: 10px; }
.hosky-flag { font-size: 0.95rem; }
.wallet-menu {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: 320px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  display: grid; gap: 12px;
  animation: drop 0.18s ease-out;
  z-index: 30;
}
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
.wm-title { font-weight: 700; font-family: Fredoka, sans-serif; font-size: 1.1rem; }
.wm-head { display: flex; align-items: center; gap: 12px; }
.wm-net { font-size: 0.75rem; font-weight: 600; display: inline-block; padding: 2px 8px; border-radius: 999px; margin-top: 2px; }
.wm-net.main { background: #dcfce7; color: #166534; }
.wm-net.test { background: #fef3c7; color: #92400e; }
.wm-addr {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem; word-break: break-all; text-align: left;
  padding: 10px 12px; border-radius: 12px; border: 0; cursor: copy;
  background: var(--surface-2); color: var(--text);
  position: relative;
}
.wm-addr.copied::after { content: "Copied!"; position: absolute; right: 8px; top: 6px; font-family: Inter, sans-serif; font-weight: 600; color: var(--good); }
.wm-balances { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wm-bal { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); display: grid; gap: 2px; }
.wm-bal.hosky { background: linear-gradient(135deg, #fed7aa, #fdba74); color: #431407; }
.wm-bal-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; opacity: 0.7; }
.wm-bal-val { font-family: Fredoka, sans-serif; font-weight: 600; font-size: 1.15rem; }
.wm-perk { font-size: 0.85rem; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, transparent); }
.wm-score { font-size: 0.85rem; color: var(--muted); }
.wm-list { display: grid; gap: 6px; }
.wm-wallet {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; border: 0;
  background: var(--surface-2); color: var(--text);
  font: 600 0.98rem Inter, sans-serif; cursor: pointer; text-align: left;
  transition: background 0.15s, transform 0.1s;
}
.wm-wallet:hover { background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); }
.wm-wallet.loading::after { content: ""; margin-left: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); border-top-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.wm-empty, .wm-hint, .wm-error { margin: 0; font-size: 0.85rem; line-height: 1.45; color: var(--muted); }
.wm-empty a { color: var(--accent); font-weight: 600; }
.wm-error { color: #dc2626; }

/* ------------------------------------------------------------ layout */
main { max-width: 1240px; margin: 0 auto; padding: 24px; }

/* ------------------------------------------------------------ start */
.screen-start { min-height: calc(100vh - 140px); display: grid; place-items: center; }
.hero { text-align: center; max-width: 680px; }
.hero h1 { font-size: clamp(3rem, 10vw, 6.2rem); line-height: 0.95; margin: 12px 0 16px; letter-spacing: -0.02em; }
.hero h1 span {
  background: linear-gradient(135deg, #fb923c, #ea580c 60%, #c2410c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { font-size: 1.2rem; color: var(--muted); line-height: 1.5; margin: 0 auto 28px; max-width: 520px; }
.hero-note { font-size: 0.9rem; color: var(--muted); margin-top: 22px; }
.hero-dogs { display: flex; justify-content: center; align-items: flex-end; gap: 22px; margin-bottom: 18px; }
.hero-dog { width: 110px; }
.hero-dog:nth-child(2) { width: 140px; margin-top: -14px; }
@keyframes bob { to { transform: translateY(-6px); } }

/* ------------------------------------------------------------ race HUD */
.race-hud {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  margin-bottom: 14px;
}
.hud-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hud-right { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.hud-msg { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-msg b { color: var(--text); }
.hud-msg b.pos { color: var(--accent); }
.phase-pill {
  white-space: nowrap;
  padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 0.9rem;
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line);
}
.phase-pill.ready { background: #fef3c7; color: #92400e; box-shadow: none; }
.phase-pill.live { background: #fee2e2; color: #b91c1c; box-shadow: none; }
.phase-pill.live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; margin-right: 8px; animation: blink 1s infinite; vertical-align: 1px; }
.phase-pill.done { background: #dcfce7; color: #166534; box-shadow: none; }
@keyframes blink { 50% { opacity: 0.2; } }
.trait-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 22px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow), inset 0 0 0 1.5px var(--line);
  font-size: 1.15rem; font-weight: 600;
  min-width: 280px; justify-content: center;
}
.trait-banner[data-trait="Eyes"] { background: linear-gradient(90deg, #dbeafe, #ede9fe); color: #1e3a8a; }
.trait-banner[data-trait="Fur"] { background: linear-gradient(90deg, #ffedd5, #fee2e2); color: #7c2d12; }
.trait-banner[data-trait="Background"] { background: linear-gradient(90deg, #dcfce7, #fce7f3); color: #14532d; }
.trait-banner.pop { animation: pop 0.35s ease-out; }
@keyframes pop { 0% { transform: scale(0.92); } 60% { transform: scale(1.05); } }
.trait-icon { font-size: 1.3rem; }
.timer {
  font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums;
  min-width: 64px; text-align: right;
}
.timer small { font-size: 0.9rem; color: var(--muted); margin-left: 2px; }

.legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  font-size: 0.85rem; color: var(--muted);
  margin-bottom: 12px; padding: 0 4px;
}
.legend-title { font-weight: 600; }
.legend-src a { color: var(--accent); font-weight: 600; text-decoration: none; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.legend-group { display: inline-flex; align-items: center; gap: 4px; }
.legend-label { margin-right: 4px; color: var(--text); font-weight: 500; }
.dot {
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-block;
  box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.12);
}

/* ------------------------------------------------------------ track */
.track {
  position: relative;
  background: var(--surface);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  padding: 10px;
}
.lanes { display: grid; gap: 6px; }
.lane {
  --lane-bg: #eee;
  display: grid; grid-template-columns: var(--info-w) 1fr;
  align-items: stretch;
  border-radius: 14px;
  background: var(--surface-2);
  cursor: pointer;
  position: relative;
  outline: none;
  transition: box-shadow 0.2s, transform 0.2s, opacity 0.3s;
}
.track:not(.racing) .lane:hover { transform: translateX(3px); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 50%, transparent); }
.lane:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.track.racing .lane { cursor: default; }
.lane.picked { box-shadow: 0 0 0 3px var(--accent), 0 10px 26px -12px var(--accent); z-index: 1; }
.lane.picked::after {
  content: "YOUR PICK";
  position: absolute; left: calc(var(--info-w) - 12px); top: -8px;
  font: 700 0.62rem/1 Inter, sans-serif; letter-spacing: 0.08em;
  background: var(--accent); color: #fff; padding: 4px 7px; border-radius: 6px;
  transform: translateX(-100%);
}
.lane-info {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  min-width: 0;
}
.lane-num {
  flex: none;
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 1.05rem;
  background: var(--surface); box-shadow: inset 0 0 0 2px var(--rarity);
  transition: background 0.3s, color 0.3s;
}
.lane.leader .lane-num { background: var(--gold); color: #fff; box-shadow: none; }
.lane-meta { min-width: 0; display: grid; gap: 5px; }
.lane-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lane-name { font-weight: 600; font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-traits { display: flex; align-items: center; gap: 8px; }
.trait-meter { display: inline-flex; align-items: center; gap: 4px; font-size: 0.66rem; color: var(--muted); transition: color 0.2s; }
.trait-meter i { font-style: normal; font-weight: 600; }
.trait-meter b {
  --v: 0.5;
  width: 26px; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--muted) calc(var(--v) * 100%), var(--line) 0);
  opacity: 0.7; transition: opacity 0.2s, transform 0.2s;
}
.track[data-trait="Background"] .trait-meter[data-trait="Background"],
.track[data-trait="Fur"] .trait-meter[data-trait="Fur"],
.track[data-trait="Eyes"] .trait-meter[data-trait="Eyes"] { color: var(--accent); }
.track[data-trait="Background"] .trait-meter[data-trait="Background"] b,
.track[data-trait="Fur"] .trait-meter[data-trait="Fur"] b,
.track[data-trait="Eyes"] .trait-meter[data-trait="Eyes"] b {
  background: linear-gradient(90deg, var(--accent) calc(var(--v) * 100%), var(--line) 0);
  opacity: 1; transform: scaleY(1.4);
}
.rarity-badge {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; flex: none;
  color: #fff; background: var(--rarity);
}
.rarity-badge.r-legendary { background: linear-gradient(90deg, #f59e0b, #ef4444, #f59e0b); background-size: 200% 100%; animation: shimmer 2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.runway {
  position: relative;
  height: 76px;
  border-radius: 0 14px 14px 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0,0,0,.06) calc(10% - 1px) 10%),
    color-mix(in srgb, var(--lane-bg) 38%, var(--lane-base));
  overflow: hidden;
}
.runway::after {
  content: "";
  position: absolute; right: 0; top: 0; bottom: 0; width: var(--finish-w);
  background: repeating-conic-gradient(#1f2937 0 25%, #fff 0 50%) 0 0 / 7px 7px;
  opacity: 0.85;
}
.runner {
  --p: 0;
  position: absolute; bottom: 2px;
  width: var(--dog-w);
  left: calc(var(--start-w) + var(--p) * (100% - var(--start-w) - var(--dog-w) - var(--finish-w) + 6px));
  transition: left var(--tick) linear;
  z-index: 2;
}
.hosky { position: relative; width: 100%; padding-bottom: 10px; }
.hosky-img {
  display: block; width: 100%; aspect-ratio: 1; border-radius: 12px;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 2px var(--tier), 0 6px 12px -4px rgba(0,0,0,.35);
  background: #fff;
  position: relative; z-index: 1;
  image-rendering: pixelated;
  user-select: none;
}
.hosky-legs { position: absolute; left: 6%; right: 6%; bottom: 0; width: 88%; height: 16px; overflow: visible; }
.hosky-legs .leg { fill: var(--leg); }
.tile-crown { position: absolute; top: -12px; right: -6px; font-size: 18px; z-index: 2; transform: rotate(18deg); }
.leg { transform-box: fill-box; transform-origin: 50% 10%; }
.running .l1, .running .l4 { animation: legA 0.34s ease-in-out infinite alternate; }
.running .l2, .running .l3 { animation: legB 0.34s ease-in-out infinite alternate; }
@keyframes legA { from { transform: rotate(32deg); } to { transform: rotate(-32deg); } }
@keyframes legB { from { transform: rotate(-32deg); } to { transform: rotate(32deg); } }
.runner.running .hosky-img, .hero-dog.running .hosky-img { animation: hop 0.34s ease-in-out infinite alternate; }
@keyframes hop { from { transform: translateY(0) rotate(-3deg); } to { transform: translateY(-4px) rotate(3deg); } }

.runner.pooping .hosky { animation: squat 0.4s ease-in-out 2 alternate; }
.runner.pooping .leg, .runner.pooping .hosky-img { animation-play-state: paused; }
@keyframes squat { to { transform: scaleY(0.86) translateY(5px); } }
.runner.stumble .hosky { animation: tumble 0.6s ease-in-out; }
@keyframes tumble { 0% { transform: rotate(0); } 30% { transform: rotate(-24deg) translateY(-6px); } 60% { transform: rotate(12deg); } 100% { transform: rotate(0); } }
.runner.stumble::before { content: "💫"; position: absolute; top: -8px; right: -4px; font-size: 16px; z-index: 3; animation: floatUp 0.8s ease-out forwards; }
.runner.surge::after {
  content: ""; position: absolute; left: -24px; top: 30%; width: 22px; height: 18px;
  background: repeating-linear-gradient(0deg, transparent 0 4px, rgba(255,255,255,.9) 4px 6px);
  border-radius: 4px;
  animation: whoosh 0.5s ease-out forwards;
}
@keyframes whoosh { from { opacity: 1; transform: translateX(10px); } to { opacity: 0; transform: translateX(-10px); } }
@keyframes floatUp { to { opacity: 0; transform: translateY(-12px); } }

.poop {
  --p: 0;
  position: absolute; bottom: 2px;
  /* just behind the runner's tile, which would otherwise cover it */
  left: calc(var(--start-w) + var(--p) * (100% - var(--start-w) - var(--dog-w) - var(--finish-w) + 6px) - 30px);
  font-size: 26px; line-height: 1;
  z-index: 3;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.25));
  animation: poopIn 0.35s cubic-bezier(.3,1.8,.5,1), fadeOut 0.4s ease-in forwards;
  animation-delay: 0s, calc(var(--tick) * 1.3);
}
.poop::after { content: "〰"; position: absolute; left: 4px; top: -14px; font-size: 14px; color: #65a30d; opacity: .8; animation: floatUp 1s ease-out infinite; }
@keyframes poopIn { from { transform: scale(0) translateY(10px); } }
@keyframes fadeOut { to { opacity: 0; transform: scale(0.6); } }

.place-badge {
  position: absolute; top: -2px; left: -34px;
  font: 700 0.85rem Fredoka, sans-serif;
  padding: 3px 8px; border-radius: 999px;
  background: var(--gold); color: #fff;
  opacity: 0; transform: scale(0.4);
  transition: opacity 0.3s, transform 0.3s cubic-bezier(.3,1.6,.5,1);
}
.runner.finished .place-badge { opacity: 1; transform: scale(1); }
.lane.done .runway { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gold) 70%, transparent); }

.commentary {
  margin-top: 14px; display: grid; gap: 6px; min-height: 40px;
}
.comment {
  padding: 8px 14px; border-radius: 12px; font-size: 0.92rem;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  animation: slideIn 0.25s ease-out;
}
.comment:nth-child(n+2) { opacity: 0.7; }
.comment:nth-child(n+3) { opacity: 0.45; }
.comment.hl { font-weight: 600; }
.comment.mine { box-shadow: inset 3px 0 0 var(--accent), inset 0 0 0 1px var(--line); }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } }

/* ------------------------------------------------------------ result modal */
.modal {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 16px;
  background: rgba(30, 18, 5, 0.45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.25s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface);
  border-radius: 26px;
  padding: 26px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.35s cubic-bezier(.2,1.3,.4,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(0.96); } }
.result-headline { text-align: center; }
.result-headline h2 { margin: 0 0 4px; font-size: 2rem; }
.result-headline p { margin: 0; color: var(--muted); }
.result-headline.win h2 { color: var(--accent); }
.result-headline.lose h2 { color: var(--text); }

.podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 10px; margin: 22px 0 16px; }
.podium-col { display: grid; justify-items: center; gap: 4px; text-align: center; }
.podium-dog { width: 100%; max-width: 104px; }
.podium-img { display: block; width: 100%; aspect-ratio: 1; border-radius: 16px; image-rendering: pixelated; box-shadow: 0 8px 18px -8px rgba(0,0,0,.4); }
.podium-col.p1 .podium-dog { max-width: 128px; animation: bob 0.6s ease-in-out infinite alternate; }
.podium-name { font-weight: 600; font-size: 0.9rem; line-height: 1.2; min-height: 2.4em; display: grid; align-items: end; }
.podium-block {
  width: 100%; border-radius: 14px 14px 6px 6px;
  display: grid; place-items: center; gap: 2px;
  color: #fff; font-family: Fredoka, sans-serif; font-weight: 700;
}
.podium-col.p1 .podium-block { height: 96px; background: linear-gradient(180deg, #fbbf24, #f59e0b); }
.podium-col.p2 .podium-block { height: 72px; background: linear-gradient(180deg, #cbd5e1, #94a3b8); }
.podium-col.p3 .podium-block { height: 56px; background: linear-gradient(180deg, #fdba74, #c2703d); }
.podium-col.mine .podium-block { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--accent); }
.podium-medal { font-size: 1.5rem; line-height: 1; }
.podium-num { font-size: 0.8rem; opacity: 0.9; }

.standings { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.standings li {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 8px; align-items: center;
  padding: 7px 12px; border-radius: 10px; background: var(--surface-2); font-size: 0.92rem;
}
.standings li.mine { background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); font-weight: 600; }
.st-rank { color: var(--muted); font-weight: 600; }
.st-dist { color: var(--muted); font-variant-numeric: tabular-nums; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

#confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .race-hud { grid-template-columns: 1fr auto; }
  .trait-banner { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
  :root { --info-w: 170px; }
}
@media (max-width: 640px) {
  main { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .brand-name, .score-chip .muted { display: none; }
  .btn-wallet.connected span:not(.hosky-flag) { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .wallet-menu { position: fixed; left: 16px; right: 16px; top: 64px; width: auto; }
  :root { --info-w: 70px; --dog-w: 42px; --start-w: 26px; }
  .lane-head, .trait-meter i { display: none; }
  .lane-meta { width: 100%; }
  .lane-traits { flex-direction: column; gap: 3px; align-items: stretch; }
  .trait-meter b { width: 100%; }
  .lane-info { flex-direction: column; gap: 4px; justify-content: center; padding: 4px; }
  .lane.picked::after { left: 4px; transform: none; top: -9px; }
  .runway { height: 62px; }
  .poop { font-size: 20px; left: calc(var(--start-w) + var(--p) * (100% - var(--start-w) - var(--dog-w) - var(--finish-w) + 6px) - 24px); }
  .hud-msg { display: none; }
  .trait-banner { font-size: 1rem; padding: 8px 14px; }
  .legend-note { display: none; }
  .place-badge { left: -8px; top: -10px; font-size: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}
