/**
 * Corrida Harmônica — estilos
 * Visual alinhado ao site Cifra Simplificada: fundo claro, roxo como cor
 * principal, selos lilás/âmbar, bordas suaves e cantos arredondados.
 * Todas as classes usam o prefixo "ch-". O container faz um reset próprio
 * para não herdar estilos do tema. Cores em variáveis CSS.
 */

/* ===================================================================
 * Variáveis (tema claro)
 * ================================================================= */
.ch-game {
	--ch-primary: #7c3aed;
	--ch-accent: #f59e0b;

	/* derivadas da cor principal (fallback + color-mix para cores personalizadas) */
	--ch-primary-strong: #6d28d9;
	--ch-primary-strong: color-mix(in srgb, var(--ch-primary) 84%, #000);
	--ch-primary-soft: #f3efff;
	--ch-primary-soft: color-mix(in srgb, var(--ch-primary) 9%, #fff);
	--ch-primary-line: #d8c9fb;
	--ch-primary-line: color-mix(in srgb, var(--ch-primary) 32%, #fff);
	--ch-primary-text: #6d28d9;
	--ch-primary-text: color-mix(in srgb, var(--ch-primary) 88%, #000);

	--ch-accent-soft: #fef6e0;
	--ch-accent-soft: color-mix(in srgb, var(--ch-accent) 14%, #fff);
	--ch-accent-line: #f8d27a;
	--ch-accent-line: color-mix(in srgb, var(--ch-accent) 55%, #fff);
	--ch-accent-text: #8a4b06;

	--ch-success: #10b981;
	--ch-success-soft: #ecfdf5;
	--ch-success-text: #047857;
	--ch-danger: #ef4444;
	--ch-danger-soft: #fef2f2;
	--ch-danger-text: #b91c1c;

	--ch-bg: #ffffff;
	--ch-bg-subtle: #f8f6fd;
	--ch-surface: #ffffff;
	--ch-border: #e8e4f1;
	--ch-border-strong: #d9d3e8;
	--ch-track: #efebf8;
	--ch-text: #1b1433;
	--ch-muted: #6b6783;
	--ch-overlay: rgba(255, 255, 255, 0.88);
	--ch-shadow-sm: 0 1px 2px rgba(27, 20, 51, 0.06);
	--ch-shadow: 0 1px 2px rgba(27, 20, 51, 0.04), 0 10px 30px rgba(76, 46, 160, 0.08);

	--ch-radius: 16px;
	--ch-radius-md: 12px;
	--ch-radius-sm: 10px;
	--ch-pad: 18px;
	--ch-ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===================================================================
 * Tema escuro (ativado pelo JS quando o site está no modo escuro,
 * ou pelo sistema na página dedicada)
 * ================================================================= */
.ch-game.ch-dark {
	--ch-primary-soft: #2a2145;
	--ch-primary-soft: color-mix(in srgb, var(--ch-primary) 20%, #17141f);
	--ch-primary-line: #4c3a86;
	--ch-primary-line: color-mix(in srgb, var(--ch-primary) 50%, #17141f);
	--ch-primary-text: #c4b5fd;
	--ch-primary-text: color-mix(in srgb, var(--ch-primary) 45%, #fff);

	--ch-accent-soft: rgba(245, 158, 11, 0.14);
	--ch-accent-line: rgba(245, 158, 11, 0.45);
	--ch-accent-text: #fcd34d;

	--ch-success-soft: rgba(16, 185, 129, 0.15);
	--ch-success-text: #6ee7b7;
	--ch-danger-soft: rgba(239, 68, 68, 0.15);
	--ch-danger-text: #fca5a5;

	--ch-bg: #17141f;
	--ch-bg-subtle: #1c1827;
	--ch-surface: #211c2e;
	--ch-border: #2f2943;
	--ch-border-strong: #3d3555;
	--ch-track: #2b2540;
	--ch-text: #f3f1fa;
	--ch-muted: #a8a2c0;
	--ch-overlay: rgba(23, 20, 31, 0.9);
	--ch-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
	--ch-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
	color-scheme: dark;
}

/* ===================================================================
 * Reset isolado (especificidade 0,2,0 vence a maioria dos temas)
 * ================================================================= */
.ch-wrap {
	max-width: 600px;
	margin: 1.5em auto;
}

.ch-game,
.ch-game *,
.ch-game *::before,
.ch-game *::after {
	box-sizing: border-box;
}

.ch-game.ch-game :where(div, span, p, h1, h2, h3, ol, ul, li, dl, dt, dd, section, header, fieldset, legend, label, strong, b, i, small, details, summary, button, select, canvas, svg) {
	margin: 0;
	padding: 0;
	border: 0;
	font: inherit;
	color: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	text-shadow: none;
	line-height: inherit;
	background: none;
	box-shadow: none;
	min-width: 0;
	max-width: none;
	float: none;
	list-style: none;
	vertical-align: baseline;
}

.ch-game.ch-game :where(button, select) {
	-webkit-appearance: none;
	appearance: none;
	border-radius: 0;
	width: auto;
	height: auto;
	cursor: pointer;
	text-align: center;
	outline: none;
}

.ch-game.ch-game :where(svg) {
	display: inline-block;
	width: 1em;
	height: 1em;
	flex-shrink: 0;
	fill: none;
	vertical-align: middle;
}

.ch-game [hidden] {
	display: none !important;
}

.ch-game {
	position: relative;
	display: block;
	width: 100%;
	max-width: 600px;
	margin: 0 auto;
	/* herda a fonte do site; sem fonte definida, usa a do sistema */
	font-family: inherit;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.4;
	color: var(--ch-text);
	text-align: left;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
	color-scheme: light;
}

.ch-game .ch-stage,
.ch-game .ch-boot {
	font-family: var(--ch-font, inherit);
}

.ch-game :focus-visible {
	outline: 3px solid var(--ch-primary) !important;
	outline-offset: 2px;
}

/* Texto só para leitores de tela */
.ch-game .ch-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Carregando (antes do JS) */
.ch-game .ch-boot {
	padding: 48px 20px;
	border-radius: var(--ch-radius);
	border: 1px solid var(--ch-border);
	background: var(--ch-bg);
	text-align: center;
	color: var(--ch-muted);
}

.ch-game .ch-boot-title {
	font-size: 1.5rem;
	font-weight: 800;
	color: var(--ch-text);
	margin-bottom: 4px;
}

/* ===================================================================
 * Palco
 * ================================================================= */
.ch-game .ch-stage {
	position: relative;
	display: flex;
	flex-direction: column;
	height: clamp(520px, 88vh, 840px);
	height: clamp(520px, 88svh, 840px);
	padding: max(var(--ch-pad), env(safe-area-inset-top)) max(var(--ch-pad), env(safe-area-inset-right)) max(var(--ch-pad), env(safe-area-inset-bottom)) max(var(--ch-pad), env(safe-area-inset-left));
	border-radius: var(--ch-radius);
	border: 1px solid var(--ch-border);
	background: var(--ch-bg);
	box-shadow: var(--ch-shadow);
	overflow: hidden;
	isolation: isolate;
	container-type: inline-size;
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

/* faixa lilás suave no topo (no lugar dos gradientes neon) */
.ch-game .ch-bg {
	position: absolute;
	inset: 0 0 auto 0;
	height: 200px;
	z-index: -1;
	pointer-events: none;
	background: linear-gradient(180deg, var(--ch-primary-soft), transparent);
}

.ch-game .ch-bg span {
	display: none;
}

.ch-game .ch-fx {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: 30;
	pointer-events: none;
}

/* Barra de ícones (som / tela cheia) */
.ch-game .ch-toolbar {
	position: absolute;
	top: max(var(--ch-pad), env(safe-area-inset-top));
	right: max(var(--ch-pad), env(safe-area-inset-right));
	z-index: 40;
	display: flex;
	gap: 8px;
}

.ch-game .ch-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--ch-surface);
	border: 1px solid var(--ch-border);
	box-shadow: var(--ch-shadow-sm);
	color: var(--ch-text);
	font-size: 19px;
	transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
	touch-action: manipulation;
}

.ch-game .ch-icon-btn:hover {
	background: var(--ch-primary-soft);
	border-color: var(--ch-primary-line);
	color: var(--ch-primary-text);
}

.ch-game .ch-icon-btn:active {
	transform: scale(0.94);
}

.ch-game .ch-home::-webkit-scrollbar,
.ch-game .ch-end::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}

/* durante a partida o botão de tema some (sobra espaço para o placar) */
.ch-game.is-playing .ch-theme-btn {
	display: none;
}

.ch-game .ch-icon-btn[aria-pressed="true"] {
	color: var(--ch-danger-text);
}

/* Telas */
.ch-game .ch-screen {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	outline: none;
}

.ch-game .ch-home,
.ch-game .ch-end {
	overflow-y: auto;
	overscroll-behavior: contain;
	/* rola normalmente, mas sem barra de rolagem visível */
	scrollbar-width: none;
	-ms-overflow-style: none;
	gap: 14px;
	padding-top: 4px;
	text-align: center;
}

/* ===================================================================
 * Botões gerais
 * ================================================================= */
.ch-game .ch-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 46px;
	padding: 10px 18px;
	border-radius: var(--ch-radius-sm);
	font-weight: 700;
	font-size: 0.95rem;
	color: var(--ch-text);
	touch-action: manipulation;
	transition: transform 0.1s, box-shadow 0.2s, background-color 0.15s, border-color 0.15s;
}

.ch-game .ch-btn svg {
	font-size: 1.15em;
}

.ch-game .ch-btn:active {
	transform: translateY(1px);
}

.ch-game .ch-btn-play {
	width: 100%;
	min-height: 58px;
	font-size: 1.15rem;
	font-weight: 800;
	letter-spacing: 0.04em;
	color: #fff;
	background: var(--ch-primary);
	border-radius: var(--ch-radius-md);
	box-shadow: 0 6px 18px rgba(124, 58, 237, 0.28);
	box-shadow: 0 6px 18px color-mix(in srgb, var(--ch-primary) 30%, transparent);
}

.ch-game .ch-btn-play:hover {
	background: var(--ch-primary-strong);
}

.ch-game .ch-btn-play svg {
	font-size: 1.3em;
}

.ch-game .ch-btn-ghost {
	background: var(--ch-surface);
	border: 1px solid var(--ch-border);
	box-shadow: var(--ch-shadow-sm);
}

.ch-game .ch-btn-ghost:hover {
	border-color: var(--ch-primary-line);
	background: var(--ch-primary-soft);
	color: var(--ch-primary-text);
}

/* Selo (chip) — mesmo formato de "Tom: C", "Capo 1ª" do site */
.ch-game .ch-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 12px;
	border-radius: var(--ch-radius-sm);
	border: 1px solid var(--ch-border);
	background: var(--ch-bg-subtle);
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--ch-muted);
	line-height: 1.3;
}

/* ===================================================================
 * Tela inicial
 * ================================================================= */
.ch-game .ch-brand {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding-top: 6px;
}

.ch-game .ch-logo {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 16px;
	background: var(--ch-primary);
	color: #fff;
	font-size: 34px;
	box-shadow: 0 8px 20px rgba(124, 58, 237, 0.28);
	box-shadow: 0 8px 20px color-mix(in srgb, var(--ch-primary) 32%, transparent);
	transform: rotate(-6deg);
}

.ch-game .ch-title {
	font-size: clamp(1.75rem, 8.5cqi, 2.4rem);
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.02em;
	color: var(--ch-text);
}

.ch-game .ch-title-b {
	color: var(--ch-primary-text);
}

.ch-game .ch-tagline {
	max-width: 30em;
	color: var(--ch-muted);
	font-size: 0.95rem;
}

/* Ilustração: teclado de piano com um acorde aceso */
.ch-game .ch-hero {
	display: flex;
	justify-content: center;
}

.ch-game .ch-keys {
	width: min(100%, 340px);
	height: auto;
	font-size: inherit;
}

.ch-game .ch-keys .ch-k-white {
	fill: var(--ch-surface);
	stroke: var(--ch-border-strong);
	stroke-width: 1.5;
}

.ch-game .ch-keys .ch-k-black {
	fill: #1b1433;
}

.ch-game.ch-dark .ch-keys .ch-k-black {
	fill: #0b0912;
	stroke: var(--ch-border-strong);
	stroke-width: 1.5;
}

.ch-game .ch-keys .ch-k-on {
	fill: var(--ch-primary-soft);
	stroke: var(--ch-primary);
	animation: ch-key 3.6s ease-in-out infinite;
}

.ch-game .ch-keys .ch-k-on:nth-of-type(2) { animation-delay: 0.2s; }
.ch-game .ch-keys .ch-k-on:nth-of-type(3) { animation-delay: 0.4s; }

.ch-game .ch-keys .ch-k-dot {
	fill: var(--ch-primary);
}

.ch-game .ch-keys .ch-k-label {
	fill: var(--ch-primary-text);
	font-size: 11px;
	font-weight: 800;
	font-family: inherit;
}

.ch-game .ch-label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ch-muted);
	text-align: left;
}

.ch-game .ch-label svg {
	margin-left: 2px;
	color: var(--ch-primary-text);
}

.ch-game .ch-fieldset {
	min-width: 0;
}

.ch-game .ch-modes {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}

.ch-game .ch-mode {
	position: relative;
	display: block;
	cursor: pointer;
}

.ch-game .ch-mode-input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}

.ch-game .ch-mode-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	height: 100%;
	padding: 12px 6px 11px;
	border-radius: var(--ch-radius-md);
	background: var(--ch-surface);
	border: 1px solid var(--ch-border);
	box-shadow: var(--ch-shadow-sm);
	transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.ch-game .ch-mode:hover .ch-mode-card {
	border-color: var(--ch-primary-line);
}

.ch-game .ch-mode-ico {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-bottom: 2px;
	border-radius: 12px;
	background: var(--ch-primary-soft);
	color: var(--ch-primary-text);
	font-size: 28px;
	transition: background-color 0.15s, color 0.15s;
}

.ch-game .ch-mode-name {
	font-weight: 700;
	font-size: clamp(0.84rem, 3.5cqi, 0.97rem);
	line-height: 1.15;
	color: var(--ch-text);
}

.ch-game .ch-mode-desc {
	font-size: clamp(0.68rem, 2.8cqi, 0.76rem);
	color: var(--ch-muted);
	line-height: 1.25;
}

.ch-game .ch-mode-input:checked + .ch-mode-card {
	border-color: var(--ch-primary);
	background: var(--ch-primary-soft);
	box-shadow: 0 0 0 1px var(--ch-primary);
}

.ch-game .ch-mode-input:checked + .ch-mode-card .ch-mode-ico {
	background: var(--ch-primary);
	color: #fff;
}

.ch-game .ch-mode-input:focus-visible + .ch-mode-card {
	outline: 3px solid var(--ch-primary);
	outline-offset: 2px;
}

.ch-game .ch-mode.is-disabled {
	cursor: not-allowed;
	opacity: 0.45;
}

.ch-game .ch-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.ch-game .ch-field {
	display: block;
	min-width: 0;
}

.ch-game .ch-select {
	display: block;
	width: 100%;
	min-height: 46px;
	padding: 10px 36px 10px 12px;
	border-radius: var(--ch-radius-sm);
	background-color: var(--ch-surface);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%237c3aed' stroke-width='2.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 11px center;
	background-size: 17px;
	border: 1px solid var(--ch-border);
	box-shadow: var(--ch-shadow-sm);
	color: var(--ch-text);
	font-size: 0.93rem;
	font-weight: 600;
	text-align: left;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
	transition: border-color 0.15s;
}

.ch-game .ch-select:hover {
	border-color: var(--ch-primary-line);
}

.ch-game .ch-select:disabled {
	opacity: 1;
	cursor: default;
	background-color: var(--ch-primary-soft);
	border-color: var(--ch-primary-line);
	color: var(--ch-primary-text);
	background-image: none;
	padding-right: 12px;
}

.ch-game .ch-select option {
	background: var(--ch-surface);
	color: var(--ch-text);
}

.ch-game .ch-song {
	align-self: center;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 7px 12px;
	border-radius: var(--ch-radius-sm);
	background: var(--ch-accent-soft);
	border: 1px solid var(--ch-accent-line);
	color: var(--ch-accent-text);
	font-size: 0.86rem;
	font-weight: 600;
	text-align: left;
}

.ch-game .ch-song svg {
	font-size: 1.1em;
}

.ch-game .ch-record {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	font-size: 0.95rem;
	color: var(--ch-muted);
}

.ch-game .ch-record svg {
	font-size: 1.25em;
	color: var(--ch-accent);
}

.ch-game .ch-record strong {
	color: var(--ch-text);
	font-weight: 800;
}

.ch-game .ch-kbd-hint {
	display: none;
	font-size: 0.76rem;
	color: var(--ch-muted);
}

@media (hover: hover) and (pointer: fine) {
	.ch-game .ch-kbd-hint {
		display: block;
	}
}

.ch-game .ch-howto {
	border-radius: var(--ch-radius-md);
	background: var(--ch-surface);
	border: 1px solid var(--ch-border);
	text-align: left;
}

.ch-game .ch-howto summary {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 14px;
	font-weight: 700;
	cursor: pointer;
	list-style: none;
	color: var(--ch-text);
}

.ch-game .ch-howto summary::-webkit-details-marker {
	display: none;
}

.ch-game .ch-howto summary::after {
	content: "";
	width: 9px;
	height: 9px;
	margin-left: auto;
	border-right: 2px solid var(--ch-primary);
	border-bottom: 2px solid var(--ch-primary);
	transform: rotate(45deg) translateY(-2px);
	transition: transform 0.2s;
}

.ch-game .ch-howto[open] summary::after {
	transform: rotate(-135deg) translateY(-2px);
}

.ch-game .ch-howto summary svg {
	color: var(--ch-primary-text);
	font-size: 1.2em;
}

.ch-game .ch-steps {
	display: grid;
	gap: 10px;
	padding: 2px 14px 14px;
	counter-reset: ch-step;
}

.ch-game .ch-steps li {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 28px;
	padding-left: 38px;
	font-size: 0.9rem;
	color: var(--ch-text);
	counter-increment: ch-step;
}

.ch-game .ch-steps li::before {
	content: counter(ch-step);
	position: absolute;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 28px;
	height: 28px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.85rem;
	font-weight: 800;
	color: var(--ch-primary-text);
	background: var(--ch-primary-soft);
	border: 1px solid var(--ch-primary-line);
}

/* ===================================================================
 * Partida
 * ================================================================= */
.ch-game .ch-play {
	gap: 10px;
	overflow: hidden;
}

.ch-game.is-playing .ch-stage {
	touch-action: none;
	overscroll-behavior: none;
}

.ch-game .ch-hud {
	display: grid;
	grid-template-columns: 92px 1fr 92px;
	align-items: center;
	min-height: 40px;
}

.ch-game .ch-score {
	display: flex;
	flex-direction: column;
	align-items: center;
	line-height: 1;
}

.ch-game .ch-score-label {
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ch-muted);
}

.ch-game .ch-score-num {
	display: inline-block;
	margin-top: 3px;
	font-size: clamp(1.4rem, 6.5cqi, 1.8rem);
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	color: var(--ch-text);
}

.ch-game .ch-score-num.is-pop {
	animation: ch-pop 0.35s var(--ch-ease-pop);
}

/* Relógio: número + barra (verde → amarelo → vermelho) */
.ch-game .ch-timer {
	--tc: var(--ch-success);
	--tc-text: var(--ch-success-text);
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px;
	border-radius: var(--ch-radius-md);
	background: var(--ch-surface);
	border: 1px solid var(--ch-border);
	box-shadow: var(--ch-shadow-sm);
}

.ch-game .ch-timer[data-estado="warn"] {
	--tc: var(--ch-accent);
	--tc-text: var(--ch-accent-text);
}

.ch-game .ch-timer[data-estado="danger"] {
	--tc: var(--ch-danger);
	--tc-text: var(--ch-danger-text);
	border-color: var(--ch-danger);
	background: var(--ch-danger-soft);
	animation: ch-pulse 0.9s ease-in-out infinite;
}

.ch-game .ch-timer.is-hurt {
	animation: ch-shake 0.4s;
}

.ch-game .ch-timer-ico {
	display: inline-flex;
	color: var(--tc-text);
	font-size: 22px;
}

.ch-game .ch-timer-num {
	min-width: 2ch;
	font-size: clamp(1.5rem, 7cqi, 1.9rem);
	font-weight: 800;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	text-align: right;
	color: var(--tc-text);
}

.ch-game .ch-timer-s {
	margin-left: -8px;
	font-weight: 700;
	color: var(--tc-text);
}

.ch-game .ch-timer-bar {
	position: relative;
	flex: 1;
	height: 10px;
	border-radius: 999px;
	background: var(--ch-track);
	overflow: hidden;
}

.ch-game .ch-timer-fill {
	position: absolute;
	inset: 0;
	border-radius: 999px;
	background: var(--tc);
	transform-origin: left center;
	transition: background-color 0.4s;
	will-change: transform;
}

/* HUD do modo Ritmo */
.ch-game .ch-rhud {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 14px;
	border-radius: var(--ch-radius-md);
	background: var(--ch-surface);
	border: 1px solid var(--ch-border);
	box-shadow: var(--ch-shadow-sm);
}

.ch-game .ch-lives {
	display: flex;
	gap: 6px;
}

.ch-game .ch-heart {
	display: inline-flex;
	font-size: 26px;
	color: var(--ch-danger);
	transition: color 0.3s, opacity 0.3s;
}

.ch-game .ch-heart.is-lost {
	color: var(--ch-track);
}

.ch-game .ch-heart.is-break {
	animation: ch-heartbreak 0.5s;
}

.ch-game .ch-bpm {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 700;
	color: var(--ch-muted);
	font-size: 0.85rem;
}

.ch-game .ch-bpm svg {
	color: var(--ch-primary-text);
	font-size: 1.4em;
}

.ch-game .ch-bpm strong {
	font-size: 1.35rem;
	font-weight: 800;
	color: var(--ch-text);
}

.ch-game .ch-bpm.is-pop {
	animation: ch-pop 0.5s var(--ch-ease-pop);
}

/* Tom atual — selo igual ao "Tom: C" do site */
.ch-game .ch-keybox {
	align-self: center;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px 6px 12px;
	border-radius: var(--ch-radius-md);
	background: var(--ch-primary-soft);
	border: 1px solid var(--ch-primary-line);
}

.ch-game .ch-key-ico {
	display: inline-flex;
	color: var(--ch-primary-text);
	font-size: 18px;
}

.ch-game .ch-key-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--ch-primary-text);
}

