:root {
  --bg: #15171b;
  --bg-soft: #191c21;
  --panel: #20242a;
  --panel-2: #282d34;
  --line: #343a43;
  --text: #f4f1e9;
  --muted: #8f96a0;
  --gold: #efb83f;
  --gold-light: #efb83f;
  --gold-dark: #9a6c18;
  --premium-ease: cubic-bezier(.2,.8,.2,1);
  --board-gap: clamp(6px, 1.4vw, 10px);
  --board-pad: clamp(8px, 1.8vw, 13px);
}

html,
body,
.app,
.screen {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
}

*,
*::before,
*::after {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

img,
svg,
button,
.board,
.coin,
.coin-slot {
  -webkit-user-drag: none;
  user-drag: none;
}

img {
  pointer-events: none;
}

button {
  touch-action: manipulation;
}

.screen {
  min-height: 100dvh;
  background: var(--bg);
  animation: none !important;
}

.screen.is-active {
  animation: none !important;
}

/* INTRO */
.intro-screen {
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: max(22px, env(safe-area-inset-top)) 22px max(22px, env(safe-area-inset-bottom));
  background: var(--bg);
}

.intro-screen::before,
.intro-screen::after,
.menu-screen::before,
.menu-screen::after {
  display: none;
}

.studio-lockup {
  position: relative;
  text-align: center;
}

.brand-lockup {
  width: min(100%, 620px);
}

.studio-logo {
  display: block;
  width: min(100%, 560px);
  height: auto;
  margin: 0 auto;
  user-select: none;
  -webkit-user-drag: none;
}

.loading-content {
  width: min(100%, 360px);
  text-align: center;
}

.loading-coin {
  position: relative;
  width: clamp(96px, 27vw, 126px);
  aspect-ratio: 1;
  margin: 0 auto 24px;
  filter: none;
}

.loading-coin img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.loading-coin > span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #4b3105;
  font-size: clamp(2.2rem, 9vw, 3.1rem);
  font-weight: 950;
  text-shadow: none;
}

.loading-halo {
  display: none;
}

.loading-copy h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.9rem, 8vw, 2.55rem);
  font-weight: 950;
  letter-spacing: -.065em;
}

.kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .18em;
}

.loading-track {
  height: 6px;
  margin-top: 30px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--panel-2);
}

.loading-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  box-shadow: none;
}

.loading-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--muted);
  font-size: .58rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.loading-meta strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* MENU */
.menu-screen {
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background: var(--bg);
}

.menu-panel {
  position: relative;
  display: flex;
  width: min(100%, 500px);
  min-height: 100dvh;
  flex-direction: column;
  justify-content: center;
  padding:
    max(24px, env(safe-area-inset-top))
    clamp(22px, 6vw, 36px)
    max(20px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.menu-panel::before,
.menu-ambient,
.hero-glow {
  display: none;
}

.menu-content {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  text-align: center;
}

.menu-settings {
  position: absolute;
  z-index: 5;
  top: max(18px, env(safe-area-inset-top));
  right: clamp(18px, 5vw, 28px);
}

.round-button,
.icon-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  box-shadow: none;
  cursor: pointer;
  transition: transform 130ms ease, background-color 130ms ease, border-color 130ms ease;
}

.round-button {
  width: 44px;
  aspect-ratio: 1;
  border-radius: 12px;
}

.round-button:hover,
.icon-button:hover {
  background: var(--panel-2);
  border-color: #464d57;
}

.round-button:active,
.icon-button:active,
.button:active {
  transform: scale(.96);
}

.round-button svg,
.icon-button svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.round-button svg {
  width: 20px;
}

.hero-stage {
  display: grid;
  height: clamp(128px, 22vh, 176px);
  place-items: center;
}

.hero-coin {
  position: relative;
  width: clamp(112px, 30vw, 146px);
  aspect-ratio: 1;
  margin: 0;
  filter: none;
  animation: none;
}

.hero-coin::after {
  display: none;
}

.hero-coin img,
.modal-coin img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hero-coin span,
.modal-coin span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #4b3105;
  font-weight: 950;
  text-shadow: none;
}

