/* Solfege Scoops — an ice cream stand under the arcade sky.
   Rob's 2026 sky + ground (assets/bg) behind everything; play is one
   full-screen canvas with a light DOM HUD on top. Same type, navy ink and
   chroma palette as the rest of the arcade. Safe areas follow the house
   convention (scripts/safe-area-sweep/README.md). */

:root {
  --ss-ink: #1b233e;
  --ss-sky: #5bbfea;
  --ss-berry: #c2185b;
  --ss-berry-dark: #8e1145;
  --ss-cream: #fff8ec;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Nunito, system-ui, -apple-system, sans-serif;
  color: var(--ss-ink);
  background: #bfe6f6;
  -webkit-text-size-adjust: 100%;
}
body { overscroll-behavior: none; }

.ss-app { position: relative; min-height: 100svh; }

/* ── Menu ─────────────────────────────────────────────────────────────── */
.ss-menu {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(72px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background:
    url("bg/ground.png") center bottom / 100% auto no-repeat,
    url("bg/clouds-top.png") center top / 120% auto no-repeat,
    url("bg/sky.jpg") center / cover no-repeat,
    var(--ss-sky);
  background-attachment: fixed;
}
.ss-title {
  margin: 0;
  font-size: clamp(42px, 9vw, 72px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.5px;
  color: #173a5c;
  text-align: center;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.7);
}
.ss-title span { color: var(--ss-berry); }
.ss-sub { margin: 8px 0 0; font-size: 20px; font-weight: 800; color: #2c5877; text-align: center; }
.ss-hero { width: 360px; max-width: 100%; height: auto; aspect-ratio: 360 / 190; margin-top: 6px; }
.ss-quick-blurb { color: #fff; font-size: 16px; font-weight: 800; }

.ss-labels { display: flex; gap: 8px; margin: 4px 0 2px; }
.ss-pill {
  min-height: 48px;
  padding: 0 18px;
  border: 2px solid rgba(23, 58, 92, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: #2c5877;
  font: 800 16px/1 Nunito, system-ui, sans-serif;
  cursor: pointer;
}
.ss-pill[aria-pressed="true"] { background: #173a5c; border-color: #173a5c; color: #fff; }
.ss-pill:focus-visible { outline: 4px solid #183e74; outline-offset: 3px; }

.ss-levels-title { margin: 14px 0 12px; font-size: 22px; font-weight: 900; color: #173a5c; }
.ss-levels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 176px), 1fr));
  gap: 12px;
  width: min(960px, 100%);
}
.ss-level {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  column-gap: 10px;
  align-items: center;
  min-height: 92px;
  padding: 12px 12px 10px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.93);
  color: var(--ss-ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(23, 58, 92, 0.16);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.ss-level:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(23, 58, 92, 0.16); }
.ss-level:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(23, 58, 92, 0.16); }
.ss-level:focus-visible { outline: 4px solid #183e74; outline-offset: 3px; }
.ss-level-emoji { grid-row: 1 / span 3; font-size: 32px; text-align: center; }
.ss-level-name { font-size: 17px; font-weight: 900; line-height: 1.15; }
.ss-level-num { color: #4f7390; font-weight: 800; margin-right: 4px; }
.ss-level-dots { display: flex; flex-wrap: wrap; gap: 3px; margin: 3px 0 1px; }
.ss-level-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.08); }
.ss-level-blurb { font-size: 13px; font-weight: 700; color: #45607a; line-height: 1.25; }
.ss-level-stars { font-size: 15px; letter-spacing: 1px; color: #f2b72b; }
.ss-level-stars .off { color: #cdd8e2; }
.ss-level.is-locked { background: rgba(255, 255, 255, 0.6); cursor: not-allowed; }
.ss-level.is-locked :is(.ss-level-emoji, .ss-level-name, .ss-level-dots) { opacity: 0.5; }
.ss-level.is-paywalled { cursor: pointer; }

/* ── Play ─────────────────────────────────────────────────────────────── */
.ss-play {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--ss-sky);
  /* the canvas IS the controller: no scrolling, zooming or text selection */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.ss-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: ew-resize; }

/* Hearts + count sit under the chrome's Menu pill, clear of the falling lane. */
.ss-hud {
  position: absolute;
  top: calc(70px + env(safe-area-inset-top));
  left: max(12px, calc(12px + env(safe-area-inset-left)));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}
.ss-hearts {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 3px 0 rgba(23, 58, 92, 0.14);
  font-size: 22px;
  line-height: 1;
}
.ss-hearts .off { filter: grayscale(1); opacity: 0.35; }
.ss-hearts.is-hit { animation: ss-shake 360ms ease-out; }
@keyframes ss-shake { 20% { transform: translateX(-5px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } }
.ss-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 84px;
  padding: 6px 12px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 3px 0 rgba(23, 58, 92, 0.14);
}
.ss-count b { font-size: 26px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ss-count small { font-size: 12px; font-weight: 900; letter-spacing: 0.6px; text-transform: uppercase; color: #45607a; }
.ss-count.is-bump b { animation: ss-bump 260ms ease-out; }
@keyframes ss-bump { 40% { transform: scale(1.3); } }

/* The order ticket: top centre, between the chrome's Menu and Pause pills. */
.ss-ticket {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 200px);
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 3px 0 rgba(23, 58, 92, 0.14);
  pointer-events: none;
}
.ss-ticket-cone { font-size: 22px; }
.ss-ticket-notes { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.ss-note {
  --c: #9aa3b8;
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--c);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}
.ss-note.is-dark { color: #512d1b; text-shadow: none; }   /* yellow Mi */
.ss-note.is-done { opacity: 0.35; }
.ss-note.is-next { animation: ss-next 900ms ease-in-out infinite; outline: 3px solid var(--ss-ink); outline-offset: 2px; }
.ss-note.is-sing { animation: ss-sing 340ms ease-out; }
@keyframes ss-next { 50% { transform: scale(1.14); } }
@keyframes ss-sing { 40% { transform: scale(1.35); } }

.ss-toast {
  position: absolute;
  top: calc(150px + env(safe-area-inset-top));
  left: 50%;
  transform: translate(-50%, -8px);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(27, 35, 62, 0.86);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.ss-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.ss-banner {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  padding: 0 16px;
  color: #fff;
  font-size: clamp(34px, 7vw, 64px);
  font-weight: 900;
  text-align: center;
  line-height: 1.05;
  text-shadow: 0 4px 0 rgba(23, 58, 92, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}
.ss-banner.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ── Results ──────────────────────────────────────────────────────────── */
.ss-veil {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(23, 58, 92, 0.42);
  overflow-y: auto;
}
.ss-card {
  width: min(440px, 100%);
  padding: 22px 22px 18px;
  border-radius: 24px;
  background: #fff;
  text-align: center;
  box-shadow: 0 10px 0 rgba(23, 58, 92, 0.2);
  animation: ss-pop 280ms ease-out;
}
@keyframes ss-pop { from { transform: scale(0.9); opacity: 0; } }
.ss-card h2 { margin: 0; font-size: 30px; font-weight: 900; color: #173a5c; }
.ss-stars { margin: 6px 0 2px; font-size: 40px; letter-spacing: 4px; color: #f2b72b; }
.ss-stars .off { color: #dde5ec; }
.ss-big { display: flex; flex-direction: column; align-items: center; margin: 4px 0; }
.ss-big span { font-size: 56px; font-weight: 900; line-height: 1; }
.ss-big small { font-size: 15px; font-weight: 800; color: #45607a; }
.ss-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 10px 0; font-size: 15px; font-weight: 700; color: #45607a; }
.ss-stats b { color: var(--ss-ink); }
.ss-noterow { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 6px 0 10px; }
.ss-card button {
  display: block;
  width: 100%;
  min-height: 56px;
  margin-top: 10px;
  border: 0;
  border-radius: 16px;
  font: 900 20px/1 Nunito, system-ui, sans-serif;
  cursor: pointer;
}
.ss-card button:focus-visible { outline: 4px solid #183e74; outline-offset: 3px; }
.ss-next { background: #176877; color: #fff; }
.ss-next:hover { background: #145967; }
.ss-again { background: #fde7f0; color: var(--ss-berry-dark); }
.ss-menu-btn { background: transparent; color: #2c5877; min-height: 48px !important; font-size: 17px !important; }

/* Upright phones: the ticket drops to its own row under the chrome, and the
   hearts/count move under it. */
@media (max-width: 560px) {
  .ss-ticket { max-width: calc(100% - 24px); top: calc(66px + env(safe-area-inset-top)); }
  .ss-hud { top: calc(124px + env(safe-area-inset-top)); flex-direction: row; align-items: center; }
  .ss-hud.no-ticket { top: calc(70px + env(safe-area-inset-top)); }
  .ss-count { flex-direction: row; gap: 6px; min-width: 0; padding: 6px 12px; }
  .ss-count b { font-size: 22px; }
  .ss-note { min-width: 30px; height: 30px; font-size: 13px; }
  .ss-toast { top: calc(186px + env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
  .ss-note.is-next, .ss-note.is-sing, .ss-count.is-bump b, .ss-card, .ss-hearts.is-hit { animation: none; }
}