.ch-game .ch-key-name {
	font-size: clamp(1.1rem, 5cqi, 1.3rem);
	font-weight: 800;
	color: var(--ch-text);
}

.ch-game .ch-key-chip {
	padding: 3px 9px;
	border-radius: 8px;
	background: var(--ch-primary);
	font-weight: 800;
	font-size: 0.9rem;
	color: #fff;
}

.ch-game .ch-warn {
	align-self: center;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border-radius: var(--ch-radius-sm);
	background: var(--ch-accent-soft);
	border: 1px solid var(--ch-accent-line);
	color: var(--ch-accent-text);
	font-weight: 700;
	font-size: 0.92rem;
}

.ch-game .ch-warn b {
	display: inline-block;
	font-weight: 800;
	font-size: 1.1em;
}

.ch-game .ch-warn.is-tick b {
	animation: ch-pop 0.45s var(--ch-ease-pop);
}

/* Combo */
.ch-game .ch-combo {
	--cc: var(--ch-muted);
	--cc-bg: var(--ch-bg-subtle);
	--cc-line: var(--ch-border);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 34px;
}

.ch-game .ch-combo[data-tier="2"] { --cc: var(--ch-primary-text); --cc-bg: var(--ch-primary-soft); --cc-line: var(--ch-primary-line); }
.ch-game .ch-combo[data-tier="3"] { --cc: var(--ch-success-text); --cc-bg: var(--ch-success-soft); --cc-line: var(--ch-success); }
.ch-game .ch-combo[data-tier="4"] { --cc: var(--ch-accent-text); --cc-bg: var(--ch-accent-soft); --cc-line: var(--ch-accent-line); }
.ch-game .ch-combo[data-tier="5"] { --cc: #fff; --cc-bg: var(--ch-danger); --cc-line: var(--ch-danger); }

.ch-game .ch-mult {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 3em;
	padding: 4px 10px;
	border-radius: var(--ch-radius-sm);
	border: 1px solid var(--cc-line);
	background: var(--cc-bg);
	color: var(--cc);
	font-weight: 800;
	font-size: 1rem;
	line-height: 1.2;
	transition: background-color 0.25s, color 0.25s, border-color 0.25s, transform 0.25s var(--ch-ease-pop);
}

.ch-game .ch-combo[data-tier="3"] .ch-mult,
.ch-game .ch-combo[data-tier="4"] .ch-mult { transform: scale(1.08); }
.ch-game .ch-combo[data-tier="5"] .ch-mult { transform: scale(1.15); }

.ch-game .ch-mult.is-bump {
	animation: ch-pop 0.3s var(--ch-ease-pop);
}

.ch-game .ch-dots {
	display: inline-flex;
	gap: 5px;
}

.ch-game .ch-dots i {
	display: block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--ch-track);
	transition: background-color 0.2s, transform 0.2s;
}