.hero-coin span {
  font-size: clamp(2.3rem, 9vw, 3.3rem);
}

.title-block {
  margin-top: 4px;
}

.title-block h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(2.9rem, 13vw, 4.25rem);
  font-weight: 950;
  line-height: .88;
  letter-spacing: -.075em;
  white-space: nowrap;
}

.title-block h1 span {
  color: var(--gold);
}

.title-block h1::first-line {
  color: inherit;
}

.menu-subtitle {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 650;
  letter-spacing: .035em;
}

.button {
  min-height: 54px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 0 20px;
  font-weight: 900;
  font-size: .76rem;
  letter-spacing: .1em;
  cursor: pointer;
  box-shadow: none;
  transition: transform 130ms ease, background-color 130ms ease, border-color 130ms ease;
}

.button-primary {
  color: #251901;
  background: var(--gold);
  box-shadow: none;
}

.button-primary:hover {
  filter: none;
  background: #f5c454;
}

.button-secondary {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--line);
  box-shadow: none;
}

.menu-play {
  display: flex;
  position: relative;
  width: min(100%, 280px);
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin: clamp(26px, 5vh, 38px) auto 0;
  overflow: visible;
  border-radius: 13px;
  box-shadow: none;
}

.menu-play::after {
  display: none;
}

.button-icon {
  display: grid;
  width: 25px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: #d49b28;
}

.button-icon svg {
  width: 13px;
  fill: currentColor;
}

.menu-best {
  display: grid;
  grid-template-columns: auto auto;
  width: max-content;
  align-items: center;
  column-gap: 10px;
  row-gap: 1px;
  margin: 22px auto 0;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.best-icon {
  display: grid;
  grid-row: 1 / span 2;
  width: 28px;
  aspect-ratio: 1;
  place-items: center;
  color: var(--gold);
}

.best-icon svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-best .best-copy {
  color: var(--muted);
  font-size: .53rem;
  font-weight: 850;
  letter-spacing: .12em;
}

.menu-best strong {
  justify-self: start;
  color: var(--text);
  font-size: .98rem;
  font-variant-numeric: tabular-nums;
}

.menu-panel .brand-footer {
  left: 0;
  right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  color: #555c66;
  text-align: center;
}

/* GAME */
.game-screen {
  align-items: flex-start;
  justify-content: center;
  min-height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom));
  overflow: hidden;
  background: var(--bg);
}

.game-shell {
  display: flex;
  width: min(100%, var(--runtime-shell-width, 700px));
  min-height: calc(100dvh - max(18px, env(safe-area-inset-top)) - max(14px, env(safe-area-inset-bottom)));
  flex-direction: column;
  gap: clamp(8px, 1.2vh, 12px);
  margin: 0 auto;
}

.game-header,
.score-strip,
.board-card,
.control-hint {
  width: min(100%, var(--runtime-board-size, 620px));
  margin-inline: auto;
}

.game-header {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 10px;
  margin-top: 0;
  margin-bottom: 0;
}

.icon-button {
  width: 42px;
  aspect-ratio: 1;
  border-radius: 12px;
}

.icon-button svg {
  width: 19px;
}

.mini-title {
  min-width: 0;
  text-align: center;
  line-height: 1;
}

.mini-title span,
.mini-title strong {
  display: inline;
  font-size: clamp(.98rem, 4vw, 1.25rem);
  font-weight: 950;
  letter-spacing: -.045em;
}

.mini-title span {
  color: var(--gold);
}

.score-strip {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 7px;
  margin-top: 0;
  margin-bottom: 0;
}

