/* ================================================================== */
/* BALL STREET — 90s/2000s DOTCOM WALL STREET THEME                    */
/* ================================================================== */

/* --- FONTS --- */
@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&family=Playfair+Display:wght@700;900&display=swap');

:root {
  /* Core palette */
  --bg-deep: #0d0a07;
  --bg-panel: #1a1510;
  --bg-panel-alt: #221c14;
  --bg-inset: #0f0c08;
  --bg-titlebar: #2a2318;

  --gold: #c9a227;
  --gold-light: #d4b44a;
  --gold-dim: #8a7020;
  --gold-bg: rgba(201, 162, 39, 0.08);

  --cream: #e8dcc8;
  --cream-dim: #a89878;

  --bull: #2d8f4e;
  --bull-bright: #45b868;
  --bear: #c23028;
  --bear-bright: #e84040;

  --border-raised: #3d3428 #1a140e #1a140e #3d3428;
  --border-inset: #1a140e #3d3428 #3d3428 #1a140e;

  --text-primary: #e8dcc8;
  --text-dim: #8a7a64;
  --text-header: #c9a227;
}

/* BASE */
body {
  margin: 0;
  overflow: hidden;
  background-color: var(--bg-deep);
  font-family: Tahoma, 'Trebuchet MS', Geneva, Verdana, sans-serif;
  touch-action: none;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  color: var(--cream);
}

/* GAME SCENE WRAPPER */
#game-scene-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* FLOOR BACKGROUND — changes per floor via JS */
#office-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../assets/floor1-bg.png');
  background-size: cover;
  background-position: center;
  filter: brightness(0.4) saturate(0.6);
  opacity: 0.6;
  z-index: 1;
  transition: all 0.6s ease;
}

/* CRT MONITOR → TRADING DESK FRAME */
#crt-monitor {
  position: relative;
  width: 1000px;
  height: 750px;
  background: linear-gradient(145deg, #2a2318 0%, #1a1510 50%, #12100c 100%);
  border-radius: 6px;
  border: 3px solid;
  border-color: #4a3f30 #1a140e #1a140e #4a3f30;
  box-shadow:
    0 10px 50px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 20px;
}

/* GAME SCREEN — Trading Terminal */
#game-screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
  z-index: 10;
  border: 2px solid;
  border-color: var(--border-inset);
  border-radius: 2px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* Remove old scanlines — replace with subtle vignette */
#game-screen::after {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center,
      transparent 60%,
      rgba(0, 0, 0, 0.3) 100%);
  pointer-events: none;
  z-index: 1;
}

/* LAYOUT */
#main-layout {
  display: flex;
  height: calc(100% - 32px);
  justify-content: space-between;
}

/* ================================================================== */
/* TOP BAR (TICKER TAPE)                                               */
/* ================================================================== */
#top-bar {
  width: 100%;
  height: 32px;
  background: linear-gradient(180deg, #1a1510 0%, #12100c 100%);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--gold-dim);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

#level-info {
  font-size: 13px;
  padding: 0 12px;
  font-weight: bold;
  color: var(--gold);
  white-space: nowrap;
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: 0.5px;
  border-right: 1px solid var(--gold-dim);
}

#ticker-tape {
  flex-grow: 1;
  height: 100%;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.tape-content {
  display: inline-block;
  padding-left: 100%;
  animation: ticker 25s linear infinite;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  color: var(--cream);
}

@keyframes ticker {
  0% {
    transform: translate3d(0, 0, 0);
  }

  100% {
    transform: translate3d(-100%, 0, 0);
  }
}

/* ================================================================== */
/* SIDEBARS                                                            */
/* ================================================================== */
.sidebar {
  width: 260px;
  height: 100%;
  padding: 8px;
  box-sizing: border-box;
  font-size: 13px;
  overflow-y: auto;
  border-color: #2a2318;
  border-width: 0 1px;
  border-style: solid;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(26, 21, 16, 0.6) 0%, rgba(13, 10, 7, 0.6) 100%);
}

