/* Theme: "Pitchside on the beach". Navy and volt like a sports kit, on a sunny beach.
   To try another direction (e.g. Lifeguard), change the brand colours in this block
   and the matching BRAND colours in public/js/engine.js. */
:root {
  color-scheme: light;
  --navy: #0b2545;
  --navy-2: #163a66;
  --volt: #d4ff3a;
  --volt-dark: #b5e01c;
  --ink: var(--navy);
  --muted: #4d6480;
  --card: rgba(255, 253, 247, 0.93);
  --line: rgba(11, 37, 69, 0.1);
  --sky: #38bdf8;
  --sky-deep: #0369a1;
  --sea: #1fb5a8;
  --sun: #ffc93c;
  --teal: #1fb5a8;
  --red: #dc2626;
  --gold: #f5b700;
  --silver: #a9b6c3;
  --bronze: #cd7f32;
  --radius: 18px;
  --shadow: 0 10px 28px rgba(11, 37, 69, 0.16), 0 2px 6px rgba(11, 37, 69, 0.08);
  --head: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: #bfeaff;
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
[hidden] { display: none !important; }

/* ---------- Sunny beach backdrop ---------- */
#bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(circle at 86% 7%, #fff7c2 0 40px, rgba(255, 220, 90, 0.55) 41px 62px, rgba(255, 230, 120, 0) 130px),
    radial-gradient(ellipse 90px 26px at 30% 3%, rgba(255,255,255,.85) 60%, transparent 62%),
    radial-gradient(ellipse 60px 22px at 37% 1%, rgba(255,255,255,.85) 60%, transparent 62%),
    radial-gradient(ellipse 80px 22px at 75% 46%, rgba(255,255,255,.8) 60%, transparent 62%),
    linear-gradient(to bottom, #2fb4f5 0%, #6fd0ff 32%, #b9ecff 54%, #2cc6d0 54%, #18b3c6 64%, #ffe3a3 64%, #ffd486 84%, #f6c06c 100%);
}
#bg::before, #bg::after {
  content: ''; position: absolute; left: -130px; right: -130px; height: 28px;
  background-repeat: repeat-x; background-size: 120px 28px;
}
#bg::before {
  top: calc(64% - 14px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 28'%3E%3Cpath d='M0 14 Q15 2 30 14 T60 14 T90 14 T120 14 V28 H0Z' fill='%23ffe3a3'/%3E%3Cpath d='M0 14 Q15 2 30 14 T60 14 T90 14 T120 14' fill='none' stroke='%23ffffff' stroke-width='4'/%3E%3C/svg%3E");
  animation: surf 9s linear infinite;
}
#bg::after {
  top: calc(59% - 14px); opacity: .55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 28'%3E%3Cpath d='M0 14 Q15 6 30 14 T60 14 T90 14 T120 14' fill='none' stroke='%23ffffff' stroke-width='3'/%3E%3C/svg%3E");
  animation: surf 14s linear infinite reverse;
}
@keyframes surf { from { transform: translateX(0); } to { transform: translateX(120px); } }