.ch-game .ch-dots i.is-on {
	background: var(--ch-primary);
	transform: scale(1.15);
}

.ch-game .ch-seq {
	min-width: 6.5em;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--ch-muted);
	text-align: left;
}

.ch-game .ch-combo.is-levelup {
	animation: ch-levelup 0.7s var(--ch-ease-pop);
}

.ch-game .ch-combo.is-break {
	animation: ch-shake 0.35s;
}

/* Área central: cartão com pauta musical desenhada */
.ch-game .ch-center {
	position: relative;
	flex: 1;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--ch-radius);
	border: 1px solid var(--ch-border);
	background-color: var(--ch-bg-subtle);
	background-image: linear-gradient(var(--ch-border) 0 0), linear-gradient(var(--ch-border) 0 0), linear-gradient(var(--ch-border) 0 0), linear-gradient(var(--ch-border) 0 0), linear-gradient(var(--ch-border) 0 0);
	background-size: 100% 1px;
	background-repeat: no-repeat;
	background-position: 0 calc(50% - 36px), 0 calc(50% - 18px), 0 50%, 0 calc(50% + 18px), 0 calc(50% + 36px);
	overflow: hidden;
}

.ch-game .is-ritmo .ch-center {
	background-image: none;
}

.ch-game .ch-clef {
	position: absolute;
	left: 10px;
	top: 50%;
	height: 132px;
	width: auto;
	transform: translateY(-50%);
	color: var(--ch-primary-line);
	font-size: inherit;
	pointer-events: none;
}

