@font-face {
  font-family: 'Bungee';
  src: url('assets/fonts/Bungee-Regular.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url('assets/fonts/IBMPlexMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url('assets/fonts/IBMPlexMono-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}

:root {
  --paper: #f3ecdc;
  --paper-dark: #e6dcbe;
  --paper-light: #fbf7ee;
  --ink: #231d14;
  --red: #d9481c;
  --red-deep: #a52f0b;
  --mustard: #e69d27;
  --teal: #1a7861;
  --steel: #ded4bc;
  --cream: #faf4e4;
  --gold: #c48c12;
  --border-thin: 1.5px solid var(--ink);
  --border-thick: 2px solid var(--ink);
  --border-heavy: 3px solid var(--ink);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; width: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  font-family: 'Plex Mono', monospace;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}

::selection { background: rgba(217, 72, 28, 0.25); }

/* Industrial Tactile Button */
.btn {
  font-family: 'Plex Mono', monospace;
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  background: var(--cream);
  color: var(--ink);
  border: var(--border-thick);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
  border-radius: 3px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) {
  background: #ffffff;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}
.btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: 1px 1px 0 var(--ink);
}
.btn.primary {
  background: var(--red);
  color: var(--cream);
}
.btn.primary:hover:not(:disabled) {
  background: #e85528;
}
.btn.teal {
  background: var(--teal);
  color: var(--cream);
}
.btn.teal:hover:not(:disabled) {
  background: #218f74;
}
.btn.danger {
  background: #fff;
  color: var(--red-deep);
  border-color: var(--red-deep);
}
.btn.danger:hover:not(:disabled) {
  background: var(--red-deep);
  color: #fff;
}

/* =============================================================
   TOP PRECISION CONTROL BAR / HUD
============================================================= */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 18px;
  gap: 16px;
  z-index: 20;
  border-bottom: var(--border-thick);
  background: var(--paper);
  flex-shrink: 0;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sticker {
  position: relative;
  z-index: 0;
  transform: rotate(-1.5deg);
  font-family: 'Bungee', cursive;
  font-weight: 400;
  font-size: 26px;
  line-height: 1;
  color: var(--red);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.sticker:hover {
  transform: rotate(-0.5deg) scale(1.04);
}
.sticker::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: var(--ink);
  -webkit-text-stroke: 6px var(--ink);
}

.model-badge {
  font-family: 'Plex Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: var(--ink);
  background: var(--paper-light);
  border: var(--border-thin);
  box-shadow: 1.5px 1.5px 0 var(--ink);
  border-radius: 3px;
  padding: 4px 8px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.1s ease;
}
.model-badge:hover {
  background: #ffffff;
  transform: translate(-1px, -1px);
}

/* Coin Balance Readout Gauge */
.coin-display {
  display: flex;
  align-items: center;
  background: var(--paper-light);
  border: var(--border-thick);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 4px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.12s ease;
}
.coin-display:hover {
  background: #ffffff;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}
.coin-amounts {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.coin-label-tag {
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: rgba(35, 29, 20, 0.55);
}
.coin-val-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.coin-val {
  font-family: 'Bungee', cursive;
  font-size: 19px;
  color: var(--ink);
  line-height: 1;
}
.coin-unit {
  font-size: 8.5px;
  font-weight: 600;
  color: rgba(35, 29, 20, 0.6);
  letter-spacing: 0.5px;
}
.coin-rate {
  font-size: 9px;
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 0.5px;
  margin-left: 2px;
}

/* Navigation Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-btn {
  font-size: 10px;
  padding: 6px 11px;
}

/* =============================================================
   INTERACTIVE GAMEPLAY STAGE (Expansive Tactile Playfield)
============================================================= */
#stage {
  flex: 1;
  position: relative;
  cursor: grab;
  touch-action: none;
  min-height: 0;
  width: 100%;
  background: radial-gradient(circle at 50% 50%, var(--paper-light) 0%, var(--paper) 65%, var(--paper-dark) 100%);
  overflow: hidden;
}
#stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, transparent 0%, rgba(35,29,20,0.02) 100%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(35,29,20,0.035) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(35,29,20,0.035) 31px 32px);
  pointer-events: none;
  opacity: 0.65;
}
#stage::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(35,29,20,0.12);
  border-radius: 6px;
  pointer-events: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
#stage.spinning::after {
  border-color: rgba(26,120,97,0.28);
  box-shadow: inset 0 0 35px rgba(26,120,97,0.07);
}
#stage.grabbing {
  cursor: grabbing;
}

#grain { position: absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; z-index:0; }
#spin { position: absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; z-index:2; }
#effects { position: absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; z-index:3; }

/* Quick-buy strip removed — upgrades now live in persistent dock */

/* Auxiliary Passive Test Bench — compact dock version (no longer overlays hero) */
.passive-bench-container {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(100% - 20px));
  max-width: none;
  background: rgba(251, 247, 238, 0.96);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: var(--border-thick);
  box-shadow: 3px 3px 0 var(--ink);
  border-radius: 6px;
  padding: 7px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  z-index: 10;
}
/* when relocated inside upgrades dock — slim, full-width, non-overlay */
.upgrades-dock .passive-bench-container.dock-bench {
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  width: auto;
  max-width: none;
  margin: 0;
  background: var(--paper);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-bottom: var(--border-thick);
  border-radius: 0;
  box-shadow: none;
  padding: 6px 8px 7px;
  gap: 5px;
  pointer-events: none;
}
.passive-bench-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(35, 29, 20, 0.22);
}
.upgrades-dock .passive-bench-container.dock-bench .passive-bench-header {
  padding-bottom: 3px;
  gap: 6px;
}
.upgrades-dock .passive-bench-container.dock-bench .passive-bench-rack {
  gap: 4px;
  padding: 1px 0 0;
}
.upgrades-dock .passive-bench-container.dock-bench .passive-rig-card {
  padding: 4px 2px 3px;
  gap: 2px;
  border-radius: 3px;
}
.upgrades-dock .passive-bench-container.dock-bench .passive-rig-canvas {
  width: 32px;
  height: 32px;
}
.upgrades-dock .passive-bench-container.dock-bench .passive-rig-name {
  font-size: 6.5px;
}
.upgrades-dock .passive-bench-container.dock-bench .passive-rig-yield {
  font-size: 6.5px;
}
.upgrades-dock .passive-bench-container.dock-bench .passive-rig-id {
  font-size: 6px;
}
.mobile-bench {
  position: relative;
  bottom: auto;
  left: auto;
  transform: none;
  width: auto;
  max-width: none;
  margin: 0;
  background: var(--paper);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-bottom: var(--border-thick);
  border-radius: 0;
  box-shadow: none;
  padding: 6px 8px 7px;
  gap: 5px;
}
.mobile-bench .passive-bench-rack {
  gap: 4px;
}
.mobile-bench .passive-rig-card {
  padding: 4px 2px 3px;
  gap: 2px;
}
.mobile-bench .passive-rig-canvas {
  width: 30px;
  height: 30px;
}
.bench-title {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(35, 29, 20, 0.62);
}
.bench-count {
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: rgba(35,29,20,0.45);
  background: var(--paper-dark);
  border: 1px solid rgba(35,29,20,0.12);
  border-radius: 10px;
  padding: 1px 6px;
}
.bench-rate-badge {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: 0.4px;
  background: var(--paper);
  border: var(--border-thin);
  border-radius: 10px;
  padding: 1.5px 7px;
  box-shadow: 1px 1px 0 rgba(35,29,20,0.12);
}
.passive-bench-rack {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  padding: 2px 0 1px;
}
.passive-rig-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--paper);
  border: var(--border-thin);
  border-radius: 4px;
  padding: 6px 4px 5px;
  position: relative;
  min-width: 0;
  overflow: hidden;
}
.passive-rig-card.is-active {
  background: #fffdf6;
  border-color: rgba(35,29,20,0.85);
  box-shadow: 1.5px 1.5px 0 rgba(35,29,20,0.18);
}
.passive-rig-card.is-locked {
  background: rgba(251,247,238,0.55);
  border-style: dashed;
  border-color: rgba(35,29,20,0.22);
  opacity: 0.86;
}
.passive-rig-canvas {
  width: 46px;
  height: 46px;
  display: block;
  flex-shrink: 0;
}
.passive-rig-card.is-locked .passive-rig-canvas {
  opacity: 0.22;
  filter: grayscale(1);
}
.rig-lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.rig-lock-badge {
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 0.7px;
  color: rgba(35,29,20,0.55);
  background: var(--paper-dark);
  border: 1px solid rgba(35,29,20,0.18);
  border-radius: 3px;
  padding: 1.5px 4px;
  margin-top: 10px;
}
.passive-rig-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 100%;
  min-width: 0;
}
.passive-rig-id {
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: rgba(35, 29, 20, 0.5);
  line-height: 1;
}
.passive-rig-name {
  font-size: 7.5px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1;
}
.passive-rig-yield {
  font-size: 7.5px;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: 0.2px;
  line-height: 1;
}
.passive-rig-yield.is-idle {
  color: rgba(35,29,20,0.38);
  font-weight: 600;
}

