* { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --bg: #07120f;
  --panel: rgba(13, 32, 27, 0.88);
  --panel-2: rgba(18, 44, 36, 0.94);
  --line: rgba(221, 255, 232, 0.16);
  --text: #f4fff7;
  --muted: #a8c7b2;
  --leaf: #62d66f;
  --fruit: #ff6b5f;
  --gold: #f5c84c;
}
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(98, 214, 111, 0.18), transparent 32%),
    linear-gradient(225deg, rgba(245, 200, 76, 0.16), transparent 34%),
    linear-gradient(160deg, #07120f 0%, #10231c 48%, #182035 100%);
}
button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 850;
  letter-spacing: 0;
  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.48; filter: grayscale(0.35); }
.shell {
  width: min(1040px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 24px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px 16px 8px 8px;
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.28);
}
h1 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.5rem); letter-spacing: 0; }
p { margin: 0; }
.topbar p { margin-top: 4px; color: var(--muted); font-size: 0.96rem; }
#restartBtn, #rewardBtn {
  padding: 0 18px;
  color: #08120d;
  background: linear-gradient(135deg, var(--leaf), var(--gold));
}
.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}
.chip {
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.chip span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}
.chip strong { font-size: 1.28rem; color: #fff; }
.reward-bar {
  display: grid;
  grid-template-columns: minmax(190px, 0.36fr) 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(9, 24, 20, 0.78);
}
#rewardBtn { background: linear-gradient(135deg, #ff8a65, #f5c84c); }
.reward-note, .tip {
  color: #d7eadc;
  font-size: 0.94rem;
  font-weight: 750;
  line-height: 1.45;
}
.stage-shell {
  overflow: hidden;
  border: 1px solid rgba(221,255,232,0.18);
  border-radius: 12px;
  background: #081611;
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.38);
}
#game-stage {
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 420px;
}
#game-stage canvas { display: block; width: 100%; height: 100%; }
.touch-pad {
  display: none;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}
.touch-pad div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.touch-pad button {
  color: #07120f;
  background: #d9f99d;
}
.tip { margin-top: 10px; text-align: center; color: var(--muted); }
@media (max-width: 760px) {
  .shell { width: min(100vw - 16px, 680px); 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: 50px; }
  .reward-bar { grid-template-columns: 1fr; }
  #game-stage { min-height: 360px; aspect-ratio: 3 / 4; }
  .touch-pad { display: grid; }
}
