

:root {
  color-scheme: dark;
  --night: #0c0a10;
  --night-2: #16121d;
  --panel: #1c1724;
  --line: #2e2638;
  --text: #f4eee4;
  --muted: #a99fb4;
  --gold: #f2b631;
  --red: #e0262b;
  --blue: #2b56c4;
  --cream: #f5efe4;
  --move: var(--gold);
  --brush: "Slicey Heallow", "Marker Felt", "Comic Sans MS", cursive;
  --ui: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* rough brush-stroke shape used behind titles (sticker-sheet labels) */
  --brush-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 80' preserveAspectRatio='none'%3E%3Cpath d='M6 22 C40 8 90 14 140 10 C200 5 260 12 320 8 C350 6 380 10 396 6 L392 20 C396 30 384 36 394 44 C386 52 396 60 388 70 C340 74 290 68 230 74 C170 78 110 70 60 76 C40 78 20 72 4 76 L10 62 C2 52 12 46 4 38 C12 30 2 28 6 22 Z M2 40 L-0 44 Z' fill='black'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { background: var(--night); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 30% -10%, #2a1c38 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #3a1416 0%, transparent 55%),
    var(--night);
  color: var(--text);
  font-family: var(--ui);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }

/* ---------- page nav ---------- */
.nav {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px 0;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.nav a {
  padding: 8px 16px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  font-family: var(--brush);
  font-size: 21px;
  line-height: 1;
  transition: background 120ms, transform 120ms;
}
.nav a:hover { background: #271f31; transform: rotate(-1.5deg); }
.nav a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.nav a[aria-current="page"] { background: var(--text); color: var(--night); border-color: var(--text); }
.nav em {
  font-style: normal;
  margin-left: 4px;
  padding: 1px 7px 3px;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  font-size: 15px;
}

/* ---------- header ---------- */
.top {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 24px;
}

.logo {
  margin: 0;
  font-family: var(--brush);
  font-weight: 400;
  font-size: clamp(44px, 7.5vw, 92px);
  line-height: 0.95;
  letter-spacing: 0.01em;
}
.logo span { display: inline-block; }
.logo span:nth-child(1) { transform: rotate(-3deg); }
.logo span:nth-child(2) { color: var(--gold); transform: rotate(2deg) translateY(4px); }
.logo span:nth-child(3) {
  color: var(--night);
  padding: 0 0.22em 0.04em;
  background: var(--red);
  -webkit-mask: var(--brush-mask) center / 100% 100% no-repeat;
          mask: var(--brush-mask) center / 100% 100% no-repeat;
  transform: rotate(-2deg);
}

.tag {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}
.hee {
  font-family: var(--brush);
  font-size: 1.6em;
  color: var(--gold);
  display: inline-block;
  transform: rotate(-6deg);
}

/* ---------- layout ---------- */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

/* ---------- stage ---------- */
.stage {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 22px;
  overflow: hidden;
  background: #07060a;
  box-shadow: 0 0 0 1px var(--line), 0 30px 80px -30px #000;
}
.stage canvas { display: block; width: 100%; height: 100%; }

.banner {
  position: absolute;
  left: 18px;
  top: 16px;
  padding: 6px 30px 10px 22px;
  font-family: var(--brush);
  font-size: clamp(26px, 3.6vw, 44px);
  line-height: 1;
  color: #fff;
  isolation: isolate;
  transform: rotate(-2deg);
  pointer-events: none;
}
.banner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--move);
  -webkit-mask: var(--brush-mask) center / 100% 100% no-repeat;
          mask: var(--brush-mask) center / 100% 100% no-repeat;
}
.banner.pop { animation: pop 420ms cubic-bezier(.2, 1.6, .4, 1); }