@media (max-width: 560px) {
  .passive-bench-container {
    bottom: 8px;
    width: calc(100% - 12px);
    padding: 5px 6px 6px;
  }
  .passive-bench-rack {
    gap: 4px;
  }
  .passive-rig-card {
    padding: 4px 2px 3px;
    border-radius: 3px;
  }
  .passive-rig-canvas {
    width: 34px;
    height: 34px;
  }
  .passive-rig-id { font-size: 6px; }
  .passive-rig-name { font-size: 6px; }
  .passive-rig-yield { font-size: 6px; }
  .bench-title { font-size: 7px; }
  .bench-count, .bench-rate-badge { font-size: 7px; }
}
@media (max-width: 380px) {
  .passive-bench-rack {
    gap: 3px;
  }
  .passive-rig-canvas {
    width: 30px;
    height: 30px;
  }
}

/* =============================================================
   APP LAYOUT — Hero spinner (main) + Persistent Upgrades Dock
============================================================= */
.app-layout {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}
.play-column {
  flex: 1.55;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.play-column #stage {
  flex: 1;
}

/* Hero spotlight — makes spinner unmistakably the main element */
.hero-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(72vmin, 560px);
  height: min(72vmin, 560px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, rgba(255,255,255,0.92) 0%, rgba(251,247,238,0.55) 22%, rgba(243,236,220,0) 62%),
    radial-gradient(circle at 50% 50%, rgba(217,72,28,0.07) 0%, rgba(217,72,28,0) 62%);
  pointer-events: none;
  z-index: 1;
}
.hero-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(78vmin, 610px);
  height: min(78vmin, 610px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1.5px dashed rgba(35,29,20,0.10);
  box-shadow: 0 0 0 12px rgba(251,247,238,0.35), 0 0 0 1px rgba(35,29,20,0.04) inset;
  pointer-events: none;
  z-index: 1;
}
#stage.spinning .hero-ring {
  border-color: rgba(26,120,97,0.18);
  box-shadow: 0 0 0 14px rgba(26,120,97,0.06), 0 0 40px rgba(26,120,97,0.08);
}
#stage.spinning .hero-glow {
  background:
    radial-gradient(circle at 50% 38%, rgba(255,255,255,0.95) 0%, rgba(251,247,238,0.6) 24%, rgba(243,236,220,0) 64%),
    radial-gradient(circle at 50% 50%, rgba(26,120,97,0.09) 0%, rgba(217,72,28,0.05) 45%, transparent 70%);
}

