:root {
	--bg: #fbf8f5;
	--fg: #2a2230;
	--muted: #6d6474;
	--line: #e3dcd6;
	--accent: #c2346c;   /* white on it about 5:1 */
	--accent-fg: #ffffff;
	--card: #ffffff;
	--error: #b3261e;
	color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
	:root { --bg: #17141a; --fg: #f1ecf4; --muted: #a79fae; --line: #342e3a; --card: #211d25; --error: #ff8a80; --link: #f07aa8; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0; background: var(--bg); color: var(--fg);
	font: 16px/1.6 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Leelawadee UI", sans-serif;
}
main { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }
h1 { font-size: 1.35rem; margin: 8px 0; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
h3 { font-size: 0.95rem; margin: 20px 0 4px; }
.tag { font-size: 0.7rem; vertical-align: middle; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
.step, .note { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 0 0 16px; }
.note { border-color: var(--error); }
.muted { color: var(--muted); font-size: 0.88rem; margin: 6px 0; }
.error { color: var(--error); font-size: 0.92rem; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.big { font-size: 1.1rem; min-width: 6.5em; text-align: center; }
.row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.row.wrap { flex-wrap: wrap; }
.row input[type=range] { flex: 1; min-width: 0; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.button {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line);
	background: var(--bg); color: var(--fg); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.button.small { min-height: 44px; padding: 4px 14px; font-size: 0.9rem; font-weight: 500; }
.button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.button:disabled { opacity: 0.5; cursor: default; }
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file { position: relative; }
.stage { position: relative; display: flex; justify-content: center; background: #000; border-radius: 12px; overflow: hidden; }
/* The screens stay at the top while the choices under them are scrolled, so a choice can be seen
   as it is made. One page scroll only: a box
   scrolling inside the page is awkward on phones. Smaller while choosing, full size while recording. */
.stage.sticky { position: sticky; top: 0; z-index: 5; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }
.stage.sticky canvas { width: auto; height: min(42vh, 568px); max-width: 100%; }
.stage.sticky.live canvas { height: min(68vh, 640px); }
@supports (height: 1svh) {
	.stage.sticky canvas { height: min(42svh, 568px); }
	.stage.sticky.live canvas { height: min(68svh, 640px); }
}
/* the count, big in the middle: it is shown before the lyrics come in, so it does not cover them
   (at the top edge it is hard to see) */
.countdown {
	position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
	font-size: 6rem; font-weight: 800; line-height: 1; color: #fff; text-shadow: 0 3px 16px rgba(0, 0, 0, 0.75); pointer-events: none;
}
.countdown.beat { animation: count-beat 0.4s ease-out; }
@keyframes count-beat { from { transform: scale(1.3); opacity: 0.55; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .countdown.beat { animation: none; } }
.rec-badge {
	position: absolute; top: 10px; left: 10px;
	background: #d92d2d; color: #fff; font-size: 0.85rem; font-weight: 700; border-radius: 999px; padding: 2px 10px;
}
.styles { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 8px 0 12px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.styles legend { font-size: 0.85rem; color: var(--muted); padding: 0 4px; }
.styles label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 0.95rem; }
.styles input { accent-color: var(--accent); width: 18px; height: 18px; }
.ok { background: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: 0.92rem; margin: 6px 0 10px; }
.stage canvas, #result-video { display: block; width: 100%; max-width: 320px; aspect-ratio: 9 / 16; height: auto; background: #000; }
#result { display: grid; justify-items: center; gap: 12px; margin-top: 12px; }
#result-video { border-radius: 12px; }
progress { width: 100%; height: 10px; accent-color: var(--accent); }
.slider { display: block; margin: 10px 0; font-size: 0.92rem; }
.slider output { float: right; color: var(--muted); }
.langs { font-size: 0.85rem; color: var(--muted); margin: 0 0 4px; }
.langs a { color: var(--link, var(--accent)); text-decoration: none; }
.langs [aria-current] { font-weight: 700; color: var(--fg); }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; margin-top: 10px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.rules ul, .rules ol { padding-left: 22px; margin: 6px 0; }
.rules li { margin: 4px 0; }
.doc h2 { font-size: 1.15rem; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 4px; }
.doc h3 { font-size: 0.98rem; margin: 18px 0 4px; }
.doc p, .doc li { font-size: 0.93rem; }
.small { font-size: 0.88rem; }
.lang-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.lang-list .button { width: 100%; font-size: 1.1rem; }
.diag { margin: 16px 0; font-size: 0.85rem; }
.net-line { display: block; margin: 8px 0 16px; color: var(--muted); font-size: 0.85rem; }
.net-list { padding-left: 18px; margin: 4px 0; word-break: break-all; }
.net-warn { color: var(--error); }
.diag pre { white-space: pre-wrap; word-break: break-all; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
footer { margin-top: 24px; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* the choices under the screen in use (moved between the recording screen and the result) */
.controls { margin-top: 12px; }
.controls h3 { margin: 16px 0 4px; font-size: 1rem; }
.controls h3:first-child { margin-top: 4px; }

/* note of the sing-along guide, at the bottom edge of the screen (the band itself is in the middle) */
.guide-label {
	position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
	background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 0.8rem; line-height: 1.4; white-space: nowrap;
	border-radius: 999px; padding: 1px 10px; pointer-events: none;
}

/* "loading" over a screen while a lyric material is fetched */
.loading {
	position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2;
	background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 0.9rem; border-radius: 999px; padding: 6px 14px; pointer-events: none;
}
/* the choice groups open and close; a closed one shows what is chosen */
.controls details.group { border-top: 1px solid var(--line); padding: 4px 0; }
.controls details.group:first-child { border-top: 0; }
.controls summary { cursor: pointer; font-weight: 700; padding: 10px 0; min-height: 44px; }
.controls summary .sum { font-weight: 400; color: var(--muted); margin-left: 8px; font-size: 0.9rem; }
.controls details[open] summary .sum { display: none; }

/* "stop" on the recording screen itself, so it is never pushed out of view while recording */
.stage .stop-over { position: absolute; top: 8px; right: 8px; z-index: 3; min-height: 40px; background: rgba(0, 0, 0, 0.7); color: #fff; border-color: rgba(255, 255, 255, 0.5); }
/* "how was it recorded": the chosen one is filled */
.button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
/* play/stop on the preview screen (it stays at the top while scrolling): bottom right, which on a
   phone is in the black beside the picture */
.stage .stage-play { position: absolute; right: 8px; bottom: 8px; z-index: 3; min-height: 44px; background: rgba(0, 0, 0, 0.7); color: #fff; border-color: rgba(255, 255, 255, 0.5); }
