:root {
  --bg: #071428;
  --panel: #0e2140;
  --cyan: #3de7ff;
  --gold: #f5c518;
  --blue: #1e5cff;
  --text: #f4fbff;
  --muted: #9bb4d0;
  --line: rgba(61, 231, 255, 0.2);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background: var(--bg);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0 auto;
  max-width: 480px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% 0%, rgba(245, 197, 24, 0.2), transparent 40%),
    radial-gradient(circle at 10% 30%, rgba(61, 231, 255, 0.12), transparent 35%),
    var(--bg);
  touch-action: manipulation;
  user-select: none;
}
header { display: flex; gap: 12px; align-items: center; padding: 14px 14px 6px; }
.mark { width: 48px; height: 48px; border-radius: 12px; }
header strong { display: block; }
header span { color: var(--gold); font-size: 13px; }
nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 6px 10px;
}
nav button, .mode, .controls button, #clearScores, #overResume, #overHome {
  border: 0;
  min-height: 42px;
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}
nav button.on { background: var(--blue); }
.mode {
  display: block;
  width: 100%;
  margin: 8px 0;
  text-align: left;
  padding: 14px;
  font-weight: 600;
}
.mode[data-mode="easy"] { border-left: 4px solid var(--cyan); }
.mode[data-mode="medium"] { border-left: 4px solid var(--gold); }
.mode[data-mode="hard"] { border-left: 4px solid #ff4d6d; }
main { padding: 8px 14px 24px; }
h2 { margin: 8px 0; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.4; }
.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr) 88px;
  gap: 6px;
  margin-bottom: 8px;
}
.hud > div, .nextBox {
  background: var(--panel);
  border-radius: 12px;
  padding: 8px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.hud small { color: var(--muted); display: block; font-size: 11px; }
.hud b { font-size: 18px; }
.nextBox { display: grid; place-items: center; }
#next { width: 64px; height: 64px; }
#boardWrap {
  margin: 0 auto;
  width: min(100%, 300px);
  background: #040c18;
  border-radius: 16px;
  box-shadow: inset 0 0 0 2px var(--line), 0 0 24px rgba(61, 231, 255, 0.12);
  overflow: hidden;
}
#board { display: block; width: 100%; height: auto; touch-action: none; }
.controls { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
#btnHard { background: var(--gold); color: #111; font-weight: 700; }
.tip { text-align: center; }
#scoreList { list-style: none; padding: 0; }
#scoreList li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}
.switch { display: flex; gap: 8px; align-items: center; margin: 12px 0; }
#overlay {
  position: fixed; inset: 0; z-index: 5;
  display: grid; place-items: center;
  background: rgba(4, 12, 24, 0.88);
  padding: 20px;
}
#overlay[hidden] { display: none; }
.sheet {
  width: min(100%, 340px);
  background: var(--panel);
  border-radius: 18px;
  padding: 18px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.sheet button { width: 100%; margin-top: 8px; }
#overResume { background: var(--cyan); color: #041018; font-weight: 700; }