/* Persistent Upgrades Dock */
.upgrades-dock {
  width: 380px;
  flex-shrink: 0;
  background: var(--paper-dark);
  border-left: var(--border-thick);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  z-index: 5;
}
.dock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px 10px;
  background: var(--paper);
  border-bottom: var(--border-thick);
  flex-shrink: 0;
}
.dock-title-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dock-title {
  font-family: 'Bungee', cursive;
  font-size: 17px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: 0.5px;
}
.dock-subtitle {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: rgba(35,29,20,0.55);
  text-transform: uppercase;
}
.dock-flash {
  animation: dockFlash 0.5s ease;
}
@keyframes dockFlash {
  0% { box-shadow: inset 0 0 0 2px var(--red); }
  100% { box-shadow: none; }
}

.dock-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px 8px;
  background: var(--paper-dark);
  border-bottom: 1px dashed rgba(35,29,20,0.18);
  flex-shrink: 0;
}
.dock-toolbar .label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  color: rgba(35,29,20,0.6);
}
.upgrades-dock .upgrade-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 10px;
  align-content: flex-start;
}
.upgrades-dock .upgrade-card {
  background: var(--paper-light);
}

.prestige-global {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  background: var(--paper-light);
  border-bottom: var(--border-thick);
  height: 30px;
  flex-shrink: 0;
  z-index: 19;
}
.prestige-global-track {
  flex: 1;
  height: 12px;
  background: var(--paper-dark);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
  max-width: 520px;
  box-shadow: 1.5px 1.5px 0 rgba(35,29,20,0.12);
  position: relative;
}
.prestige-global-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 8px, rgba(255,255,255,0.14) 8px 9px);
  pointer-events: none;
  opacity: 0.9;
}
.prestige-global-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal) 0%, var(--mustard) 55%, var(--gold) 100%);
  transition: width 0.42s cubic-bezier(0.16,1,0.3,1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}
.prestige-global-fill.is-ready {
  background: linear-gradient(90deg, var(--mustard) 0%, var(--red) 100%);
  animation: rewindShimmer 1.1s ease-in-out infinite alternate;
}
@keyframes rewindShimmer {
  from { filter: brightness(1); }
  to { filter: brightness(1.14); }
}
.prestige-global-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.7px;
  color: rgba(35,29,20,0.62);
  white-space: nowrap;
}
.prestige-global-label {
  font-family: 'Bungee', cursive;
  font-size: 10px;
  color: var(--ink);
  letter-spacing: 0.4px;
}
.prestige-global-detail {
  color: rgba(35,29,20,0.65);
  font-weight: 700;
  font-size: 8px;
}