.score-box,
.goal-pill {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.score-box {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 9px;
}

.score-box span,
.goal-pill span {
  color: var(--muted);
  font-size: .54rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.score-box strong,
.goal-pill strong {
  margin-top: 3px;
  color: var(--text);
  font-size: clamp(.92rem, 3.8vw, 1.12rem);
  font-variant-numeric: tabular-nums;
}

.score-box em {
  position: absolute;
  right: 8px;
  top: 5px;
  color: var(--gold);
  font-size: .62rem;
  font-style: normal;
  font-weight: 900;
  opacity: 0;
}

.goal-pill {
  display: flex;
  min-width: 64px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border-color: #806326;
  background: #2a251b;
}

.goal-pill svg {
  width: 15px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.goal-pill strong {
  color: var(--gold);
}

.board-card {
  padding: clamp(5px, 1vw, 8px);
  border: 1px solid var(--line);
  border-radius: clamp(16px, 3vw, 22px);
  background: var(--panel);
  box-shadow: none;
}

.board {
  position: relative;
  width: var(--runtime-board-size, min(100%, 620px));
  max-width: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border-radius: clamp(13px, 2.6vw, 18px);
  background: #252a31;
  touch-action: none;
  outline: none;
  box-shadow: none;
}

.board:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  box-shadow: none;
}

.slot-layer,
.tile-layer,
.motion-layer {
  position: absolute;
  inset: var(--board-pad);
}

.slot-layer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: var(--board-gap);
}

.coin-slot {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  opacity: .28;
}

.coin-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: grayscale(1) brightness(.58);
}

.tile-layer,
.motion-layer {
  pointer-events: none;
}

.tile-layer { z-index: 2; }
.motion-layer { z-index: 3; }

.coin {
  position: absolute;
  left: calc(var(--col) * (var(--cell-size) + var(--board-gap)));
  top: calc(var(--row) * (var(--cell-size) + var(--board-gap)));
  width: var(--cell-size);
  height: var(--cell-size);
  transform: scale(.92);
  transform-origin: center;
  isolation: isolate;
  filter: none;
  will-change: left, top, transform, opacity;
}

.coin img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.coin-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-top: 1%;
  color: rgba(52, 31, 3, .94);
  font-size: clamp(1.02rem, 5.5vw, 2.35rem);
  font-weight: 950;
  letter-spacing: -.065em;
  line-height: 1;
  text-shadow: none;
  font-variant-numeric: tabular-nums;
}

.coin-tone-silver .coin-value {
  color: #30363d;
  text-shadow: none;
}

.coin-tone-aqua .coin-value,
.coin-tone-violet .coin-value,
.coin-tone-ruby .coin-value {
  color: #f5f7f8;
  text-shadow: none;
}

.coin[data-value="4096"] .coin-value,
.coin[data-value="8192"] .coin-value,
.coin[data-value="16384"] .coin-value {
  font-size: clamp(.8rem, 4.4vw, 1.75rem);
}

.coin-motion.is-moving {
  transition: none;
}

.coin-motion.will-merge {
  z-index: 4;
}

.coin-merged::after,
.merge-flash {
  display: none;
}

.control-hint {
  display: flex;
  min-height: 18px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 0;
  margin-bottom: 0;
  color: #666d76;
  text-align: center;
  font-size: .58rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.control-hint svg {
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* MODALS */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 11, 14, .86);
  backdrop-filter: none;
  opacity: 1;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: min(100%, 390px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: none;
  text-align: center;
  animation: none;
}

.modal-coin {
  position: relative;
  width: 94px;
  aspect-ratio: 1;
  margin: 0 auto 16px;
  filter: none;
}

.modal-coin span {
  font-size: 1.45rem;
}

.modal-card h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -.04em;
}

