:root {
  --deep: #03131e;
  --deep-2: #0b2c3b;
  --cyan: #93d7d2;
  --cyan-soft: rgba(147, 215, 210, 0.16);
  --violet: #d1b77a;
  --orange: #e77b57;
  --white: #f3f4e9;
  --muted: #9bb0b4;
  --panel: rgba(6, 25, 35, 0.82);
  --line: rgba(180, 217, 211, 0.2);
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  color: var(--white);
  background: var(--deep);
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: #020e16; touch-action: manipulation; }
body { display: grid; place-items: center; overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button, canvas { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

.game-shell { position: relative; isolation: isolate; width: min(100vw, 430px); height: 100svh; min-height: 480px; overflow: hidden; background: transparent; box-shadow: 0 0 0 1px rgba(165,215,208,.14), 0 22px 70px rgba(0,0,0,.55); }
#gameCanvas { position: absolute; inset: 20% 0 0; width: 100%; height: 80%; border-radius: clamp(14px, 4vw, 22px) clamp(14px, 4vw, 22px) 0 0; touch-action: none; }

.screen, .overlay-panel, .hud, .boss-alert { position: absolute; z-index: 2; }
.asset-loading { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: #d8f3e8; color: #176078; font-size: 12px; font-weight: 900; letter-spacing: .2em; }
.asset-loading span { padding: 14px 18px; border: 2px solid rgba(23,96,120,.2); border-radius: 999px; background: rgba(255,248,222,.82); box-shadow: 0 8px 22px rgba(23,96,120,.12); }
.title-screen { inset: 20% 0 0; display: grid; place-items: center; padding: 28px; text-align: center; overflow: hidden; border-radius: clamp(14px, 4vw, 22px) clamp(14px, 4vw, 22px) 0 0; background: linear-gradient(180deg, rgba(5, 39, 52, .44), rgba(2, 14, 22, .88)), url("assets/chibi/reef-bg-bright.png") center / cover; }
.title-copy { position: relative; z-index: 3; animation: rise-in 700ms cubic-bezier(.2,.8,.2,1) both; }
.eyebrow { margin: 0 0 13px; color: var(--cyan); font-size: 10px; font-weight: 800; letter-spacing: .28em; }
h1, h2, p { margin: 0; }
h1 { display: grid; gap: 4px; margin: 0; font-size: clamp(44px, 11vw, 104px); font-weight: 900; line-height: .82; letter-spacing: -.07em; text-shadow: 0 3px 16px rgba(0, 0, 0, .35); }
h1 span { color: var(--white); }
h1 strong { color: var(--cyan); font-size: .72em; font-weight: 900; letter-spacing: -.06em; }
.tagline { margin: 25px 0 32px; color: #a6bfd3; font-size: 11px; font-weight: 800; letter-spacing: .27em; }
.title-actions { display: grid; justify-items: center; gap: 13px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 19px; min-width: 212px; min-height: 56px; padding: 0 24px; border: 1px solid rgba(218, 236, 216, .26); border-radius: 999px; background: linear-gradient(160deg, #b7ded2, #679f9c); color: #082630; font-size: 12px; font-weight: 900; letter-spacing: .16em; box-shadow: 0 10px 28px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255,255,255,.45), inset 0 -3px 0 rgba(16, 57, 61, .2); transition: transform 160ms ease, box-shadow 160ms ease; }
.primary-button:hover { transform: translateY(-3px); box-shadow: 0 14px 35px rgba(0, 0, 0, .28); }
.primary-button span { font-size: 19px; line-height: 0; }
.primary-button.compact { min-width: 184px; min-height: 48px; font-size: 11px; }
.text-button { min-height: 42px; padding: 6px 15px; color: #b6d5e1; background: transparent; font-size: 10px; font-weight: 800; letter-spacing: .22em; opacity: .86; }
.text-button:hover { color: var(--cyan); }
.title-meta { display: flex; justify-content: center; gap: 22px; margin-top: 34px; color: #6f91ab; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.title-meta b { margin-left: 6px; color: var(--white); }
.title-art { position: absolute; inset: 0; pointer-events: none; opacity: .85; }
.orb { position: absolute; display: block; border-radius: 50%; filter: blur(2px); animation: drift 7s ease-in-out infinite alternate; }
.orb-a { width: 34vw; height: 34vw; left: -12vw; top: 7vh; background: radial-gradient(circle, rgba(147, 215, 210, .12), transparent 67%); }
.orb-b { width: 42vw; height: 42vw; right: -14vw; bottom: 10vh; background: radial-gradient(circle, rgba(209, 183, 122, .1), transparent 67%); animation-delay: -2s; }
.orb-c { width: 15vw; height: 15vw; left: 20vw; bottom: 13vh; background: radial-gradient(circle, rgba(231, 123, 87, .11), transparent 67%); animation-delay: -4s; }
.fish-float { display: none; }
.fish-float-a { left: 11%; top: 22%; transform: rotate(-20deg); }
.fish-float-b { right: 13%; bottom: 22%; color: var(--violet); transform: rotate(18deg); animation-delay: -2.6s; }

.hud { inset: 20% 0 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; padding: max(17px, env(safe-area-inset-top)) max(17px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(17px, env(safe-area-inset-left)); }
.hud-top { display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.hud-brand { display: flex; align-items: center; gap: 8px; margin-right: auto; color: rgba(245,251,255,.86); font-size: 10px; font-weight: 900; letter-spacing: .15em; }
.brand-mark { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid rgba(69, 244, 232, .55); border-radius: 9px; color: var(--cyan); font-size: 12px; }
.hud-stat { display: grid; gap: 2px; min-width: 60px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 24, 32, .65); backdrop-filter: blur(9px); }
.hud-stat span, .energy-readout span, .combo-readout span { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .17em; }
.hud-stat b { font-size: 14px; letter-spacing: .02em; }
.score-stat b { color: var(--cyan); }
.time-stat b { color: var(--orange); }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4,24,32,.65); color: var(--white); font-size: 14px; pointer-events: auto; }
.icon-button:hover { border-color: var(--cyan); color: var(--cyan); }
.hud-bottom { display: flex; align-items: end; gap: 16px; pointer-events: auto; }
.special-button { position: relative; display: flex; align-items: center; gap: 9px; min-width: 165px; min-height: 51px; padding: 8px 12px; overflow: hidden; border: 1px solid rgba(209, 183, 122, .4); border-radius: 16px; background: rgba(13, 29, 35, .78); text-align: left; }
.special-button:not(:disabled):hover { border-color: var(--violet); box-shadow: 0 0 22px rgba(141,104,255,.22); }
.special-button:disabled { opacity: .72; cursor: default; }
.special-icon { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 10px; background: rgba(209,183,122,.18); color: #e4d2a0; font-size: 15px; }
.special-copy { display: grid; gap: 2px; position: relative; z-index: 1; }
.special-copy small { color: #cfbb87; font-size: 7px; font-weight: 800; letter-spacing: .14em; }
.special-copy b { font-size: 9px; letter-spacing: .12em; }
.special-meter { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(209,183,122,.2); }
.special-meter i { display: block; width: 0; height: 100%; background: var(--violet); box-shadow: 0 0 8px rgba(209,183,122,.5); transition: width 150ms ease; }
.combo-readout { display: grid; gap: 3px; min-width: 55px; padding-bottom: 8px; text-align: center; opacity: .2; transition: opacity 180ms ease, transform 180ms ease; }
.combo-readout.is-hot { opacity: 1; transform: translateY(-4px); }
.combo-readout b { color: var(--orange); font-size: 22px; }
.energy-readout { display: grid; grid-template-columns: auto 90px auto; align-items: center; gap: 8px; margin-left: auto; padding-bottom: 9px; }
.energy-track { width: 90px; height: 7px; overflow: hidden; border-radius: 99px; background: rgba(69,244,232,.15); }
.energy-track i { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--cyan); box-shadow: 0 0 11px var(--cyan); transition: width 180ms ease; }
.energy-readout b { min-width: 25px; color: var(--cyan); font-size: 11px; text-align: right; }
.hud-toast { position: absolute; top: 22%; left: 50%; transform: translate(-50%, -10px); color: var(--white); font-size: 16px; font-weight: 900; letter-spacing: .12em; white-space: nowrap; text-shadow: 0 2px 10px rgba(0,0,0,.6); opacity: 0; transition: opacity 180ms ease, transform 180ms ease; }
.hud-toast.show { opacity: 1; transform: translate(-50%, 0); }

.overlay-panel { top: 50%; left: 50%; width: min(520px, calc(100% - 34px)); transform: translate(-50%, -50%); padding: clamp(24px, 5vw, 40px); border: 1px solid rgba(180, 217, 211, .26); border-radius: 25px; background: linear-gradient(145deg, rgba(13,46,56,.95), rgba(4,22,30,.98)); box-shadow: 0 24px 80px rgba(0,0,0,.45), 0 0 0 100vmax rgba(1,10,16,.62); text-align: center; animation: panel-in 230ms ease both; }
.overlay-panel h2, .results-screen h2 { margin-bottom: 10px; font-size: clamp(28px, 7vw, 48px); line-height: .92; letter-spacing: -.05em; }
.panel-copy { color: var(--muted); font-size: 13px; }
.close-button { position: absolute; top: 14px; right: 17px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.06); color: var(--muted); font-size: 24px; line-height: 1; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 26px 0 28px; text-align: left; }
.how-grid > div { padding: 14px 13px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); }
.how-grid span { color: var(--cyan); font-size: 10px; font-weight: 900; }
.how-grid b { display: block; margin: 9px 0 7px; font-size: 10px; letter-spacing: .08em; }
.how-grid p { color: var(--muted); font-size: 11px; line-height: 1.5; }
.panel-actions { display: grid; justify-items: center; gap: 8px; margin-top: 25px; }

.results-screen { inset: 20% 0 0; display: grid; place-content: center; justify-items: center; padding: 28px; text-align: center; border-radius: clamp(14px, 4vw, 22px) clamp(14px, 4vw, 22px) 0 0; background: linear-gradient(180deg, rgba(5, 39, 52, .46), rgba(2, 14, 22, .9)), url("assets/chibi/reef-bg-bright.png") center / cover; animation: rise-in 400ms ease both; }
.result-score { margin-top: 18px; color: var(--cyan); font-size: clamp(60px, 16vw, 120px); font-weight: 900; line-height: .8; letter-spacing: -.08em; text-shadow: 0 0 28px rgba(69,244,232,.35); }
.result-label { margin: 15px 0 26px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .25em; }
.result-grid { display: grid; grid-template-columns: repeat(3, minmax(75px, 1fr)); gap: 10px; width: min(390px, 100%); margin-bottom: 29px; }
.result-grid div { display: grid; gap: 6px; padding: 13px 8px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7,22,47,.6); }
.result-grid span { color: var(--white); font-size: 18px; font-weight: 900; }
.result-grid small { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .11em; }
.boss-alert { top: calc(20% + 16px); left: 50%; display: flex; align-items: center; gap: 10px; transform: translate(-50%, -10px); padding: 10px 16px; border: 1px solid rgba(255,138,98,.45); border-radius: 13px; background: rgba(68,22,33,.8); box-shadow: 0 0 30px rgba(255,90,71,.18); animation: alert-in 350ms ease both; }
.boss-alert > span { color: var(--orange); font-size: 23px; }
.boss-alert div { display: grid; gap: 3px; text-align: left; }
.boss-alert b { font-size: 11px; letter-spacing: .1em; }
.boss-alert small { color: #ffb8a1; font-size: 8px; letter-spacing: .18em; }
[hidden] { display: none !important; }

@keyframes rise-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes panel-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes drift { from { transform: translate3d(-4vw, 0, 0) scale(.92); } to { transform: translate3d(4vw, 3vh, 0) scale(1.08); } }
@keyframes fish-drift { 0%,100% { translate: 0 0; } 50% { translate: 4vw -2vh; } }
@keyframes alert-in { from { opacity: 0; transform: translate(-50%, -16px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }

@media (max-width: 560px) {
  body { place-items: stretch; }
  .game-shell { width: 100vw; height: 100svh; min-height: 0; max-height: none; border-radius: 0; box-shadow: none; }
  #gameCanvas { border-radius: 0; }
  .hud { padding-inline: 12px; }
  .hud-brand { display: none; }
  .hud-top { gap: 6px; }
  .hud-stat { min-width: 55px; padding-inline: 8px; }
  .how-grid { grid-template-columns: 1fr; text-align: center; }
  .how-grid > div { padding: 11px; }
  .how-grid p { display: none; }
  .hud-bottom { gap: 8px; }
  .special-button { min-width: 0; width: min(149px, 43vw); min-height: 48px; padding-inline: 9px; }
  .energy-readout { grid-template-columns: auto minmax(38px, 1fr) auto; gap: 5px; min-width: 0; }
  .energy-track { width: 100%; min-width: 38px; }
  .energy-readout span { font-size: 7px; letter-spacing: .1em; }
  .primary-button { min-height: 52px; }
  .icon-button, .close-button { min-width: 44px; min-height: 44px; }
}

@media (max-width: 360px) {
  .hud { padding-inline: 8px; }
  .hud-top { gap: 4px; }
  .hud-stat { min-width: 48px; padding: 6px 6px; }
  .hud-stat span { font-size: 7px; }
  .hud-stat b { font-size: 12px; }
  .special-copy b { font-size: 8px; }
  .special-button { width: 40vw; }
  .energy-readout { gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}

/* Sunlit Coral Lagoon theme: a warm, playful direction replacing the dark neon treatment. */
:root {
  --deep: #0b5870;
  --deep-2: #168b9a;
  --cyan: #21bfae;
  --cyan-soft: rgba(33, 191, 174, .18);
  --violet: #f39a59;
  --orange: #e96e5d;
  --white: #fff8e6;
  --muted: #47798a;
  --panel: rgba(255, 248, 226, .94);
  --line: rgba(255, 255, 255, .62);
}

html, body { background: #d8f3e8; }
body { color: #164f63; }
.game-shell {
  background: linear-gradient(180deg, #ffeeb5 0%, #8de0ce 54%, #42b5b2 100%);
  box-shadow: 0 0 0 2px rgba(255,255,255,.7), 0 20px 60px rgba(23,100,117,.3);
}
.title-screen, .results-screen {
  background: linear-gradient(180deg, rgba(255,231,153,.18), rgba(13,99,122,.48)), url("assets/chibi/reef-bg-bright.png") center / cover;
}
.eyebrow { color: #fff3b0; text-shadow: 0 2px 8px rgba(15,86,102,.35); }
h1 { color: #fff9df; text-shadow: 0 4px 0 rgba(204,107,79,.25), 0 8px 18px rgba(16,90,107,.3); }
h1 span { color: #fff9df; }
h1 strong { color: #ff8869; }
.tagline { color: #fff4c9; text-shadow: 0 2px 8px rgba(13,84,103,.25); }
.primary-button {
  border-color: rgba(255,255,255,.8);
  background: linear-gradient(145deg, #ffe08a, #ff9b67);
  color: #744154;
  box-shadow: 0 9px 22px rgba(20,94,107,.25), inset 0 2px 0 rgba(255,255,255,.7), inset 0 -3px 0 rgba(195,87,75,.18);
}
.primary-button:hover { box-shadow: 0 13px 28px rgba(20,94,107,.3), inset 0 2px 0 rgba(255,255,255,.7); }
.text-button { color: #fff8dc; text-shadow: 0 2px 8px rgba(13,84,103,.3); }
.text-button:hover { color: #fff1a7; }
.title-meta { color: #e1fff0; }
.title-meta b { color: #fff8da; }
.hud-brand { color: #fffbe4; text-shadow: 0 2px 6px rgba(15,81,96,.25); }
.brand-mark { border-color: rgba(255,244,177,.9); background: rgba(255,255,255,.18); color: #fff0a5; }
.hud-stat, .icon-button {
  border-color: rgba(255,255,255,.72);
  background: rgba(255,248,222,.78);
  color: #18576b;
  box-shadow: 0 5px 14px rgba(18,96,111,.14), inset 0 1px 0 rgba(255,255,255,.8);
}
.hud-stat span, .energy-readout span, .combo-readout span { color: #568697; }
.score-stat b { color: #159e99; }
.time-stat b { color: #df6b58; }
.icon-button:hover { border-color: #fff0a5; color: #d45f59; }
.special-button {
  border-color: rgba(255,255,255,.78);
  background: rgba(255,248,222,.86);
  color: #255b6c;
  box-shadow: 0 6px 16px rgba(18,96,111,.15);
}
.special-button:not(:disabled):hover { border-color: #ffe28e; box-shadow: 0 0 20px rgba(255,192,100,.35); }
.special-icon { background: #ffe3a1; color: #df745b; }
.special-copy small { color: #d8785c; }
.special-meter { background: rgba(235,125,91,.18); }
.special-meter i { background: #f29659; box-shadow: 0 0 9px rgba(242,150,89,.65); }
.special-button { display: none !important; }
.combo-readout b { color: #ee775b; }
.energy-track { background: rgba(255,255,255,.48); }
.energy-track i { background: #23c5af; box-shadow: 0 0 10px rgba(35,197,175,.65); }
.energy-readout b { color: #138f8f; }
.hud-toast { color: #fff7c8; text-shadow: 0 2px 10px rgba(10,83,101,.5); }
.overlay-panel {
  border-color: rgba(255,255,255,.84);
  background: linear-gradient(145deg, rgba(255,249,225,.98), rgba(218,249,232,.97));
  color: #174f63;
  box-shadow: 0 22px 70px rgba(20,91,107,.28), 0 0 0 100vmax rgba(17,95,111,.35);
}
.overlay-panel .eyebrow { color: #df745b; text-shadow: none; }
.panel-copy, .how-grid p { color: #47798a; }
.close-button { background: rgba(23,94,108,.08); color: #39768a; }
.how-grid > div, .result-grid div { border-color: rgba(23,139,154,.18); background: rgba(255,255,255,.42); }
.how-grid span { color: #df745b; }
.how-grid b { color: #1b566a; }
.result-score { color: #159e99; text-shadow: 0 0 25px rgba(33,191,174,.3); }
.result-label, .result-grid small { color: #47798a; }
.result-grid span { color: #1b566a; }
.boss-alert { border-color: rgba(255,255,255,.7); background: rgba(226,103,82,.9); box-shadow: 0 0 30px rgba(229,104,84,.3); }
.boss-alert > span, .boss-alert small { color: #fff1b5; }

/* Commercial portrait UI pass: a quiet 20% header void, clear game branding,
   compact glass HUD chips and stronger action hierarchy. */
/* :root wins over html (see the first :root block), so name it here too —
   otherwise screens taller than the 900px shell show a teal band below. */
:root, html, body { background: #06151b; }
body { min-height: 100vh; min-height: 100svh; color: #f7f1d7; }
.game-shell { background: transparent; box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 22px 70px rgba(0,0,0,.42); }
.play-title { position: absolute; top: calc(20% + 10px); left: 50%; z-index: 4; display: grid; justify-items: center; gap: 2px; width: max-content; transform: translateX(-50%); pointer-events: none; text-align: center; filter: drop-shadow(0 4px 8px rgba(0,0,0,.24)); }
.play-title span { color: rgba(255,248,211,.78); font-size: 8px; font-weight: 900; letter-spacing: .34em; }
.play-title b { color: #fff8d4; font-size: clamp(18px, 5vw, 27px); font-weight: 950; letter-spacing: .08em; line-height: .9; text-shadow: 0 2px 0 rgba(188,91,72,.24); }
.play-title::after { content: ""; width: 34px; height: 3px; margin-top: 5px; border-radius: 99px; background: linear-gradient(90deg, #ff9b67, #ffe08a); box-shadow: 0 0 12px rgba(255,191,118,.55); }
.hud { padding-top: clamp(54px, 8vh, 72px); padding-inline: 14px; }
.hud-top { gap: 7px; }
.hud-stat, .icon-button { border-color: rgba(255,255,255,.58); background: rgba(255,248,222,.86); box-shadow: 0 6px 15px rgba(18,96,111,.16), inset 0 1px 0 rgba(255,255,255,.9); backdrop-filter: blur(12px); }
.hud-stat { min-width: 57px; padding: 6px 9px; border-radius: 13px; }
.hud-stat span { font-size: 7px; letter-spacing: .14em; }
.hud-stat b { color: #18576b; font-size: 13px; }
.score-stat b { color: #159e99; }
.time-stat b { color: #df6b58; }
.icon-button { width: 38px; height: 38px; color: #18576b; }
.hud-bottom { gap: 8px; margin: 0 -2px; padding: 9px 10px max(10px, env(safe-area-inset-bottom)); border: 1px solid rgba(255,255,255,.62); border-bottom: 0; border-radius: 20px 20px 0 0; background: linear-gradient(180deg, rgba(255,248,222,.72), rgba(222,248,232,.88)); box-shadow: 0 -8px 24px rgba(17,94,109,.13); backdrop-filter: blur(12px); }
.combo-readout { min-width: 48px; padding-bottom: 0; }
.combo-readout span { font-size: 7px; letter-spacing: .14em; }
.combo-readout b { font-size: 20px; }
.energy-readout { min-width: 0; padding: 7px 9px; border: 1px solid rgba(23,139,154,.18); border-radius: 13px; background: rgba(255,255,255,.48); }
.energy-track { height: 8px; }
.hud-toast { top: 30%; font-size: 14px; letter-spacing: .1em; }
.asset-loading { background: #06151b; color: #fff0b0; }
.asset-loading span { border-color: rgba(255,240,176,.24); background: rgba(22,80,94,.88); color: #fff0b0; }
.primary-button { min-height: 54px; border-color: rgba(255,255,255,.85); background: linear-gradient(145deg, #ffe08a, #ff9b67); box-shadow: 0 10px 24px rgba(20,94,107,.24), inset 0 2px 0 rgba(255,255,255,.72), inset 0 -3px 0 rgba(195,87,75,.18); }
.overlay-panel { border-radius: 22px; box-shadow: 0 22px 70px rgba(20,91,107,.28), 0 0 0 100vmax rgba(4,28,36,.56); }

/* The in-game brand is a single authored transparent banner, so it reads as
   one expressive mark instead of a rigid text strip across the reef. */
.play-title { top: calc(20% + 3px); width: min(90vw, 390px); filter: drop-shadow(0 7px 14px rgba(0,0,0,.34)); }
.play-title img { display: block; width: 100%; height: auto; max-height: 82px; object-fit: contain; }
.play-title::after { display: none; }

/* Keep the combo readout in a clear sightline. The cannon is deliberately
   bottom-aligned, so the combo chip floats in the upper-left of the playfield
   instead of competing with the pedestal and barrel. */
.combo-readout { position: absolute; left: 14px; top: 132px; z-index: 6; min-width: 54px; padding: 7px 9px; border: 1px solid rgba(255,255,255,.42); border-radius: 13px; background: rgba(255,248,222,.78); box-shadow: 0 6px 15px rgba(18,96,111,.14); backdrop-filter: blur(10px); opacity: .72; }
.combo-readout.is-hot { transform: translateY(-2px); opacity: 1; }

/* Keep the requested clean, straight playfield edge. The logo is the element
   that crosses the edge, using the 20% header void as breathing room. */
#gameCanvas, .title-screen, .results-screen { -webkit-clip-path: none; clip-path: none; }
.title-screen, .results-screen { overflow: visible; }
.play-title { top: clamp(8px, calc(20% - 74px), 54px); width: min(128vw, 540px); max-width: none; }
.play-title img { max-height: 150px; }

/* Shared brand lockup for the opening and results states. It stays in the
   same top rail as the live-game logo so the product feels like one screen. */
.screen-brand { position: absolute; top: -46px; left: 50%; z-index: 4; width: min(106vw, 420px); transform: translateX(-50%); pointer-events: none; filter: drop-shadow(0 6px 12px rgba(0,0,0,.3)); animation: screen-brand-float 4.8s ease-in-out infinite; }
.screen-brand img { display: block; width: 100%; height: auto; max-height: 130px; object-fit: contain; }
.title-screen .title-copy { padding-top: clamp(46px, 8vh, 72px); }
.results-screen { padding-top: clamp(90px, 15vh, 128px); }

/* Bottom controls no longer paint a panel over the bottom-aligned cannon.
   Combo and energy are both parked in the upper playfield corners. */
.hud-bottom { min-height: 0; height: 0; margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; backdrop-filter: none; pointer-events: none; }
.energy-readout { position: absolute; top: 96px; right: 10px; z-index: 6; margin: 0; padding: 7px 9px; border: 1px solid rgba(255,255,255,.72); border-radius: 13px; background: rgba(4,35,43,.9); color: #e9fff1; box-shadow: 0 7px 18px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.22); backdrop-filter: blur(12px); pointer-events: auto; }
.energy-readout span { color: #d1f4e6; }
.energy-readout b { color: #fff1ab; }
.energy-readout { grid-template-columns: 21px minmax(24px, 1fr) 22px; gap: 5px; }
.energy-readout > span { display: block; width: 30px; overflow: hidden; white-space: nowrap; transform: scaleX(.7); transform-origin: left center; }
.energy-readout b { min-width: 0; width: 22px; }
.result-score { color: #ffe28b; text-shadow: 0 3px 0 rgba(10,55,66,.72), 0 0 28px rgba(255,173,91,.52); -webkit-text-stroke: 1px rgba(10,55,66,.28); }

@media (max-width: 560px) {
  .hud { padding-inline: 10px; }
  .hud-top { gap: 5px; }
  .hud-stat { min-width: 53px; padding-inline: 7px; }
  .play-title { top: calc(20% - 66px); width: min(142vw, 520px); }
  .play-title img { max-height: 132px; }
  .screen-brand { top: -40px; width: min(82vw, 280px); }
  .screen-brand img { max-height: 84px; }
  .title-screen .title-copy { padding-top: 54px; }
  .results-screen { padding-top: 106px; }
  .combo-readout { left: 10px; top: 122px; }
  .energy-readout { top: 88px; right: 10px; }
}

/* Final HUD placement: keep the lower controls in their requested corners,
   away from the top brand strip and the score row. */
.hud-top { display: grid; grid-template-columns: auto auto 1fr auto auto; justify-content: stretch; transform: translateY(-12px); }
.hud-brand { display: none; }
.hud-top > :nth-child(2) { grid-column: 1; }
.hud-top > :nth-child(3) { grid-column: 2; }
.hud-top > :nth-child(4) { grid-column: 4; }
.hud-top > :nth-child(5) { grid-column: 5; }
.combo-readout { top: auto; left: 14px; bottom: max(16px, env(safe-area-inset-bottom)); }
.combo-readout { transform: scale(.7); transform-origin: left bottom; }
.combo-readout.is-hot { transform: scale(.7) translateY(-2px); }
.energy-readout { top: auto; right: 10px; bottom: max(16px, env(safe-area-inset-bottom)); width: min(114px, calc(100% - 30px)); grid-template-columns: auto minmax(30px, 1fr) auto; gap: 5px; }
.energy-track { width: 100%; min-width: 0; justify-self: stretch; transform: none; }
.play-title { top: clamp(44px, calc(20% - 34px), 90px); }
.screen-brand { top: 8px; }

@media (max-width: 560px) {
  .hud-top { transform: translateY(-10px); }
  .combo-readout { left: 10px; bottom: max(14px, env(safe-area-inset-bottom)); }
  .energy-readout { right: 10px; bottom: max(14px, env(safe-area-inset-bottom)); width: min(105px, calc(100% - 30px)); grid-template-columns: auto minmax(26px, 1fr) auto; gap: 4px; }
  .energy-readout { grid-template-columns: 20px minmax(22px, 1fr) 20px; }
  .energy-readout > span { width: 28px; }
  .energy-readout b { width: 20px; }
  .play-title { top: clamp(38px, calc(20% - 32px), 74px); }
  .screen-brand { top: -42px; width: min(112vw, 400px); }
  .screen-brand img { max-height: 120px; }
}

@keyframes screen-brand-float {
  0%, 100% { transform: translate(-50%, 0) scale(1); filter: drop-shadow(0 6px 12px rgba(0,0,0,.3)); }
  50% { transform: translate(-50%, -5px) scale(1.018); filter: drop-shadow(0 10px 18px rgba(0,0,0,.38)); }
}

/* Progress, identity and progression UI */
.player-name { display: grid; gap: 5px; width: min(220px, 72vw); margin: 16px auto 4px; text-align: left; }
.player-name span { color: rgba(255,248,211,.7); font-size: 8px; font-weight: 900; letter-spacing: .16em; }
.player-name input { width: 100%; padding: 9px 12px; border: 1px solid rgba(255,255,255,.45); border-radius: 12px; outline: none; background: rgba(4,35,43,.56); color: #fff8d8; font: 800 12px/1 "Avenir Next", sans-serif; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.player-name input::placeholder { color: rgba(255,248,216,.5); }
.player-name input:focus { border-color: #ffe08a; box-shadow: 0 0 0 3px rgba(255,224,138,.18); }
.title-actions #leaderboardButton { grid-column: 1 / -1; }
.level-progress { position: absolute; top: clamp(94px, 14vh, 132px); left: 50%; z-index: 3; width: min(340px, calc(100% - 28px)); transform: translateX(-50%); pointer-events: none; }
.level-progress-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; color: rgba(232,255,247,.86); font-size: 8px; font-weight: 900; letter-spacing: .14em; text-shadow: 0 2px 8px rgba(0,0,0,.45); }
.level-progress-head b { color: #f8fff0; font-size: 9px; letter-spacing: .05em; }
.level-progress-track { height: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,.6); border-radius: 999px; background: rgba(3,35,48,.72); box-shadow: 0 3px 10px rgba(0,0,0,.2); }
.level-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2ea8ff, #58e5ff); box-shadow: 0 0 12px rgba(73,198,255,.7); transition: width 220ms ease, background 180ms ease; }
.level-progress-track.is-cleared i { background: linear-gradient(90deg, #ffd15c, #fff0a0); box-shadow: 0 0 14px rgba(255,211,92,.8); }
.level-clear-panel, .leaderboard-panel { z-index: 8; }
.clear-score { display: grid; gap: 4px; margin: 18px 0 22px; }
.clear-score span { color: #47798a; font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.clear-score b { color: #159e99; font-size: 42px; line-height: .9; }
.leaderboard-panel { width: min(430px, calc(100% - 24px)); max-height: min(720px, calc(100% - 34px)); overflow: hidden; padding: 24px 16px 16px; }
.leaderboard-panel h2 { margin-bottom: 14px; }
.leaderboard-list { display: grid; gap: 5px; max-height: 45vh; overflow: auto; padding-right: 3px; }
.leaderboard-row { display: grid; grid-template-columns: 28px minmax(0,1fr) auto 46px; align-items: center; gap: 8px; min-height: 31px; padding: 6px 8px; border: 1px solid rgba(23,139,154,.14); border-radius: 9px; background: rgba(255,255,255,.38); color: #1b566a; }
.leaderboard-row.is-current { border-color: #e8a35f; background: linear-gradient(90deg, rgba(255,224,138,.7), rgba(255,255,255,.55)); box-shadow: 0 0 0 2px rgba(255,184,97,.18); }
.leaderboard-row > span { color: #df745b; font-size: 10px; font-weight: 950; }
.leaderboard-row b { overflow: hidden; font-size: 10px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-row em { color: #159e99; font-size: 11px; font-style: normal; font-weight: 950; }
.leaderboard-row small { color: #47798a; font-size: 8px; font-weight: 900; text-align: right; }
.leaderboard-empty { padding: 22px 8px; color: #47798a; font-size: 10px; letter-spacing: .12em; }
.leaderboard-self { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; margin-top: 10px; padding: 10px 11px; border-radius: 11px; background: #174f63; color: #f7f1d7; }
.leaderboard-self span { font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.leaderboard-self b { color: #ffe28b; font-size: 15px; }
.leaderboard-self small { color: #d1f4e6; font-size: 8px; text-align: right; }
.result-grid { grid-template-columns: repeat(4, minmax(64px, 1fr)); }

@media (max-width: 560px) {
  .level-progress { top: 114px; width: calc(100% - 24px); }
  .player-name { margin-top: 10px; }
  .result-grid { grid-template-columns: repeat(2, minmax(90px, 1fr)); }
  .leaderboard-panel { padding-inline: 12px; }
}

/* Tablet portrait (iPad): the game fills the screen edge to edge and the brand
   rail collapses — logo pinned to the top, score chips flanking it, level
   progress right under it. --full-bleed tells game.js to scale the sprites up. */
@media (min-width: 561px) and (orientation: portrait) {
  .game-shell { width: 100vw; box-shadow: none; }
  #gameCanvas { --full-bleed: 1; inset: 0; height: 100%; border-radius: 0; }
  .title-screen, .results-screen, .hud { inset: 0; border-radius: 0; }
  .play-title { top: max(10px, env(safe-area-inset-top)); width: min(46vw, 440px); }
  .play-title img { max-height: 150px; }
  .hud { padding-top: max(22px, env(safe-area-inset-top)); }
  .hud-top { transform: none; }
  .level-progress { top: calc(max(10px, env(safe-area-inset-top)) + min(18.7vw, 150px) + 4px); }
  .screen-brand { top: max(10px, env(safe-area-inset-top)); }
  .results-screen { padding-top: calc(min(18.7vw, 150px) + 40px); }
}
