:root {
  --paper: #f4ecdc;
  --paper-deep: #e9dfc9;
  --ink: #2b2540;
  --accent: #ff6f59;
  --field-w: 440;
  --field-h: 660;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper-deep);
  color: var(--ink);
  font-family: "Rubik", "Trebuchet MS", system-ui, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.app {
  --w: min(440px, calc(100vw - 24px), calc((100dvh - 150px) * 440 / 660));
  width: var(--w);
  margin: 0 auto;
  padding: 10px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

h1 {
  margin: 0;
  font-weight: 900;
  font-size: 30px;
  letter-spacing: -0.5px;
  transform: rotate(-3deg);
}

.stats {
  display: flex;
  gap: 14px;
  margin-left: auto;
}

.stat { text-align: right; line-height: 1.05; }
.stat span { display: block; font-size: 11px; font-weight: 500; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.6px; }
.stat b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

.buttons { display: flex; gap: 6px; }

button {
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
button:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.buttons button { width: 38px; height: 36px; font-size: 18px; line-height: 1; }
#mute[aria-pressed="true"] { opacity: 0.45; text-decoration: line-through; }

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 440 / 660;
  border: 3px solid var(--ink);
  border-radius: 12px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 6px 0 var(--ink);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(43, 37, 64, 0.45);
}
.overlay[hidden] { display: none; }

.card {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 6px 0 var(--ink);
  padding: 22px 30px;
  text-align: center;
}
.card h2 { margin: 0 0 6px; font-size: 26px; font-weight: 900; }
.card p { margin: 4px 0; font-size: 18px; }
.card .record { color: var(--accent); font-weight: 700; }
.card button { margin-top: 12px; padding: 10px 22px; font-size: 18px; }

.hint {
  margin: 4px 2px 0;
  font-size: 12.5px;
  line-height: 1.35;
  opacity: 0.65;
  text-align: center;
}