#left-sidebar {
  border-left: none;
}

#right-sidebar {
  border-right: none;
}

/* Scrollbar styling */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--gold-dim);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

.panel-title {
  font-size: 11px;
  font-weight: bold;
  margin: 10px 0 5px 0;
  padding: 4px 8px;
  background: linear-gradient(180deg, #2a2318 0%, #1a1510 100%);
  border: 1px solid;
  border-color: #3d3428 #1a140e #1a140e #3d3428;
  color: var(--gold);
  font-family: Tahoma, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.panel-subtitle {
  font-size: 11px;
  color: var(--text-dim);
}

/* ================================================================== */
/* CENTER BOARD                                                        */
/* ================================================================== */
#center-board {
  position: relative;
  width: 480px;
  height: 100%;
  flex-shrink: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  cursor: crosshair;
}

/* ================================================================== */
/* DANGER LINE                                                         */
/* ================================================================== */
#warning-line {
  position: absolute;
  width: 100%;
  height: 3px;
  top: 130px;
  pointer-events: none;
  background: repeating-linear-gradient(90deg,
      var(--bear) 0px, var(--bear) 6px,
      transparent 6px, transparent 12px);
  box-shadow: 0 0 8px rgba(194, 48, 40, 0.5);
  z-index: 8;
  opacity: 0;
  transition: opacity 0.2s;
  animation: danger-pulse 0.5s infinite alternate;
}

@keyframes danger-pulse {
  from {
    transform: scaleY(1);
    opacity: 0.8;
  }

  to {
    transform: scaleY(1.3);
    opacity: 1;
  }
}

#danger-countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 120px;
  font-weight: bold;
  color: var(--bear);
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
  font-family: 'Playfair Display', Georgia, serif;
  text-shadow: 0 0 20px rgba(194, 48, 40, 0.6);
}

@keyframes countdownPulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
  }

  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

.countdown-anim {
  animation: countdownPulse 1s ease-out infinite;
}

/* ================================================================== */
/* SCORE PANEL                                                         */
/* ================================================================== */
#score-panel {
  text-align: center;
}

#score-panel .panel-title {
  font-size: 28px;
  border: none;
  background: none;
  margin: 10px 0 0 0;
  padding: 0;
  color: var(--gold-light);
  font-family: 'Courier New', monospace;
  letter-spacing: 0;
}

/* ================================================================== */
/* PROGRESS BAR                                                        */
/* ================================================================== */
#progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--bg-inset);
  border: 1px solid;
  border-color: var(--border-inset);
  margin: 10px 0;
  overflow: hidden;
}

#progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transition: width 0.3s;
  box-shadow: 0 0 6px rgba(201, 162, 39, 0.4);
}

/* ================================================================== */
/* NEXT TRADE & DROP PREVIEW                                            */
/* ================================================================== */
#next-trade-panel {
  text-align: center;
}

.next-preview-box {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
}

#drop-preview-container {
  position: absolute;
  top: 55px;
  left: 0;
  width: 100%;
  height: 50px;
  pointer-events: none;
  z-index: 9;
}

#drop-preview {
  position: absolute;
  top: 0;
  left: 0;
}

/* ================================================================== */
/* HIERARCHY LIST (MERGE LADDER)                                        */
/* ================================================================== */
#hierarchy-list {
  margin-top: 8px;
  overflow-y: auto;
  max-height: 85%;
}

.hierarchy-item {
  display: flex;
  align-items: center;
  padding: 3px 4px;
  cursor: default;
  height: 48px;
  border-bottom: 1px solid rgba(42, 35, 24, 0.6);
  transition: background 0.2s;
}

.hierarchy-item:hover {
  background: rgba(201, 162, 39, 0.05);
}

.h-circle-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 8px;
  position: relative;
}