.dock-prestige {
  background: var(--paper);
  border-top: var(--border-thick);
  padding: 12px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex-shrink: 0;
}
.dock-prestige-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dock-prestige-title {
  font-family: 'Bungee', cursive;
  font-size: 12px;
  letter-spacing: 0.4px;
  color: var(--ink);
}
.dock-prestige-chips {
  font-size: 9px;
  font-weight: 700;
  color: var(--teal);
  background: var(--paper-light);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  padding: 2px 7px;
  box-shadow: 1.5px 1.5px 0 var(--ink);
}
.dock-prestige-bar {
  height: 14px;
  background: var(--paper-dark);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 1.5px 1.5px 0 rgba(35,29,20,0.12);
  position: relative;
}
.dock-prestige-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 7px, rgba(255,255,255,0.13) 7px 8px);
  pointer-events: none;
}
.dock-prestige-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 0.42s cubic-bezier(0.16,1,0.3,1);
}
.dock-prestige-fill.is-ready {
  background: linear-gradient(90deg, var(--mustard), var(--red));
  animation: rewindShimmer 1.1s ease-in-out infinite alternate;
}
.dock-prestige-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: rgba(35,29,20,0.66);
}
.dock-prestige-meta span:last-child {
  font-family: 'Bungee', cursive;
  font-size: 10px;
  color: var(--red);
}

/* =============================================================
   INTEGRATED TELEMETRY HUD FOOTER
============================================================= */
.telemetry-hud {
  background: var(--paper);
  border-top: var(--border-thick);
  padding: 8px 18px 10px;
  flex-shrink: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-cluster {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 10px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  background: var(--paper-light);
  border: var(--border-thick);
  box-shadow: 2px 2px 0 var(--ink);
  padding: 6px 10px;
  border-radius: 4px;
}

.hud-stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 2px;
}

.hud-label {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: rgba(35, 29, 20, 0.6);
}

.combo-badge {
  font-size: 7.5px;
  font-weight: 700;
  padding: 1.5px 5px;
  border-radius: 2px;
  background: var(--mustard);
  color: #fff;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

.hud-val-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.hud-val {
  font-family: 'Bungee', cursive;
  font-size: 15px;
  color: var(--ink);
  line-height: 1;
}

.hud-val-big {
  font-size: 17px;
  color: var(--red);
}
.hud-val.hot {
  color: var(--red-deep);
}

.hud-unit {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: rgba(35, 29, 20, 0.5);
}

.hud-hint {
  text-align: center;
  font-size: 8.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(35, 29, 20, 0.45);
  font-weight: 600;
  transition: opacity 0.3s ease;
}
.hud-hint.gone {
  opacity: 0;
  pointer-events: none;
}

/* =============================================================
   SLIDE-OUT WORKSHOP DRAWER & BACKDROP
============================================================= */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(35, 29, 20, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.workshop-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 92vw);
  max-width: 95vw;
  background: var(--paper-light);
  border-left: var(--border-heavy);
  box-shadow: -8px 0 32px rgba(35, 29, 20, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 110;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
.workshop-sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px 10px;
  background: var(--paper-dark);
  border-bottom: var(--border-thick);
}

.sidebar-title-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-title {
  font-family: 'Bungee', cursive;
  font-size: 20px;
  color: var(--ink);
  line-height: 1;
}

.sidebar-subtitle {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: rgba(35, 29, 20, 0.65);
  text-transform: uppercase;
  font-weight: 600;
}

.sidebar-close-btn {
  background: var(--paper-light);
  border: var(--border-thick);
  font-family: 'Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 3px;
  box-shadow: 2px 2px 0 var(--ink);
  transition: background 0.12s ease, transform 0.08s ease, color 0.12s ease;
}
.sidebar-close-btn:hover {
  background: var(--red);
  color: #fff;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

/* Sidebar Navigation Tabs */
.sidebar-tabs {
  display: flex;
  background: var(--paper);
  border-bottom: var(--border-thick);
  padding: 8px 14px;
  gap: 8px;
  overflow-x: auto;
  flex-shrink: 0;
}

.tab-btn {
  font-family: 'Plex Mono', monospace;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  background: var(--paper-light);
  color: var(--ink);
  border: var(--border-thick);
  border-radius: 3px;
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 1.5px 1.5px 0 var(--ink);
  transition: all 0.12s ease;
}
.tab-btn:hover {
  background: #fff;
  transform: translate(-1px, -1px);
  box-shadow: 2px 2px 0 var(--ink);
}
.tab-btn.active {
  background: var(--ink);
  color: var(--paper);
  box-shadow: 2px 2px 0 var(--paper-dark);
}

/* Scrollable Content Container */
.sidebar-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Tab Contents */
.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  min-height: 0;
}
.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Multiplier Toolbar inside Shop */
.shop-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
}
.shop-toolbar .label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: rgba(35, 29, 20, 0.65);
}
.mult-toggle {
  display: flex;
  gap: 4px;
  background: var(--paper-dark);
  padding: 3px;
  border: var(--border-thick);
  border-radius: 3px;
}
.mult-btn {
  font-family: 'Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  border: none;
  background: transparent;
  padding: 4px 10px;
  border-radius: 2px;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.1s ease;
}
.mult-btn.active {
  background: var(--ink);
  color: var(--paper);
}

