/* Big Wave Island: the sea fills the screen. Colors: sea blue, sunny yellow, sand, coral (Beach Volleyball's).
   The joystick is under your left thumb; Pop up! (the big one) and Trick are on the right.
   surf-tour's menus have their own menus.css; this file is the game screen, the HUD and the controls. */
:root { --ink: #0f3550; --muted: #5c7686; --line: #d8e9f2; --sea: #1f8fd0; --sun: #ffd23f; --cream: #fffaf0; --coral: #ff6b6b; --panel: rgba(10, 50, 80, 0.72); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fd0f5; font-family: 'Fredoka', 'Trebuchet MS', sans-serif; color: var(--ink);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
button { font: inherit; cursor: pointer; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
.btn { font-weight: 700; font-size: 17px; border: 0; border-radius: 14px; padding: 10px 18px; background: linear-gradient(#3fb6f0, #1f7fc8); color: #fff; box-shadow: 0 3px 0 #135a92; }
.btn.alt { background: #e6f2f8; color: var(--ink); box-shadow: 0 3px 0 #b6d0de; } .btn.gold { background: var(--sun); color: var(--ink); box-shadow: 0 3px 0 #c49a12; }
.btn.big { font-size: 21px; padding: 12px 26px; }
.btn:active:not(:disabled) { translate: 0 2px; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
@keyframes pop { 0% { scale: 1; } 40% { scale: 1.6; } 100% { scale: 1; } }
@keyframes pulse { 50% { scale: 1.08; } }

/* ---- the top ---- */
#top { position: fixed; left: 0; right: 0; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; pointer-events: none;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); }
#top > * { pointer-events: auto; }
.tb { display: flex; gap: 6px; }
.round-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; background: var(--panel); color: #fff; font-size: 20px; border: 2px solid rgba(255, 255, 255, 0.45); }
#logo { font-weight: 700; font-size: 22px; color: #fff; background: linear-gradient(#3fc6f0, #1f7fc8); border: 3px solid #fff3c4; border-radius: 14px; padding: 2px 12px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2); white-space: nowrap; }
body:not([data-mode="menu"]) #logo { display: none; }
body[data-mode="ride"] #b-menu, body[data-mode="ride"] #b-how { display: none; }

/* ---- the HUD (hud.js): nothing stays on screen; each piece fades in while it matters ---- */
#hud { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.sh-fade { opacity: 0; transition: opacity 0.35s; } .sh-fade.on { opacity: 1; }
#sh-level { position: absolute; left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); translate: -50% 0; width: min(300px, 40vw); }
#sh-level svg { width: 100%; display: block; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.3)); }
.sh-board { fill: rgba(255, 255, 255, 0.82); stroke: #fff; stroke-width: 3; }
.sh-end { fill: #ff6b6b; opacity: 0.85; }
.sh-mid { stroke: #1f8fd0; stroke-width: 3; stroke-dasharray: 4 4; }
#sh-bubble { fill: #3fd17a; stroke: #fff; stroke-width: 3; transition: fill 0.2s; }
#sh-bubble.hot { fill: #ff4d5e; }
#sh-points { position: absolute; left: 50%; top: max(12px, env(safe-area-inset-top)); translate: -50% 0; display: flex; align-items: baseline; gap: 8px;
  background: var(--panel); border: 3px solid rgba(255, 255, 255, 0.6); border-radius: 18px; padding: 2px 16px; color: #fff; }
body[data-play="free"] #sh-points { display: none; } /* (Free Surf: no score, no clock: just ride) */
#sh-total { font-size: 30px; } #sh-combo { font-style: normal; font-weight: 700; font-size: 22px; color: var(--sun); }
#sh-combo:empty { display: none; }
#sh-pops { position: absolute; left: 50%; top: 13%; translate: -50% 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sh-pop { font-size: 30px; font-weight: 700; color: #fff; text-shadow: 0 3px 0 rgba(0, 40, 80, 0.55), 0 0 12px rgba(0, 60, 120, 0.4); animation: sh-up 1.5s ease-out forwards; white-space: nowrap; }
.sh-pop.k-air, .sh-pop.k-surf { color: var(--sun); } .sh-pop.k-tube { color: #8fe3ff; } .sh-pop.k-close { color: #7dffb0; font-size: 24px; } .sh-pop.k-pop { font-size: 24px; }
.sh-pop.k-letter { font-size: 44px; color: var(--sun); }
/* the computer surfer's speech pop, over their head (buddy.js) */
.buddy-say { position: absolute; translate: -50% -100%; white-space: nowrap; font-weight: 700; font-size: 17px; color: var(--ink); background: #fff; border-radius: 14px;
  padding: 4px 11px; box-shadow: 0 3px 0 rgba(0, 40, 80, 0.25); opacity: 0; transition: opacity 0.25s; }
.buddy-say::after { content: ''; position: absolute; left: clamp(14px, calc(50% + var(--tail, 0px)), calc(100% - 14px)); bottom: -7px; translate: -50% 0; border: 7px solid transparent; border-bottom: 0; border-top-color: #fff; }
.buddy-say.on { opacity: 1; }
.sh-pop.k-star { font-size: 34px; color: var(--sun); animation-duration: 2.2s; }
#sh-goal { position: absolute; left: 50%; top: calc(max(14px, env(safe-area-inset-top)) + 54px); translate: -50% 0; white-space: nowrap; font-weight: 700; font-size: 18px;
  color: #fff; background: rgba(10, 50, 80, 0.5); border-radius: 999px; padding: 4px 14px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.sh-pop.k-carve, .sh-pop.k-floater { color: #b8f5ff; font-size: 26px; }
.sh-pop.k-combo { font-size: 40px; color: var(--sun); letter-spacing: 0.02em; animation: sh-combo 1.5s ease-out forwards; }
@keyframes sh-combo { 0% { scale: 0.4; opacity: 0; } 15% { scale: 1.25; opacity: 1; } 30% { scale: 1; } 75% { opacity: 1; translate: 0 -10px; } 100% { opacity: 0; translate: 0 -30px; } }
@keyframes sh-up { 0% { opacity: 0; translate: 0 18px; scale: 0.7; } 15% { opacity: 1; translate: 0 0; scale: 1.15; } 30% { scale: 1; } 80% { opacity: 1; } 100% { opacity: 0; translate: 0 -40px; } }
#sh-set { position: absolute; left: 50%; top: max(14px, env(safe-area-inset-top)); translate: -50% 0; display: flex; align-items: flex-end; gap: 6px; background: rgba(10, 50, 80, 0.45); border-radius: 999px; padding: 2px 14px 4px; }
#sh-set span { font-size: calc(30px * var(--s, 1)); line-height: 1; opacity: 0.7; filter: saturate(0.7); }
#sh-set span.now { opacity: 1; filter: none; outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 10px; }
#sh-set span.big { filter: drop-shadow(0 0 6px rgba(255, 210, 63, 0.9)); }
#sh-letters { position: absolute; right: max(14px, env(safe-area-inset-right)); top: max(64px, calc(env(safe-area-inset-top) + 56px)); display: flex; gap: 4px; }
#sh-letters span { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 22px; background: rgba(10, 50, 80, 0.5); color: rgba(255, 255, 255, 0.35); }
#sh-letters span.got { background: var(--sun); color: var(--ink); }

/* ---- touch controls ---- */
#controls { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
body[data-mode="menu"] #controls .pad, body[data-mode="end"] #controls .pad, body[data-mode="end"] .joy-base { visibility: hidden; }
#joyzone { position: absolute; left: 0; bottom: 0; width: 50%; top: 120px; pointer-events: auto; touch-action: none; }
.joy-base { position: absolute; left: max(110px, calc(env(safe-area-inset-left) + 100px)); bottom: max(30px, env(safe-area-inset-bottom)); width: 130px; height: 130px; margin: -65px 0 0 -65px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.26)); border: 3px solid rgba(255, 255, 255, 0.7); opacity: 0.55; pointer-events: none; transition: opacity 0.2s; }
.joy-base:not(.on) { bottom: max(30px, env(safe-area-inset-bottom)); margin: 0 0 0 -65px; }
.joy-base.on { opacity: 1; bottom: auto; transition: none; margin-top: var(--half, -65px) !important; }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #ffe6a8); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); }
@media (pointer: fine) { .joy-base:not(.on) { display: none; } }
.pad { position: absolute; pointer-events: auto; border-radius: 50%; padding: 0; display: grid; place-items: center; align-content: center; color: #fff; touch-action: none; isolation: isolate;
  border: 3px solid rgba(255, 255, 255, 0.9); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.22); transition: box-shadow 0.15s; }
.pad span { font-size: 34px; line-height: 0.95; } .pad b { font-size: 14px; font-weight: 700; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.pad:active, .pad.down { translate: 0 3px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
/* Pop up!: the big one under your right thumb. While you wait, a ring fills round it as the wave lifts your tail
   (--ring), gold when it's time */
.popup { right: calc(max(18px, env(safe-area-inset-right)) + 8px); bottom: max(26px, env(safe-area-inset-bottom)); width: 124px; height: 124px; --ring: 0%;
  background: conic-gradient(#7dffb0 var(--ring), transparent 0), radial-gradient(circle at 35% 30%, #8fe3ff, #1f8fd0 72%); }
.popup::after { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8fe3ff, #1f8fd0 72%); z-index: -1; }
.popup span { font-size: 46px; }
.popup.now { border-color: var(--sun); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.22), 0 0 0 5px rgba(255, 210, 63, 0.7), 0 0 30px rgba(255, 190, 40, 0.9); animation: pulse 0.5s ease-in-out infinite; }
.popup.now::after { background: radial-gradient(circle at 35% 30%, #fff1a6, #f2b705 75%); }
.trick { right: calc(max(18px, env(safe-area-inset-right)) + 146px); bottom: max(22px, env(safe-area-inset-bottom)); width: 96px; height: 96px;
  background: radial-gradient(circle at 35% 30%, #ffb0c8, #e8437e 75%); }
/* (Pop up! as 🏊 Paddle! bobs while the wave is coming: tap, tap: hud.js popNow, 2026-10-27) */
body[data-mode="lineup"] .popup.ready[data-say="paddle"] { animation: pulse 0.7s ease-in-out infinite; }
/* (what Trick does right now glows: hud.js trickNow, 2026-10-27) */
body[data-mode="ride"] .trick.hot { box-shadow: 0 5px 0 rgba(0, 0, 0, 0.22), 0 0 0 4px rgba(255, 255, 255, 0.75), 0 0 26px rgba(255, 120, 180, 0.95); animation: pulse 0.9s ease-in-out infinite; }
body[data-mode="ride"] .popup { opacity: 0.55; }
body[data-mode="lineup"] .trick { opacity: 0.4; }
@media (hover: hover) and (pointer: fine) { .pad { opacity: 0.88; } }
@media (max-height: 430px) { .popup { width: 100px; height: 100px; } .popup span { font-size: 38px; } .trick { width: 78px; height: 78px; right: calc(max(18px, env(safe-area-inset-right)) + 120px); } .pad span { font-size: 28px; }
  .joy-base { scale: 0.85; } #logo { display: none; } #sh-pops { top: 16%; } .sh-pop { font-size: 24px; } }

/* ---- the photo boat's flash (the postcard moment) ---- */
#flash { position: fixed; inset: 0; z-index: 7; pointer-events: none; background: #fff; opacity: 0; box-shadow: inset 0 0 0 14px #fffaf0; }
#flash.on { animation: sh-flash 0.9s ease-out; }
@keyframes sh-flash { 0% { opacity: 0.55; } 20% { opacity: 0.2; } 100% { opacity: 0; } } /* (a quick soft click of a camera, not a white-out) */

/* ---- Captain Splash zips you round to another beach (a quick boat ride over the screen) ---- */
#zip { position: fixed; inset: 0; z-index: 8; pointer-events: none; visibility: hidden; overflow: hidden; }
#zip.on { visibility: visible; animation: zip-fade 1.6s ease-in-out forwards; }
.zip-sea { position: absolute; inset: 0; background: radial-gradient(ellipse 60px 8px at 20% 62%, rgba(255,255,255,.7), transparent), radial-gradient(ellipse 80px 9px at 70% 75%, rgba(255,255,255,.6), transparent), radial-gradient(ellipse 50px 7px at 45% 88%, rgba(255,255,255,.6), transparent), linear-gradient(#8fd0f5 0 45%, #1f8fd0 45% 100%); }
.zip-boat { position: absolute; top: 40%; left: -20%; font-size: 90px; scale: -1 1; filter: drop-shadow(0 6px 0 rgba(0, 40, 80, 0.3)); } /* (the emoji faces left: turned round to go right) */
#zip.on .zip-boat { animation: zip-boat 1.6s ease-in-out forwards; }
.zip-name { position: absolute; left: 0; right: 0; top: 22%; text-align: center; color: #fff; font-size: 40px; font-weight: 700; text-shadow: 0 4px 0 rgba(0, 40, 80, 0.45); }
@keyframes zip-fade { 0% { opacity: 0; } 15% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes zip-boat { 0% { left: -20%; rotate: 0deg; } 30% { rotate: -6deg; } 60% { rotate: 4deg; } 100% { left: 110%; rotate: 0deg; } }

/* ---- only watching someone else's wave (a heat): no buttons or stick to tap ---- */
body[data-watch="1"] #controls { display: none; }

/* ---- with friends online: the 🙌 button when a friend's beside you, the party combo ---- */
.five { right: calc(max(18px, env(safe-area-inset-right)) + 30px); bottom: calc(max(26px, env(safe-area-inset-bottom)) + 140px); width: 84px; height: 84px; background: radial-gradient(circle at 35% 30%, #fff1a6, #f2b705 75%); }
.five b { color: #4a3000; text-shadow: none; }
#party { position: fixed; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 52px); translate: -50% 0; z-index: 4; pointer-events: none; font-weight: 700; font-size: 22px; color: #fff; background: rgba(10, 50, 80, 0.6); border-radius: 999px; padding: 2px 14px; opacity: 0; transition: opacity 0.3s; }
#party.on { opacity: 1; }

/* ---- messages ---- */
#toast { position: fixed; left: 50%; bottom: max(170px, calc(env(safe-area-inset-bottom) + 160px)); translate: -50% 0; z-index: 14; background: var(--panel); color: #fff; font-size: 18px; font-weight: 600;
  border-radius: 18px; padding: 8px 18px; opacity: 0; transition: opacity 0.3s; pointer-events: none; text-align: center; width: max-content; max-width: calc(100vw - 40px); }
/* (width: max-content: with left: 50% a box only gets half the screen before it wraps, so on a phone messages squeezed into a narrow oval, 2026-10-30) */
#toast.on { opacity: 1; }
#banner { position: fixed; left: 50%; top: 32%; translate: -50% -50%; z-index: 6; pointer-events: none; text-align: center; font-size: 46px; font-weight: 700; color: #fff; line-height: 1.1;
  opacity: 0; scale: 0.6; transition: opacity 0.25s, scale 0.35s cubic-bezier(.2, 1.6, .4, 1); text-shadow: 0 4px 0 rgba(0, 40, 80, 0.45); white-space: nowrap; }
#banner.on { opacity: 1; scale: 1; }
#banner small { display: block; font-size: 22px; font-weight: 600; margin-top: 6px; }
#banner.gold { color: #ffe066; } #banner.sad { color: #e2f2ff; }

/* ---- the stand-in menus (until surf-tour's menus.js is in) ---- */
.sheet { position: fixed; z-index: 12; left: 50%; top: 50%; translate: -50% -50%; width: min(560px, calc(100vw - 20px)); max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); overflow-y: auto;
  background: var(--cream); border-radius: 22px; box-shadow: 0 20px 50px rgba(0, 40, 70, 0.4); padding: 18px 20px 20px; border: 4px solid var(--sun); text-align: center; }
.sheet h2 { margin: 0 0 6px; font-size: 25px; } .sheet p { margin: 6px 0; line-height: 1.4; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chips button { font-size: 16px; font-weight: 700; border: 3px solid var(--line); background: #fff; border-radius: 14px; padding: 7px 12px; color: var(--ink); }
.chips button.on { border-color: var(--sea); background: #dff3ff; }

/* ---- narrow screens (a phone held upright): the buttons out of each other's way ---- */
@media (max-width: 600px) {
  #logo { display: none; }
  #sh-set { top: calc(max(8px, env(safe-area-inset-top)) + 54px); }
  #sh-points { top: calc(max(8px, env(safe-area-inset-top)) + 54px); }
  #sh-goal { top: calc(max(8px, env(safe-area-inset-top)) + 104px); font-size: 16px; }
  .trick { right: calc(max(18px, env(safe-area-inset-right)) + 22px); bottom: calc(max(26px, env(safe-area-inset-bottom)) + 136px); width: 84px; height: 84px; }
  #banner { white-space: normal; width: calc(100vw - 32px); font-size: 32px; } #banner small { font-size: 17px; }
  /* (the balance level above Trick, not beside it: at +130 px its right end ran under the Trick button, 2026-10-24) */
  #sh-level { width: min(260px, 70vw); bottom: calc(max(26px, env(safe-area-inset-bottom)) + 232px); }
  /* (messages above Trick and the balance level: they ran over Trick's words at 170 px, 2026-10-30) */
  #toast { bottom: calc(max(26px, env(safe-area-inset-bottom)) + 268px); max-width: calc(100vw - 32px); }
}
/* (the "turn sideways" note on an upright phone: a few seconds each time a ride starts or the phone turns upright, then it
   fades, and never under a menu or in the way of a tap. Until 2026-10-24 it stayed on the whole time, over the welcome
   card's "Pick a beach!", which it took the tap from; like Lava Soccer's, Beach Volleyball's and BRGR's) */
@keyframes rotate-tip { 0%, 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
#rotate { display: none; }
@media (orientation: portrait) and (max-width: 600px) { #rotate { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--panel); color: #fff; text-align: center; padding: 8px; font-weight: 600; pointer-events: none; animation: rotate-tip 7s forwards; }
  #ui:has(.sv-menus:not(.sv-hidden)) ~ #rotate { display: none; } }
/* (a phone held sideways: the beach's name smaller, above the surfer; after the rules above so it wins) */
/* (and clear of the lesson's card, and messages low down between the joystick and the buttons, not on the surfer, 2026-10-30) */
@media (max-height: 430px) { #banner { top: 34%; font-size: 28px; } #banner small { font-size: 15px; margin-top: 3px; }
  #toast { bottom: max(10px, env(safe-area-inset-bottom)); font-size: 16px; max-width: max(260px, calc(100vw - 440px)); } }