.h-circle {
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.h-info {
  flex-grow: 1;
  line-height: 1.3;
  padding-left: 5px;
}

.h-name {
  font-weight: bold;
  color: var(--cream);
  font-size: 12px;
}

.h-price {
  font-size: 10px;
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
}

/* ================================================================== */
/* RECAP STATS                                                         */
/* ================================================================== */
#recap-stats {
  margin: 20px 0;
  text-align: left;
  border: 1px solid var(--gold-dim);
  padding: 15px;
  background: var(--bg-inset);
}

.recap-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 15px;
  color: var(--cream);
}

/* ================================================================== */
/* STRATEGIES & ORDERS SLOTS                                           */
/* ================================================================== */
.inventory-slots {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: center;
}

.inventory-slot {
  width: 60px;
  height: 60px;
  border: 2px solid;
  border-color: var(--border-inset);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--bg-inset);
  transition: all 0.2s;
  cursor: pointer;
}

.inventory-slot.filled {
  border-color: var(--gold-dim) var(--bg-deep) var(--bg-deep) var(--gold-dim);
  background: linear-gradient(145deg, rgba(201, 162, 39, 0.08), rgba(201, 162, 39, 0.02));
  box-shadow: 0 0 8px rgba(201, 162, 39, 0.12);
}

.inventory-slot:hover {
  border-color: #3d3428;
}

.inventory-slot.filled:hover {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(201, 162, 39, 0.25);
}

.tool-item {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.tool-name {
  font-size: 9px;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55px;
  color: var(--cream-dim);
}

.tool-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--gold);
  color: #000;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 10px;
  border: 1px solid var(--bg-deep);
}

.tool-icon {
  font-size: 20px;
  color: var(--gold);
}

/* ================================================================== */
/* TOOLTIP                                                             */
/* ================================================================== */
.tooltip {
  position: fixed;
  background: var(--bg-panel);
  border: 1px solid var(--gold-dim);
  color: var(--cream);
  padding: 12px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 1000;
  pointer-events: auto;
  display: none;
  width: 180px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.6);
}

.tooltip-title {
  font-weight: bold;
  color: var(--gold);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: Georgia, serif;
}

.tooltip-desc {
  color: var(--text-dim);
  margin-bottom: 10px;
  line-height: 1.4;
}

