* { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --bg: #160d18;
  --panel: rgba(42, 20, 28, 0.9);
  --panel-2: rgba(74, 27, 32, 0.9);
  --line: rgba(255, 225, 170, 0.22);
  --text: #fff8ed;
  --muted: #e7caa4;
  --gold: #ffd166;
  --red: #e83f3f;
  --jade: #57d68d;
}
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(115deg, rgba(232, 63, 63, 0.17), transparent 32%),
    linear-gradient(245deg, rgba(255, 209, 102, 0.17), transparent 34%),
    linear-gradient(180deg, #150b16 0%, #32141b 48%, #5b1e1f 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button {
  border: 0;
  cursor: pointer;
  color: #2a1212;
  font-weight: 850;
  transition: transform 140ms ease, opacity 140ms ease, filter 140ms ease;
}
button:active { transform: translateY(1px) scale(0.99); }
button:disabled { cursor: not-allowed; opacity: 0.5; filter: grayscale(0.45); }
.shell {
  width: min(980px, calc(100vw - 26px));
  margin: 0 auto;
  padding: 14px 0 22px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 14px 14px 8px 8px;
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}
h1 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.3rem); letter-spacing: 0; }
p { margin: 0; }
.topbar p { margin-top: 4px; color: var(--muted); font-size: 0.95rem; }
#restartBtn {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), #f97316);
}
.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}
.chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.chip span { color: var(--muted); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; }
.chip strong { font-size: 1.15rem; color: #fff; white-space: nowrap; }
.stage-shell {
  overflow: hidden;
  border: 1px solid rgba(255, 225, 170, 0.22);
  border-radius: 12px;
  background: #140d16;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.36);
}
#game-stage {
  width: 100%;
  aspect-ratio: 500 / 890;
  max-height: 74vh;
  min-height: 430px;
}
#game-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.controls {
  display: grid;
  grid-template-columns: minmax(150px, 0.6fr) minmax(190px, 0.7fr) minmax(280px, 1fr);
  gap: 10px 12px;
  align-items: center;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 14px 14px;
  background: var(--panel);
}
#dropBtn, #rewardBtn {
  min-height: 50px;
  border-radius: 10px;
  padding: 0 16px;
  font-size: 0.96rem;
}
#dropBtn { background: linear-gradient(135deg, #ffdf7e, #ff595e); }
#rewardBtn { background: linear-gradient(135deg, var(--jade), var(--gold)); }
#statusText {
  color: #fff4dc;
  font-weight: 800;
  min-height: 24px;
}
#rewardNote {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}
@media (max-width: 760px) {
  .shell { width: min(100vw - 16px, 620px); padding-top: 8px; }
  .topbar { align-items: flex-start; padding: 13px; }
  #restartBtn { min-height: 38px; padding: 0 13px; }
  .hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chip { min-height: 46px; }
  #game-stage { min-height: 400px; max-height: 68vh; }
  .controls { grid-template-columns: 1fr 1fr; padding: 12px; }
  #statusText, #rewardNote { grid-column: 1 / -1; }
}
