/* Sunny Street Letter Launch - HUD in the pinball's family: teal lacquer, gold trim, cream. */
:root {
  --teal: #126b69; --teal-2: #0d5553; --teal-glass: rgba(10, 70, 72, 0.78);
  --gold: #ecc877; --gold-2: #b8913e; --cream: #fff6e2; --amber: #ffb02e; --ink: #0b2d2e;
  --tap: 70px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #5fb4ee; font-family: "Trebuchet MS", "Avenir Next Rounded", system-ui, sans-serif;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
#yard { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; }
button { font: inherit; cursor: pointer; touch-action: manipulation; }

/* ---- top bar (the backbox) ---- */
.hud { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; padding: 8px 12px; border-radius: 26px;
  background: linear-gradient(180deg, rgba(22, 128, 124, 0.92), rgba(10, 80, 78, 0.92));
  border: 3px solid var(--gold); box-shadow: 0 8px 24px rgba(0, 30, 30, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.25); z-index: 5; max-width: calc(100vw - 16px); }
.round { min-width: var(--tap); height: var(--tap); border-radius: 50%; border: 3px solid var(--gold);
  background: radial-gradient(circle at 35% 30%, #25a19c, var(--teal-2)); color: var(--cream); font-size: 30px; position: relative;
  box-shadow: 0 3px 0 var(--gold-2), 0 6px 12px rgba(0, 0, 0, 0.25); display: grid; place-items: center; padding: 0; }
.round:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-2); }
.round.small { font-size: 28px; }
.round b { position: absolute; right: -6px; bottom: -6px; min-width: 28px; height: 28px; border-radius: 14px; background: var(--amber); color: var(--ink);
  font-size: 16px; display: grid; place-items: center; border: 2px solid var(--cream); }