.sell-container {
  border-top: 1px solid #2a2318;
  padding-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sell-price {
  color: var(--gold);
  font-weight: bold;
  font-family: 'Courier New', monospace;
}

.sell-button {
  background: var(--bear);
  color: #fff;
  border: 1px solid;
  border-color: #d84040 #8a1818 #8a1818 #d84040;
  padding: 4px 8px;
  border-radius: 2px;
  font-size: 10px;
  cursor: pointer;
  font-weight: bold;
}

.sell-button:hover {
  background: var(--bear-bright);
}

/* ================================================================== */
/* MODALS — "Stock Certificate" Style                                  */
/* ================================================================== */
.game-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(145deg, #1a1510 0%, #12100c 60%, #0d0a07 100%);
  border: 2px solid var(--gold-dim);
  outline: 1px solid rgba(201, 162, 39, 0.2);
  outline-offset: 3px;
  color: var(--cream);
  padding: 30px;
  text-align: center;
  display: none;
  z-index: 100;
  width: 80%;
  max-width: 750px;
  box-shadow:
    0 0 40px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(201, 162, 39, 0.1);
}

.game-modal h1 {
  margin: 0 0 10px 0;
  font-size: 32px;
  color: var(--gold-light);
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.game-modal h2 {
  font-size: 16px;
  color: var(--text-dim);
  margin-bottom: 20px;
  font-family: Georgia, serif;
  font-style: italic;
}

.game-modal h3 {
  font-size: 14px;
  color: var(--gold);
  border-bottom: 1px solid var(--gold-dim);
  padding-bottom: 5px;
  margin-top: 15px;
  font-family: Georgia, serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* BUTTONS — 3D Beveled Win2000 style */
.game-modal button {
  background: linear-gradient(180deg, #3d3428 0%, #2a2318 100%);
  border: 2px solid;
  border-color: #4a3f30 #1a140e #1a140e #4a3f30;
  color: var(--gold-light);
  padding: 10px 24px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
  font-family: Tahoma, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.game-modal button:hover {
  background: linear-gradient(180deg, #4a3f30 0%, #3d3428 100%);
  color: #fff;
  box-shadow: 0 0 12px rgba(201, 162, 39, 0.2);
}

.game-modal button:active {
  border-color: #1a140e #4a3f30 #4a3f30 #1a140e;
  background: linear-gradient(180deg, #1a1510 0%, #2a2318 100%);
}

.red-text {
  color: var(--bear-bright);
}

.green-text {
  color: var(--bull-bright);
}

/* ================================================================== */
/* ELEVATOR SHOP                                                       */
/* ================================================================== */
/* ================================================================== */
/* ELEVATOR SHOP — FULL OVERLAY                                        */
/* ================================================================== */
#elevator-shop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  transform: none;
  background: var(--bg-deep);
  border: none;
  outline: none;
  z-index: 200;
  display: none;
  overflow-y: auto;
  padding: 40px 30px;
  box-sizing: border-box;
}

#elevator-shop h1 {
  animation: goldFlicker 2s infinite alternate;
}

@keyframes goldFlicker {
  0% {
    opacity: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  }

  100% {
    opacity: 0.9;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), 0 0 8px rgba(201, 162, 39, 0.3);
  }
}

#shop-status {
  font-size: 18px;
  font-weight: bold;
  color: var(--gold);
  margin-bottom: 20px;
  font-family: 'Courier New', monospace;
}

#shop-container {
  display: flex;
  gap: 20px;
  text-align: left;
  margin-bottom: 20px;
}

.shop-section {
  flex: 1;
  padding: 10px;
  border: 1px solid;
  border-color: var(--border-inset);
  background: var(--bg-inset);
}

.shop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(42, 35, 24, 0.5);
}

.shop-item:last-child {
  border-bottom: none;
}

.shop-details {
  flex-grow: 1;
}

.shop-price-button {
  display: flex;
  align-items: center;
}

.shop-price {
  font-weight: bold;
  color: var(--gold);
  margin-right: 10px;
  white-space: nowrap;
  font-family: 'Courier New', monospace;
}

.buy-button {
  background: linear-gradient(180deg, #2d8f4e 0%, #1a6934 100%);
  color: white;
  border: 1px solid;
  border-color: #45b868 #1a5030 #1a5030 #45b868;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
}

.buy-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #45b868 0%, #2d8f4e 100%);
}

.buy-button:disabled {
  background: #222;
  border-color: #333;
  cursor: not-allowed;
  color: #555;
}

.purchased {
  color: var(--gold);
  font-weight: bold;
  font-style: italic;
}

#shop-controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

#shop-reroll-button {
  background: linear-gradient(180deg, #8a7020 0%, #6a5818 100%);
  color: var(--bg-deep);
  border-color: var(--gold) #504010 #504010 var(--gold);
}

#shop-reroll-button:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--gold) 0%, #8a7020 100%);
  color: #000;
}

#shop-reroll-button:disabled {
  background: #222;
  border-color: #333;
  color: #555;
  cursor: not-allowed;
}

/* ================================================================== */
/* SETTINGS                                                            */
/* ================================================================== */
#settings-button {
  position: absolute;
  bottom: 10px;
  left: 10px;
  color: var(--gold-dim);
  font-size: 18px;
  z-index: 50;
  cursor: pointer;
  transition: color 0.2s;
}

#settings-button:hover {
  color: var(--gold-light);
}