.ch-game .is-ritmo .ch-clef {
	display: none;
}

.ch-game .ch-question {
	--ch-entrada: 420ms;
	position: relative;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 10px 26px;
	border-radius: var(--ch-radius);
	background: var(--ch-surface);
	border: 1px solid var(--ch-border);
	box-shadow: var(--ch-shadow);
	line-height: 1;
}

.ch-game .ch-question.is-enter {
	animation: ch-enter var(--ch-entrada) var(--ch-ease-pop) both;
}

.ch-game .ch-degree {
	font-size: clamp(3.2rem, min(19cqi, 13vh), 6.5rem);
	font-weight: 800;
	letter-spacing: -0.03em;
	white-space: nowrap;
	color: var(--ch-text);
}

.ch-game .ch-qmark {
	margin-left: 4px;
	font-size: clamp(1.6rem, min(9cqi, 6vh), 3rem);
	font-weight: 800;
	color: var(--ch-primary);
}

/* Trilha do Ritmo */
.ch-game .ch-track {
	position: absolute;
	inset: 0;
	background-image: linear-gradient(90deg, transparent calc(50% - 1px), var(--ch-border) calc(50% - 1px), var(--ch-border) calc(50% + 1px), transparent calc(50% + 1px));
	overflow: hidden;
}

.ch-game .ch-banner {
	position: absolute;
	top: 10px;
	left: 50%;
	z-index: 0;
	transform: translateX(-50%);
	padding: 4px 12px;
	border-radius: var(--ch-radius-sm);
	background: var(--ch-surface);
	border: 1px solid var(--ch-border);
	font-weight: 700;
	font-size: 0.82rem;
	color: var(--ch-muted);
	white-space: nowrap;
}

.ch-game .ch-banner:empty {
	display: none;
}

.ch-game .ch-banner.is-show {
	animation: ch-banner 1.6s ease-out;
}

.ch-game .ch-hitline {
	position: absolute;
	left: 8%;
	right: 8%;
	bottom: 34px;
	height: 4px;
	border-radius: 999px;
	background: var(--ch-primary);
}

.ch-game .ch-hitline::before,
.ch-game .ch-hitline::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--ch-primary);
	transform: translateY(-50%);
}

.ch-game .ch-hitline::before { left: -6px; }
.ch-game .ch-hitline::after { right: -6px; }

.ch-game .ch-hitline.is-beat {
	animation: ch-beat 0.22s ease-out;
}

.ch-game .ch-note {
	position: absolute;
	top: 0;
	left: 50%;
	z-index: 1;
	padding: 9px 16px;
	border-radius: var(--ch-radius-md);
	font-size: 1.45rem;
	font-weight: 800;
	line-height: 1;
	white-space: nowrap;
	color: var(--ch-text);
	background: var(--ch-surface);
	border: 2px solid var(--ch-primary);
	box-shadow: var(--ch-shadow);
	will-change: transform;
}