.bubble {
  position: absolute;
  left: 50%;
  top: 14%;
  padding: 10px 18px 12px;
  background: #fff;
  color: #111;
  border-radius: 999px;
  font-family: var(--brush);
  font-size: clamp(22px, 3vw, 36px);
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 10px) scale(.6) rotate(-6deg);
  transition: opacity 160ms, transform 260ms cubic-bezier(.2, 1.8, .4, 1);
  pointer-events: none;
}
.bubble::after {
  content: "";
  position: absolute;
  left: 30%;
  bottom: -12px;
  border: 8px solid transparent;
  border-top: 14px solid #fff;
  border-bottom: 0;
  transform: skewX(-20deg);
}
.bubble.on { opacity: 1; transform: translate(-50%, 0) scale(1) rotate(-6deg); }

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--brush);
  font-size: 32px;
  color: var(--muted);
  background: #07060a;
  transition: opacity 300ms;
}
.loading.done { opacity: 0; pointer-events: none; }

@keyframes pop {
  0% { transform: rotate(-2deg) scale(.7); }
  100% { transform: rotate(-2deg) scale(1); }
}

/* ---------- controls ---------- */
.controls {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.btn {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  cursor: pointer;
  font-family: var(--brush);
  font-size: 22px;
  line-height: 1;
  transition: background 120ms, transform 120ms, border-color 120ms;
}
.btn:hover { background: #271f31; border-color: #46395a; }
.btn:active { transform: scale(.96); }
.btn:focus-visible, .move:focus-visible, .strip button:focus-visible, input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.btn.big {
  background: var(--gold);
  border-color: var(--gold);
  color: #1a1206;
  padding: 0 22px;
  font-size: 26px;
}
.btn.big:hover { background: #ffc94a; }
.btn .ico { font-family: var(--ui); font-size: 15px; vertical-align: 2px; }
.btn[aria-pressed="true"]#sound, .btn[aria-pressed="true"].show {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.frame {
  min-width: 64px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 15px;
}

.tempo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
}
.tempo b { color: var(--text); font-variant-numeric: tabular-nums; }
.tempo input { width: 120px; accent-color: var(--gold); }

/* ---------- step strip ---------- */
.strip {
  list-style: none;
  margin: 18px 0 0;
  padding: 6px 2px 10px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.strip button {
  position: relative;
  width: 74px;
  height: 104px;
  padding: 6px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--night-2);
  cursor: pointer;
  display: grid;
  place-items: end center;
}
.strip img { max-width: 100%; max-height: 100%; object-fit: contain; }
.strip .num {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--move);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 0 0 2px #fff;
}
.strip [aria-current="step"] {
  border-color: var(--move);
  background: #241c2e;
  box-shadow: 0 0 0 2px var(--move), 0 8px 24px -8px var(--move);
}

/* ---------- move list ---------- */
.moves h2 {
  margin: 0 0 12px;
  font-family: var(--brush);
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
}
.moves ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.move {
  width: 100%;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  transition: transform 140ms, background 140ms, border-color 140ms;
}
.move:hover { background: #241c2e; transform: translateX(-3px) rotate(-.5deg); }
.move .thumb {
  height: 62px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--c) 30%, #0e0b12);
  display: grid;
  place-items: end center;
  overflow: hidden;
}
.move .thumb img { height: 58px; width: auto; }
.move .name {
  font-family: var(--brush);
  font-size: 25px;
  line-height: 1.05;
}
.move .key {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--c);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 0 0 2px #fff;
}
.move[aria-pressed="true"] {
  background: color-mix(in srgb, var(--c) 22%, var(--panel));
  border-color: var(--c);
}

.keys { margin: 14px 2px 0; color: var(--muted); font-size: 13px; }
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--night-2);
  font: 600 11px/1.4 var(--ui);
  text-align: center;
}

.foot {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 24px 40px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .moves ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .move { grid-template-columns: 44px 1fr; padding-right: 8px; }
  .move .key { display: none; }
  .move .thumb { height: 54px; }
  .move .thumb img { height: 50px; }
  .move .name { font-size: 22px; }
  .keys { display: none; }
}

@media (max-width: 600px) {
  .top, .layout, .foot { padding-left: 16px; padding-right: 16px; }
  .stage { aspect-ratio: 4 / 5; border-radius: 18px; }
  .tempo { flex: 1 1 100%; justify-content: space-between; }
  .tempo input { flex: 1; }
  .btn.show { flex: 1 1 auto; }
}

@media (min-width: 99999px) {
  .banner.pop { animation: none; }
  .move:hover { transform: none; }
}