.close-button {
  position: absolute;
  right: 10px;
  top: 5px;
  font-size: 24px;
  cursor: pointer;
  color: var(--cream-dim);
}

.close-button:hover {
  color: #fff;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #333;
  transition: 0.4s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: var(--cream);
  transition: 0.4s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: var(--gold);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #2a2318;
  color: var(--cream);
}

.modal-content {
  background: var(--bg-panel);
  margin: 20% auto;
  padding: 20px;
  width: 300px;
  border-radius: 4px;
  border: 1px solid #2a2318;
  position: relative;
}

/* ================================================================== */
/* HOME SCREEN                                                         */
/* ================================================================== */
#home-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 320px;
  margin: 0 auto;
}

#home-menu button {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.08), rgba(201, 162, 39, 0.02));
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font-family: Tahoma, sans-serif;
}

#home-menu button:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dim) 100%);
  color: #000;
  box-shadow: 0 0 20px rgba(201, 162, 39, 0.3);
}

#home-menu button:active:not(:disabled) {
  background: var(--gold-dim);
}

#home-menu button:disabled {
  border-color: #222;
  color: #444;
  background: rgba(0, 0, 0, 0.4);
  cursor: default;
}

/* ================================================================== */
/* BUILDING SELECT GRID                                                */
/* ================================================================== */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 20px;
}

#building-select-screen .shop-item {
  border: 1px solid #2a2318;
  padding: 15px;
  background: rgba(201, 162, 39, 0.02);
  transition: transform 0.2s, box-shadow 0.2s;
}

#building-select-screen .shop-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
  background: rgba(201, 162, 39, 0.06);
}

/* ================================================================== */
/* STATS ROW                                                           */
/* ================================================================== */
.stat-row {
  font-size: 16px;
  margin-bottom: 5px;
  color: var(--text-dim);
  font-family: Georgia, serif;
}

.stat-row span {
  color: var(--gold-light);
  font-weight: bold;
  font-family: 'Courier New', monospace;
}

/* ================================================================== */
/* VICTORY SCREEN                                                      */
/* ================================================================== */
#victory-screen {
  z-index: 200;
  overflow: hidden;
}

.victory-title {
  font-size: 36px !important;
  color: var(--gold-light) !important;
  text-shadow: 0 0 20px rgba(201, 162, 39, 0.4), 0 0 40px rgba(201, 162, 39, 0.2);
  animation: victoryGlow 2s ease-in-out infinite alternate;
}

.victory-subtitle {
  color: var(--bull-bright) !important;
  font-size: 20px !important;
}

.victory-flavor {
  color: var(--text-dim);
  font-style: italic;
  margin: 20px 0;
  font-size: 13px;
  font-family: Georgia, serif;
}

#victory-stats {
  margin: 20px auto;
  text-align: left;
  border: 1px solid var(--gold-dim);
  padding: 15px;
  max-width: 350px;
  background: var(--bg-inset);
}

@keyframes victoryGlow {
  0% {
    text-shadow: 0 0 20px rgba(201, 162, 39, 0.4), 0 0 40px rgba(201, 162, 39, 0.2);
  }

  100% {
    text-shadow: 0 0 30px rgba(201, 162, 39, 0.7), 0 0 60px rgba(201, 162, 39, 0.3), 0 0 80px rgba(201, 162, 39, 0.1);
  }
}

/* Confetti */
#confetti-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
}

.confetti-particle {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall linear infinite;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-10px) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(500px) rotate(720deg);
    opacity: 0;
  }
}

/* ================================================================== */
/* MOBILE DRAWER TOGGLES & RESPONSIVE                                  */
/* ================================================================== */
.mobile-toggle-btn {
  display: none;
}

.mobile-drawer-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 400;
}

.mobile-drawer-overlay.active {
  display: block;
}

#mobile-hud {
  display: none;
}