/* Upgrade Cards */
.upgrade-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.upgrade-card {
  background: var(--paper-light);
  border: var(--border-thick);
  box-shadow: 2px 2px 0 var(--ink);
  border-radius: 4px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.upgrade-card:has(.upgrade-buy-btn:disabled) {
  opacity: 0.65;
  border-color: rgba(35,29,20,0.3);
  box-shadow: 1px 1px 0 rgba(35,29,20,0.2);
}
.upgrade-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.upgrade-name {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink);
  letter-spacing: 0.5px;
}
.upgrade-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 0.3px;
}
.upgrade-buy-btn.just-bought {
  transform: scale(0.96);
  filter: brightness(1.08);
}
.upgrade-card.shake-lite {
  animation: shakeLite 0.22s ease;
}
@keyframes shakeLite {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-1.5px); }
  75% { transform: translateX(1.5px); }
}
.upgrade-buy-btn {
  min-width: 105px;
  padding: 8px 12px;
  font-size: 11px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

/* Spinner Garage Grid */
.garage-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.spinner-card {
  background: var(--paper-light);
  border: var(--border-thick);
  box-shadow: 2.5px 2.5px 0 var(--ink);
  border-radius: 4px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.spinner-card.equipped {
  border: 2px solid var(--red);
  background: #fffdf8;
}
.spinner-card-top {
  display: flex;
  gap: 12px;
  align-items: center;
}
.spinner-preview-cv {
  width: 56px;
  height: 56px;
  border-radius: 4px;
  background: var(--paper);
  border: var(--border-thin);
  flex-shrink: 0;
}
.spinner-card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.spinner-card-code {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  color: rgba(35, 29, 20, 0.55);
}
.spinner-card-name {
  font-family: 'Bungee', cursive;
  font-size: 13.5px;
  line-height: 1.1;
  color: var(--ink);
}
.spinner-card-perk {
  font-size: 10px;
  font-weight: 600;
  color: var(--teal);
  margin-top: 1px;
}
.spinner-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed rgba(35, 29, 20, 0.2);
}
.spinner-badge {
  font-size: 9.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 3px;
  letter-spacing: 0.8px;
}
.spinner-badge.active-badge {
  background: var(--red);
  color: #fff;
}

/* Stats Table */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
  background: var(--paper-light);
  border: var(--border-thick);
  border-radius: 4px;
  box-shadow: 2.5px 2.5px 0 var(--ink);
}
.stats-table tr {
  border-bottom: 1px solid rgba(35, 29, 20, 0.15);
}
.stats-table tr:last-child {
  border-bottom: none;
}
.stats-table td {
  padding: 8px 12px;
  font-size: 10.5px;
}
.stats-table td:first-child {
  font-weight: 600;
  color: rgba(35, 29, 20, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stats-table td:last-child {
  text-align: right;
  font-family: 'Bungee', cursive;
  font-size: 12px;
  color: var(--ink);
}

.achievement-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.achievement-card {
  background: var(--paper-light);
  border: var(--border-thick);
  box-shadow: 2px 2px 0 var(--ink);
  border-radius: 4px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.achievement-card.completed {
  background: #fbfbf0;
  border-color: var(--teal);
}
.achievement-card.ready-claim {
  background: #fffdf2;
  border-color: var(--mustard);
  box-shadow: 2px 2px 0 var(--gold);
}
.ach-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.ach-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.ach-title {
  font-weight: 700;
  font-size: 11px;
  color: var(--ink);
  letter-spacing: 0.5px;
}
.ach-desc {
  font-size: 9px;
  color: rgba(35, 29, 20, 0.65);
}
.ach-reward {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}

/* Achievement Progress Bar */
.ach-progress-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
}
.ach-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--paper-dark);
  border: 1px solid rgba(35, 29, 20, 0.3);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.ach-progress-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 3px;
  transition: width 0.2s ease;
}
.ach-progress-fill.ready {
  background: var(--gold);
}
.ach-progress-fill.completed {
  background: var(--teal);
}
.ach-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8.5px;
  font-weight: 600;
  color: rgba(35, 29, 20, 0.65);
  letter-spacing: 0.5px;
}
.ach-claim-btn {
  font-size: 9.5px;
  font-weight: 700;
  padding: 4px 8px;
  background: var(--teal);
  color: #fff;
  border: var(--border-thin);
  border-radius: 3px;
  cursor: pointer;
  box-shadow: 1px 1px 0 var(--ink);
  transition: background 0.1s ease;
}
.ach-claim-btn:hover {
  background: #218f74;
}
.ach-claimed-badge {
  font-size: 8px;
  font-weight: 700;
  padding: 2px 6px;
  background: var(--paper-dark);
  color: var(--teal);
  border: 1px solid var(--teal);
  border-radius: 2px;
  letter-spacing: 0.8px;
}

/* Settings Group */
.settings-group {
  background: var(--paper-light);
  border: var(--border-thick);
  box-shadow: 2.5px 2.5px 0 var(--ink);
  border-radius: 4px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.setting-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.5px;
}
.setting-sub {
  font-size: 9px;
  color: rgba(35, 29, 20, 0.6);
}

/* Modal Dialogs */
.modal-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(35, 29, 20, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s;
}
.modal-dialog-backdrop.open {
  opacity: 1;
  visibility: visible;
}
.modal-dialog-card {
  background: var(--paper);
  border: var(--border-heavy);
  box-shadow: 5px 5px 0 var(--ink);
  border-radius: 6px;
  padding: 20px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}
.modal-dialog-code {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(35, 29, 20, 0.55);
}
.modal-dialog-title {
  font-family: 'Bungee', cursive;
  font-size: 18px;
  color: var(--red);
  line-height: 1.1;
}
.modal-dialog-coins {
  font-family: 'Bungee', cursive;
  font-size: 24px;
  color: var(--ink);
  margin: 2px 0;
}
.modal-dialog-text {
  font-size: 9.5px;
  color: rgba(35, 29, 20, 0.8);
  line-height: 1.4;
}

/* Golden Flick Event */
.golden-tick {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: radial-gradient(circle at 35% 35%, #fff6a0 0%, #e69d27 45%, #c48c12 70%, #a52f0b 100%);
  box-shadow: 0 0 0 3px var(--paper), 0 0 18px rgba(230,157,39,0.9), 3px 3px 0 var(--ink);
  cursor: pointer;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: golden-pulse 1.1s ease-in-out infinite alternate, golden-drift 6s ease-in-out infinite;
  pointer-events: auto;
}
.golden-tick-inner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset -2px -2px 0 rgba(0,0,0,0.15);
  opacity: 0.95;
}
.golden-tick:hover { transform: scale(1.08); }
@keyframes golden-pulse {
  from { box-shadow: 0 0 0 3px var(--paper), 0 0 14px rgba(230,157,39,0.7), 3px 3px 0 var(--ink); }
  to { box-shadow: 0 0 0 3px var(--paper), 0 0 26px rgba(230,157,39,1), 3px 3px 0 var(--ink); transform: scale(1.04); }
}
@keyframes golden-drift {
  0%,100% { margin-top: 0; }
  50% { margin-top: -6px; }
}

.buff-bar {
  position: fixed;
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 30;
  pointer-events: none;
  flex-wrap: wrap;
  justify-content: center;
  max-width: min(92%, 620px);
}
@media (max-width: 680px) {
  .buff-bar { top: 108px; }
}
.buff-chip {
  display: flex;
  align-items: stretch;
  background: var(--paper-light);
  border: var(--border-thick);
  border-radius: 6px;
  box-shadow: 2.5px 2.5px 0 var(--ink);
  overflow: hidden;
  min-width: 150px;
  max-width: 200px;
  animation: buffIn 0.22s cubic-bezier(0.16,1,0.3,1);
  pointer-events: none;
}
@keyframes buffIn {
  from { opacity:0; transform: translateY(-6px) scale(0.96); }
  to { opacity:1; transform: translateY(0) scale(1); }
}
.buff-chip-accent {
  width: 5px;
  flex-shrink: 0;
}
.buff-chip-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.buff-chip-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px 3px;
}
.buff-chip-icon {
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  border: 1.5px solid var(--ink);
  box-shadow: 1px 1px 0 rgba(35,29,20,0.18);
  flex-shrink: 0;
}
.buff-chip-label {
  font-family: 'Bungee', cursive;
  font-size: 10.5px;
  letter-spacing: 0.5px;
  color: var(--ink);
  line-height: 1;
  white-space: nowrap;
  flex: 1;
}
.buff-chip-mult {
  font-family: 'Plex Mono', monospace;
  font-weight: 700;
  font-size: 9.5px;
  letter-spacing: 0.4px;
  color: var(--ink);
  background: var(--paper-dark);
  border: 1px solid rgba(35,29,20,0.14);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
}
.buff-chip-mult.is-boost {
  color: #fff;
}
.buff-chip-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: rgba(35,29,20,0.55);
  padding: 0 8px 4px;
}
.buff-chip-meta strong {
  color: var(--ink);
  font-weight: 700;
}
.buff-timer {
  height: 4px;
  background: var(--paper-dark);
  border-top: 1px solid rgba(35,29,20,0.14);
  overflow: hidden;
}
.buff-timer-fill {
  height: 100%;
  transition: width 0.12s linear;
}
.buff-chip.is-ending {
  animation: buffPulse 0.6s ease-in-out infinite alternate;
}
@keyframes buffPulse {
  from { box-shadow: 2.5px 2.5px 0 var(--ink); }
  to { box-shadow: 2.5px 2.5px 0 var(--ink), 0 0 10px rgba(217,72,28,0.18); }
}
.buff-ticker {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 4px;
  scrollbar-width: none;
}
.buff-ticker::-webkit-scrollbar { display:none; }
.buff-ticker .buff-chip {
  transform: scale(0.92);
  min-width: 132px;
}

