:root {
  --ink: #2a1509;
  --ink-soft: #543a29;
  --cream: #fcf7eb;
  --gold: #f5b92a;
  --gold-bright: #ffe570;
  --crimson: #d63b2f;
  --emerald: #3a9c46;
  --shadow: rgba(42, 21, 9, 0.28);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  touch-action: manipulation;
  background: #233342;
  color: var(--ink);
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  background: linear-gradient(180deg, #f9f2df 0%, #e9d9ba 100%);
  overflow: hidden;
}

/* ── SLIM SINGLE-ROW TOP HUD ── */
#hud {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: linear-gradient(180deg, #fffaf0 0%, #efe2c4 100%);
  border-bottom: 2.5px solid var(--ink);
  box-shadow: 0 2px 6px var(--shadow);
  padding: 5px 8px;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 5px; min-width: 0; }
.brand-icon { width: 28px; height: 28px; border-radius: 7px; border: 2px solid var(--ink); background: #fff4c2; object-fit: contain; flex-shrink: 0; padding: 1px; }
.brand-text h1 { margin: 0; font-size: 11.5px; line-height: 1.02; font-weight: 900; letter-spacing: -0.2px; }
.brand-text .title-br { display: block; height: 0; }
.brand-text .subtitle { display: none; }

.wave-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; border: 2px solid var(--ink);
  font-size: 11px; font-weight: 900; white-space: nowrap;
  box-shadow: 0 2px 0 var(--ink); cursor: pointer;
}
.wave-pill.breather { background: linear-gradient(180deg, #ffe793, #f3bd3a); color: var(--ink); }
.wave-pill.battle { background: linear-gradient(180deg, #ef5a47, #b92b1e); color: #fff8ea; }
.wave-pill.boss { background: linear-gradient(180deg, #8b2fc9, #4c116e); color: #ffe88a; }
.wave-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.upgrade-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; border: 2px solid var(--ink);
  background: linear-gradient(180deg, #fff9dd, #edd79f);
  box-shadow: 0 2px 0 var(--ink); color: var(--ink);
  font-size: 11px; font-weight: 900; white-space: nowrap; cursor: pointer;
  transition: transform 0.14s ease;
}
.upgrade-pill img { width: 16px; height: 16px; object-fit: contain; }
.upgrade-pill.ready {
  background: linear-gradient(180deg, #ffe970, #f59e0b);
  animation: readyBounce 0.8s ease-in-out infinite alternate;
}
@keyframes readyBounce {
  0% { transform: scale(1); box-shadow: 0 2px 0 var(--ink), 0 0 6px rgba(255,190,0,0.6); }
  100% { transform: scale(1.07); box-shadow: 0 2px 0 var(--ink), 0 0 14px rgba(255,165,0,0.95); }
}

.hud-controls { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn {
  width: 27px; height: 27px; border-radius: 8px; border: 2px solid var(--ink);
  background: linear-gradient(180deg, #fffaf0, #ead8ad); box-shadow: 0 2px 0 var(--ink);
  color: var(--ink); font-size: 12px; font-weight: 900; cursor: pointer; display: grid; place-items: center; padding: 0;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--ink); }
.icon-btn.active { background: linear-gradient(180deg, #62c45e, #37873f); color: #fff; }

/* ── MAIN RESPONSIVE LAYOUT: BATTLEFIELD > 55%, COMPACT 3x3 DOCK < 35% ── */
#layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 5px 6px calc(54px + env(safe-area-inset-bottom));
  overflow: hidden;
}

#stage-col {
  flex: 1 1 auto;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

#arena-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 270px;
  border-radius: 13px;
  border: 3px solid var(--ink);
  overflow: hidden;
  background: #5ec3ee;
  box-shadow: 0 3px 0 #3f2210, 0 5px 12px var(--shadow);
}

#battle { width: 100%; height: 100%; display: block; }

#battle-top-ui {
  position: absolute; top: 6px; left: 8px; right: 8px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none;
}

.hud-left-stack, .hud-right-stack { display: flex; flex-direction: column; gap: 4px; }
.hud-right-stack { align-items: flex-end; }

#fort-hp-pill, #wave-prog-pill, #barricade-pill, #squad-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(34, 20, 12, 0.82); color: #fff9ea;
  border: 2px solid #2a1509; border-radius: 999px;
  padding: 2px 8px; font-size: 10.5px; font-weight: 800;
}
#squad-pill img { width: 15px; height: 15px; object-fit: contain; }
.hp-tag { color: var(--gold-bright); white-space: nowrap; }
.bar-tag { color: #8de6ff; white-space: nowrap; }
.hp-track, .prog-track, .bar-track { width: 64px; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.22); overflow: hidden; }
#fort-hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #4ec654, #90e35d); transition: width 0.2s; }
#fort-hp-fill.mid { background: linear-gradient(90deg, #f5b92a, #ffe066); }
#fort-hp-fill.low { background: linear-gradient(90deg, #e53935, #ff7043); }
#bar-hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #38bdf8, #bae6fd); transition: width 0.2s; }
#wave-prog-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #ff7a45, #ffd166); transition: width 0.25s; }

#boss-bar {
  position: absolute; top: 36px; left: 50%; transform: translateX(-50%);
  width: min(80%, 330px); background: rgba(48, 12, 58, 0.88);
  border: 2px solid #ffd45e; border-radius: 11px; padding: 3px 9px 5px; pointer-events: none;
}
.boss-title { font-size: 10px; font-weight: 900; color: #ffe27a; text-align: center; margin-bottom: 2px; }
.boss-track { height: 8px; border-radius: 999px; background: rgba(0,0,0,0.45); overflow: hidden; }
#boss-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #d81b60, #ff5252, #ffab40); transition: width 0.16s; }

#banner-layer {
  position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 62px; pointer-events: none; z-index: 6;
}
.stage-banner {
  background: linear-gradient(180deg, #fff5d1, #f5be3d); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 12px; padding: 5px 13px;
  font-size: 13px; font-weight: 900; box-shadow: 0 4px 0 var(--ink), 0 8px 18px rgba(0,0,0,0.32);
  animation: bannerPop 1.7s cubic-bezier(.22,1.28,.36,1) forwards; text-align: center;
}
.stage-banner.danger { background: linear-gradient(180deg, #ff6b57, #b71c1c); color: #fff6dc; }
.stage-banner.jackpot { background: linear-gradient(180deg, #fff199, #ff9f1c); color: var(--ink); }
.stage-banner.turbo { background: linear-gradient(180deg, #ffffff, #bfe8ff); color: #152b44; border-color: #152b44; }

@keyframes bannerPop {
  0% { opacity: 0; transform: scale(0.55) translateY(12px); }
  16% { opacity: 1; transform: scale(1.06) translateY(0); }
  26% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: scale(0.95) translateY(-12px); }
}

#combo-toast {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  pointer-events: none; display: flex; gap: 5px; z-index: 5;
}
.toast-tag {
  background: rgba(42, 21, 9, 0.88); color: #ffe88f; border: 2px solid #f7c343;
  border-radius: 999px; padding: 2px 9px; font-size: 10.5px; font-weight: 800;
  animation: toastFade 1.85s ease forwards; white-space: nowrap;
}
@keyframes toastFade {
  0% { opacity: 0; transform: translateY(6px); }
  14% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-6px); }
}

/* ── COMPACT BOTTOM DOCK (< 35% HEIGHT ON MOBILE!) ── */
#control-col {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dock-shell {
  display: grid;
  grid-template-columns: 212px 1fr;
  gap: 8px;
  align-items: stretch;
  background: linear-gradient(180deg, #c9772d 0%, #8f4717 100%);
  border: 3px solid var(--ink);
  border-radius: 15px;
  padding: 7px;
  box-shadow: inset 0 2px 0 rgba(255, 224, 150, 0.45), 0 4px 0 var(--ink);
}

/* Compact 3x3 Slot Grid (212x212px square!) */
.slot-wrap {
  position: relative;
  width: 212px;
  height: 212px;
}

.reel-grid {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  background: #55280c;
  border: 2.5px solid var(--ink);
  border-radius: 11px;
  padding: 4px;
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.38);
}

#match-lines {
  position: absolute;
  inset: 4px;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  pointer-events: none;
  z-index: 6;
  opacity: 0.58;
  filter: drop-shadow(0 0 4px rgba(255, 210, 40, 0.85));
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #fffefb 0%, #f5e5be 100%);
  border: 2px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 -2px 0 rgba(162, 108, 38, 0.25);
}

.tile.spinning .tile-art {
  animation: reelBlur 0.11s linear infinite;
}
@keyframes reelBlur {
  0% { transform: translateY(-10px) scaleY(1.16); filter: blur(1.3px); opacity: 0.72; }
  50% { transform: translateY(10px) scaleY(1.16); filter: blur(1.3px); opacity: 0.92; }
  100% { transform: translateY(-10px) scaleY(1.16); filter: blur(1.3px); opacity: 0.72; }
}

.tile.landed { animation: tileBounce 0.22s cubic-bezier(.2,1.5,.4,1); }
@keyframes tileBounce {
  0% { transform: scale(1.12, 0.88); }
  55% { transform: scale(0.95, 1.05); }
  100% { transform: scale(1, 1); }
}

.tile.win {
  border-color: #ffae00;
  background: linear-gradient(180deg, #fffbd4 0%, #ffe06b 100%);
  box-shadow: 0 0 12px rgba(255, 200, 0, 0.98);
  animation: winPop 0.34s cubic-bezier(.2,1.6,.4,1);
}
@keyframes winPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.11); }
  100% { transform: scale(1); }
}

.tile.fired {
  border-color: #4a9e44;
  background: linear-gradient(180deg, #ffffff 0%, #e9f9d6 100%);
  box-shadow: 0 0 6px rgba(95, 209, 90, 0.55);
}

.tile.dim {
  opacity: 0.48;
  filter: saturate(0.6);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.tile.tease {
  border-color: #ff9800;
  background: linear-gradient(180deg, #fff8cc 0%, #ffd55c 100%);
  box-shadow: 0 0 12px rgba(255, 168, 0, 0.95), inset 0 0 8px rgba(255, 240, 140, 0.9);
  animation: teasePulse 0.16s ease-in-out infinite alternate;
}
@keyframes teasePulse {
  0% { transform: scale(0.98); }
  100% { transform: scale(1.04); }
}

.tile-art {
  width: 42px;
  height: 42px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 1.5px 1px rgba(42,21,9,0.22));
}

/* Right Stack: Saveable Growing Chubby Duck Ultimate + SPIN! + AUTO */
.right-controls {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.duck-ult-btn {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background: radial-gradient(circle at 50% 45%, #fff9df 0%, #f5d88b 100%);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 4px 6px 5px;
  box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,0.6);
  cursor: pointer;
  overflow: visible;
}

.duck-ult-btn.stage-annoyed {
  background: radial-gradient(circle at 50% 45%, #fff5d6 0%, #f5be6b 100%);
}
.duck-ult-btn.stage-hiss {
  background: radial-gradient(circle at 50% 45%, #ffe6cc 0%, #f48c42 100%);
  border-color: #6b1d07;
}
.duck-ult-btn.ult-ready {
  background: radial-gradient(circle at 50% 45%, #fff0d0 0%, #ff5a26 100%);
  border-color: #7c1406;
  animation: ultPulse 0.52s ease-in-out infinite alternate;
}
@keyframes ultPulse {
  0% { transform: scale(1); box-shadow: 0 0 12px rgba(255,95,30,0.8), 0 3px 0 var(--ink); }
  100% { transform: scale(1.03); box-shadow: 0 0 24px rgba(255,45,10,1), 0 3px 0 var(--ink); }
}

.duck-ult-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9.5px;
  font-weight: 900;
  color: var(--ink);
  z-index: 2;
}
.duck-ult-top span {
  background: var(--ink);
  color: #ffe885;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

.duck-ult-visual {
  position: relative;
  height: 76px;
  width: 100%;
  display: grid;
  place-items: center;
}

#duck-img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  transition: transform 0.22s cubic-bezier(.22,1.5,.36,1);
  filter: drop-shadow(0 3px 2px rgba(42,21,9,0.25));
  animation: catCalm 3.8s ease-in-out infinite;
}
#duck-img.stage-annoyed { animation: catAnnoyed 0.85s ease-in-out infinite; }
#duck-img.stage-hiss { animation: catHiss 0.38s ease-in-out infinite; }
#duck-img.spinning-watch { animation: catWatch 0.28s ease-in-out infinite alternate; }
#duck-img.perk { animation: catPerk 0.55s cubic-bezier(.2,1.5,.4,1); }
#duck-img.gulp { animation: duckGulp 0.32s cubic-bezier(.2,1.6,.4,1); }
#duck-img.wobble { animation: catReadyAngry 0.42s ease-in-out infinite alternate; }
#duck-img.prepop { animation: catCrouch 0.32s ease-in forwards; }
#duck-img.bursting { animation: catPounce 0.68s cubic-bezier(.16,1.2,.3,1) forwards; }

@keyframes catCalm {
  0%, 100% { transform: scale(0.92, 0.92) translate(0, 0) rotate(-1.5deg); }
  20% { transform: scale(0.96, 0.89) translate(0, 2px) rotate(1deg); }
  40% { transform: scale(0.91, 0.96) translate(-2px, -3px) rotate(-4deg); }
  58% { transform: scale(0.95, 0.90) translate(2px, 1px) rotate(4.5deg); }
  78% { transform: scale(0.93, 0.95) translate(0, -2px) rotate(-2deg); }
}
@keyframes catPerk {
  0% { transform: scale(0.92, 0.92) translateY(0); }
  30% { transform: scale(1.06, 0.82) translateY(4px); }
  65% { transform: scale(0.92, 1.08) translateY(-8px) rotate(4deg); }
  100% { transform: scale(0.94, 0.94) translateY(0) rotate(0deg); }
}
@keyframes catAnnoyed {
  0%, 100% { transform: scale(0.98) rotate(-3deg) translateX(-1px); }
  35% { transform: scale(1.01, 0.96) rotate(3deg) translateX(2px); }
  70% { transform: scale(0.97, 1.02) rotate(-2deg) translateY(-1px); }
}
@keyframes catHiss {
  0%, 100% { transform: scale(1.05, 1.08) translate(-1.5px, 0) rotate(-2.5deg); }
  25% { transform: scale(1.09, 1.04) translate(1.5px, -2px) rotate(2.5deg); }
  50% { transform: scale(1.04, 1.10) translate(-1px, -1px) rotate(-2deg); }
  75% { transform: scale(1.08, 1.05) translate(1.5px, 0) rotate(2deg); }
}
@keyframes catWatch {
  0% { transform: scale(0.98) translateY(0) rotate(-4deg); }
  100% { transform: scale(1.04) translateY(-3px) rotate(4deg); }
}
@keyframes catReadyAngry {
  0% { transform: scale(1.05, 0.98) translateY(1px) rotate(-2deg); filter: drop-shadow(0 0 6px rgba(255,60,20,0.8)); }
  100% { transform: scale(1.12, 1.06) translateY(-3px) rotate(2deg); filter: drop-shadow(0 0 12px rgba(255,140,20,1)); }
}
@keyframes catCrouch {
  0% { transform: scale(1.08, 1.04) translateY(0); }
  100% { transform: scale(1.22, 0.80) translateY(8px) rotate(-4deg); filter: brightness(1.25); }
}
@keyframes catPounce {
  0% { transform: scale(1.15) translate(-18px, 6px) rotate(-8deg); opacity: 1; }
  35% { transform: scale(1.28) translate(16px, -12px) rotate(6deg); opacity: 1; }
  75% { transform: scale(1.22) translate(28px, -4px) rotate(2deg); opacity: 0.95; }
  100% { transform: scale(1.12) translate(42px, 4px) rotate(0deg); opacity: 0.1; }
}

@keyframes duckGulp {
  0% { transform: scale(var(--ds, 1)); }
  40% { transform: scale(calc(var(--ds, 1) * 1.18), calc(var(--ds, 1) * 0.84)) translateY(3px); }
  75% { transform: scale(calc(var(--ds, 1) * 0.94), calc(var(--ds, 1) * 1.12)) translateY(-4px); }
  100% { transform: scale(var(--ds, 1)); }
}
@keyframes duckWobble {
  0%, 100% { transform: rotate(-4deg) scale(1.14, 0.96); }
  50% { transform: rotate(4deg) scale(1.06, 1.12); }
}
@keyframes duckPrePop {
  0% { transform: scale(1.15) rotate(-3deg); filter: brightness(1.05); }
  50% { transform: scale(1.36) rotate(6deg); filter: brightness(1.4); }
  100% { transform: scale(1.48) rotate(0deg); filter: brightness(1.65); }
}
@keyframes duckBurstPop {
  0% { transform: scale(0.85); opacity: 1; }
  28% { transform: scale(1.38); opacity: 1; }
  75% { transform: scale(1.45); opacity: 0.95; }
  100% { transform: scale(1.65); opacity: 0.05; }
}

.duck-ult-bar {
  width: 100%; height: 9px; border-radius: 999px;
  background: rgba(42,21,9,0.22); border: 1.5px solid var(--ink); overflow: hidden;
}
#duck-ult-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #ffbe2e, #ff6b24);
  transition: width 0.24s ease;
}

.duck-fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.duck-pop-text {
  position: absolute; top: 44%; left: 50%; transform: translateX(-50%);
  font-size: 13px; font-weight: 900; color: #ffe866;
  text-shadow: -1.5px -1.5px 0 #2a1509, 1.5px -1.5px 0 #2a1509, -1.5px 1.5px 0 #2a1509, 1.5px 1.5px 0 #2a1509;
  white-space: nowrap; animation: floatUp 0.9s ease-out forwards;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.75); }
  20% { opacity: 1; transform: translate(-50%, -6px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -32px) scale(1); }
}

/* SPIN! Button (NO gamble icon — clean bold SPIN!) */
.spin-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.spin-btn {
  position: relative;
  height: 52px;
  border-radius: 12px;
  border: 3px solid var(--ink);
  background: linear-gradient(180deg, #5fd15a 0%, #2b8a34 100%);
  box-shadow: 0 4px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,0.38);
  color: #fffef5;
  cursor: pointer;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.spin-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.spin-btn:disabled { background: linear-gradient(180deg, #7e7366, #574e44); cursor: not-allowed; }
.spin-cd-fill {
  position: absolute; inset: 0; width: 100%;
  background: linear-gradient(90deg, rgba(255, 240, 140, 0.28), rgba(255,255,255,0.16));
  transition: width 0.08s linear; pointer-events: none;
}
.spin-label {
  position: relative; z-index: 2; font-size: 19px; font-weight: 900; letter-spacing: 1px;
  text-shadow: 0 2px 0 rgba(42, 21, 9, 0.48);
}

.auto-btn {
  height: 28px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  background: linear-gradient(180deg, #fff6da, #e2caa0);
  box-shadow: 0 2.5px 0 var(--ink);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 900;
  cursor: pointer;
}
.auto-btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--ink); }
.auto-btn.on { background: linear-gradient(180deg, #ffe055, #eb9115); }

.desktop-tip { display: none; }

/* Flying Snacks / Tokens / Feathers */
#fly-layer { position: fixed; inset: 0; pointer-events: none; z-index: 45; overflow: hidden; }
.fly-item {
  position: fixed; width: 42px; height: 42px; object-fit: contain;
  pointer-events: none; filter: drop-shadow(0 3px 3px rgba(42,21,9,0.42)); will-change: transform, opacity;
}
.fly-feather {
  position: fixed; width: 34px; height: 34px; object-fit: contain;
  pointer-events: none; filter: drop-shadow(0 2px 2px rgba(42,21,9,0.3)); will-change: transform, opacity;
}

/* ── 3-CARD UPGRADE MODAL & HELP MODAL ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(24, 14, 8, 0.72);
  display: grid; place-items: center; padding: 14px 12px 62px; z-index: 50; backdrop-filter: blur(2px);
}
.modal-card {
  width: min(520px, 100%); max-height: 84dvh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #fcf5e0, #efe0b8); border: 3px solid var(--ink);
  border-radius: 18px; box-shadow: 0 8px 28px rgba(0,0,0,0.45); overflow: hidden;
}
.center-card { text-align: center; padding: 20px 18px; gap: 10px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 12px 14px 10px; border-bottom: 2px solid rgba(42,21,9,0.16); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head p { margin: 2px 0 0; font-size: 12px; color: var(--ink-soft); }
.close-btn { width: 32px; height: 32px; border-radius: 10px; border: 2px solid var(--ink); background: #fff6dc; font-size: 15px; font-weight: 900; cursor: pointer; }

.upgrade-card {
  background: linear-gradient(180deg, #fff9dc, #f4c854);
  border-color: #7c3a06;
  padding: 14px;
  gap: 10px;
}
.upgrade-head { display: flex; align-items: center; gap: 10px; }
.upgrade-head img { width: 50px; height: 50px; object-fit: contain; }
.upgrade-head h2 { margin: 0; font-size: 18px; color: var(--ink); }
.upgrade-head p { margin: 2px 0 0; font-size: 12px; font-weight: 700; color: var(--ink-soft); }

.upgrade-choices { display: grid; gap: 8px; }
.choice-card {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: linear-gradient(180deg, #fffdf4, #f7e9c4);
  border: 2.5px solid var(--ink); border-radius: 13px; padding: 9px 11px;
  box-shadow: 0 3px 0 var(--ink); cursor: pointer; color: var(--ink);
}
.choice-card:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.choice-card img { width: 46px; height: 46px; object-fit: contain; flex-shrink: 0; }
.choice-tag {
  display: inline-block; width: fit-content; font-size: 9.5px; font-weight: 900; letter-spacing: 0.45px;
  padding: 2px 7px; border-radius: 999px; margin-bottom: 3px;
  background: #47230d; color: #ffe885;
}
.choice-tag.comp { background: #1f6e33; color: #e8ffec; }
.choice-tag.slot { background: #1a588c; color: #e2f5ff; }
.choice-copy strong { display: block; font-size: 13.5px; font-weight: 900; color: var(--ink); }
.choice-copy span:not(.choice-tag) { display: block; font-size: 11px; color: var(--ink-soft); margin-top: 1px; line-height: 1.3; }

.help-body { padding: 12px 14px 16px; overflow-y: auto; }
.help-body ul { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.48; color: var(--ink-soft); }
.help-body li { margin-bottom: 6px; }
.help-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pill-btn { border: 2px solid var(--ink); border-radius: 10px; padding: 7px 12px; font-size: 12px; font-weight: 900; background: #fff6dc; color: var(--ink); cursor: pointer; text-decoration: none; }
.pill-btn.danger { background: #f9d1cc; color: #8c1c13; }
.pill-btn.subtle { background: #dff2e0; color: #1b5c25; }

.end-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0; }
.end-stat { background: #fffaf0; border: 2px solid rgba(42,21,9,0.25); border-radius: 12px; padding: 8px 6px; }
.end-stat strong { display: block; font-size: 18px; }
.end-stat span { font-size: 10px; color: var(--ink-soft); font-weight: 700; }
.compact-spin { width: 100%; height: 44px; }

/* ── DESKTOP LANDSCAPE ── */
@media (min-width: 860px) {
  .brand-text h1 { font-size: 16px; white-space: nowrap; }
  .brand-text .title-br { display: inline; }
  .brand-text .subtitle { display: block; font-size: 9px; font-weight: 900; letter-spacing: 0.9px; color: var(--ink-soft); }
  #hud { padding: 8px 16px; gap: 14px; }
  .hud-controls { margin-left: auto; }

  #layout {
    flex-direction: row-reverse;
    padding: 12px 16px 14px;
    gap: 14px;
  }

  #control-col {
    flex: 0 0 385px;
    max-width: 400px;
    justify-content: center;
    gap: 10px;
  }

  .dock-shell {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  .slot-wrap {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-height: 340px;
  }

  .tile-art { width: 64px; height: 64px; }

  .right-controls {
    flex-direction: row;
    align-items: stretch;
  }

  .duck-ult-btn { flex: 0 0 148px; }
  .spin-stack { flex: 1 1 auto; justify-content: center; gap: 8px; }
  .spin-btn { height: 64px; }
  .auto-btn { height: 34px; font-size: 12px; }

  .desktop-tip {
    display: block;
    background: rgba(255, 250, 236, 0.92);
    border: 2.5px solid rgba(42, 21, 9, 0.28);
    border-radius: 13px;
    padding: 10px 12px;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--ink-soft);
  }
}
