:root {
  --bg: #f6f4f1;
  --panel: #ffffff;
  --ink: #1f1b18;
  --muted: #6b635c;
  --line: #e4ded7;
  --accent: #6d1f2c;
  --accent-ink: #ffffff;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header { padding: 20px 16px 4px; max-width: 1200px; margin: 0 auto; }
header h1 { margin: 0; font-size: 1.5rem; }
header p { margin: 4px 0 0; color: var(--muted); }
.tag {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--accent); color: var(--accent-ink); padding: 2px 8px; border-radius: 99px;
  vertical-align: middle;
}

main {
  max-width: 1200px; margin: 0 auto; padding: 12px 16px 40px;
  display: grid; gap: 16px;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  align-items: start;
}
@media (max-width: 860px) { main { grid-template-columns: minmax(0, 1fr); } }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px;
}
.notes { grid-column: 1 / -1; }
.notes ol, .notes ul { padding-left: 20px; margin: 6px 0; }
.notes li { margin: 4px 0; }
h2 { margin: 0 0 6px; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
h3 { margin: 14px 0 4px; font-size: 1rem; }
.step {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 0.8rem;
}
.hint { color: var(--muted); margin: 4px 0 8px; font-size: 0.9rem; }
.status { margin: 8px 0 0; font-size: 0.9rem; color: var(--muted); min-height: 1.4em; }
.status.error { color: #b3261e; }

.thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.thumbs.small { grid-template-columns: repeat(auto-fill, minmax(56px, 72px)); }
.thumbs button {
  position: relative; padding: 0; border: 2px solid transparent; border-radius: 8px;
  overflow: hidden; background: var(--line); cursor: pointer; aspect-ratio: 2 / 3;
}
.thumbs button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs button[aria-pressed="true"] { border-color: var(--accent); }
.thumbs button .star {
  position: absolute; top: 2px; left: 4px; color: #fff; font-size: 0.8rem;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.7);
}

.prep { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.prep figure { margin: 0; }
.prep canvas { width: 100%; height: auto; display: block; border-radius: 8px; border: 1px solid var(--line); }
.prep figcaption { font-size: 0.8rem; color: var(--muted); text-align: center; margin-top: 2px; }
.checker {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e8e8e8 25%, transparent 25%), linear-gradient(-45deg, #e8e8e8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e8e8e8 75%), linear-gradient(-45deg, transparent 75%, #e8e8e8 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.tune { margin-top: 10px; }
.tune summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.tune label { display: block; font-size: 0.85rem; margin-top: 8px; }
.tune output { float: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.tune input[type="range"] { width: 100%; accent-color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
button, .button {
  font: inherit; font-size: 0.9rem; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tune button { margin-top: 10px; }

#stage-wrap { margin-top: 12px; display: flex; justify-content: center; }
#stage {
  position: relative; width: 100%; aspect-ratio: 2 / 3; max-width: 100%;
  background: #2b2724; border-radius: var(--radius); overflow: hidden;
}
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#stage.mirror canvas { transform: scaleX(-1); }
#hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.65); color: #fff; padding: 6px 12px; border-radius: 99px;
  font-size: 0.85rem; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis;
}
#countdown {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 5rem; font-weight: 700; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; }
.toggles { display: flex; gap: 14px; font-size: 0.85rem; color: var(--muted); }
.toggles input { accent-color: var(--accent); }

#video { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