/* Prestige Panel */
.prestige-panel {
  background: var(--paper-light);
  border: var(--border-thick);
  box-shadow: 2.5px 2.5px 0 var(--ink);
  border-radius: 4px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prestige-panel-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.prestige-panel-title {
  font-family: 'Bungee', cursive;
  font-size: 13px;
  color: var(--ink);
  letter-spacing: 0.5px;
}
.prestige-panel-sub {
  font-size: 9px;
  color: rgba(35,29,20,0.6);
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.prestige-stats-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.prestige-stat {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--teal);
}
.prestige-stat span { color: var(--ink); font-family: 'Bungee', cursive; font-size: 11px; }
.prestige-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--paper);
  border: var(--border-thick);
  border-radius: 6px;
  padding: 9px 10px;
  box-shadow: 2px 2px 0 var(--ink);
}
.prestige-progress-bar {
  height: 14px;
  background: var(--paper-dark);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 1.5px 1.5px 0 rgba(35,29,20,0.12);
  position: relative;
}
.prestige-progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 7px, rgba(255,255,255,0.12) 7px 8px);
  pointer-events: none;
}
.prestige-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--mustard));
  transition: width 0.42s cubic-bezier(0.16,1,0.3,1);
}
.prestige-progress-fill.is-ready {
  background: linear-gradient(90deg, var(--mustard), var(--red));
  animation: rewindShimmer 1.1s ease-in-out infinite alternate;
}
.prestige-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: rgba(35,29,20,0.66);
}
.prestige-progress-meta span:last-child {
  font-family: 'Plex Mono', monospace;
  font-weight: 700;
  color: var(--ink);
}
/* Rewind Ready Popup */
.rewind-ready-popup {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 260;
  width: min(380px, calc(100vw - 20px));
  pointer-events: auto;
  animation: rewindPopIn 0.28s cubic-bezier(0.16,1,0.3,1);
}
@keyframes rewindPopIn {
  from { opacity:0; transform: translateX(-50%) translateY(14px) scale(0.96); }
  to { opacity:1; transform: translateX(-50%) translateY(0) scale(1); }
}
.rewind-ready-card {
  background: var(--paper-light);
  border: var(--border-heavy);
  box-shadow: 6px 6px 0 var(--ink);
  border-radius: 8px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  text-align: center;
}
.rewind-ready-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.rewind-ready-tag {
  font-family: 'Bungee', cursive;
  font-size: 11px;
  letter-spacing: 0.8px;
  color: var(--red);
}
.rewind-ready-close {
  background: var(--paper);
  border: var(--border-thin);
  border-radius: 3px;
  width: 22px;
  height: 22px;
  font-size: 10px;
  cursor: pointer;
  box-shadow: 1px 1px 0 var(--ink);
}
.rewind-ready-title {
  font-family: 'Bungee', cursive;
  font-size: 18px;
  line-height: 1;
  color: var(--ink);
}
.rewind-ready-sub {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: rgba(35,29,20,0.65);
  text-transform: uppercase;
}
.rewind-ready-bar {
  height: 10px;
  background: var(--paper-dark);
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  overflow: hidden;
}
.rewind-ready-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--mustard), var(--red));
  animation: rewindShimmer 1s ease-in-out infinite alternate;
}
.rewind-ready-actions {
  display: flex;
  gap: 8px;
}
.rewind-ready-actions .btn {
  flex: 1;
  font-size: 11px;
  padding: 8px;
}
.prestige-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.prestige-reward-preview {
  font-size: 9px;
  color: rgba(35,29,20,0.65);
  line-height: 1.3;
}
.heavenly-shop {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.heavenly-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: var(--border-thin);
  border-radius: 3px;
  padding: 8px 10px;
}
.heavenly-card strong { font-size: 11px; }
.heavenly-card p { font-size: 9px; color: rgba(35,29,20,0.7); margin: 2px 0 0; }
.heavenly-card .btn { font-size: 10px; padding: 5px 10px; white-space: nowrap; }