.ch-game .ch-note.is-hit {
	border-color: var(--ch-success);
	background: var(--ch-success-soft);
	color: var(--ch-success-text);
	opacity: 0;
	transition: opacity 0.25s ease-out;
}

.ch-game .ch-note.is-miss {
	border-color: var(--ch-danger);
	background: var(--ch-danger-soft);
	color: var(--ch-danger-text);
	opacity: 0.6;
}

.ch-game .ch-judge {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 48px;
	z-index: 3;
	font-size: 1.4rem;
	font-weight: 800;
	text-align: center;
	opacity: 0;
	pointer-events: none;
}

.ch-game .ch-judge[data-tipo="perfeito"] { color: var(--ch-primary-text); }
.ch-game .ch-judge[data-tipo="bom"] { color: var(--ch-success-text); }
.ch-game .ch-judge[data-tipo="errou"] { color: var(--ch-danger-text); }

.ch-game .ch-judge.is-show {
	animation: ch-judge 0.6s ease-out;
}

/* Botões de resposta (2x2) */
.ch-game .ch-answers {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.ch-game .ch-answer {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: clamp(64px, 11vh, 96px);
	padding: 10px;
	border-radius: var(--ch-radius-md);
	background: var(--ch-surface);
	border: 1px solid var(--ch-border-strong);
	box-shadow: 0 2px 0 var(--ch-border-strong);
	color: var(--ch-text);
	font-size: clamp(1.45rem, 7cqi, 2.1rem);
	font-weight: 800;
	line-height: 1.05;
	touch-action: manipulation;
	transition: transform 0.08s, box-shadow 0.15s, background-color 0.15s, border-color 0.15s, color 0.15s;
}

.ch-game .ch-answer:hover {
	border-color: var(--ch-primary);
	color: var(--ch-primary-text);
}

.ch-game .ch-answer:active {
	transform: translateY(2px);
	box-shadow: 0 0 0 var(--ch-border-strong);
}

.ch-game .ch-answer-key {
	position: absolute;
	top: 8px;
	left: 9px;
	display: none;
	min-width: 22px;
	height: 22px;
	padding: 0 4px;
	border-radius: 6px;
	border: 1px solid var(--ch-border);
	background: var(--ch-bg-subtle);
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 20px;
	color: var(--ch-muted);
}

@media (hover: hover) and (pointer: fine) {
	.ch-game .ch-answer-key {
		display: block;
	}
}

.ch-game .ch-answer-txt {
	overflow-wrap: anywhere;
}

/* selo de certo/errado desenhado no canto */
.ch-game .ch-answer::after {
	content: "";
	position: absolute;
	top: 8px;
	right: 8px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background-repeat: no-repeat;
	background-position: center;
	background-size: 14px;
	opacity: 0;
	transform: scale(0.4);
	transition: opacity 0.15s, transform 0.25s var(--ch-ease-pop);
}

.ch-game .ch-answer.is-right {
	background: var(--ch-success-soft);
	border-color: var(--ch-success);
	box-shadow: 0 2px 0 var(--ch-success);
	color: var(--ch-success-text);
	animation: ch-right 0.45s var(--ch-ease-pop);
}

.ch-game .ch-answer.is-right::after,
.ch-game .ch-answer.is-reveal::after {
	opacity: 1;
	transform: scale(1);
	background-color: var(--ch-success);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' stroke='%23fff' stroke-width='3.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.ch-game .ch-answer.is-wrong {
	background: var(--ch-danger-soft);
	border-color: var(--ch-danger);
	box-shadow: 0 2px 0 var(--ch-danger);
	color: var(--ch-danger-text);
	animation: ch-shake 0.4s;
}

.ch-game .ch-answer.is-wrong::after {
	opacity: 1;
	transform: scale(1);
	background-color: var(--ch-danger);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 7l10 10M17 7L7 17' stroke='%23fff' stroke-width='3.2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

.ch-game .ch-answer.is-reveal {
	border-color: var(--ch-success);
	box-shadow: 0 0 0 2px var(--ch-success);
	color: var(--ch-success-text);
	animation: ch-reveal 0.8s ease-in-out;
}

.ch-game .ch-answer.is-swap {
	animation: ch-swap 0.35s var(--ch-ease-pop);
}

/* Textos flutuantes "+2s", "−3s", "+180" */
.ch-game .ch-float {
	position: absolute;
	z-index: 35;
	transform: translate(-50%, -50%);
	padding: 2px 8px;
	border-radius: 8px;
	font-weight: 800;
	font-size: 1.1rem;
	pointer-events: none;
	white-space: nowrap;
	animation: ch-float-up 1s ease-out forwards;
}

.ch-game .ch-float.is-plus { color: var(--ch-success-text); background: var(--ch-success-soft); border: 1px solid var(--ch-success); }
.ch-game .ch-float.is-minus { color: var(--ch-danger-text); background: var(--ch-danger-soft); border: 1px solid var(--ch-danger); }
.ch-game .ch-float.is-points { color: var(--ch-primary-text); background: var(--ch-primary-soft); border: 1px solid var(--ch-primary-line); }

/* ===================================================================
 * Sobreposições
 * ================================================================= */
.ch-game .ch-overlay {
	position: absolute;
	inset: 0;
	z-index: 50;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 24px;
	background: var(--ch-overlay);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	text-align: center;
}

.ch-game .ch-count-num {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 1.6em;
	height: 1.6em;
	padding: 0 0.25em;
	border-radius: 0.32em;
	background: var(--ch-primary);
	color: #fff;
	font-size: clamp(4rem, 26cqi, 7rem);
	font-weight: 800;
	line-height: 1;
	box-shadow: 0 16px 40px rgba(124, 58, 237, 0.3);
	box-shadow: 0 16px 40px color-mix(in srgb, var(--ch-primary) 35%, transparent);
}

.ch-game .ch-count-num.is-go {
	background: var(--ch-accent);
	color: #3b2203;
	font-size: clamp(2.6rem, 17cqi, 4.6rem);
	padding: 0 0.4em;
}

.ch-game .ch-count-num.is-pop {
	animation: ch-count 0.7s ease-out;
}

.ch-game .ch-pause .ch-btn {
	width: min(280px, 100%);
}

.ch-game .ch-overlay-title {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 1.8rem;
	font-weight: 800;
	margin-bottom: 6px;
	color: var(--ch-text);
}

.ch-game .ch-overlay-title svg {
	color: var(--ch-primary-text);
}

.ch-game .ch-transition {
	gap: 10px;
}

.ch-game .ch-transition.is-on {
	animation: ch-flash 1.4s ease-out;
}

.ch-game .ch-transition.is-on .ch-trans-card {
	animation: ch-zoom 0.7s var(--ch-ease-pop) both;
}

.ch-game .ch-trans-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 22px 30px;
	border-radius: var(--ch-radius);
	background: var(--ch-surface);
	border: 1px solid var(--ch-border);
	box-shadow: var(--ch-shadow);
}

.ch-game .ch-trans-ico {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 14px;
	background: var(--ch-primary-soft);
	color: var(--ch-primary-text);
	font-size: 32px;
}

.ch-game .ch-trans-label {
	font-weight: 700;
	font-size: 0.8rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ch-muted);
}

.ch-game .ch-trans-name {
	font-size: clamp(2rem, 11cqi, 3rem);
	font-weight: 800;
	line-height: 1.05;
	color: var(--ch-text);
}

.ch-game .ch-trans-chip {
	padding: 3px 12px;
	border-radius: 8px;
	background: var(--ch-primary);
	color: #fff;
	font-weight: 800;
	font-size: 1.05rem;
}

.ch-game .ch-toast {
	position: absolute;
	left: 50%;
	bottom: 22px;
	z-index: 60;
	max-width: calc(100% - 32px);
	padding: 11px 16px;
	border-radius: var(--ch-radius-sm);
	background: var(--ch-text);
	color: var(--ch-bg);
	font-weight: 600;
	font-size: 0.9rem;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
	transform: translateX(-50%);
	user-select: text;
	-webkit-user-select: text;
}

.ch-game .ch-toast.is-show {
	animation: ch-toast 0.3s var(--ch-ease-pop);
}

/* ===================================================================
 * Tela final
 * ================================================================= */
.ch-game .ch-end {
	gap: 12px;
	padding-top: 50px; /* espaço para os botões de som/tela cheia */
	padding-bottom: 4px;
}

.ch-game .ch-end-title {
	font-size: clamp(1.5rem, 7cqi, 2rem);
	font-weight: 800;
	letter-spacing: -0.01em;
	color: var(--ch-text);
}

.ch-game .ch-newrecord {
	align-self: center;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border-radius: var(--ch-radius-sm);
	background: var(--ch-accent-soft);
	border: 1px solid var(--ch-accent-line);
	color: var(--ch-accent-text);
	font-weight: 800;
	font-size: 0.95rem;
	animation: ch-record 1.2s ease-in-out infinite alternate;
}

.ch-game .ch-newrecord svg {
	font-size: 1.25em;
	color: var(--ch-accent);
}

.ch-game .ch-final {
	display: flex;
	flex-direction: column;
	align-items: center;
	line-height: 1;
}

.ch-game .ch-final-label {
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ch-muted);
}