/* ================================================================== */
/* MOBILE RESPONSIVE                                                   */
/* ================================================================== */
@media (max-width: 768px) {
  body {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
  }

  #game-scene-wrapper {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
  }

  #crt-monitor {
    width: 100%;
    height: 100%;
    max-width: none;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  #game-screen {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    width: 100%;
    height: 100%;
  }

  #main-layout {
    justify-content: center;
    height: calc(100% - 32px);
  }

  /* Slide-out drawers */
  .sidebar {
    position: fixed;
    top: 0;
    height: 100vh;
    height: 100dvh;
    width: 260px;
    background: var(--bg-deep);
    z-index: 500;
    transition: transform 0.3s ease;
    border: none;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    overflow-y: auto;
    padding-top: 10px;
  }

  #left-sidebar {
    left: 0;
    transform: translateX(-100%);
    border-right: 2px solid var(--gold-dim);
  }

  #right-sidebar {
    right: 0;
    left: auto;
    transform: translateX(100%);
    border-left: 2px solid var(--gold-dim);
  }

  #left-sidebar.drawer-open {
    transform: translateX(0);
  }

  #right-sidebar.drawer-open {
    transform: translateX(0);
  }

  /* Center board */
  #center-board {
    width: 100%;
    max-width: 100vw;
    height: calc(100% - 44px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 0;
    margin: 0;
  }

  canvas {
    display: block;
    width: auto;
    height: auto;
    max-width: 100vw;
    max-height: calc(100dvh - 76px);
    /* top bar 32px + hud bar 44px */
    aspect-ratio: 480 / 750;
    object-fit: contain;
    opacity: 0.88;
  }

  /* Mobile HUD bar */
  #mobile-hud {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 44px;
    background: var(--bg-panel);
    border-top: 1px solid var(--gold-dim);
    align-items: center;
    justify-content: space-between;
    z-index: 350;
    padding: 0 4px;
  }

  .mobile-hud-btn {
    width: 38px;
    height: 38px;
    border-radius: 4px;
    border: 1px solid var(--gold-dim);
    background: transparent;
    color: var(--gold);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .mobile-hud-btn:active {
    background: var(--gold);
    color: #000;
  }

  .mobile-hud-item {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .mobile-hud-label {
    font-size: 9px;
    color: var(--text-dim);
    font-weight: bold;
  }

  .mobile-hud-score {
    font-size: 14px;
    font-weight: bold;
    color: var(--gold);
  }

  #mobile-score-value {
    color: var(--gold-light);
    font-weight: bold;
    font-family: 'Courier New', monospace;
  }

  /* Settings button — move into HUD area on mobile */
  #settings-button {
    position: fixed !important;
    bottom: 5px !important;
    left: 48px !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    z-index: 10000;
    font-size: 18px;
    width: 34px;
    height: 34px;
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  /* Modals */
  .game-modal {
    width: 90% !important;
    max-width: 95vw !important;
    padding: 15px !important;
    max-height: 85vh;
    overflow-y: auto;
    outline: none;
  }

  /* Shop stays full-screen on mobile too */
  #elevator-shop {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    padding: 20px 15px !important;
    background: linear-gradient(rgba(13, 10, 7, 0.82), rgba(13, 10, 7, 0.88)), url('../assets/elevator_bg.png') center / cover no-repeat !important;
  }

  .game-modal h1 {
    font-size: 22px;
  }

  .game-modal h2 {
    font-size: 13px;
  }

  #shop-container {
    flex-direction: column;
    gap: 10px;
  }

  #shop-controls {
    flex-direction: column;
    gap: 8px;
  }

  #home-screen {
    width: 90% !important;
    max-width: 95vw !important;
  }

  .victory-title {
    font-size: 22px !important;
  }

  #level-info {
    font-size: 10px;
    padding: 0 5px;
  }

  .tape-content {
    font-size: 9px;
  }

  #drop-preview-container {
    top: 30px;
  }

  #warning-line {
    top: 80px;
  }
}