.round[aria-pressed="false"] { opacity: 0.55; }
.hud-right { display: flex; gap: 10px; }
.picture { width: 86px; height: 86px; border-radius: 50%; border: 4px solid var(--gold); background: radial-gradient(circle at 40% 30%, #fffdf3, #ffe9b8);
  font-size: 52px; line-height: 1; position: relative; box-shadow: 0 0 0 4px rgba(255, 210, 90, 0.25), 0 6px 14px rgba(0, 0, 0, 0.25); padding: 0; }
.picture .speaker { position: absolute; right: -8px; bottom: -6px; font-size: 20px; font-style: normal; background: var(--teal); border: 2px solid var(--gold);
  border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; }
.picture.talk { animation: talk 0.6s ease-in-out 2; }
@keyframes talk { 50% { transform: scale(1.12) rotate(-4deg); } }

.slots { display: flex; gap: 10px; }
.slot { width: 70px; height: 76px; border-radius: 14px; display: grid; place-items: center; font: 800 46px Georgia, serif; color: var(--cream);
  background: linear-gradient(180deg, #06343a, #0a4a50); border: 3px solid var(--gold); box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.5); position: relative; }
.slot::after { content: ""; width: 16px; height: 16px; border-radius: 50%; background: rgba(159, 238, 255, 0.35); position: absolute; }
.slot.next { border-color: var(--amber); box-shadow: 0 0 0 4px rgba(255, 176, 46, 0.35), 0 0 22px rgba(255, 176, 46, 0.7), inset 0 3px 8px rgba(0, 0, 0, 0.5); animation: glow 1.2s ease-in-out infinite; }
.slot.next::after { background: rgba(255, 200, 90, 0.8); }
.slot.filled { background: linear-gradient(180deg, #0a5f66, #0d7a80); text-shadow: 0 0 14px #8ff3ff, 0 2px 0 #033; }
.slot.filled::after { display: none; }
.slot.pop { animation: pop 0.5s ease-out; }
.slots.long { gap: 6px; }
.slots.long .slot { width: 52px; height: 62px; font-size: 34px; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(255, 176, 46, 0.2), 0 0 30px rgba(255, 176, 46, 0.9), inset 0 3px 8px rgba(0, 0, 0, 0.5); } }
@keyframes pop { 0% { transform: scale(1.5); } 60% { transform: scale(0.9); } 100% { transform: scale(1); } }

.level { position: fixed; top: calc(max(10px, env(safe-area-inset-top)) + 112px); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 4; }
.level i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, 0.5); border: 2px solid var(--gold); }
.level i.on { background: var(--amber); }

/* ---- first-time "pull back" hand over the knob ---- */
.pull-hint { position: fixed; z-index: 4; pointer-events: none; font-size: 56px; display: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); }
.pull-hint.show { display: block; }
.pull-hint .hand { display: inline-block; animation: pull 1.6s ease-in-out infinite; }
@keyframes pull { 0%, 15% { transform: translate(0, 0); } 60% { transform: translate(-60px, 55px); } 70% { transform: translate(-60px, 55px) scale(0.9); } 100% { transform: translate(0, 0); } }

/* ---- overlays ---- */
.overlay { position: fixed; inset: 0; display: none; place-items: center; z-index: 10; background: rgba(8, 50, 52, 0.35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.overlay.show { display: grid; }
.card { background: linear-gradient(180deg, #16807c, #0c5552); border: 4px solid var(--gold); border-radius: 34px; padding: 26px 34px; text-align: center;
  color: var(--cream); box-shadow: 0 20px 50px rgba(0, 20, 20, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.25); max-width: calc(100vw - 32px); }
.welcome .sun { font-size: 64px; color: #ffd23a; text-shadow: 0 0 30px #ffb02e; line-height: 1; animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.logo { font: 800 40px Georgia, serif; letter-spacing: 1px; margin: 4px 0 10px; }
.logo small { display: block; font: 700 16px "Trebuchet MS", sans-serif; letter-spacing: 6px; color: var(--gold); }
.preview-row { display: flex; gap: 12px; justify-content: center; align-items: center; font-size: 46px; margin: 8px 0 18px; }
.blk { width: 54px; height: 58px; border-radius: 10px; border: 3px solid var(--gold); background: #0a4a50; font: 800 36px Georgia, serif; display: grid; place-items: center; text-shadow: 0 0 10px #8ff3ff; }
.play { width: 132px; height: 132px; border-radius: 50%; border: 5px solid var(--gold); color: var(--ink); font-size: 60px; padding-left: 10px;
  background: radial-gradient(circle at 35% 30%, #fff1a8, #ffd23a 45%, #e8a915); box-shadow: 0 6px 0 var(--gold-2), 0 12px 24px rgba(0, 0, 0, 0.3), 0 0 40px rgba(255, 210, 60, 0.6);
  animation: breathe 1.8s ease-in-out infinite; }
.play:active { transform: translateY(4px) scale(0.98); }
@keyframes breathe { 50% { transform: scale(1.06); } }
.celebrate .big-picture { font-size: 150px; line-height: 1.1; animation: dance 0.9s ease-in-out infinite; }
@keyframes dance { 0%, 100% { transform: rotate(-8deg) translateY(0); } 50% { transform: rotate(8deg) translateY(-18px); } }
.yay-word { display: flex; gap: 10px; justify-content: center; margin: 6px 0 20px; flex-wrap: wrap; }
.yay-word .blk { width: 74px; height: 80px; font-size: 52px; animation: pop 0.5s ease-out backwards; }
/* age-8 sentence round: a whole word per block (agetracks.js / sentences.js), so let it size to its text */
.yay-word .blk.sentence-w { width: auto; min-width: 74px; padding: 0 14px; font-size: 34px; }

.book { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; }
.book-head { display: flex; justify-content: space-between; align-items: center; font-size: 44px; margin-bottom: 10px; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
.sticker { background: radial-gradient(circle at 40% 30%, #fffdf3, #ffe9b8); border: 3px solid var(--gold); border-radius: 22px; padding: 8px 4px; color: var(--ink);
  transform: rotate(var(--r, 0deg)); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25); min-height: 120px; }
.sticker .e { font-size: 58px; line-height: 1.15; }
.sticker .w { font: 800 22px Georgia, serif; letter-spacing: 3px; }
.sticker.empty { background: rgba(255, 255, 255, 0.12); border-style: dashed; box-shadow: none; }

/* ---- the letter that flies from the animal into its slot ---- */
.fly-layer { position: fixed; inset: 0; pointer-events: none; z-index: 8; }
.fly { position: fixed; width: 70px; height: 76px; margin: -38px 0 0 -35px; border-radius: 14px; border: 3px solid var(--gold); background: #0d7a80; color: #fff;
  font: 800 46px Georgia, serif; display: grid; place-items: center; text-shadow: 0 0 14px #8ff3ff; box-shadow: 0 0 30px rgba(143, 243, 255, 0.8);
  transition: left 0.7s cubic-bezier(.3, .0, .3, 1), top 0.7s cubic-bezier(.5, -0.6, .6, 1), transform 0.7s ease; }

/* start card picks: reading level + look, picture buttons (>= 70px) */
.welcome { display: flex; gap: 28px; align-items: center; }
.picks { display: flex; flex-direction: column; gap: 14px; padding-left: 26px; border-left: 2px solid rgba(236, 200, 119, 0.45); }
.picks:has(.pick-row:empty:first-child) { display: none; }
.pick-row { display: flex; gap: 10px; justify-content: center; }
.pick-row:empty { display: none; }
.pick { min-width: 84px; min-height: 84px; border-radius: 22px; border: 3px solid rgba(236, 200, 119, 0.55); background: rgba(6, 52, 58, 0.55);
  color: var(--cream); display: grid; place-items: center; padding: 6px 8px; opacity: 0.72; transition: transform 0.15s, opacity 0.15s; }
.pick span { font-size: 44px; line-height: 1; }
.pick small { font-size: 12px; color: var(--gold); letter-spacing: 2px; margin-top: 4px; }
.pick.on { opacity: 1; border-color: var(--gold); background: radial-gradient(circle at 40% 30%, #25a19c, var(--teal-2)); box-shadow: 0 0 0 3px rgba(255, 210, 60, 0.45), 0 0 22px rgba(255, 210, 60, 0.5); transform: scale(1.06); }
.pick:active { transform: scale(0.96); }
.proto { position: fixed; right: 8px; bottom: 6px; font: 700 10px sans-serif; letter-spacing: 2px; color: rgba(255, 255, 255, 0.6); z-index: 3; }

@media (max-height: 520px) {
  :root { --tap: 70px; }
  .hud { gap: 8px; padding: 6px 8px; top: 6px; }
  .picture { width: 74px; height: 74px; font-size: 44px; }
  .slot { width: 58px; height: 70px; font-size: 38px; }
  .slots { gap: 6px; }
  .slots.long { gap: 4px; }
  .slots.long .slot { width: 40px; height: 52px; font-size: 28px; }
  .level { top: 92px; }
  .celebrate .big-picture { font-size: 96px; }
  .card { padding: 16px 22px; }
  .play { width: 110px; height: 110px; font-size: 50px; }
  .welcome .sun, .welcome .preview-row { display: none; }
  .welcome { gap: 18px; }
  .picks { gap: 10px; padding-left: 18px; }
  .pick { min-width: 72px; min-height: 72px; }
  .pick span { font-size: 36px; }
}
@media (max-width: 700px) {
  .slot { width: 50px; height: 62px; font-size: 34px; }
  .hud-right { gap: 6px; }
}

/* ---- portrait phone: the launcher needs width, so ask (with pictures) for landscape ---- */
.rotate { position: fixed; inset: 0; display: none; place-items: center; z-index: 50; background: linear-gradient(180deg, #5fb4ee, #bfe3f7 60%, #6cc24a); }
.rot-phone { font-size: 110px; line-height: 1; animation: tilt 2.4s ease-in-out infinite; }
.rot-arrow { font: 800 64px Georgia, serif; color: var(--gold); margin-top: 8px; }
@keyframes tilt { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (max-width: 700px) { .rotate { display: grid; } }

/* ---- 2D pilots (bubble.html, slice.html) ---- */
body.pilot #board { position: fixed; inset: 0; width: 100vw; height: 100vh; touch-action: none; display: block; }
body.pilot .welcome .sun { animation: none; }

/* owner 09-26 world map + level HUD */
.level { align-items: center; }
.level b { font-weight: 700; font-size: 18px; line-height: 1; color: #fff; background: rgba(6, 52, 58, 0.6); border: 2px solid var(--gold); border-radius: 14px; padding: 4px 10px; margin-right: 4px; text-shadow: 0 1px 2px #0006; }
.level i.now { box-shadow: 0 0 0 3px rgba(255, 210, 60, 0.6); }
.level i.boss { width: auto; height: auto; border: 0; background: none; font-style: normal; font-size: 18px; opacity: 0.55; }
.level i.boss.now, .level i.boss.on { opacity: 1; box-shadow: none; }
.yay-stars { display: flex; gap: 12px; justify-content: center; margin: -8px 0 14px; }
.yay-stars:empty { display: none; }
.yay-stars i { font-style: normal; font-size: 64px; line-height: 1; color: rgba(255, 255, 255, 0.25); animation: pop 0.5s ease-out backwards; }
.yay-stars i.on { color: #ffd23c; text-shadow: 0 0 18px rgba(255, 210, 60, 0.8), 0 3px 0 #b8860b; }
.card.map { max-width: min(96vw, 900px); max-height: 92vh; overflow: auto; padding: 16px 20px; }
.map-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.map-total { font-size: 34px; color: #ffd23c; font-weight: 700; text-shadow: 0 2px 0 #0005; }
.map-lands { display: flex; flex-direction: column; gap: 10px; }
.land { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 22px; background: rgba(6, 52, 58, 0.35); }
.land.here { background: rgba(255, 210, 60, 0.16); box-shadow: inset 0 0 0 2px rgba(255, 210, 60, 0.5); }
.land-e { font-size: 40px; width: 52px; text-align: center; }
.node { width: 76px; height: 82px; border-radius: 20px; border: 3px solid var(--gold); background: radial-gradient(circle at 40% 30%, #2bb3ad, #0c5552); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 700; font-size: 30px; line-height: 1; cursor: pointer; touch-action: manipulation; }
.node small { display: flex; gap: 1px; font-size: 15px; }
.node small i { font-style: normal; color: rgba(255, 255, 255, 0.25); }
.node small i.on { color: #ffd23c; }
.node.boss { background: radial-gradient(circle at 40% 30%, #ffcf5a, #c47a12); }
.node.cur { box-shadow: 0 0 0 4px rgba(255, 210, 60, 0.7), 0 0 22px rgba(255, 210, 60, 0.6); }
.node.locked { opacity: 0.4; cursor: default; border-color: rgba(236, 200, 119, 0.4); }
.node:active:not(.locked) { transform: scale(0.95); }
@media (max-height: 520px) { .node { width: 60px; height: 64px; font-size: 24px; border-radius: 16px; } .land-e { font-size: 30px; width: 40px; } .node small { font-size: 12px; } }

/* owner 09-26 ball picker (left edge) + split-ball tap hint */
.ball-pick { position: fixed; left: max(12px, env(safe-area-inset-left)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 12px; z-index: 5; }
.ball-pick:empty { display: none; }
.bk { width: 72px; height: 72px; border-radius: 50%; border: 4px solid rgba(236, 200, 119, 0.6); display: grid; place-items: center; font-size: 30px; line-height: 1;
  box-shadow: inset -8px -10px 16px rgba(0, 0, 0, 0.25), inset 6px 6px 12px rgba(255, 255, 255, 0.6), 0 4px 10px rgba(0, 0, 0, 0.25); touch-action: manipulation; }
.bk-plain { background: radial-gradient(circle at 35% 30%, #ffffff, #c9d3dc 60%, #8c99a6); }
.bk-split { background: radial-gradient(circle at 35% 30%, #ffd1e8, #ff6fb5 60%, #c23a80); }
.bk-bouncy { background: radial-gradient(circle at 35% 30%, #d4ffd0, #57d957 60%, #2a8f2a); color: #fff; font-weight: 700; }
.bk-heavy { background: radial-gradient(circle at 35% 30%, #b9c0cc, #5a5f6b 60%, #2b2e35); width: 84px; height: 84px; }
.bk.on { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255, 210, 60, 0.7), 0 0 20px rgba(255, 210, 60, 0.7), inset -8px -10px 16px rgba(0, 0, 0, 0.25); transform: scale(1.08); }
.bk.new:not(.on) { animation: bk-new 1.1s ease-in-out infinite; }
@keyframes bk-new { 50% { transform: scale(1.12); box-shadow: 0 0 0 5px rgba(255, 210, 60, 0.8), 0 0 26px rgba(255, 210, 60, 0.9); } }
.tap-hint { position: fixed; z-index: 6; pointer-events: none; opacity: 0; transform: translate(-50%, -50%); transition: opacity 0.15s; font-size: 54px; }
.tap-hint.show { opacity: 1; }
.tap-hint.show .hand { display: inline-block; animation: tap 0.45s ease-in-out infinite; }
@keyframes tap { 50% { transform: translateY(12px) scale(0.9); } }

/* ---- Letter Slice: a hand swiping side to side, teaching the slice gesture (reviewer 09-29 n0009) ---- */
.slice-hint { position: fixed; left: 50%; top: 46%; z-index: 6; pointer-events: none; opacity: 0; transition: opacity 0.2s; font-size: 58px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); }
.slice-hint.show { opacity: 1; }
.slice-hint.show .hand { display: inline-block; animation: slice-swipe 1s ease-in-out infinite; }
@keyframes slice-swipe {
  0%, 100% { transform: translate(-70px, 20px) rotate(-24deg); }
  50% { transform: translate(70px, -20px) rotate(24deg); }
}
@media (max-height: 520px) { .bk { width: 58px; height: 58px; font-size: 24px; } .bk-heavy { width: 66px; height: 66px; } .ball-pick { gap: 8px; } }

#music.off { opacity: 0.45; filter: grayscale(1); }

/* 10-12 reviewer notes: start card shows 4 looks + "more"; the opened row of 8 swipes sideways with a small arrow hint */
.look-wrap { position: relative; max-width: 100%; display: flex; justify-content: center; }
.pick-row.scroll { justify-content: flex-start; max-width: min(440px, 52vw); overflow-x: auto; overflow-y: hidden; touch-action: pan-x; -webkit-overflow-scrolling: touch;
  padding: 8px 34px 8px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.pick-row.scroll::-webkit-scrollbar { display: none; }
.pick-row.scroll .pick { flex: 0 0 auto; scroll-snap-align: start; }
.pick.more span { font-size: 30px; }
.scroll-hint { position: absolute; right: 0; top: 50%; width: 30px; height: 44px; margin-top: -22px; display: none; place-items: center; pointer-events: none;
  font: 800 34px/1 Georgia, serif; color: var(--ink); background: linear-gradient(90deg, rgba(255, 210, 60, 0), #ffd23a 55%); border-radius: 0 16px 16px 0; padding-left: 6px; }
.scroll-hint.show { display: grid; }
@media (max-height: 520px) {   /* short landscape phones: lift the start card clear of the Home button (bottom right) and trim the look row */
  #start.overlay { align-items: start; padding-top: 8px; }
  #look-row .pick { min-width: 64px; min-height: 64px; }
  #look-row .pick span { font-size: 32px; }
  .pick.more span { font-size: 26px; }
}