.ch-game .ch-final-num {
	margin: 6px 0;
	font-size: clamp(2.6rem, 14cqi, 3.6rem);
	font-weight: 800;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
	color: var(--ch-primary-text);
}

.ch-game .ch-final-best {
	font-size: 0.85rem;
	color: var(--ch-muted);
}

.ch-game .ch-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}

.ch-game .ch-stat {
	padding: 10px 6px;
	border-radius: var(--ch-radius-md);
	background: var(--ch-surface);
	border: 1px solid var(--ch-border);
	box-shadow: var(--ch-shadow-sm);
}

.ch-game .ch-stat dt {
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--ch-muted);
}

.ch-game .ch-stat dd {
	margin-top: 4px;
	font-size: 1.3rem;
	font-weight: 800;
	color: var(--ch-text);
}

.ch-game .ch-weak {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	border-radius: var(--ch-radius-md);
	background: var(--ch-accent-soft);
	border: 1px solid var(--ch-accent-line);
	text-align: left;
	font-weight: 600;
	font-size: 0.93rem;
	color: var(--ch-accent-text);
}

.ch-game .ch-weak-ico {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	border-radius: 10px;
	background: var(--ch-surface);
	border: 1px solid var(--ch-accent-line);
	color: var(--ch-accent);
	font-size: 24px;
}

.ch-game .ch-review {
	display: grid;
	gap: 12px;
}

.ch-game .ch-review-title {
	margin-bottom: 8px;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ch-muted);
}

.ch-game .ch-field-list {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 6px;
}

.ch-game .ch-chord {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	padding: 8px 2px;
	border-radius: var(--ch-radius-sm);
	background: var(--ch-surface);
	border: 1px solid var(--ch-border);
}

.ch-game .ch-chord-deg {
	font-size: 0.72rem;
	font-weight: 700;
	color: var(--ch-primary-text);
	white-space: nowrap;
}

.ch-game .ch-chord-name {
	font-weight: 800;
	font-size: clamp(0.8rem, 3.6cqi, 1.02rem);
	white-space: nowrap;
	color: var(--ch-text);
}

.ch-game .ch-chord.is-weak {
	border-color: var(--ch-accent);
	background: var(--ch-accent-soft);
	box-shadow: 0 0 0 1px var(--ch-accent);
}

.ch-game .ch-end-actions {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 10px;
}

/* ===================================================================
 * Botão "Treinar o campo harmônico desta música"
 * ================================================================= */
.ch-wrap .ch-launcher {
	-webkit-appearance: none;
	appearance: none;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 52px;
	margin: 0 0 12px;
	padding: 12px 20px;
	border: 0;
	border-radius: 12px;
	background: #7c3aed;
	background: var(--ch-launcher, #7c3aed);
	color: #fff;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(124, 58, 237, 0.25);
	touch-action: manipulation;
}

.ch-wrap .ch-launcher:hover {
	filter: brightness(0.94);
}

.ch-wrap .ch-launcher:focus-visible {
	outline: 3px solid #c4b5fd;
	outline-offset: 2px;
}

.ch-wrap .ch-launcher-icon {
	font-size: 1.3em;
	line-height: 1;
}

/* ===================================================================
 * Tela cheia
 * ================================================================= */
.ch-game:fullscreen {
	max-width: none;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--ch-bg-subtle);
}

.ch-game:-webkit-full-screen {
	max-width: none;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--ch-bg-subtle);
}

.ch-game.ch-pseudo-fs {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	max-width: none;
	width: 100%;
	height: 100%;
	height: 100dvh;
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--ch-bg-subtle);
}

.ch-game.is-fullscreen .ch-stage {
	width: 100%;
	max-width: 600px;
	height: 100%;
	border-radius: 0;
	border-width: 0 1px;
	box-shadow: none;
}

html.ch-noscroll,
html.ch-noscroll body {
	overflow: hidden !important;
}

/* ===================================================================
 * Telas estreitas e baixas
 * ================================================================= */
@media (max-width: 380px) {
	.ch-game {
		--ch-pad: 12px;
	}

	.ch-game .ch-answers {
		gap: 8px;
	}

	.ch-game .ch-stats {
		grid-template-columns: repeat(2, 1fr);
	}
}

@container (max-width: 420px) {
	.ch-game .ch-field-list {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.ch-game .ch-row {
		grid-template-columns: 1fr;
	}

	.ch-game .ch-clef {
		height: 104px;
		left: 4px;
	}
}

@media (max-height: 680px) {
	.ch-game .ch-play {
		gap: 7px;
	}

	.ch-game .ch-hero {
		display: none;
	}
}

/* ===================================================================
 * Animações (discretas)
 * ================================================================= */
@keyframes ch-key {
	0%, 70%, 100% { fill: var(--ch-primary-soft); }
	80% { fill: var(--ch-primary-line); }
}

@keyframes ch-enter {
	0% { opacity: 0; transform: translateY(18px) scale(0.7); }
	100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ch-pop {
	0% { transform: scale(1); }
	45% { transform: scale(1.22); }
	100% { transform: scale(1); }
}

@keyframes ch-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.02); }
}

@keyframes ch-shake {
	0%, 100% { transform: translateX(0); }
	20% { transform: translateX(-7px); }
	40% { transform: translateX(6px); }
	60% { transform: translateX(-4px); }
	80% { transform: translateX(2px); }
}

@keyframes ch-right {
	0% { transform: scale(1); }
	40% { transform: scale(1.06); }
	100% { transform: scale(1); }
}

@keyframes ch-reveal {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.04); }
}

@keyframes ch-swap {
	0% { transform: rotateX(90deg); opacity: 0.2; }
	100% { transform: rotateX(0); opacity: 1; }
}

@keyframes ch-levelup {
	0% { transform: scale(1); }
	35% { transform: scale(1.3); }
	65% { transform: scale(0.96); }
	100% { transform: scale(1); }
}