.modal-card > p:not(.kicker) {
  margin: 10px auto 20px;
  max-width: 290px;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal-actions .button {
  min-height: 48px;
  padding-inline: 11px;
  font-size: .65rem;
}

.settings-card {
  width: min(100%, 400px);
  padding: 22px;
  text-align: left;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.modal-header h2 {
  margin: 0;
}

.audio-mixer {
  display: grid;
  gap: 10px;
}

.audio-control {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-2);
  cursor: pointer;
}

.audio-control-icon {
  display: grid;
  grid-row: 1;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 11px;
  color: var(--gold);
  background: #302a1d;
}

.audio-control-icon svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.audio-control-copy {
  display: block;
  min-width: 0;
}

.audio-control-copy strong,
.audio-control-copy small {
  display: block;
}

.audio-control-copy strong {
  color: var(--text);
  font-size: .72rem;
  letter-spacing: .065em;
}

.audio-control-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: .66rem;
  line-height: 1.25;
}

.audio-control output {
  min-width: 40px;
  color: var(--text);
  font-size: .68rem;
  font-weight: 900;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.custom-range {
  --range-progress: 50%;
  position: relative;
  display: block;
  grid-column: 1 / -1;
  height: 24px;
}

.custom-range-track {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: #3b414a;
  transform: translateY(-50%);
  pointer-events: none;
}

.custom-range-fill {
  display: block;
  width: var(--range-progress);
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.custom-range input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 24px;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}

.custom-range input:focus {
  outline: none;
}

.custom-range input:focus-visible + * {
  outline: none;
}

.custom-range:has(input:focus-visible) .custom-range-track {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.custom-range input::-webkit-slider-runnable-track {
  height: 24px;
  background: transparent;
}

.custom-range input::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  appearance: none;
  -webkit-appearance: none;
  border: 3px solid var(--gold);
  border-radius: 50%;
  background: #181b20;
  box-shadow: none;
}

.custom-range input::-moz-range-track {
  height: 24px;
  border: 0;
  background: transparent;
}

.custom-range input::-moz-range-progress {
  background: transparent;
}

.custom-range input::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 3px solid var(--gold);
  border-radius: 50%;
  background: #181b20;
  box-shadow: none;
}

.custom-range input:active::-webkit-slider-thumb {
  transform: scale(1.08);
}

.custom-range input:active::-moz-range-thumb {
  transform: scale(1.08);
}

.settings-done {
  width: 100%;
  margin-top: 22px;
}

/* GSAP handles motion. Keep it clean and non-luminous. */
.coin-spawn,
.coin-merged,
.coin-motion.is-consumed,
.score-box em.is-visible {
  animation: none;
}

@media (pointer: coarse), (max-width: 680px) {
  .desktop-copy { display: none; }
  .mobile-copy { display: inline; }
}

@media (max-width: 380px) {
  :root {
    --board-gap: 5px;
    --board-pad: 8px;
  }

  .game-screen { padding-inline: 8px; }
  .game-header { grid-template-columns: 40px 1fr 40px; }
  .icon-button { width: 40px; border-radius: 11px; }
  .score-box, .goal-pill { min-height: 52px; border-radius: 11px; }
  .goal-pill { min-width: 58px; padding-inline: 8px; }
}

@media (max-height: 680px) and (orientation: portrait) {
  .hero-stage { height: 116px; }
  .hero-coin { width: 100px; }
  .title-block h1 { font-size: 2.8rem; }
  .menu-subtitle { margin-top: 10px; }
  .menu-play { min-height: 52px; margin-top: 21px; }
  .menu-best { margin-top: 15px; padding-block: 8px; }
  .menu-panel .brand-footer { display: none; }
}

@media (max-height: 540px) and (orientation: portrait) {
  .hero-stage { height: 78px; }
  .hero-coin { width: 72px; }
  .title-block .kicker,
  .menu-subtitle { display: none; }
  .title-block h1 { font-size: 2.35rem; }
  .menu-play { margin-top: 16px; }
}

