/* Raindrop Drummer: rainy-day blues and greens, navy outlines like the drops on the canvas. */
:root {
  --sky: #8eabc2;
  --paper: #f5f9fc;
  --ink: #24364f;
  --ink-soft: #5b6f88;
  --rain: #3d8fd6;
  --rain-soft: #bfe6ff;
  --leaf: #62c47c;
  --display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --line: 3px solid var(--ink);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--sky);
  color: var(--ink);
  font-family: var(--display);
  display: grid;
  place-items: center;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#stage { display: block; touch-action: none; }

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(36, 54, 79, 0.18);
  overflow-y: auto;
}
.overlay[hidden] { display: none; }

.card {
  width: min(540px, 100%);
  background: var(--paper);
  border: var(--line);
  border-radius: 26px;
  box-shadow: 0 8px 0 var(--ink);
  padding: 24px 24px 22px;
  display: grid;
  gap: 16px;
}
.card.small { width: min(360px, 100%); text-align: center; }

h1, h2, p { margin: 0; }
.brand h1 {
  font-size: clamp(38px, 8vw, 56px);
  line-height: 0.95;
  font-weight: 700;
  color: var(--rain-soft);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--ink);
  text-wrap: balance;
}
.tagline { font-size: 17px; font-weight: 500; color: var(--ink-soft); margin-top: 8px; }

.songs { display: grid; gap: 10px; }
.song {
  font: inherit;
  color: inherit;
  text-align: left;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "num text" "num meta";
  column-gap: 14px;
  row-gap: 2px;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border: var(--line);
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s;
}
.song:hover { background: #eaf5fd; }
.song:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.song:focus-visible, .btn:focus-visible, .pause:focus-visible, summary:focus-visible {
  outline: 3px dashed var(--rain);
  outline-offset: 3px;
}
.sg-num {
  grid-area: num;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border: var(--line);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--rain-soft);
  font-size: 24px; font-weight: 700;
}
.sg-text { grid-area: text; display: grid; min-width: 0; }
.sg-name { font-size: 22px; font-weight: 700; line-height: 1.1; }
.sg-blurb { font-size: 15px; font-weight: 500; color: var(--ink-soft); }
.sg-meta {
  grid-area: meta;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.sg-best { color: var(--ink); }

.controls { display: grid; gap: 6px; font-size: 15px; font-weight: 500; }
.ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ctl-dot { width: 16px; height: 16px; flex: none; border: 2.5px solid var(--ink); border-radius: 50%; background: var(--rain-soft); }
.ctl-dot.pause-dot { background: var(--paper); border-radius: 4px; }
kbd {
  font: 600 13px/1 var(--display);
  padding: 3px 7px 2px;
  border: 2px solid var(--ink);
  border-bottom-width: 3.5px;
  border-radius: 7px;
  background: #fff;
}

.settings { border-top: 2px dashed #c9d6e2; padding-top: 10px; font-size: 15px; }
.settings summary { cursor: pointer; font-weight: 700; font-size: 16px; }
.settings[open] summary { margin-bottom: 10px; }
.row { display: flex; gap: 10px; align-items: center; padding: 6px 0; cursor: pointer; }
.row.col { flex-direction: column; align-items: stretch; gap: 4px; }
.row-head { display: flex; justify-content: space-between; font-weight: 600; }
.row-head output { font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--rain); }
.hint { font-size: 14px; font-weight: 500; color: var(--ink-soft); line-height: 1.35; }
.hint:empty { display: none; }
.fine { font-size: 12px; font-weight: 500; color: var(--ink-soft); text-align: right; margin-top: -6px; }

.buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.card.small .buttons { flex-direction: column; }
.btn {
  font: 700 18px/1 var(--display);
  color: var(--ink);
  padding: 12px 22px 10px;
  background: #fff;
  border: var(--line);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
}
.btn.primary { background: var(--rain-soft); }
.btn.ghost { box-shadow: none; font-size: 15px; padding: 9px 16px 7px; justify-self: start; border-style: dashed; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: 0.6; }

.eyebrow { font-size: 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.rank {
  font-size: clamp(36px, 8vw, 52px); line-height: 1; font-weight: 700;
  color: var(--rain-soft); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--ink);
  text-wrap: balance;
}
.rank-line { font-size: 18px; font-weight: 500; }
.score { font-size: 56px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 6px; }
.score small { font-size: 28px; }
.badge { font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; background: var(--leaf); color: #fff; border: 2.5px solid var(--ink); border-radius: 999px; padding: 4px 10px 2px; align-self: center; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.stats div { background: #fff; border: 2.5px solid var(--ink); border-radius: 14px; padding: 6px 10px; }
.stats dt { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-soft); }
.stats dd { margin: 0; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }

.pause {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  width: 48px; height: 48px;
  display: flex; gap: 6px; align-items: center; justify-content: center;
  background: var(--paper); border: var(--line); border-radius: 50%;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.pause span { width: 6px; height: 18px; background: var(--ink); border-radius: 3px; }
.pause[hidden] { display: none; }

@media (max-width: 480px) {
  .card { padding: 18px 16px; border-radius: 22px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .song, .btn { transition: none; }
}