@keyframes ch-float-up {
	0% { opacity: 0; transform: translate(-50%, -30%) scale(0.8); }
	15% { opacity: 1; transform: translate(-50%, -60%) scale(1.05); }
	100% { opacity: 0; transform: translate(-50%, -220%) scale(1); }
}

@keyframes ch-count {
	0% { opacity: 0; transform: scale(1.6); }
	30% { opacity: 1; transform: scale(0.96); }
	75% { opacity: 1; transform: scale(1); }
	100% { opacity: 0; transform: scale(0.85); }
}

@keyframes ch-flash {
	0% { opacity: 0; }
	12% { opacity: 1; }
	82% { opacity: 1; }
	100% { opacity: 0; }
}

@keyframes ch-zoom {
	0% { transform: scale(0.6); opacity: 0; }
	100% { transform: scale(1); opacity: 1; }
}

@keyframes ch-beat {
	0% { transform: scaleY(2.2); }
	100% { transform: scaleY(1); }
}

@keyframes ch-banner {
	0% { opacity: 0; transform: translate(-50%, -6px); }
	15% { opacity: 1; transform: translate(-50%, 0); }
	100% { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes ch-judge {
	0% { opacity: 0; transform: scale(0.7); }
	25% { opacity: 1; transform: scale(1.12); }
	100% { opacity: 0; transform: translateY(-20px) scale(1); }
}

@keyframes ch-heartbreak {
	0% { transform: scale(1); }
	30% { transform: scale(1.4) rotate(-10deg); }
	60% { transform: scale(0.85) rotate(6deg); }
	100% { transform: scale(1); }
}

@keyframes ch-record {
	from { transform: scale(1); }
	to { transform: scale(1.04); }
}

@keyframes ch-toast {
	from { opacity: 0; transform: translate(-50%, 14px); }
	to { opacity: 1; transform: translate(-50%, 0); }
}

/* ===================================================================
 * Movimento reduzido
 * ================================================================= */
@media (prefers-reduced-motion: reduce) {
	.ch-game *,
	.ch-game *::before,
	.ch-game *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}

	.ch-game .ch-keys .ch-k-on,
	.ch-game .ch-newrecord {
		animation: none !important;
	}

	.ch-game .ch-timer[data-estado="danger"] {
		animation: none !important;
	}

	.ch-game .ch-judge.is-show {
		opacity: 1;
	}
}

/* ===================================================================
 * Guia do campo harmônico (tutorial + grade de todos os tons)
 * ================================================================= */
.ch-game.is-playing .ch-guide-btn {
	display: none;
}

.ch-game .ch-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.ch-game .ch-btn-guide {
	flex: none;
	height: auto;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 12px;
	width: 100%;
	padding: 10px 14px;
	border-radius: var(--ch-radius-md);
	border: 1px dashed var(--ch-primary-line);
	background: var(--ch-primary-soft);
	color: var(--ch-primary-text);
	text-align: left;
	font-weight: 600;
}

.ch-game .ch-btn-guide:hover {
	border-style: solid;
	border-color: var(--ch-primary);
}

.ch-game .ch-btn-guide > svg {
	flex: none;
	width: 26px;
	height: 26px;
}

.ch-game .ch-btn-guide span {
	display: flex;
	flex-direction: column;
	gap: 1px;
	line-height: 1.25;
}

.ch-game .ch-btn-guide strong {
	font-size: 0.95rem;
	color: var(--ch-text);
}

.ch-game .ch-btn-guide small {
	font-size: 0.78rem;
	font-weight: 500;
	color: var(--ch-muted);
}

.ch-game .ch-link-btn {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	align-self: center;
	padding: 6px 10px;
	border: 0;
	background: none;
	color: var(--ch-primary-text);
	font-size: 0.88rem;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.ch-game .ch-link-btn svg {
	width: 18px;
	height: 18px;
}

.ch-game .ch-guide {
	z-index: 60;
	justify-content: flex-start;
	align-items: stretch;
	gap: 0;
	padding: 0;
	background: var(--ch-bg);
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	text-align: left;
	animation: ch-guide-in 0.22s ease-out;
}

@keyframes ch-guide-in {
	from { opacity: 0; transform: translateY(12px); }
	to { opacity: 1; transform: none; }
}

.ch-game .ch-guide-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: max(14px, env(safe-area-inset-top)) max(var(--ch-pad), env(safe-area-inset-right)) 10px max(var(--ch-pad), env(safe-area-inset-left));
}

.ch-game .ch-guide-title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	font-size: 1.2rem;
	font-weight: 800;
	color: var(--ch-text);
}

.ch-game .ch-guide-title svg {
	width: 24px;
	height: 24px;
	color: var(--ch-primary-text);
}

.ch-game .ch-guide-tabs {
	display: flex;
	gap: 6px;
	padding: 0 var(--ch-pad) 10px;
	border-bottom: 1px solid var(--ch-border);
	overflow-x: auto;
	scrollbar-width: none;
}

.ch-game .ch-chip-btn {
	flex: none;
	padding: 7px 14px;
	border-radius: 999px;
	border: 1px solid var(--ch-border);
	background: var(--ch-surface);
	color: var(--ch-muted);
	font-size: 0.88rem;
	font-weight: 600;
	cursor: pointer;
}

.ch-game .ch-chip-btn:hover {
	color: var(--ch-primary-text);
	border-color: var(--ch-primary-line);
}

.ch-game .ch-chip-btn.is-on {
	background: var(--ch-primary);
	border-color: var(--ch-primary);
	color: #fff;
}

.ch-game .ch-guide-body {
	flex: 1;
	min-height: 0;
	overflow: auto;
	padding: 14px var(--ch-pad) 18px;
	scrollbar-width: thin;
	-webkit-user-select: text;
	user-select: text;
	outline: none;
	overscroll-behavior: contain;
}

.ch-game .ch-guide-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px max(var(--ch-pad), env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(var(--ch-pad), env(safe-area-inset-left));
	border-top: 1px solid var(--ch-border);
	background: var(--ch-bg-subtle);
}

.ch-game .ch-guide-tip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.8rem;
	color: var(--ch-muted);
}

.ch-game .ch-guide-tip svg {
	width: 16px;
	height: 16px;
}

.ch-game .ch-btn-sm {
	width: auto;
	min-height: 0;
	padding: 9px 22px;
	font-size: 0.95rem;
}

.ch-game .ch-guide-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 12px;
	margin-bottom: 12px;
}

.ch-game .ch-guide-formula {
	margin: 0;
	font-size: 0.84rem;
	color: var(--ch-muted);
	flex: 1 1 260px;
}

.ch-game .ch-seg {
	display: inline-flex;
	padding: 3px;
	border-radius: 999px;
	background: var(--ch-track);
}

.ch-game .ch-seg-btn {
	padding: 5px 12px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--ch-muted);
	font-size: 0.82rem;
	font-weight: 600;
	cursor: pointer;
}

.ch-game .ch-seg-btn.is-on {
	background: var(--ch-surface);
	color: var(--ch-primary-text);
	box-shadow: var(--ch-shadow-sm);
}

.ch-game .ch-grid-wrap {
	overflow-x: auto;
	border: 1px solid var(--ch-border);
	border-radius: var(--ch-radius-md);
	background: var(--ch-surface);
	scrollbar-width: thin;
}

.ch-game .ch-grid {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 0.86rem;
}

.ch-game .ch-grid th,
.ch-game .ch-grid td {
	padding: 5px 4px;
	border-bottom: 1px solid var(--ch-border);
	text-align: center;
	vertical-align: middle;
	white-space: nowrap;
}

