/* Same palette and type as hellobillie.dev, so the game feels like part of the site. */
:root {
  --bg: #FBF6EE;
  --card: #FFFFFF;
  --ink: #1D1B19;
  --muted: #6B645C;
  --line: #EAE1D3;
  --tongue: #E2607F;
  --tongue-soft: #FCE3E9;
  --grass: #4F7D2E;
  --grass-soft: #E6EFDA;
  /* The yard (read by play.js for drawing). */
  --yard-a: #DCEBC8;
  --yard-b: #D2E4BB;
  --fur: #1D1B19;
  --blaze: #FFFFFF;
  --cheese: #F5C542;
  --cheese-dark: #D9A21E;
  --outline: transparent;
  --shadow: 0 1px 2px rgb(60 40 20 / 6%), 0 12px 32px -12px rgb(60 40 20 / 22%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --card: #211F1D;
    --ink: #F4EEE6;
    --muted: #ABA197;
    --line: #34302C;
    --tongue: #F0839C;
    --tongue-soft: #3E2229;
    --grass: #9CC57A;
    --grass-soft: #26301E;
    --yard-a: #4A5E37;
    --yard-b: #435632;
    --fur: #141210;
    --outline: rgb(244 238 230 / 45%);
    --blaze: #F4EEE6;
    --cheese: #F2C14E;
    --cheese-dark: #C9971F;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 12px 32px -12px rgb(0 0 0 / 60%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--tongue); outline-offset: 3px; border-radius: 6px; }

main {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 16px 32px;
  flex: 1;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 15px; color: var(--muted); text-decoration: none;
}
.eyebrow svg { width: 18px; height: 18px; fill: var(--tongue); }

header { margin-top: 20px; }
h1 { margin: 0; font-size: clamp(36px, 7vw, 56px); line-height: 1; letter-spacing: -.02em; font-weight: 800; }
h1 .name { color: var(--tongue); }
.lede { color: var(--muted); margin: 12px 0 0; max-width: 46ch; }

.layout { display: grid; gap: 28px; margin-top: 24px; }
@media (min-width: 760px) { .layout { grid-template-columns: minmax(0, 1fr) 260px; align-items: start; } }

.play { max-width: min(560px, calc(100svh - 250px)); width: 100%; min-width: 280px; }
.stats { display: flex; justify-content: space-between; align-items: baseline; margin: 0 4px 8px; font-size: 18px; }
.stat b { font-variant-numeric: tabular-nums; }
.stats .music {
  font-size: 14px; padding: 4px 12px; box-shadow: none;
  background: var(--card); color: var(--muted); border: 1px solid var(--line);
}
.stats .music:active { transform: none; box-shadow: none; }
.stats .music[aria-pressed="true"] { background: var(--tongue-soft); color: var(--tongue); border-color: transparent; }
.muted { color: var(--muted); }

.yard {
  position: relative;
  aspect-ratio: 1;
  border-radius: 22px;
  overflow: hidden;
  background: var(--yard-a);
  box-shadow: var(--shadow);
  border: 6px solid var(--card);
  touch-action: none; /* swipes steer Billie instead of scrolling the page */
  user-select: none;
  -webkit-user-select: none;
}
.yard.bonk { animation: bonk .35s ease; }
@keyframes bonk {
  0%, 100% { transform: none; }
  20% { transform: translate(-7px, 2px) rotate(-1deg); }
  40% { transform: translate(6px, -2px) rotate(1deg); }
  60% { transform: translate(-4px, 1px); }
  80% { transform: translate(2px, 0); }
}
canvas { display: block; width: 100%; height: 100%; }

.overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 20px; text-align: center;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.overlay[hidden] { display: none; }
.overlay .big { color: var(--ink); font-size: clamp(34px, 8vw, 52px); font-weight: 800; line-height: 1; margin: 0; }
.overlay .big.pink { color: var(--tongue); }
.overlay p { margin: 0; color: var(--muted); }
.overlay .sub b { color: var(--ink); }
.overlay .new-best {
  font-weight: 800; color: var(--tongue); background: var(--tongue-soft);
  padding: 2px 12px; border-radius: 999px;
}
.overlay .err { color: var(--tongue); font-weight: 700; }

button, .btn {
  font: inherit; font-weight: 700; cursor: pointer;
  border: 0; border-radius: 999px; padding: 10px 22px;
  background: var(--tongue); color: #fff;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--tongue) 60%, #000);
  transition: transform .08s ease, box-shadow .08s ease;
}
button:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--tongue) 60%, #000); }
button.quiet { background: none; color: var(--muted); box-shadow: none; padding: 4px 6px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
button.quiet:active { transform: none; }

.name-form { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 320px; }
.name-form label { width: 100%; font-weight: 700; }
.name-form input {
  flex: 1; min-width: 0; font: inherit; padding: 9px 14px;
  border: 2px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink);
}
.name-form input:focus { outline: none; border-color: var(--tongue); }
.name-form .err { width: 100%; margin: 0; color: var(--tongue); font-size: 15px; font-weight: 700; }

.hint { margin: 10px 4px 0; font-size: 14px; color: var(--muted); text-align: center; }

.board {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 16px 18px; box-shadow: var(--shadow);
}
h2 { font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; font-weight: 700; }
.scores { margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.scores li {
  counter-increment: rank;
  display: flex; gap: 10px; align-items: baseline;
  padding: 6px 0; border-bottom: 1px dashed var(--line);
}
.scores li:last-child { border-bottom: 0; }
.scores li::before { content: counter(rank); width: 1.6em; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }
.scores li:nth-child(1)::before { content: "🥇"; }
.scores li:nth-child(2)::before { content: "🥈"; }
.scores li:nth-child(3)::before { content: "🥉"; }
.scores .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scores .pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.scores li.mine { color: var(--tongue); font-weight: 700; }
.scores li.empty { color: var(--muted); counter-increment: none; }
.scores li.empty::before { content: none; }

.you { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.you b { color: var(--ink); }
.you .name-form { justify-content: flex-start; max-width: none; }

footer {
  max-width: 920px; width: 100%; margin: 0 auto;
  padding: 24px 16px max(28px, env(safe-area-inset-bottom));
  color: var(--muted); font-size: 14px;
  display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between;
  border-top: 1px dashed var(--line);
}

@media (prefers-reduced-motion: reduce) {
  .yard.bonk { animation: none; }
}
