:root {
  --board-w: 1568;
  --board-h: 1003;
  --accent: #ff8a19;
  --cyan: #40d6d6;
  --green: #87db6d;
  --paper: #f2dfbd;
  color-scheme: dark;
  font-family: "Avenir Next", "DIN Condensed", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050606;
}

button,
input {
  font: inherit;
}

.game-shell {
  width: 100vw;
  height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(45, 55, 45, 0.32), transparent 46%),
    #050606;
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.board {
  position: relative;
  width: min(100vw, calc(100dvh * 1.56331));
  aspect-ratio: 1568 / 1003;
  max-height: 100dvh;
  background: #050606;
  touch-action: manipulation;
  user-select: none;
}

.board > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transform: translateZ(0);
}

.metric-overlay {
  position: absolute;
  pointer-events: none;
}

.metric-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: rgba(5, 13, 12, 0.94);
  filter: blur(0.2px);
}

.metric-overlay::after {
  content: attr(data-label);
  position: absolute;
  z-index: 1;
  left: 29%;
  top: 15%;
  font-size: clamp(6px, 0.78vw, 13px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.metric-overlay strong {
  position: absolute;
  z-index: 1;
  left: 29%;
  top: 44%;
  transform: translateY(-50%);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(15px, 2.25vw, 40px);
  font-weight: 900;
  line-height: 0.85;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.88);
}

.metric-overlay span {
  position: absolute;
  z-index: 1;
  left: 22%;
  top: 75%;
  font-size: clamp(6px, 0.7vw, 12px);
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.metric-overlay svg {
  position: absolute;
  right: 4%;
  top: 54%;
  width: 36%;
  height: 28%;
  overflow: visible;
  filter: drop-shadow(0 0 4px currentColor);
}

.metric-overlay polyline {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric-overlay.cash {
  color: #89d99e;
}

.metric-overlay.backlog {
  color: #f39a24;
}

.metric-overlay.inventory {
  color: #48cdd1;
}

.metric-overlay.reputation {
  color: #8fdc63;
}

.quarter-overlay,
.year-overlay {
  position: absolute;
  pointer-events: none;
  display: grid;
  place-items: center;
  font-family: Impact, "Arial Black", sans-serif;
  font-variant-numeric: tabular-nums;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.92);
}

.quarter-overlay {
  color: #e8e1d4;
  font-size: clamp(13px, 2.15vw, 36px);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 0.9;
  white-space: nowrap;
}

.year-overlay {
  color: #d89230;
  font-size: clamp(6px, 0.82vw, 14px);
  font-weight: 900;
  letter-spacing: 0.12em;
}

.lever-value-overlay {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #f3e6c7;
  background: rgba(18, 14, 10, 0.86);
  box-shadow:
    inset 0 0 0 1px rgba(242, 211, 151, 0.28),
    inset 0 0 10px rgba(0, 0, 0, 0.72),
    0 2px 8px rgba(0, 0, 0, 0.58);
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(12px, 1.85vw, 31px);
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9);
}

.hotspot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  background: rgba(255, 138, 25, 0.12);
}

.hotspot:active {
  background: rgba(255, 138, 25, 0.18);
}

.lever-slider {
  z-index: 4;
  appearance: none;
  -webkit-appearance: none;
  opacity: 0;
  cursor: ew-resize;
}

.lever-slider::-webkit-slider-runnable-track {
  height: 100%;
  background: transparent;
}

.lever-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 34px;
  height: 72px;
  background: transparent;
}

.lever-slider::-moz-range-track {
  height: 100%;
  background: transparent;
}

.lever-slider::-moz-range-thumb {
  width: 34px;
  height: 72px;
  border: 0;
  background: transparent;
}

body.debug-hotspots .hotspot {
  background: rgba(255, 138, 25, 0.13);
  box-shadow: inset 0 0 0 2px rgba(255, 174, 67, 0.84);
}

body.debug-hotspots .metric-overlay,
body.debug-hotspots .lever-value-overlay {
  outline: 2px solid rgba(64, 214, 214, 0.9);
  background: rgba(64, 214, 214, 0.08);
}