.ch-game .ch-grid tbody tr:last-child th,
.ch-game .ch-grid tbody tr:last-child td {
	border-bottom: 0;
}

.ch-game .ch-grid thead th {
	position: sticky;
	top: 0;
	z-index: 2;
	background: var(--ch-bg-subtle);
	color: var(--ch-muted);
	font-size: 0.78rem;
	font-weight: 700;
}

.ch-game .ch-grid th[scope="row"],
.ch-game .ch-grid thead th:first-child {
	position: sticky;
	left: 0;
	z-index: 1;
	background: var(--ch-surface);
	text-align: left;
	padding-left: 10px;
	padding-right: 8px;
	border-right: 1px solid var(--ch-border);
}

.ch-game .ch-grid thead th:first-child {
	z-index: 3;
	background: var(--ch-bg-subtle);
}

.ch-game .ch-grid th[scope="row"] small {
	display: block;
	margin-top: 2px;
	font-size: 0.68rem;
	font-weight: 500;
	color: var(--ch-muted);
}

.ch-game .ch-grid tr.is-current th[scope="row"],
.ch-game .ch-grid tr.is-current td {
	background: var(--ch-primary-soft);
}

.ch-game .ch-key-tag {
	display: inline-block;
	min-width: 2.3em;
	padding: 2px 7px;
	border-radius: 7px;
	background: var(--ch-primary);
	color: #fff;
	font-weight: 800;
	text-align: center;
}

.ch-game .ch-roman {
	font-family: Georgia, "Times New Roman", serif;
	font-weight: 700;
	font-size: 0.95rem;
	color: var(--ch-text);
}

.ch-game .ch-chord {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 3.2em;
	padding: 5px 7px;
	border-radius: 8px;
	border: 1px solid var(--ch-border);
	background: var(--ch-surface);
	color: var(--ch-text);
	font-size: 0.9rem;
	font-weight: 700;
	line-height: 1.15;
	cursor: pointer;
	transition: transform 0.12s, border-color 0.12s;
}

.ch-game .ch-grid .ch-chord {
	width: 100%;
}

.ch-game .ch-chord:hover {
	transform: translateY(-1px);
	border-color: var(--ch-primary);
}

.ch-game .ch-chord:focus-visible {
	outline: 2px solid var(--ch-primary);
	outline-offset: 2px;
}

.ch-game .ch-chord.is-M {
	background: var(--ch-primary-soft);
	border-color: var(--ch-primary-line);
	color: var(--ch-primary-text);
}

.ch-game .ch-chord.is-m {
	background: var(--ch-surface);
	border-color: var(--ch-border-strong);
	color: var(--ch-text);
}

.ch-game .ch-chord.is-d,
.ch-game .ch-chord.is-a {
	background: var(--ch-accent-soft);
	border-color: var(--ch-accent-line);
	color: var(--ch-accent-text);
}

.ch-game .ch-chord.is-playing {
	animation: ch-chord-pulse 0.5s ease-out;
}

@keyframes ch-chord-pulse {
	0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ch-primary) 45%, transparent); }
	100% { box-shadow: 0 0 0 10px transparent; }
}

.ch-game .ch-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	margin: 12px 0 0;
	font-size: 0.78rem;
	color: var(--ch-muted);
}

.ch-game .ch-legend span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.ch-game .ch-legend i {
	width: 12px;
	height: 12px;
	border-radius: 4px;
	border: 1px solid var(--ch-border-strong);
	background: var(--ch-surface);
}

.ch-game .ch-legend i.is-M {
	background: var(--ch-primary-soft);
	border-color: var(--ch-primary-line);
}

.ch-game .ch-legend i.is-d {
	background: var(--ch-accent-soft);
	border-color: var(--ch-accent-line);
}

.ch-game .ch-tutorial {
	font-size: 0.92rem;
	line-height: 1.55;
	color: var(--ch-text);
}

.ch-game .ch-tutorial p {
	margin: 0 0 10px;
}

.ch-game .ch-tutorial h3 {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 20px 0 8px;
	font-size: 1.02rem;
	font-weight: 800;
	color: var(--ch-text);
}

.ch-game .ch-step-n {
	display: inline-grid;
	place-items: center;
	width: 24px;
	height: 24px;
	border-radius: 8px;
	background: var(--ch-primary);
	color: #fff;
	font-size: 0.8rem;
}

.ch-game .ch-mnemonic {
	display: inline-block;
	padding: 6px 14px;
	border-radius: var(--ch-radius-sm);
	border: 1px solid var(--ch-accent-line);
	background: var(--ch-accent-soft);
	color: var(--ch-accent-text);
	font-weight: 800;
	letter-spacing: 0.06em;
}

.ch-game .ch-recipe {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 6px;
	margin: 6px 0 14px;
}

.ch-game .ch-recipe-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 8px 2px;
	border-radius: var(--ch-radius-sm);
	background: var(--ch-bg-subtle);
	border: 1px solid var(--ch-border);
	text-align: center;
}

.ch-game .ch-recipe-item .ch-chord {
	min-width: 0;
	width: 100%;
	max-width: 5.2em;
	font-size: 0.82rem;
	padding: 4px 3px;
}

.ch-game .ch-recipe-item small {
	font-size: 0.66rem;
	color: var(--ch-muted);
}

.ch-game .ch-tips {
	margin: 0 0 12px;
	padding-left: 1.2em;
}

.ch-game .ch-tips li {
	margin: 0 0 6px;
}

.ch-game .ch-tutorial-cta {
	margin: 14px 0 0;
}

@container (max-width: 480px) {
	.ch-game .ch-guide-title {
		font-size: 1.05rem;
	}
	.ch-game .ch-chip-btn {
		padding: 6px 11px;
		font-size: 0.82rem;
	}
	.ch-game .ch-guide-tabs,
	.ch-game .ch-guide-body {
		padding-left: 12px;
		padding-right: 12px;
	}
	.ch-game .ch-grid th,
	.ch-game .ch-grid td {
		padding: 4px 2px;
	}
	.ch-game .ch-grid th[scope="row"],
	.ch-game .ch-grid thead th:first-child {
		padding-left: 6px;
		padding-right: 4px;
	}
	.ch-game .ch-grid th[scope="row"] small {
		display: none;
	}
	.ch-game .ch-grid .ch-chord {
		min-width: 0;
		padding: 5px 4px;
		font-size: 0.76rem;
	}
	.ch-game .ch-grid .ch-roman {
		font-size: 0.82rem;
	}
	.ch-game .ch-key-tag {
		min-width: 2.1em;
		padding: 2px 4px;
		font-size: 0.78rem;
	}
}

@container (max-width: 420px) {
	.ch-game .ch-recipe {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
	.ch-game .ch-guide-tip {
		display: none;
	}
	.ch-game .ch-guide-foot {
		justify-content: flex-end;
	}
}

/* ===================================================================
 * Anúncio (AdSense) na tela final — só entre partidas
 * ================================================================= */
.ch-game .ch-ad {
	margin-top: 18px;
	padding-top: 14px;
	border-top: 1px solid var(--ch-border);
	text-align: center;
	min-height: 120px;
}

.ch-game .ch-ad-label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ch-muted);
}

.ch-game .ch-ad-slot {
	width: 100%;
	min-height: 100px;
	overflow: hidden;
}

.ch-game .ch-ad:has(ins[data-ad-status="unfilled"]) {
	display: none;
}

.ch-game .ch-ad-break {
	z-index: 70;
}