@media (orientation: landscape) and (max-height: 620px) {
  .menu-panel {
    width: min(100%, 820px);
    max-width: none;
    min-height: 100dvh;
    padding-inline: 40px;
  }

  .menu-content {
    display: grid;
    max-width: 680px;
    grid-template-columns: .85fr 1.15fr;
    grid-template-areas:
      "hero title"
      "hero play"
      "hero best";
    align-items: center;
    column-gap: 38px;
  }

  .hero-stage { grid-area: hero; height: auto; }
  .hero-coin { width: min(29vh, 160px); }
  .title-block { grid-area: title; text-align: left; }
  .title-block h1 { font-size: clamp(2.6rem, 10vh, 4rem); }
  .menu-play { grid-area: play; width: 100%; margin: 20px 0 0; }
  .menu-best { grid-area: best; margin: 14px 0 0; }

  .game-shell {
    display: grid;
    min-height: auto;
  }
}

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

/* Prevent first-frame flashes before JavaScript/GSAP applies entrance states. */
html.js .splash-screen .studio-logo {
  opacity: 0;
  transform: translateY(12px) scale(.92);
}

html.js .loading-screen .loading-content {
  opacity: 0;
  transform: translateY(12px) scale(.985);
}

html.js .menu-screen .menu-title-logo {
  opacity: 0;
  transform: translateY(18px) scale(.88) rotate(-3deg);
}

html.js .menu-screen .menu-play,
html.js .menu-screen .menu-best,
html.js .menu-screen .menu-settings {
  opacity: 0;
  transform: translateY(18px) scale(.96);
}

html.js .game-screen .game-header,
html.js .game-screen .score-strip,
html.js .game-screen .board-card,
html.js .game-screen .control-hint {
  opacity: 0;
  transform: translateY(18px) scale(.985);
}

html.js .game-screen .coin-slot {
  opacity: 0;
  transform: scale(.78);
}

.audio-control.is-muted .audio-control-icon,
.audio-control.is-muted output {
  color: var(--muted);
}

.audio-control.is-muted .custom-range-fill {
  background: #555c66;
}

.settings-card {
  max-height: min(92dvh, 680px);
  overflow: auto;
  overscroll-behavior: contain;
}

@media (max-width: 420px) {
  .settings-card {
    padding: 18px;
  }

  .audio-control {
    grid-template-columns: 38px 1fr auto;
    column-gap: 10px;
    padding: 12px;
  }

  .audio-control-icon {
    width: 38px;
    border-radius: 10px;
  }
}

/* V10 — filled Material icon language + clearer score hierarchy */
.icon-material,
.icon-material path {
  fill: currentColor !important;
  stroke: none !important;
  stroke-width: 0 !important;
}

.round-button .icon-material,
.icon-button .icon-material,
.button-icon .icon-material,
.best-icon .icon-material,
.goal-pill .icon-material,
.control-hint .icon-material,
.audio-control-icon .icon-material {
  display: block;
  overflow: visible;
}

.best-icon .icon-material {
  width: 20px;
}

.goal-pill .icon-material {
  width: 17px;
  color: var(--gold);
}

.control-hint .icon-material {
  width: 17px;
}

.audio-control-icon .icon-material {
  width: 22px;
}

.score-box,
.goal-pill {
  min-height: 64px;
  padding-block: 8px;
}

.score-box span,
.goal-pill span {
  font-size: .59rem;
  letter-spacing: .13em;
}

.score-box strong {
  margin-top: 4px;
  font-size: clamp(1.25rem, 5vw, 1.72rem);
  line-height: .95;
  letter-spacing: -.035em;
}

.goal-pill {
  min-width: 76px;
  padding-inline: 12px;
}

.goal-pill strong {
  margin-top: 3px;
  font-size: clamp(1.12rem, 4.5vw, 1.42rem);
  line-height: 1;
  letter-spacing: -.03em;
}

.menu-best strong {
  font-size: 1.3rem;
  line-height: 1;
  letter-spacing: -.025em;
}