/* ---------- App shell: top bar, content, bottom tab bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + var(--safe-top)) max(16px, calc((100% - 1040px) / 2 + 16px)) 10px;
  background: rgba(11, 37, 69, .95);
  -webkit-backdrop-filter: blur(12px) saturate(1.4); backdrop-filter: blur(12px) saturate(1.4);
  box-shadow: 0 4px 18px rgba(8, 90, 140, .15);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: #fff; }
.brand img { border-radius: 10px; }
.brand span { font-family: var(--head); font-style: italic; font-weight: 700; font-size: 24px; text-transform: uppercase; letter-spacing: .5px; }
.brand b { color: var(--volt); font-weight: 700; }
.star-pill {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .92); color: var(--ink); font-family: var(--head); font-weight: 600; font-size: 16px;
  text-decoration: none; box-shadow: 0 4px 12px rgba(14, 80, 120, .15);
}
.star-pill::first-letter { color: var(--gold); }

#app {
  max-width: 1040px; margin: 0 auto;
  padding: 6px 16px calc(110px + var(--safe-bottom));
}

.tabbar {
  position: fixed; z-index: 6; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + var(--safe-bottom));
  width: min(420px, calc(100% - 24px));
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5);
  border-radius: 26px; box-shadow: 0 12px 34px rgba(14, 80, 120, .22);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px 6px;
  border-radius: 20px; color: var(--muted); text-decoration: none; font-weight: 800; font-size: 12px;
  transition: background .15s, color .15s;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { background: var(--navy); color: var(--volt); }

/* ---------- Typography ---------- */
h1, h2, h3 { font-family: var(--head); font-style: italic; font-weight: 700; margin: 0; line-height: 1.05; letter-spacing: .2px; }
h1 { font-size: 36px; text-transform: uppercase; }
h2 { font-size: 28px; }
h3 { font-size: 22px; margin-bottom: 10px; }
p { margin: 0 0 10px; }
a { color: var(--sky-deep); font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }

.page-head { display: flex; align-items: center; gap: 12px; margin: 10px 2px 16px; }
.page-head h1 { color: #fff; text-shadow: 0 2px 12px rgba(8, 90, 140, .35); }
.greet { margin: 12px 2px 18px; color: #fff; text-shadow: 0 2px 12px rgba(8, 90, 140, .35); }
.greet h1 { font-size: 38px; }
.greet p { font-weight: 800; margin: 4px 0 0; opacity: .95; }

/* ---------- Cards & buttons ---------- */
.panel {
  background: var(--card);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin: 0 0 14px;
}

.btn {
  font-family: var(--head); font-size: 19px; font-weight: 600; line-height: 1; letter-spacing: .3px;
  color: var(--navy); background: var(--volt);
  border: 0; border-radius: 999px; cursor: pointer;
  padding: 13px 22px; min-height: 48px;
  box-shadow: inset 0 -3px 0 var(--volt-dark), 0 6px 16px rgba(11, 37, 69, 0.22);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; touch-action: manipulation; user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(0.97); }
.btn.small { font-size: 15px; padding: 9px 16px; min-height: 40px; }
.btn.big { font-size: 24px; min-height: 58px; font-style: italic; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line), 0 2px 6px rgba(11, 37, 69, .08); }
.btn.teal { background: var(--navy); color: #fff; box-shadow: 0 6px 16px rgba(11, 37, 69, .3); }
.btn.white { background: var(--volt); color: var(--navy); box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.btn.danger { background: #fff; color: var(--red); box-shadow: inset 0 0 0 1.5px rgba(220, 38, 38, .35); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.linkish { background: none; border: 0; padding: 4px 0; font: inherit; font-weight: 800; font-size: 14px; color: var(--sky-deep); cursor: pointer; text-decoration: none; }
.linkish[disabled] { opacity: .5; }

:focus-visible { outline: 3px solid var(--sky-deep); outline-offset: 2px; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

.back {
  width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .94); color: var(--ink); text-decoration: none; font-size: 28px; line-height: 1; font-weight: 700; padding-bottom: 3px;
  box-shadow: 0 4px 12px rgba(14, 80, 120, .18);
}

.avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  font-family: var(--head); font-weight: 600; font-size: 20px; color: #fff; text-decoration: none;
  background: var(--navy); color: var(--volt); box-shadow: 0 0 0 3px #fff;
}
.avatar.sm { width: 36px; height: 36px; font-size: 16px; box-shadow: 0 0 0 2px #fff, 0 4px 12px rgba(14, 80, 120, .2); }
.avatar.xs { width: 32px; height: 32px; font-size: 14px; box-shadow: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 26px; }
.avatar.xl { width: 72px; height: 72px; font-size: 30px; }

.stars { display: inline-flex; gap: 1px; font-size: 17px; line-height: 1; }
.stars i { font-style: normal; color: rgba(15, 47, 69, .16); }
.stars i.on { color: var(--gold); text-shadow: 0 1px 4px rgba(245, 183, 0, .45); }
.stars.lg { font-size: 26px; }

/* ---------- Play tab ---------- */
.hero {
  position: relative; display: block; border-radius: 26px; overflow: hidden; cursor: pointer;
  box-shadow: 0 16px 40px rgba(14, 80, 120, .28); margin-bottom: 22px;
  transition: transform .15s ease;
}
.hero:active { transform: scale(.99); }
.hero canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #9fe0ff; }
.hero-body {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 46px 18px 16px; color: #fff;
  background: linear-gradient(to top, rgba(11, 37, 69, .92) 0%, rgba(11, 37, 69, .6) 55%, rgba(11, 37, 69, 0) 100%);
}
.hero .tag {
  display: inline-block; font-weight: 800; font-size: 12px; letter-spacing: .5px; text-transform: uppercase;
  background: var(--volt); color: var(--navy); border-radius: 6px; padding: 3px 9px; margin-bottom: 6px;
}
.hero h2 { font-size: 34px; color: #fff; text-transform: uppercase; }
.hero-sub { font-size: 14px; font-weight: 700; opacity: .95; margin: 2px 0 8px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 12px; }
.section-head h2 { color: var(--ink); }
.section-head .muted { font-weight: 800; font-size: 14px; color: var(--ink); opacity: .7; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tile {
  position: relative;
  display: flex; flex-direction: column; text-align: left; padding: 0; border: 0; cursor: pointer;
  font: inherit; color: inherit; background: #fff; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(14, 80, 120, .2); }
.tile:active { transform: scale(.97); }
.tile canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; background: #9fe0ff; }
.tile-body { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 13px; }
.tile-body b { font-family: var(--head); font-style: italic; font-weight: 700; font-size: 21px; line-height: 1.05; }
.tile-body > span:not(.stars) {
  font-size: 13px; color: var(--muted); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tile .stars { margin-top: 4px; }

/* ---------- Game page ---------- */
.game-page { display: grid; gap: 0 18px; }
.banner { position: relative; border-radius: 26px; overflow: hidden; box-shadow: var(--shadow); margin: 6px 0 -28px; }
.banner canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #9fe0ff; }
.back.floating { position: absolute; top: 12px; left: 12px; }
.sheet { position: relative; padding-top: 20px; }
.sheet h1 { font-size: 38px; }
.sheet > p.muted { margin: 6px 0 16px; }
.sheet #best-line { margin: 10px 0 14px; }

.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px;
  background: rgba(15, 47, 69, .07); border-radius: 999px; margin-bottom: 4px;
}
.segmented button {
  border: 0; background: transparent; font-family: var(--head); font-weight: 600; font-size: 19px;
  color: var(--muted); padding: 10px 6px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s;
}
.segmented button[aria-checked="true"], .segmented button[aria-selected="true"] {
  background: var(--navy); color: var(--volt); box-shadow: 0 2px 8px rgba(11, 37, 69, .2);
}
#modes { background: rgba(255, 255, 255, .55); margin-bottom: 12px; }
#modes button { color: var(--ink); }
#modes button[aria-selected="true"] { color: var(--volt); }

.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 4px 0 10px 42px; min-height: 34px; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--head); font-style: italic; font-weight: 700; font-size: 18px; color: var(--volt);
  background: var(--navy);
}

/* ---------- Leaderboards ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: 4px; scrollbar-width: none; }
.tabs:empty { display: none; }
.tabs::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font-family: var(--body); font-size: 14px; font-weight: 800; padding: 8px 14px; cursor: pointer;
  border-radius: 999px; border: 0; background: rgba(255, 255, 255, .9); color: var(--ink);
  box-shadow: 0 2px 6px rgba(14, 80, 120, .1);
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.chip.soft { font-size: 13px; padding: 6px 12px; }
.chip.soft[aria-pressed="true"] { background: var(--teal); }
#board-desc { color: var(--ink); opacity: .8; font-weight: 700; }

.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; margin: 8px 0 14px; }
.place { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.place b { font-weight: 800; font-size: 14px; margin-top: 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place .pts { font-family: var(--head); font-weight: 600; font-size: 15px; color: var(--ink); opacity: .75; margin-bottom: 6px; }
.place .block {
  width: 100%; border-radius: 18px 18px 6px 6px; display: grid; place-items: start center; padding-top: 10px;
  font-family: var(--head); font-weight: 700; font-size: 28px; color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, .15);
  box-shadow: var(--shadow);
}
.place.p1 .block { height: 118px; background: linear-gradient(180deg, #ffd84d, var(--gold)); }
.place.p2 .block { height: 86px; background: linear-gradient(180deg, #d7dee6, var(--silver)); }
.place.p3 .block { height: 66px; background: linear-gradient(180deg, #e7a46a, var(--bronze)); }
.place.p1 .avatar { box-shadow: 0 0 0 4px var(--gold); }
.place.me b { color: var(--sky-deep); }

.ranks { list-style: none; padding: 0; margin: 0; }
.ranks li { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--line); }
.ranks li:last-child { border-bottom: 0; }
.ranks li.me { background: #e6f7ff; border-radius: 14px; border-bottom-color: transparent; }
.ranks li.gap { justify-content: center; color: var(--muted); padding: 2px; border: 0; }
.ranks .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ranks .who b { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranks .who small { color: var(--muted); font-size: 12px; font-weight: 700; }
.ranks .pts { font-family: var(--head); font-weight: 600; font-size: 18px; }
.rank-badge {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none;
  font-family: var(--head); font-weight: 600; font-size: 14px; background: rgba(15, 47, 69, .07);
}
.rank-badge.r1 { background: var(--gold); color: #fff; }
.rank-badge.r2 { background: var(--silver); color: #fff; }
.rank-badge.r3 { background: var(--bronze); color: #fff; }
.empty { color: var(--muted); text-align: center; padding: 14px 0; margin: 0; }
.footer { text-align: center; font-size: 13px; font-weight: 700; color: var(--ink); opacity: .7; margin-top: 14px; }

/* ---------- Me tab ---------- */
.profile { display: flex; align-items: center; gap: 16px; }
.profile p { margin: 2px 0 0; }
.join { background: var(--navy); color: #fff; border: 0; }
.join h2 { margin-bottom: 6px; }
.join .btn.ghost { background: rgba(255, 255, 255, .2); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .6); }
.join .btn:not(.ghost) { background: var(--volt); color: var(--navy); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 12px 8px; text-align: center; }
.stat b { display: block; font-family: var(--head); font-weight: 600; font-size: 24px; }
.stat span { font-size: 12px; font-weight: 800; color: var(--muted); }

.list { list-style: none; padding: 0; margin: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a, .list .switch-row { display: flex; align-items: center; gap: 10px; padding: 12px 2px; color: var(--ink); text-decoration: none; font-weight: 700; cursor: pointer; }
.list .pts { font-family: var(--head); font-weight: 600; min-width: 42px; text-align: right; }
.list .chev { font-size: 22px; color: var(--muted); line-height: 1; }

.switch {
  appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 999px; margin: 0; flex: none;
  background: rgba(15, 47, 69, .18); position: relative; cursor: pointer; transition: background .2s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s;
}
.switch:checked { background: var(--teal); }
.switch:checked::after { transform: translateX(20px); }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 14px; font-weight: 800; margin-bottom: 6px; }
input[type=text], input[type=email], input[inputmode=numeric], select {
  width: 100%; font: inherit; font-size: 17px; color: var(--ink);
  background: #fff; border: 1.5px solid rgba(15, 47, 69, .18); padding: 12px 14px; border-radius: 14px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--sky-deep); box-shadow: 0 0 0 4px rgba(14, 165, 233, .18); outline: none; }
input.code { font-family: var(--head); font-weight: 600; font-size: 30px; letter-spacing: 12px; text-align: center; }
label.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; font-size: 15px; cursor: pointer; }
label.check input { width: 22px; height: 22px; flex: none; margin-top: 1px; accent-color: var(--navy); }
.error { color: #9b1c1c; background: #fee2e2; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-weight: 700; }
.note { color: #6b4b00; background: #fff4cc; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.mail-icon {
  width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center;
  font-size: 30px; color: var(--volt); background: var(--navy);
}

/* ---------- Game stage ---------- */
#stage { position: fixed; inset: 0; z-index: 10; background: #7fd6ff; display: flex; justify-content: center; }
#canvas-host { position: relative; width: 100%; max-width: 480px; height: 100%; }
#canvas-host canvas { display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
#pause {
  position: absolute; bottom: calc(14px + var(--safe-bottom)); left: max(14px, calc(50% - 226px));
  width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: rgba(255, 255, 255, .88); color: var(--ink); box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
#pause svg { width: 22px; height: 22px; }
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(10, 60, 90, .35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.overlay-card { width: 100%; max-width: 380px; text-align: center; background: rgba(255, 255, 255, .96); animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
.overlay-card h2 { margin-bottom: 14px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.result-card h2 { margin: 4px 0 2px; }
.result-card p { margin-bottom: 4px; }
.result-stars { display: flex; justify-content: center; gap: 6px; font-size: 48px; line-height: 1; margin-top: -4px; }
.result-stars i { font-style: normal; color: rgba(15, 47, 69, .14); }
.result-stars i:nth-child(2) { font-size: 60px; transform: translateY(-8px); }
.result-stars i.on { color: var(--gold); text-shadow: 0 3px 10px rgba(245, 183, 0, .5); animation: star .5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes star { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }
.result-stars i.on:nth-child(2) { animation-name: star2; }
@keyframes star2 { from { transform: translateY(-8px) scale(0) rotate(-40deg); } to { transform: translateY(-8px) scale(1) rotate(0); } }
.big-score {
  font-family: var(--head); font-weight: 700; font-size: 64px; line-height: 1; margin: 8px 0 2px;
  color: var(--navy); font-style: italic; font-size: 76px;
}
#claim { margin: 10px 0 14px; }
.badge-text { font-family: var(--head); font-style: italic; font-weight: 700; font-size: 20px; }
.badge-text.best { color: var(--teal); }
.save-box { background: #f0fbff; border-radius: 16px; padding: 12px; }
.save-box p { font-weight: 800; }

#toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%);
  z-index: 50; background: var(--ink); color: #fff; font-weight: 700; font-size: 15px;
  padding: 12px 18px; border-radius: 999px; box-shadow: 0 10px 24px rgba(0, 0, 0, .2); max-width: 90vw; text-align: center;
}
#stage:not([hidden]) ~ #toast { bottom: calc(20px + var(--safe-bottom)); }

/* ---------- Larger screens ---------- */
@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .hero h2 { font-size: 40px; }
}
@media (min-width: 960px) {
  .hero { display: grid; grid-template-columns: 1.25fr 1fr; background: var(--navy); }
  .hero canvas { height: 100%; }
  .hero-body { position: static; background: none; padding: 30px 32px; display: flex; flex-direction: column; justify-content: center; }
  .hero h2 { font-size: 46px; }
  .game-page { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .banner { margin-top: 6px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile-body > span:not(.stars) { -webkit-line-clamp: 3; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.tile-badge {
  position: absolute; top: 10px; left: 10px; z-index: 1;
  background: var(--volt); color: var(--navy); border-radius: 6px; padding: 3px 9px;
  font-family: var(--head); font-style: italic; font-weight: 700; font-size: 15px; text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(11, 37, 69, .25);
}