body.debug-hotspots .hotspot::after {
  content: attr(aria-label);
  position: absolute;
  left: 4px;
  top: 4px;
  padding: 2px 5px;
  border-radius: 4px;
  color: #ffefc7;
  background: rgba(14, 8, 3, 0.82);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.play:active {
  box-shadow: inset 0 0 36px rgba(255, 169, 43, 0.55);
}

.response.selected,
.lever-slider.changed {
  background: rgba(255, 138, 25, 0.12);
  box-shadow: inset 0 0 0 2px rgba(255, 174, 67, 0.42);
}

.pulse-ring {
  position: absolute;
  width: 5.8%;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 155, 35, 0.85);
  border-radius: 999px;
  pointer-events: none;
  animation: ping 900ms cubic-bezier(0.16, 1, 0.3, 1);
}

.console {
  position: absolute;
  left: 23.85%;
  bottom: 3.3%;
  width: 39.55%;
  min-height: 31.9%;
  padding: 1.25% 1.55%;
  border: 1px solid rgba(78, 40, 13, 0.8);
  border-radius: 10px;
  color: #321608;
  background:
    linear-gradient(135deg, rgba(255, 239, 197, 0.98), rgba(214, 180, 119, 0.96)),
    var(--paper);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 18px 42px rgba(0, 0, 0, 0.45);
  animation: rise 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.console .close {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  color: #5a260d;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.eyebrow {
  margin: 0 0 2px;
  color: #8a250e;
  font-size: clamp(8px, 0.82vw, 12px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.console h2 {
  margin: 0 0 6px;
  color: #9a1e10;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(18px, 2.15vw, 38px);
  line-height: 0.95;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.console p,
.console-body {
  margin: 0 0 10px;
  max-width: none;
  color: #352216;
  font-size: clamp(9px, 0.88vw, 15px);
  line-height: 1.22;
}

.console-body p {
  margin: 0 0 8px;
}

.coach,
.hint {
  margin: 0 0 8px;
  padding: 7px 8px;
  border: 1px solid rgba(120, 57, 18, 0.42);
  border-radius: 5px;
  background: rgba(66, 32, 12, 0.1);
}

.hint {
  border-color: rgba(16, 100, 96, 0.48);
  background: rgba(13, 119, 116, 0.12);
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 8px;
}

.scenario-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.button-grid button,
.tutorial-button {
  min-height: 30px;
  border: 1px solid rgba(101, 49, 17, 0.72);
  border-radius: 5px;
  color: #f5dfb2;
  background: linear-gradient(180deg, #643017, #321608);
  font-size: clamp(8px, 0.72vw, 12px);
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.button-grid button.selected,
.tutorial-button:hover {
  border-color: rgba(255, 160, 42, 0.95);
  background: linear-gradient(180deg, #a54d16, #5a260d);
}

.button-grid button:disabled {
  color: rgba(245, 223, 178, 0.48);
  background: rgba(50, 22, 8, 0.48);
  cursor: default;
}

.tutorial-button {
  width: 100%;
  margin: 0 0 8px;
}

.bar {
  display: block;
  height: 8px;
  margin-top: 4px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(50, 22, 8, 0.25);
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0d7774, #ff8a19);
}

.slider-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.slider-row[hidden] {
  display: none;
}

input[type="range"] {
  width: 100%;
  accent-color: #0d7774;
}

output {
  min-width: 30px;
  padding: 4px 7px;
  border-radius: 5px;
  color: #f5dfb2;
  background: #321608;
  font-weight: 900;
  text-align: center;
}

.readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 12px;
  margin: 10px 0 0;
  font-size: clamp(9px, 0.82vw, 13px);
}

.readout div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid rgba(88, 47, 22, 0.26);
  padding-top: 4px;
}

.readout dt {
  color: #703615;
  font-weight: 800;
  text-transform: uppercase;
}

.readout dd {
  margin: 0;
  color: #1e130d;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.toast {
  position: absolute;
  left: 50%;
  top: 14.7%;
  transform: translateX(-50%);
  min-width: 24%;
  max-width: 42%;
  padding: 0.9% 1.3%;
  border: 1px solid rgba(255, 166, 45, 0.7);
  border-radius: 999px;
  color: #ffe6af;
  background: rgba(17, 12, 6, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 12px 32px rgba(0, 0, 0, 0.42);
  font-size: clamp(10px, 1.05vw, 16px);
  font-weight: 800;
  text-align: center;
  animation: toast-in 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

@media (orientation: portrait) {
  .board {
    width: 100vw;
  }

  .console {
    left: 22%;
    bottom: 3.3%;
    width: 52%;
  }

  .toast {
    max-width: 70%;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes ping {
  from {
    opacity: 0.9;
    transform: scale(0.35);
  }
  to {
    opacity: 0;
    transform: scale(1.7);
  }
}