/* Screen shake on crit */
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translate(-2px,1px); } 75% { transform: translate(2px,-1px); } }
.shake { animation: shake 0.18s ease; }

/* Coin pulse */
.coin-display.pulse { transform: scale(1.06); box-shadow: 3px 3px 0 var(--ink); }
.coin-display { transition: transform 0.12s ease; }

/* Flying coins */
.flying-coin {
  position: fixed;
  font-family: 'Plex Mono', monospace;
  font-weight: 700;
  font-size: 12px;
  color: var(--gold);
  background: var(--paper-light);
  border: 1.5px solid var(--ink);
  box-shadow: 1.5px 1.5px 0 var(--ink);
  border-radius: 12px;
  padding: 2px 7px;
  pointer-events: none;
  z-index: 400;
  white-space: nowrap;
  will-change: transform, opacity;
  text-shadow: 0 1px 0 rgba(0,0,0,0.15);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 300;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--paper);
  border: 1.5px solid var(--paper);
  border-radius: 3px;
  padding: 5px 10px;
  font-size: 9px;
  font-weight: 600;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
  animation: toast-anim 2.4s ease forwards;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
@keyframes toast-anim {
  0% { opacity: 0; transform: translateY(12px); }
  12% { opacity: 1; transform: translateY(0); }
  85% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); }
}

/* Collectible Milestone Notifications */
.achievement-notifications {
  position: fixed;
  top: 60px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 250;
  pointer-events: auto;
  max-width: 360px;
}
.claim-toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--paper);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  padding: 8px 12px;
  animation: slide-in-claim 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.claim-toast.dismissing {
  opacity: 0;
  transform: translateY(-8px) scale(0.95);
}
@keyframes slide-in-claim {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.claim-toast-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.claim-toast-tag {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--mustard);
}
.claim-toast-title {
  font-family: 'Bungee', cursive;
  font-size: 11.5px;
  color: var(--paper);
  line-height: 1.1;
}
.claim-toast-btn {
  font-size: 10.5px;
  font-weight: 600;
  padding: 6px 12px;
  background: var(--teal);
  color: #fff;
  border: 1.5px solid var(--paper);
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 1.5px 1.5px 0 rgba(0, 0, 0, 0.3);
  transition: background 0.1s ease;
}
.claim-toast-btn:hover {
  background: #218f74;
}

/* Dock vs Drawer breakpoint */
@media (max-width: 900px) {
  .app-layout {
    flex-direction: column;
  }
  .upgrades-dock {
    display: none !important;
  }
  .play-column {
    flex: 1;
  }
  .hero-glow {
    width: min(82vmin, 480px);
    height: min(82vmin, 480px);
  }
  .hero-ring {
    width: min(88vmin, 520px);
    height: min(88vmin, 520px);
  }
}
@media (min-width: 901px) {
  /* On desktop upgrades are in dock — make drawer lighter, hide its UPGRADE tab button visually but keep for compat */
  .workshop-sidebar .tab-btn[data-tab="tab-shop"] {
    opacity: 0.55;
  }
  .telemetry-hud {
    max-width: none;
  }
  #passive-bench-mobile {
    display: none !important;
  }
}
@media (min-width: 1100px) {
  .upgrades-dock {
    width: 400px;
  }
  .play-column #stage::after {
    inset: 16px;
  }
}

/* =============================================================
   MOBILE & TABLET RESPONSIVENESS
============================================================= */
@media (max-width: 680px) {
  header {
    padding: max(6px, env(safe-area-inset-top)) 10px 6px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .brand-block {
    order: 1;
  }
  .coin-display {
    order: 2;
    padding: 4px 10px;
  }
  .nav-actions {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 4px;
    padding-top: 4px;
    border-top: 1px dashed rgba(35, 29, 20, 0.15);
  }
  .nav-btn {
    flex: 1;
    font-size: 9.5px;
    padding: 6px 2px;
    text-align: center;
    min-height: 32px;
  }
  .sticker {
    font-size: 22px;
  }
  .coin-val {
    font-size: 16px;
  }
  .hud-cluster {
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 6px;
  }
  .hud-stat {
    padding: 4px 6px;
  }
  .hud-label {
    font-size: 7.5px;
  }
  .hud-val-big {
    font-size: 14.5px;
  }
  .hud-val {
    font-size: 12.5px;
  }
  .telemetry-hud {
    padding: 6px 10px max(8px, env(safe-area-inset-bottom));
  }
  .workshop-sidebar {
    width: 100vw;
    max-width: 100vw;
    border-left: none;
  }
}

@media (max-width: 400px) {
  .model-badge {
    display: none;
  }
  .nav-btn {
    font-size: 8.5px;
    padding: 4px 1px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #hint, .value, .btn {
    transition: none !important;
    animation: none !important;
  }
}