.menu-best .best-copy {
  font-size: .58rem;
}

@media (max-width: 420px) {
  .score-box,
  .goal-pill {
    min-height: 58px;
  }

  .score-box strong {
    font-size: clamp(1.12rem, 5.8vw, 1.45rem);
  }

  .goal-pill {
    min-width: 68px;
    padding-inline: 8px;
  }

  .goal-pill strong {
    font-size: clamp(1rem, 5vw, 1.24rem);
  }
}

/* Interactive menu coin: fixed at rest, draggable like a tethered token. */
.hero-coin {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
  transform-origin: center;
}

.hero-coin.is-dragging {
  cursor: grabbing;
}

.hero-coin img,
.hero-coin span {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

/* V14 — adaptive menu viewport; no artificial clipping. */
:root {
  --app-height: 100dvh;
  --app-width: 100vw;
}

html,
body,
.app {
  height: var(--app-height, 100dvh);
  min-height: var(--app-height, 100dvh);
}

.screen {
  min-height: var(--app-height, 100dvh);
}

.menu-screen {
  align-items: flex-start;
  justify-content: center;
  min-height: var(--app-height, 100dvh);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.menu-screen::-webkit-scrollbar {
  display: none;
}

.menu-panel {
  width: min(100%, 500px);
  min-height: var(--app-height, 100dvh);
  height: auto;
  justify-content: center;
  overflow: visible;
}

.menu-content,
.hero-stage {
  overflow: visible;
}

.hero-stage {
  height: clamp(92px, 22dvh, 176px);
}

.hero-coin {
  width: clamp(82px, min(30vw, 18dvh), 146px);
}

.title-block h1 {
  font-size: clamp(2.25rem, min(13vw, 9dvh), 4.25rem);
}

.menu-play {
  margin-top: clamp(16px, 4dvh, 38px);
}

.menu-best {
  margin-top: clamp(12px, 2.5dvh, 22px);
}

@media (max-height: 620px) and (orientation: portrait) {
  .menu-panel {
    justify-content: flex-start;
    padding-top: max(58px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .hero-stage {
    height: clamp(74px, 17dvh, 104px);
  }

  .hero-coin {
    width: clamp(66px, 16dvh, 92px);
  }

  .title-block h1 {
    font-size: clamp(2rem, 8.5dvh, 2.8rem);
  }

  .menu-play {
    min-height: 50px;
    margin-top: 16px;
  }

  .menu-best {
    margin-top: 12px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .menu-screen {
    align-items: center;
  }

  .menu-panel {
    min-height: var(--app-height, 100dvh);
    justify-content: center;
    padding-block: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-bottom));
    overflow: visible;
  }

  .hero-stage {
    height: auto;
  }
}

/* V15 — juicy gameplay, still flat and minimal. */
.score-box em {
  inset: -16px -10px auto -10px;
  z-index: 8;
  display: block;
  width: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--gold);
  font-size: clamp(1.48rem, 5.6vw, 2.15rem);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -.05em;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  transform-origin: center;
  text-shadow:
    0 2px 0 #17191d,
    1px 0 0 #17191d,
    -1px 0 0 #17191d,
    0 -1px 0 #17191d,
    1px 1px 0 #17191d,
    -1px 1px 0 #17191d;
}

.merge-flash {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: block;
  overflow: hidden;
  pointer-events: none;
}

.merge-particle,
.merge-impact-ring,
.merge-value-pop {
  position: absolute;
  pointer-events: none;
  will-change: transform, opacity;
}

.merge-particle {
  width: var(--particle-size, 7px);
  height: var(--particle-size, 7px);
  border: 1.5px solid #17191d;
  border-radius: 50%;
  background: var(--juice-color, var(--gold));
}

.merge-particle.is-diamond {
  border-radius: 2px;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.merge-particle.is-spark {
  border-radius: 0;
  clip-path: polygon(50% 0%, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0% 50%, 38% 36%);
  background: var(--juice-accent, #fff4c2);
}

.merge-impact-ring {
  width: clamp(42px, 11vw, 74px);
  aspect-ratio: 1;
  border: 4px solid var(--juice-color, var(--gold));
  border-radius: 50%;
  background: transparent;
}

.merge-value-pop {
  z-index: 3;
  min-width: 48px;
  padding: 5px 9px 6px;
  border: 2px solid #17191d;
  border-radius: 10px;
  background: var(--juice-color, var(--gold));
  color: #17191d;
  font-size: clamp(1rem, 4.4vw, 1.55rem);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -.045em;
  text-align: center;
  white-space: nowrap;
}

.coin-merged {
  z-index: 6;
  transform-origin: center;
}

.coin-motion.will-merge {
  z-index: 5;
}

@media (max-width: 420px) {
  .score-box em {
    inset: -15px -4px auto -4px;
    padding: 4px 7px 5px;
    border-radius: 9px;
    font-size: clamp(1.08rem, 5.8vw, 1.48rem);
  }

  .merge-value-pop {
    min-width: 42px;
    padding: 4px 7px 5px;
    border-radius: 8px;
    font-size: clamp(.9rem, 4.8vw, 1.2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .merge-particle,
  .merge-impact-ring,
  .merge-value-pop {
    display: none !important;
  }
}


/* V18 — use uploaded logo title image. */
.menu-title-logo {
  display: block;
  width: min(100%, 520px);
  height: auto;
  margin: 0 auto;
  user-select: none;
  -webkit-user-drag: none;
}

.header-title-logo {
  display: block;
  width: clamp(118px, 24vw, 172px);
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.mini-title {
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 720px) {
  .menu-title-logo {
    width: min(100%, 420px);
  }

  .header-title-logo {
    width: clamp(106px, 33vw, 148px);
  }
}

@media (max-width: 420px) {
  .menu-title-logo {
    width: min(100%, 360px);
  }

  .header-title-logo {
    width: clamp(96px, 32vw, 130px);
  }
}

/* V19 — juicy combo system. */
.board-card {
  position: relative;
  overflow: visible;
}

.combo-hud {
  position: absolute;
  left: 50%;
  top: 14px;
  z-index: 18;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 132px;
  padding: 6px 10px 7px;
  border: 2px solid var(--combo-color, var(--gold));
  border-radius: 12px;
  background: #17191d;
  color: var(--text);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -10px) scale(.82);
  transform-origin: center;
  pointer-events: none;
  will-change: transform, opacity;
}

.combo-hud > span {
  color: var(--muted);
  font-size: .52rem;
  font-weight: 950;
  letter-spacing: .13em;
}

.combo-hud > strong {
  color: var(--combo-color, var(--gold));
  font-size: clamp(1.08rem, 4.3vw, 1.48rem);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
}

.combo-hud > em {
  margin-left: auto;
  color: var(--text);
  font-size: .66rem;
  font-style: normal;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.combo-callout {
  position: absolute;
  z-index: 12;
  display: grid;
  justify-items: center;
  min-width: 112px;
  color: var(--text);
  text-align: center;
  pointer-events: none;
  will-change: transform, opacity;
}

.combo-callout span {
  color: var(--combo-color, var(--gold));
  font-size: clamp(.62rem, 2.2vw, .78rem);
  font-weight: 950;
  letter-spacing: .13em;
  line-height: 1;
  text-shadow:
    0 1px 0 #17191d,
    1px 0 0 #17191d,
    -1px 0 0 #17191d;
}

.combo-callout strong {
  margin-top: 3px;
  color: var(--combo-color, var(--gold));
  font-size: clamp(1.9rem, 8vw, 3rem);
  font-weight: 950;
  line-height: .88;
  letter-spacing: -.07em;
  text-shadow:
    0 3px 0 #17191d,
    2px 0 0 #17191d,
    -2px 0 0 #17191d,
    0 -2px 0 #17191d;
}

.combo-callout em {
  margin-top: 7px;
  color: #fff2c4;
  font-size: clamp(.7rem, 2.6vw, .88rem);
  font-style: normal;
  font-weight: 950;
  letter-spacing: .035em;
  text-shadow:
    0 2px 0 #17191d,
    1px 0 0 #17191d,
    -1px 0 0 #17191d;
}

@media (max-width: 430px) {
  .combo-hud {
    top: 10px;
    min-width: 116px;
    gap: 5px;
    padding: 5px 8px 6px;
  }

  .combo-hud > span {
    font-size: .46rem;
  }

  .combo-hud > em {
    font-size: .58rem;
  }
}


/* V21 — title-led loading/menu and draggable tethered logo. */
.loading-content {
  width: min(88vw, 520px);
}

.loading-title-logo {
  display: block;
  width: min(100%, 480px);
  height: auto;
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.loading-track {
  margin-top: clamp(26px, 5dvh, 42px);
}

.menu-content {
  max-width: 520px;
  overflow: visible;
}

.title-block {
  position: relative;
  width: 100%;
  margin: 0 auto;
  overflow: visible;
  text-align: center;
}

.menu-title-logo.hero-coin {
  position: relative;
  z-index: 4;
  display: block;
  width: min(100%, 520px);
  max-width: none;
  height: auto;
  aspect-ratio: auto;
  margin: 0 auto;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  transform-origin: center;
  will-change: transform;
}

.menu-title-logo.hero-coin.is-dragging {
  cursor: grabbing;
}

.menu-play {
  margin-top: clamp(28px, 5dvh, 46px);
}

@media (max-height: 620px) and (orientation: portrait) {
  .menu-title-logo.hero-coin {
    width: min(88vw, 430px);
  }

  .menu-play {
    margin-top: 20px;
  }
}

@media (orientation: landscape) and (max-height: 620px) {
  .menu-content {
    display: flex;
    width: min(70vw, 560px);
    max-width: 560px;
    flex-direction: column;
    align-items: center;
  }

  .title-block {
    width: 100%;
    text-align: center;
  }

  .menu-title-logo.hero-coin {
    width: min(58vw, 460px);
    max-height: 34dvh;
    object-fit: contain;
  }

  .menu-play {
    width: min(100%, 300px);
    margin: 16px auto 0;
  }

  .menu-best {
    margin: 10px auto 0;
  }
}


/* V23 — responsive wide header controls. */
.game-shell {
  justify-items: center;
}

.game-header {
  width: 100%;
  max-width: none;
  grid-template-columns: clamp(42px, 5vw, 48px) minmax(0, 1fr) clamp(42px, 5vw, 48px);
  padding-inline: clamp(0px, calc(var(--runtime-header-extra, 0px) * .04), 8px);
}

.game-header > .icon-button:first-child {
  justify-self: start;
}

.game-header > .icon-button:last-child {
  justify-self: end;
}

.game-header .icon-button {
  width: clamp(42px, 5vw, 48px);
  border-radius: 12px;
}

.score-strip,
.board-card,
.control-hint {
  width: var(--runtime-board-size, min(calc(100vw - 20px), 560px));
  max-width: 100%;
}

.header-title-logo {
  max-width: min(42vw, 176px);
}

@media (max-width: 599px) {
  .game-header {
    width: var(--runtime-board-size, min(calc(100vw - 20px), 560px));
    padding-inline: 0;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
  }

  .game-header .icon-button {
    width: 42px;
  }

  .header-title-logo {
    max-width: min(38vw, 136px);
  }
}

@media (min-width: 900px) and (min-height: 650px) {
  .game-header .icon-button {
    width: 48px;
  }

  .header-title-logo {
    max-width: 176px;
  }
}
