/* Nunito (SIL OFL 1.1, see vendor/nunito/OFL.txt) */
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 600 900; font-display: swap; src: url(vendor/nunito/nunito-latin.woff2) format('woff2'); }
/* Aurora Snap: frosty white cards with an ice-blue edge on a night of snow; aurora green for the main buttons, gold
   for the camera's frame and good things. Every word on a card or floating over the night is at least 15 px and dark on
   light (or light on dark with a dark outline). */
:root {
  --cream: rgba(244, 248, 255, 0.95);
  --wood: #8fb0d8;
  --wood-dark: #2d4c7a;
  --ink: #13243f;
  --ink-soft: #3d5676;
  --accent: #0f7a55;
  --accent-dark: #084a33;
  --gold: #f2c14a;
  --shadow: 0 3px 0 rgba(20, 40, 80, 0.3), 0 10px 24px rgba(5, 10, 30, 0.35);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #0d1830; color: var(--ink);
  font-family: 'Nunito', system-ui, -apple-system, 'PingFang TC', 'Noto Sans TC', sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { -webkit-tap-highlight-color: transparent; }
button:focus { outline: none; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.card { background: var(--cream); border: 2px solid var(--wood); border-radius: var(--radius); box-shadow: var(--shadow); }
kbd {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 6px; border: 1.5px solid var(--wood); background: #fbfdff; box-shadow: 0 2px 0 var(--wood);
  font: 800 15px/1 'Nunito', sans-serif; color: var(--ink);
}

/* ---------- HUD: the score (and the Perfect streak), the spot (its name and its three photos), the spare film ---------- */
#hud {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: 16px; right: 16px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 10px;
  pointer-events: none; z-index: 5;
  padding-right: 164px; /* room for the corner buttons */
}
#hud > .card { padding: 6px 14px; display: flex; align-items: center; gap: 10px; min-height: 48px; }
.hud-left { justify-self: start; }
.hud-mid { justify-self: center; }
.hud-right { justify-self: end; }
.stat { display: flex; align-items: center; gap: 6px; font-size: 24px; }
.stat b { font-weight: 900; }
#hud-score { font-variant-numeric: tabular-nums; min-width: 34px; }
.chip { background: var(--gold); color: #2a1a00; font-weight: 900; font-size: 16px; padding: 2px 9px; border-radius: 999px; box-shadow: 0 2px 0 #b8861a; }
.chip.hot { background: var(--accent); color: #fff; box-shadow: 0 2px 0 var(--accent-dark); }
.chip.pop { animation: pop 0.35s ease-out; }
@keyframes pop { 40% { transform: scale(1.35); } }
.num { font-size: 16px; font-weight: 900; color: #fff; background: var(--wood-dark); padding: 1px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
#hud-name { font-size: 19px; font-weight: 900; white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
/* this spot's three photos: small picture frames; a taken one is filled (gold for three stars, paler for fewer), the
   one being taken now glows */
.pips { display: flex; align-items: center; gap: 5px; }
.pips i { display: block; width: 20px; height: 16px; border-radius: 3px; background: #e6eef9; border: 2px solid #9db4d4; transition: background 0.15s, transform 0.15s; position: relative; }
.pips i.s3 { background: var(--gold); border-color: #a06e0a; }
.pips i.s2 { background: #f9dc8c; border-color: #b8861a; }
.pips i.s1 { background: #c8d6ea; border-color: #5b7396; }
.pips i.s3::after, .pips i.s2::after, .pips i.s1::after { content: ''; position: absolute; inset: 3px 4px; border-radius: 1px; background: linear-gradient(160deg, #2fd68a 0 40%, #1b3b6a 41%); }
.pips i.cur { background: #fff6d6; border-color: #d9961a; box-shadow: 0 0 8px rgba(242, 193, 74, 0.9); animation: cur 0.9s ease-in-out infinite; }
@keyframes cur { 50% { transform: scale(1.15); } }
/* the spare film: small film cans; the used ones as pale dashed outlines (so they read without colour too) */
.film { display: flex; gap: 4px; }
.film i { display: block; width: 20px; height: 24px; transition: transform 0.25s, opacity 0.25s; }
.film svg { width: 100%; height: 100%; display: block; }
.film .can { fill: #1f6fb8; stroke: #0d2c55; stroke-width: 1.6; }
.film .cap { fill: #2a2f3a; }
.film .tab { fill: none; stroke: #5a3a1a; stroke-width: 1.6; }
.film .band { stroke: #ffe08a; stroke-width: 1.8; }
.film i.gone { transform: scale(0.82); }
.film i.gone .can { fill: #f4f8ff; stroke: #8aa0bd; stroke-dasharray: 2.5 2; }
.film i.gone .cap, .film i.gone .tab { fill: none; stroke: #b9c8dc; }
.film i.gone .band { stroke: #dbe4f0; }
.hud-right.shake { animation: shiver 0.35s linear 2; }
@keyframes shiver { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
/* the end card says all of it */
body[data-card="over"] #hud { visibility: hidden; }

.corner {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: 16px; display: flex; gap: 8px;
  /* over the title, pause and end cards (10), so music and sound can be switched there too; the leaderboard (20) covers them */
  z-index: 11;
}
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  background: var(--cream); border: 2px solid var(--wood); border-radius: 12px;
  box-shadow: 0 3px 0 rgba(20, 40, 80, 0.35); color: var(--ink); padding: 0;
}
.icon-btn:hover { background: #fff; }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(20, 40, 80, 0.35); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn .off { display: none; }
.icon-btn[aria-pressed="false"] { color: var(--ink-soft); opacity: 0.8; }
.icon-btn[aria-pressed="false"] .off { display: inline; }

/* ---------- the camera's frame over the spot ----------
   Four corners and two middle marks, drawn with a dark outline so they show on the bright lights and the dark sky
   alike. Calm white while the lights are away; pale gold as they come in; gold when a photo now would be Good;
   glowing white-gold when it would be Perfect; grey (dashed) with a cloud in front. */
.finder { position: fixed; left: 0; top: 0; z-index: 2; pointer-events: none; will-change: transform; --c: rgba(255, 255, 255, 0.85); --o: rgba(8, 16, 36, 0.75); --L: 34px; --w: 5px; }
.finder .cn { position: absolute; width: var(--L); height: var(--L); border: var(--w) solid var(--c); filter: drop-shadow(0 0 1.5px var(--o)) drop-shadow(0 0 1px var(--o)); transition: border-color 0.12s; }
.finder .tl { left: 0; top: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.finder .tr { right: 0; top: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 8px; }
.finder .bl { left: 0; bottom: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 8px; }
.finder .br { right: 0; bottom: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; }
.finder .mid { position: absolute; left: 50%; width: var(--w); height: 22px; margin-left: calc(var(--w) / -2); background: var(--c); border-radius: 3px; filter: drop-shadow(0 0 1.5px var(--o)) drop-shadow(0 0 1px var(--o)); }
.finder .mid.top { top: -4px; }
.finder .mid.bot { bottom: -4px; }
/* the swirl inside the frame: pale green; near the middle: green; right in the middle: glowing gold */
.finder[data-st="in"] { --c: #c6f6dc; }
.finder[data-st="near"] { --c: #4fe89a; }
.finder[data-st="near"] .cn, .finder[data-st="near"] .mid { filter: drop-shadow(0 0 1.5px #0b5a34) drop-shadow(0 0 6px #4fe89a); }
.finder[data-st="hot"] { --c: #ffd24a; }
.finder[data-st="hot"] .cn, .finder[data-st="hot"] .mid { filter: drop-shadow(0 0 1.5px #7a5206) drop-shadow(0 0 8px #ffd24a) drop-shadow(0 0 16px #ffc21a); }
.finder[data-st="cloud"] { --c: #aab4c4; }
.finder[data-st="cloud"] .cn { border-style: dashed; }
.finder[data-st="shot"] { --c: #fff; }
.finder.lens { --L: 30px; }
/* the self-timer: a round dial in the top right corner of the frame */
.finder .timer {
  position: absolute; right: -14px; top: -14px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  background: #fff4d6; color: #7a2a00; border: 3px solid #e2622a; font-weight: 900; font-size: 22px; line-height: 1;
  box-shadow: 0 2px 0 rgba(8, 16, 36, 0.5), 0 0 12px rgba(255, 140, 60, 0.6); animation: tick 1s ease-in-out infinite;
}
@keyframes tick { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.15); } }
.flash { position: fixed; left: 0; top: 0; z-index: 2; pointer-events: none; background: #fff; border-radius: 6px; }

/* ---------- the photo just taken, beside the frame (and the album page at the end of a spot) ---------- */
.photo {
  position: fixed; left: 0; top: 0; z-index: 3; pointer-events: none; will-change: transform;
  width: 200px; padding: 8px 8px 6px; background: #fbfdff; border-radius: 6px; text-align: center;
  box-shadow: 0 3px 0 rgba(20, 40, 80, 0.35), 0 12px 26px rgba(5, 10, 30, 0.5); border: 2px solid #c9d8ec;
  animation: photoIn 0.35s cubic-bezier(.2, 1.3, .5, 1);
}
@keyframes photoIn { from { opacity: 0; scale: 0.8; rotate: -6deg; } }
.photo .pic { position: relative; }
.photo { width: max-content; max-width: 220px; }
.photo canvas { display: block; width: auto; height: auto; max-width: 200px; max-height: 150px; margin: 0 auto; border-radius: 2px; background: #0e1a34; }
.photo.page canvas { max-width: 220px; max-height: 190px; }
.photo .cap { margin: 6px 0 0; font-size: 16px; font-weight: 800; line-height: 1.25; color: var(--ink); }
.photo .cap b { color: var(--accent); font-weight: 900; }
.photo .cap em { font-style: normal; color: #9a5a00; font-weight: 900; }
.photo .stars { color: #e0a000; letter-spacing: 1px; text-shadow: 0 1px 0 #7a4a00; }
.photo .stars .dim, .album-list .dim { color: #c6d2e2; text-shadow: none; }
.photo .rare { position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 999px; background: #e23a5a; color: #fff; font-size: 15px; font-weight: 900; box-shadow: 0 2px 0 #7a1024; }
.photo.perfect { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242, 193, 74, 0.55), 0 0 26px rgba(255, 214, 90, 0.75), 0 12px 26px rgba(5, 10, 30, 0.5); }
.photo.bad { border-color: #e2788a; }
.photo.bad .cap { color: #8a1024; }
.photo.bad canvas { filter: saturate(0.6) brightness(0.85); }
.photo.page { max-width: 240px; rotate: -2deg; }
.photo.page.perfect { rotate: 2deg; }

/* ---------- the message strip at the bottom: one message at a time ---------- */
.strip {
  position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 4;
  width: max-content; max-width: calc(100vw - 32px); padding: 8px 18px; pointer-events: none; text-align: center;
  font-size: 18px; font-weight: 800; line-height: 1.3; animation: stripIn 0.35s cubic-bezier(.2, 1.3, .5, 1);
}
.strip.rule { border-color: var(--accent); }
.strip.rule #strip-text { color: var(--accent-dark); font-weight: 900; }
@keyframes stripIn { from { opacity: 0; transform: translate(-50%, 10px) scale(0.95); } }

/* the finger that says "now" */
.press { position: fixed; left: 0; top: 0; z-index: 3; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.press .ic { width: 40px; height: 40px; animation: pressBob 0.5s ease-in-out infinite; filter: drop-shadow(0 2px 3px rgba(5, 10, 30, 0.5)); }
.press b { font-weight: 900; font-size: 18px; color: #fff4c2; --o: #1a2a4a; text-shadow: 1.5px 0 0 var(--o), -1.5px 0 0 var(--o), 0 1.5px 0 var(--o), 0 -1.5px 0 var(--o), 0 3px 6px rgba(5, 10, 30, 0.5); }
@keyframes pressBob { 50% { transform: translateY(5px) scale(0.92); } }
@media (prefers-reduced-motion: reduce) { .press .ic, .pips i.cur, .finder .timer { animation: none; } }
body[data-card="title"] .press, body[data-card="pause"] .press, body[data-card="over"] .press,
body[data-card="title"] .photo, body[data-card="over"] .photo, body[data-card="title"] .finder, body[data-card="over"] .finder { display: none; }

/* ---------- screens ---------- */
.overlay {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(200, 230, 255, 0.06), rgba(5, 10, 30, 0.35));
  z-index: 10; animation: fade 0.3s ease-out; overscroll-behavior: contain;
}
@keyframes fade { from { opacity: 0; } }
.panel {
  width: min(470px, 100%); padding: 26px 28px 22px; text-align: center;
  max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain;
  animation: rise 0.35s cubic-bezier(.2, 1.3, .5, 1);
}
.panel.small { width: min(340px, 100%); }
@keyframes rise { from { transform: translateY(16px) scale(0.97); } }
h1 { margin: 0 0 4px; font-size: 44px; font-weight: 900; letter-spacing: 0.5px; color: var(--ink); }
/* under the name: a little ribbon of northern lights */
h1::after { content: ''; display: block; width: 120px; height: 14px; margin: 6px auto 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 14'%3E%3Cpath d='M3 10C20 1 32 13 50 6s30-4 40 1 20 3 27-4' fill='none' stroke='%232fd68a' stroke-width='4' stroke-linecap='round'/%3E%3Cpath d='M3 12C22 5 34 14 52 9s28-2 38 2 20 1 27-3' fill='none' stroke='%237a6cff' stroke-width='2' stroke-linecap='round' opacity='.7'/%3E%3Ccircle cx='50' cy='6' r='3' fill='%23fff' stroke='%232fd68a' stroke-width='1.2'/%3E%3C/svg%3E") center / contain no-repeat; }
h2 { margin: 0 0 12px; font-size: 26px; font-weight: 900; }
.tag-line { margin: 8px 0 16px; color: var(--ink-soft); font-weight: 800; font-size: 16px; }
.how { list-style: none; margin: 0 0 20px; padding: 0; text-align: left; display: grid; gap: 9px; font-weight: 700; font-size: 15.5px; }
.how li { display: flex; align-items: center; gap: 10px; line-height: 1.35; }
.ic { width: 28px; height: 28px; flex: none; background-size: contain; background-repeat: no-repeat; background-position: center; }
/* a finger tapping */
.ic-tap { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Ccircle cx='10' cy='6' r='4' fill='none' stroke='%232fd68a' stroke-width='1.8' opacity='.9'/%3E%3Cpath d='M9 6v11l-2.4-1.9c-1-.7-2.3.5-1.5 1.6l4.2 5.6c.7 1 1.8 1.5 3 1.5h2.3c1.8 0 3.3-1.5 3.3-3.3V13c0-.9-.7-1.6-1.6-1.6s-1.5.6-1.5 1.5v-1.6c0-.9-.7-1.5-1.5-1.5s-1.4.6-1.4 1.4V6c0-.8-.6-1.3-1.3-1.3S9 5.3 9 6z' fill='%23fff1df' stroke='%2313243f' stroke-width='1.1' stroke-linejoin='round'/%3E%3C/svg%3E"); }
/* the frame's gold corners with the bright swirl in the middle */
.ic-aim { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Crect x='1' y='1' width='24' height='24' rx='5' fill='%2314223f'/%3E%3Cpath d='M2 15c5-8 8 2 12-4s7-4 10-2' fill='none' stroke='%232fd68a' stroke-width='2.6' stroke-linecap='round'/%3E%3Ccircle cx='13' cy='12' r='2.6' fill='%23fff'/%3E%3Cpath d='M3 8V3h5M23 8V3h-5M3 18v5h5M23 18v5h-5' fill='none' stroke='%23f2c14a' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"); }
/* a little photo album */
.ic-album { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Crect x='3' y='3' width='20' height='20' rx='3' fill='%231f6fb8' stroke='%230d2c55' stroke-width='1.4'/%3E%3Crect x='7' y='7' width='12' height='9' rx='1' fill='%23fff'/%3E%3Cpath d='M8 14c2-3 4 1 6-1s3-2 4-1' fill='none' stroke='%232fd68a' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M9 19.5l1.2-1 1.2 1M13 19.5l1.2-1 1.2 1' fill='none' stroke='%23f2c14a' stroke-width='1.4'/%3E%3C/svg%3E"); }
.big-btn {
  min-height: 48px; padding: 10px 34px; border: 0; border-radius: 14px;
  background: var(--accent); color: #fff; font-size: 20px; font-weight: 900; box-shadow: 0 4px 0 var(--accent-dark);
}
.big-btn:hover { filter: brightness(1.08); }
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-dark); }
.big-btn.ghost { background: #fbfdff; color: var(--ink); border: 2px solid var(--wood); box-shadow: 0 4px 0 var(--wood); }
.album-btn small { font-size: 15px; font-weight: 900; color: var(--ink-soft); margin-left: 4px; font-variant-numeric: tabular-nums; }
.col-btns { display: grid; gap: 10px; }
.best { margin: 14px 0 0; color: var(--ink-soft); font-weight: 800; font-size: 15px; min-height: 1em; }
.newbest { margin: -4px 0 10px; color: var(--accent); font-weight: 900; font-size: 18px; animation: pop 0.6s ease-out; }
.over-sub { margin: -6px 0 12px; color: var(--ink-soft); font-weight: 800; font-size: 15px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.stats div { background: #fbfdff; border: 1.5px solid #cbd9ec; border-radius: 12px; padding: 7px 8px; }
.stats dt { font-size: 15px; font-weight: 800; color: var(--ink-soft); }
.stats dd { margin: 0; font-size: 24px; font-weight: 900; }
.ends { margin: 0 0 6px; font-weight: 800; font-size: 15px; color: var(--ink-soft); }
.ends:empty { display: none; }
.score { margin: 4px 0 0; font-size: 18px; font-weight: 800; }
.score b { font-size: 30px; color: var(--accent); margin-left: 6px; }

/* ---------- online leaderboard and the album ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.row-btns .big-btn { padding-left: 22px; padding-right: 22px; }
.post { margin: 12px 0 0; padding: 12px 12px 10px; border-radius: 12px; background: rgba(251, 253, 255, 0.85); border: 1.5px dashed var(--wood); }
.post-rank { margin: 0 0 8px; font-weight: 800; font-size: 15px; }
.post-form { display: flex; gap: 8px; justify-content: center; }
.post-form input {
  flex: 1; min-width: 0; max-width: 180px; min-height: 44px; padding: 6px 12px; border-radius: 12px;
  border: 2px solid var(--wood); background: #fbfdff; color: var(--ink); font-family: inherit; font-weight: 800; font-size: 16px; line-height: 1.2; text-align: center;
}
.post-form input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.mid-btn {
  min-height: 44px; padding: 6px 18px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: #fff; font-family: inherit; font-weight: 900; font-size: 16px; line-height: 1; box-shadow: 0 3px 0 var(--accent-dark);
}
.mid-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-dark); }
.mid-btn:disabled { opacity: 0.6; cursor: default; }
.mid-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.post-msg { margin: 8px 0 0; min-height: 1.2em; font-size: 15px; font-weight: 700; color: var(--ink-soft); }
.post-msg:empty { display: none; }
.post-msg.bad { color: #8a1024; }
.overlay.top { z-index: 20; background: rgba(5, 10, 30, 0.55); }
/* solid, not see-through like the other cards: the end card is right behind it */
.board-panel { display: flex; flex-direction: column; padding-bottom: 20px; background: #f4f8ff; }
.board-panel .big-btn { align-self: center; }
.board-panel h2 { margin: 0 0 8px; }
.board-state { margin: 0; min-height: 1.4em; color: var(--ink-soft); font-weight: 700; font-size: 15px; }
.board-state:empty { display: none; }
.board-list { list-style: none; margin: 6px 0 0; padding: 0; text-align: left; max-height: min(46dvh, 380px); overflow: auto; overscroll-behavior: contain; border-radius: 10px; }
.board-list:empty { display: none; }
.board-list li { display: grid; grid-template-columns: 36px 30px 1fr auto; gap: 8px; align-items: center; padding: 7px 12px; font-weight: 800; font-size: 16px; border-bottom: 1px dashed rgba(45, 76, 122, 0.35); }
.board-list li:last-child { border-bottom: 0; }
.board-list .rk { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.board-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .sc { font-variant-numeric: tabular-nums; }
.board-list li.me { background: rgba(242, 193, 74, 0.3); border-radius: 8px; }
.board-me { margin: 8px 0 0; padding: 7px 12px; border-radius: 8px; background: rgba(242, 193, 74, 0.3); font-weight: 800; font-size: 15px; }
.board-account { margin: 14px 0 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; color: var(--ink-soft); }
.board-account small { font-size: 15px; }
/* the leaderboard's Privacy link: a 44 px tall target (inline padding: the text around it does not move) */
.board-account .plain-link { padding: 14px 4px; margin: 0 -4px; }
/* Google's sign-in button, light theme, as its branding guide asks */
.g-btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px 0 12px; border-radius: 22px;
  background: #fff; color: #1f1f1f; border: 1px solid #747775; text-decoration: none; font: 500 15px/20px Roboto, Arial, sans-serif;
}
.g-btn:hover { background: #f6f8fa; }
.g-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.g-btn svg { width: 18px; height: 18px; flex: none; }
.link-btn { min-height: 44px; padding: 2px 8px; border: 0; background: none; cursor: pointer; color: var(--accent-dark); font-family: inherit; font-weight: 800; font-size: 15px; line-height: 1; text-decoration: underline; }
.plain-link { color: var(--ink-soft); font-weight: 800; }
.plain-link:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.post-who { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 15px; font-weight: 700; color: var(--ink-soft); }
.post-who .or { display: flex; align-items: center; gap: 10px; width: 100%; font-size: 15px; }
.post-who .or::before, .post-who .or::after { content: ''; flex: 1; border-top: 1.5px dashed var(--wood); }
.av { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--wood); object-fit: cover; background: #fbfdff; flex: none; display: block; }
.av.dflt { display: grid; place-items: center; }
.av.dflt svg { width: 22px; height: 22px; }
.who { display: inline-flex; align-items: center; gap: 8px; }
/* the album: a page for every spot, its best photo and its stars (an empty page is a "?") */
.album-panel { width: min(640px, 100%); }
.album-list { list-style: none; margin: 10px 0 14px; padding: 2px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
  max-height: min(60dvh, 470px); overflow: auto; overscroll-behavior: contain; text-align: center; }
.album-list li { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 6px 5px; border-radius: 8px; background: #fbfdff; border: 1.5px solid #cbd9ec; }
.album-list li.empty { background: #e8eef7; border-style: dashed; }
.album-list .slot { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 3px; background: #14223f; display: grid; place-items: center; overflow: hidden; }
.album-list .slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-list .q { color: #8aa0bd; font-size: 26px; font-weight: 900; }
.album-list .rare { position: absolute; left: 4px; bottom: 4px; padding: 0 6px; border-radius: 999px; background: #e23a5a; color: #fff; font-size: 15px; font-weight: 900; }
.album-list b { font-size: 15px; font-weight: 900; line-height: 1.2; }
.album-list .st { font-size: 17px; color: #e0a000; letter-spacing: 1px; line-height: 1; }

/* ---------- the link to the other games (2026-11-27, the owner: no game led back to ossgolab.com) ----------
   Under the buttons of the title, pause and end cards: quiet, but a full-size target. Never on the game view. */
.more-games { display: flex; width: max-content; max-width: 100%; align-items: center; justify-content: center; gap: 5px; min-height: 44px; margin: 2px auto -8px; padding: 0 14px; border-radius: 14px;
  color: var(--ink-soft); font-weight: 800; font-size: 15px; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.more-games b { color: var(--ink); font-weight: 900; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--wood); }
.more-games svg { width: 16px; height: 16px; flex: none; transition: transform 0.15s; }
.more-games:hover { background: rgba(45, 76, 122, 0.12); color: var(--ink); }
.more-games:hover svg { transform: translateX(3px); }
.more-games:active { background: rgba(45, 76, 122, 0.22); }
.more-games:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
/* on the title card it is in the row of buttons: under them, or beside them on a short screen (just "More games") */
.row-btns > .more-games { flex: 0 0 100%; margin: -6px 0 -10px; }
@media (prefers-reduced-motion: reduce) { .more-games svg { transition: none; } }

/* on a touch screen the keys mean nothing: just "tap" */
@media (hover: none) and (pointer: coarse) { .how .key-only { display: none; } }
/* a tap never scrolls, zooms or goes back a page; the cards' panels and the lists still scroll */
html, body { touch-action: none; overscroll-behavior: none; }
.panel, .board-list, .album-list { touch-action: pan-y; }
button, a, input { touch-action: manipulation; }

/* ---------- the end card ---------- */
/* a wide screen: the end card stands on the right, and the night (the camp under the lights, the photos on a line) is
   fitted into the rest of the screen (main.js fitAround → view.js fitGoal) */
@media (min-width: 900px) and (min-height: 421px) {
  /* (under the corner buttons, which stay usable over it) */
  #over { place-items: center end; padding: 66px 24px 10px 16px; background: linear-gradient(90deg, rgba(5, 10, 30, 0) 40%, rgba(5, 10, 30, 0.35)); }
  #over .panel { max-height: calc(100dvh - 76px); }
  .over-card { width: min(430px, 44vw); padding: 16px 22px 14px; }
  .over-card h2 { margin-bottom: 4px; }
}

/* ---------- a phone held upright ---------- */
@media (max-width: 640px) {
  #hud { left: 10px; right: 10px; padding-right: 0; top: calc(max(12px, env(safe-area-inset-top)) + 52px); gap: 6px; }
  #hud > .card { padding: 4px 10px; min-height: 46px; gap: 7px; }
  .corner { right: 10px; }
  .stat { font-size: 21px; }
  #hud > .hud-left { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; }
  #hud > .hud-left .chip { font-size: 15px; padding: 0 7px; }
  #hud > .hud-mid { flex-direction: column; gap: 2px; padding-top: 3px; padding-bottom: 4px; }
  #hud-name { font-size: 16px; max-width: 150px; }
  .num { display: none; }
  .pips { gap: 4px; }
  .pips i { width: 17px; height: 13px; }
  .film i { width: 17px; height: 21px; }
  .film { gap: 3px; }
  h1 { font-size: 36px; }
  .panel { padding: 20px 18px 18px; }
  .strip { bottom: max(10px, env(safe-area-inset-bottom)); max-width: calc(100vw - 20px); padding: 7px 12px; font-size: 16px; line-height: 1.25; }
  .photo { max-width: 160px; padding: 6px 6px 5px; }
  .photo canvas { max-width: 148px; max-height: 100px; }
  .photo.page { max-width: 190px; }
  .photo.page canvas { max-width: 178px; max-height: 150px; }
  .photo .cap { font-size: 15px; }
  .finder { --L: 26px; --w: 4px; }
  .finder .timer { width: 34px; height: 34px; font-size: 19px; right: -10px; top: -12px; }
  .row-btns .big-btn { padding-left: 14px; padding-right: 14px; font-size: 18px; }
  .stats { gap: 6px; margin-bottom: 8px; } .stats div { padding: 4px 8px; } .stats dd { font-size: 21px; }
  .tag-line { margin-bottom: 12px; } .how { margin-bottom: 14px; gap: 8px; font-size: 15px; }
  .album-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
/* the cards start under the corner buttons; the end card sits at the bottom so the night shows above it */
@media (max-width: 640px) and (min-height: 421px) {
  .overlay:not(.top) { padding-top: calc(max(12px, env(safe-area-inset-top)) + 50px); padding-bottom: 8px; align-items: start; }
  .overlay:not(.top) .panel { max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - 58px); }
  #over { align-items: end; background: linear-gradient(180deg, rgba(5, 10, 30, 0) 30%, rgba(5, 10, 30, 0.35)); }
  .over-card { padding: 12px 14px 10px; }
  .over-card h2 { font-size: 22px; margin-bottom: 2px; }
  .over-card .newbest { margin: 0 0 4px; font-size: 16px; }
  .over-card .score { margin-top: 0; } .over-card .score b { font-size: 26px; }
  .over-card .best { margin-top: 2px; }
  .over-card .row-btns { margin-top: 8px; gap: 6px; }
  .over-card .row-btns .big-btn { flex: 1 1 28%; padding-left: 4px; padding-right: 4px; font-size: 16px; white-space: nowrap; }
  .over-card .album-btn small { margin-left: 2px; }
  .over-card .row-btns > .more-games { margin: -4px 0 -6px; }
}
/* a short window (1024×700, 375×667): the end card a little tighter, so it fits without scrolling */
@media (min-height: 421px) and (max-height: 800px) {
  .over-card .over-sub { display: none; }
  .over-card .stats { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .over-card .stats div { padding: 3px 4px; }
  .over-card .stats dt { line-height: 1.1; }
  .over-card .score b { font-size: 26px; }
  .over-card .best { margin-top: 2px; }
  .over-card .post-rank { margin-bottom: 5px; }
  .over-card .post-who { gap: 5px; margin-bottom: 6px; }
}
@media (min-height: 421px) and (max-height: 760px) {
  .over-card h2 { font-size: 22px; margin-bottom: 2px; }
  .over-card .newbest { margin: 0 0 6px; font-size: 16px; }
  .over-card .stats { gap: 6px; margin-bottom: 6px; }
  .over-card .stats div { padding: 3px 8px; }
  .over-card .stats dd { font-size: 20px; }
  .over-card .post { margin-top: 8px; padding: 8px 10px 7px; }
  .over-card .row-btns { margin-top: 10px; }
}

/* ---------- a phone on its side (740×360, 667×375): a low window ---------- */
@media (max-height: 480px) {
  .more-games { min-height: 44px; margin: 0 auto -8px; }
  .row-btns > .more-games { flex: 0 1 auto; margin: 0; align-self: center; padding: 0 8px; }
  .row-btns > .more-games .mg-at { display: none; }
  .row-btns > .more-games > span { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--wood); }
  /* the title, pause and end cards start 8 px under the corner buttons, so the buttons are never covered */
  .overlay:not(.top) { padding-top: calc(max(12px, env(safe-area-inset-top)) + 52px); }
  .overlay:not(.top) .panel { max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - 68px); }
  .album-list { max-height: calc(100dvh - 150px); }
}
@media (max-height: 420px) {
  /* the three HUD cards in one row that ends before the corner buttons; it stays within the 56 px the view keeps
     free at the top (view.js frame()) */
  #hud { top: max(6px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; justify-content: space-between; gap: 8px; padding-right: 156px; }
  #hud > .card { min-height: 44px; padding: 2px 9px; gap: 7px; }
  .corner { top: max(6px, env(safe-area-inset-top)); }
  .stat { font-size: 20px; }
  #hud-name { font-size: 16px; max-width: 120px; }
  .num { font-size: 15px; padding: 0 6px; }
  .pips i { width: 17px; height: 13px; }
  .film i { width: 16px; height: 20px; }
  /* the messages go to the bottom left (the frame stays in view) */
  .strip { left: 10px; right: auto; bottom: max(8px, env(safe-area-inset-bottom)); transform: none; width: auto; max-width: min(30vw, 230px);
    padding: 6px 10px; font-size: 15px; text-align: left; }
  @keyframes stripIn { from { opacity: 0; transform: translateY(10px); } }
  .photo { max-width: 150px; padding: 5px 5px 4px; }
  .photo canvas { max-width: 140px; max-height: 92px; }
  .photo.page { max-width: 170px; }
  .photo.page canvas { max-width: 160px; max-height: 120px; }
  .photo .cap { font-size: 15px; margin-top: 4px; }
  .finder { --L: 24px; --w: 4px; }
  .finder .timer { width: 32px; height: 32px; font-size: 18px; right: -10px; top: -10px; }
  .overlay:not(.top) { padding-top: calc(max(6px, env(safe-area-inset-top)) + 54px); padding-bottom: 8px; }
  .overlay:not(.top) .panel { max-height: calc(100dvh - max(6px, env(safe-area-inset-top)) - 62px); }
  .panel { padding: 12px 18px 10px; }
  #title h1 { font-size: 30px; line-height: 1.15; margin-bottom: 4px; }
  #title h1::after { margin-top: 3px; }
  #title .tag-line { display: none; }
  #title .how { gap: 4px; margin-bottom: 6px; font-size: 15px; }
  #title .how li { line-height: 1.2; }
  #title .ic { width: 24px; height: 24px; }
  #title .row-btns { margin-top: 8px; }
  #title .big-btn { min-height: 44px; padding-top: 6px; padding-bottom: 6px; padding-left: 16px; padding-right: 16px; }
  #title .best { margin-top: 6px; line-height: 1.2; }
  #title .best:empty { display: none; }
  .album-panel { padding: 10px 14px 10px; width: min(700px, 100%); }
  .album-panel h2 { font-size: 21px; margin-bottom: 2px; }
  .album-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 6px 0 8px; max-height: calc(100dvh - 130px); }
  .album-list li { padding: 4px; }
  /* the end card in two halves side by side (the run on the left; posting and the buttons on the right), so
     everything shows without scrolling */
  .over-card { width: min(720px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: center; padding: 8px 14px; }
  .over-card h2 { font-size: 21px; margin-bottom: 2px; }
  .over-card .over-sub { display: none; }
  .over-card .newbest { margin: 0 0 4px; font-size: 15px; }
  .over-card .stats { grid-template-columns: repeat(2, 1fr); gap: 4px; margin-bottom: 4px; }
  .over-card .stats div { padding: 2px 6px; display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
  .over-card .stats dd { font-size: 18px; }
  .over-card .ends { margin-bottom: 0; line-height: 1.25; }
  .over-card .score { font-size: 16px; margin: 0; } .over-card .score b { font-size: 23px; }
  .over-card .best { margin-top: 0; }
  .over-card .best:empty { display: none; }
  .over-card .post { margin: 0; padding: 6px 8px; }
  .over-card .post-rank { margin-bottom: 5px; line-height: 1.25; }
  .over-card .post-who { gap: 4px; margin-bottom: 5px; }
  .over-card .row-btns { margin-top: 8px; flex-wrap: wrap; gap: 6px; }
  .over-card .row-btns .big-btn { padding: 6px 8px; min-height: 44px; font-size: 16px; flex: 1 1 40%; white-space: nowrap; }
  .over-card .row-btns > .more-games { flex: 1 1 40%; margin: 0; }
}

/* ---------- the end card leaves the night in view ---------- */
/* a phone held upright: a shorter card (the run's numbers in two short rows, the extra line only on a tall phone), so
   the camp and the photos on the line show above it */
@media (max-width: 640px) and (min-height: 421px) {
  .over-card .over-sub { display: none; }
  .over-card h2 { font-size: 22px; }
  .over-card .stats { grid-template-columns: 1fr 1fr; gap: 4px 6px; margin-bottom: 4px; }
  .over-card .stats div { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding: 2px 8px; }
  .over-card .stats dt { line-height: 1.25; }
  .over-card .stats dd { font-size: 18px; }
  .over-card .ends { line-height: 1.25; }
  .over-card .post { margin-top: 6px; padding: 6px 10px 6px; }
  .over-card .post-rank { margin-bottom: 4px; line-height: 1.25; }
  .over-card .post-who { gap: 4px; margin-bottom: 5px; }
  .over-card .row-btns { margin-top: 8px; }
}
@media (max-width: 640px) and (min-height: 421px) and (max-height: 720px) {
  .over-card .ends, .over-card #o-best, .over-card .post-who .or { display: none; }
  .over-card { padding: 8px 12px 8px; }
  .over-card h2 { font-size: 20px; line-height: 1.15; }
  .over-card .newbest { margin: 0 0 2px; font-size: 15px; }
  .over-card .score b { font-size: 22px; }
  .over-card .post { margin-top: 4px; padding: 5px 8px; }
  .over-card .post-rank { margin-bottom: 4px; }
  .over-card .post-who { margin-bottom: 4px; }
  .over-card .row-btns { margin-top: 6px; }
}
/* a phone on its side: the card goes to the right, in two narrow halves, and the night shows on the left */
@media (max-height: 420px) {
  #over { place-items: center end; padding-right: 10px; background: linear-gradient(90deg, rgba(5, 10, 30, 0) 25%, rgba(5, 10, 30, 0.35)); }
  .over-card { width: min(500px, 66vw); grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 10px; padding: 6px 10px; }
  .over-card h2 { font-size: 20px; line-height: 1.15; }
  .over-card .ends { display: none; }
  .over-card .stats { grid-template-columns: 1fr; gap: 3px; }
  .over-card .stats dd { font-size: 17px; }
  .over-card .post-form input { max-width: none; }
  .over-card .mid-btn { padding: 6px 12px; }
}
