:root {
  color-scheme: dark;
  --bg: #10261a;
  --fg: #f3f6ef;
  --muted: #c5d0c7;
  --panel: rgba(9, 20, 14, .94);
  --accent: #ffad45;
  --accent-dark: #e77b12;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body, #game { margin: 0; width: 100%; height: 100%; min-height: 100%; }
html, body { overflow: hidden; background: var(--bg); color: var(--fg); }
body { overscroll-behavior: none; }
#game { position: relative; isolation: isolate; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#ov {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow-y: auto; background: rgba(3, 10, 6, .66); z-index: 100;
  backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
}
#box {
  width: min(100%, 560px); max-height: 100%; overflow-y: auto;
  padding: clamp(22px, 4vw, 34px); border-radius: 20px;
  line-height: 1.65; background: var(--panel);
  border: 1px solid rgba(255,255,255,.13);
  box-shadow: 0 24px 80px rgba(0,0,0,.48);
}
h1 { margin: 0 0 12px; font-size: clamp(25px, 5vw, 34px); line-height: 1.15;
  color: var(--accent); letter-spacing: -.8px; }
p { margin: 0 0 13px; font-size: 15px; color: var(--muted); }
b { color: #fff; }
.btn {
  min-height: 42px; margin-top: 12px; padding: 10px 22px; border: 0; border-radius: 11px;
  background: linear-gradient(135deg, #ffc16c, var(--accent-dark)); color: #172317;
  font: inherit; font-size: 15px; font-weight: 750; cursor: pointer;
  box-shadow: 0 5px 16px rgba(231,123,18,.22);
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 8px 20px rgba(231,123,18,.3); }
.btn:active { transform: translateY(0); }
button:focus-visible, input:focus-visible { outline: 3px solid #8bd3ff; outline-offset: 3px; }
#pauseBtn {
  position: fixed; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right));
  z-index: 90; padding: 9px 16px; min-height: 40px; font-size: 14px;
  background: rgba(10,20,14,.88); color: #fff; border: 1px solid rgba(255,255,255,.22);
  border-radius: 10px; cursor: pointer; font-weight: 700; backdrop-filter: blur(8px); display: none;
}
#pauseBtn:hover { background: rgba(30,50,35,.96); }
.opt { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.btn.sm { margin: 0; min-height: 32px; padding: 2px 13px; font-size: 18px; line-height: 1.3; }
.level-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; margin: 17px 0; }
.level-opt label { display: flex; align-items: center; gap: 9px; font-size: 14px; color: #d1d5db; cursor: pointer; }
.level-opt input { width: 17px; height: 17px; accent-color: var(--accent); }
.note { font-size: 13px; color: #a9b9ad; margin: 4px 0 8px; }
.btn + .btn { margin-left: 8px; }
.noscript { position: fixed; inset: 20px; z-index: 200; padding: 20px; background: #10261a; }
@media (max-width: 520px) {
  #box { border-radius: 16px; }
  #box p { font-size: 14px; }
  .btn { width: 100%; margin-left: 0 !important; }
  .opt .btn.sm { width: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } }
