/* =========================================================
   Amatista · estilos (móvil primero, paleta morada)
   ========================================================= */
:root, [data-theme="dark"] {
  --bg: #120B1F;
  --surface: #1E1533;
  --surface-2: #2A1E45;
  --border: #3B2C5E;
  --text: #F3EEFF;
  --muted: #B9AEDB;
  --primary: #7C3AED;
  --primary-press: #6D28D9;
  --on-primary: #FFFFFF;
  --disabled: #4C3B73;
  --on-disabled: #8B7FA8;
  --line: #A78BFA;
  --accent: #F472B6;
  --ok: #4ADE80;
  --warn: #FBBF24;
  --bad: #F87171;
  --glow: rgba(124, 58, 237, .35);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F7F3FF;
  --surface: #FFFFFF;
  --surface-2: #EFE7FF;
  --border: #DDD0F7;
  --text: #1E1433;
  --muted: #5B4A80;
  --primary: #6D28D9;
  --primary-press: #5B21B6;
  --on-primary: #FFFFFF;
  --disabled: #C9B8EE;
  --on-disabled: #5B4A80;
  --line: #6D28D9;
  --accent: #BE185D;
  --ok: #15803D;
  --warn: #B45309;
  --bad: #B91C1C;
  --glow: rgba(109, 40, 217, .18);
  --shadow: 0 8px 24px rgba(60, 20, 120, .12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  height: 100vh; height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  line-height: 1.4;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 1em; height: 1em; }
a { color: var(--line); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: 10px; z-index: 50; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small-print { font-size: .82rem; text-align: center; margin: 8px 0 18px; }
[hidden] { display: none !important; }

/* ---------- Pantalla de carga ---------- */
.splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: radial-gradient(circle at 50% 40%, #2A1E45 0, #120B1F 70%);
  transition: opacity .5s ease;
}
.splash.gone { opacity: 0; pointer-events: none; }
.splash-logo { width: 96px; height: 96px; animation: pop .6s ease; }
.splash-name { font-size: 1.6rem; font-weight: 800; letter-spacing: .02em; color: #F3EEFF; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Cabecera ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-logo { width: 32px; height: 32px; }
.brand-name { font-weight: 800; font-size: 1.2rem; letter-spacing: .01em; }
.topbar-actions { display: flex; gap: 4px; }
.icon-btn {
  min-width: 48px; height: 48px; padding: 0 10px; border: 0; border-radius: 14px; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--text); font-size: 1.35rem;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { background: var(--border); }
.icon-btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.icon-label { font-size: .85rem; font-weight: 700; }
@media (max-width: 380px) { .icon-label { display: none; } }

/* ---------- Contenido ---------- */
main { overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 28px; outline: none; }
.view { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

/* ---------- Barra de secciones ---------- */
.tabbar {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
}
.tabbar a {
  min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-weight: 700; font-size: .82rem;
}
.tab-ico { display: grid; place-items: center; width: 56px; height: 32px; border-radius: 16px; font-size: 1.4rem; transition: background .2s; }
.tabbar a[aria-current="page"] { color: var(--text); }
.tabbar a[aria-current="page"] .tab-ico { background: var(--primary); color: var(--on-primary); }

/* ---------- Banner de anuncios (hueco reservado: nunca tapa nada) ---------- */
.ad-banner {
  height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: var(--bg); border-top: 1px solid var(--border);
}
body.no-ads .ad-banner { display: none; }
body.no-ads .tabbar { padding-bottom: env(safe-area-inset-bottom); }
.ad-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; max-width: 100%;
  border: 2px dashed var(--border); border-radius: 10px; color: var(--muted); font-weight: 700; font-size: .85rem;
  background: repeating-linear-gradient(45deg, transparent 0 10px, var(--glow) 10px 11px);
}
.ad-placeholder small { font-weight: 500; font-size: .72rem; }

/* ---------- Botones ---------- */
.btn-primary, .btn-secondary, .btn-ghost {
  min-height: 52px; padding: 0 20px; border-radius: 16px; font-weight: 800; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 2px solid transparent;
  text-decoration: none; transition: transform .08s, background .15s;
}
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 18px var(--glow); }
.btn-primary:hover { background: var(--primary-press); }
.btn-primary:active, .btn-secondary:active { transform: scale(.97); }
.btn-primary:disabled { background: var(--disabled); color: var(--on-disabled); box-shadow: none; }
.btn-primary.active { background: var(--surface-2); color: var(--text); border-color: var(--primary); box-shadow: none; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--line); }
.btn-ghost { background: transparent; color: var(--line); padding: 0 12px; min-height: 44px; }
.btn-ghost.danger { color: var(--bad); }
.btn-xl { min-height: 64px; font-size: 1.15rem; width: 100%; border-radius: 20px; }
.btn-xl svg, .btn-primary svg, .btn-secondary svg { font-size: 1.4em; }

/* Segmentos y chips */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.seg button, .seg label span {
  display: flex; align-items: center; justify-content: center; min-height: 48px; border: 0; border-radius: 12px;
  background: transparent; color: var(--muted); font-weight: 700; font-size: .95rem; padding: 0 6px; text-align: center; cursor: pointer;
}
.seg button[aria-pressed="true"], .seg input:checked + span { background: var(--primary); color: var(--on-primary); }
.seg label { display: block; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:focus-visible + span { outline: 3px solid var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  min-height: 48px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight: 700;
}
.chips button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chips button small { color: inherit; opacity: .8; font-weight: 500; }
.chips .mus { font-size: 1.15em; margin-right: 2px; }
.scroller { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.scroller button { flex: 0 0 auto; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card-title { margin: 0; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-wrap.end { justify-content: flex-end; }
.badge { background: var(--accent); color: #1E1433; font-size: .72rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }
[data-theme="light"] .badge { color: #fff; }

/* Selector */
.select { position: relative; display: block; flex: 1; }
.select select {
  width: 100%; min-height: 52px; appearance: none; -webkit-appearance: none; padding: 0 40px 0 14px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 700;
}
.select::after { content: ""; position: absolute; right: 16px; top: 50%; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select.small { flex: 0 1 auto; }
.select.small select { min-height: 48px; }

/* Interruptor */
.switch { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { flex: 0 0 auto; width: 52px; height: 30px; border-radius: 999px; background: var(--disabled); position: relative; transition: background .2s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .switch-ui { background: var(--primary); }
.switch input:checked + .switch-ui::after { transform: translateX(22px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .switch-ui { opacity: .6; }

/* Paso a paso (−  valor  +) */
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper-label { color: var(--muted); font-weight: 600; margin-right: auto; }
.stepper output { min-width: 72px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.step-btn {
  width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2);
  font-size: 1.5rem; font-weight: 700; display: grid; place-items: center;
}
.step-btn:active { background: var(--primary); color: var(--on-primary); }

/* ---------- Afinador ---------- */
.tuning-row { display: flex; gap: 8px; align-items: center; }
.tuner-card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 14px 14px 18px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: border-color .25s, box-shadow .25s;
  --state: var(--line);
}
.tuner-card[data-state="ok"] { --state: var(--ok); border-color: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }
.tuner-card[data-state="near"] { --state: var(--warn); }
.tuner-card[data-state="far"] { --state: var(--bad); }
.tuner-card[data-state="danger"] { --state: var(--bad); border-color: var(--bad); animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.gauge { width: 100%; max-width: 270px; height: auto; }
.tuner-card .readout { margin-top: -16px; }
.tuner-card .btn-xl { margin-top: 10px; }
#instSeg button { min-height: 44px; }
.tuning-row .select select { min-height: 48px; }
.view { gap: 12px; }
@media (min-height: 860px) { .gauge { max-width: 360px; } }
.gauge-arc { fill: none; stroke: var(--border); stroke-width: 10; stroke-linecap: round; }
.gauge-zone { fill: none; stroke: var(--ok); stroke-width: 10; stroke-linecap: round; opacity: .9; }
.gauge-ticks line { stroke: var(--muted); stroke-width: 1.5; opacity: .6; }
.gauge-ticks line.big { stroke-width: 2.5; opacity: 1; }
.gauge-label { fill: var(--muted); font-size: 13px; font-weight: 700; }
.needle { transform-origin: 150px 160px; transform-box: view-box; transition: transform .09s linear; }
.needle line { stroke: var(--state); stroke-width: 6; stroke-linecap: round; transition: stroke .2s; }
.needle circle { fill: var(--state); transition: fill .2s; }
.tuner-card[data-state="idle"] .needle line, .tuner-card[data-state="listen"] .needle line { stroke: var(--line); }
.readout { text-align: center; margin-top: -54px; }
.note { font-size: 4.6rem; font-weight: 900; line-height: 1; letter-spacing: -.02em; color: var(--state); transition: color .2s; font-variant-numeric: tabular-nums; }
.tuner-card[data-state="idle"] .note, .tuner-card[data-state="listen"] .note { color: var(--text); }
.note-oct { font-size: 1.6rem; font-weight: 700; color: var(--muted); margin-left: 2px; }
.freq { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; min-height: 1.4em; }
.cents { font-weight: 800; font-size: 1.15rem; color: var(--state); font-variant-numeric: tabular-nums; min-height: 1.4em; }
.hint { margin: 6px 0 0; font-weight: 800; font-size: 1.12rem; text-align: center; min-height: 1.5em; }
.tuner-card[data-state="ok"] .hint { color: var(--ok); }
.tuner-card[data-state="danger"] .hint { color: var(--bad); }

.strings { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.string-btn {
  position: relative; min-height: 68px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 1.15rem; line-height: 1.1; padding: 4px 2px;
}
.string-btn .s-oct { font-size: .75rem; color: var(--muted); font-weight: 700; }
.string-btn.active { border-color: var(--line); background: var(--surface-2); box-shadow: 0 0 0 3px var(--glow); }
.string-btn .s-check { position: absolute; top: 3px; right: 6px; font-size: .8rem; color: var(--ok); opacity: 0; }
.string-btn.tuned { border-color: color-mix(in srgb, var(--ok) 70%, var(--border)); }
.string-btn.tuned .s-check { opacity: 1; }
.string-btn:active { transform: scale(.96); }
#btnListen.active { border-color: var(--bad); }
.tuner-options { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 8px 14px; }
.tip { margin: 0; font-size: .85rem; color: var(--muted); text-align: center; }

/* ---------- Metrónomo ---------- */
.beats { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 12px; min-height: 64px; padding: 8px 0; }
.dot { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); background: var(--surface); transition: background .08s, transform .08s, border-color .08s; }
.dot.first { border-color: var(--accent); }
.dot.group { margin-left: 12px; }
.beats[data-n="9"] .dot, .beats[data-n="12"] .dot { width: 24px; height: 24px; }
.dot.on { background: var(--line); border-color: var(--line); transform: scale(1.22); box-shadow: 0 0 18px var(--glow); }
.dot.on.strong { background: var(--accent); border-color: var(--accent); }
.bpm-display { text-align: center; }
.bpm-num { display: block; font-size: 6.2rem; font-weight: 900; line-height: .95; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.bpm-unit { font-weight: 800; color: var(--muted); letter-spacing: .15em; font-size: .85rem; }
.tempo-name { font-weight: 800; font-size: 1.2rem; color: var(--line); margin-top: 2px; }
.bpm-controls { display: flex; align-items: center; gap: 12px; }
.round-btn {
  flex: 0 0 auto; width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface-2);
  font-size: 2rem; font-weight: 700; display: grid; place-items: center; touch-action: manipulation; user-select: none;
}
.round-btn:active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
input[type="range"] { flex: 1; -webkit-appearance: none; appearance: none; height: 44px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--line)); }
input[type="range"]::-moz-range-track { height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--line)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 34px; height: 34px; margin-top: -12px; border-radius: 50%; background: #fff; border: 4px solid var(--primary); box-shadow: var(--shadow); }
input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 4px solid var(--primary); }
.metro-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
#btnTap { touch-action: manipulation; user-select: none; }
#btnTap.flash { animation: tapflash .18s; }
@keyframes tapflash { from { background: var(--primary); color: #fff; } }
#btnPlay.active { border-color: var(--accent); }
.beats.subpulse .dot.on { animation: subp .12s; }
@keyframes subp { 50% { transform: scale(1.1); } }
.trainer summary { display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: 1.05rem; min-height: 40px; cursor: pointer; list-style: none; }
.trainer summary::-webkit-details-marker { display: none; }
.trainer summary::after { content: "▾"; color: var(--muted); margin-left: 8px; }
.trainer[open] summary::after { content: "▴"; }
.trainer summary .badge { margin-left: auto; }
.trainer p { margin: 0; }
.tr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tr-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 700; color: var(--muted); }
.tr-grid input, .field-label input {
  min-height: 52px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  padding: 0 12px; font-size: 1.15rem; font-weight: 800; width: 100%;
}
.tr-status { font-weight: 800; color: var(--line); min-height: 1.4em; }

/* ---------- Acordes ---------- */
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 1.3rem; color: var(--muted); }
.search input {
  width: 100%; min-height: 54px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface);
  padding: 0 14px 0 46px; font-size: 1.05rem; color: var(--text);
}
.search input::placeholder { color: var(--muted); }
.suggest:empty { display: none; }
.suggest button.best { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.roots { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.roots button {
  min-height: 52px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface);
  font-weight: 800; font-size: 1rem; padding: 0 2px;
}
.roots button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chord-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chord-name { margin: 0; font-size: 3rem; font-weight: 900; line-height: 1; letter-spacing: -.02em; }
.chord-type { margin: 4px 0 0; color: var(--muted); font-weight: 600; }
.chord-head-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn.fav { font-size: 1.6rem; border: 1px solid var(--border); background: var(--surface); }
.icon-btn.fav[aria-pressed="true"] { color: var(--accent); background: var(--surface); border-color: var(--accent); }
.chord-notes { display: flex; flex-wrap: wrap; gap: 8px; }
.note-pill { display: inline-flex; flex-direction: column; align-items: center; min-width: 56px; padding: 6px 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.note-pill b { font-size: 1.15rem; }
.note-pill small { color: var(--line); font-weight: 800; }
.voicings { display: grid; grid-auto-flow: column; grid-auto-columns: 158px; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x mandatory; }
.voicing {
  scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 10px;
  border-radius: 18px; border: 2px solid var(--border); background: var(--surface); color: var(--text);
}
.voicing[aria-pressed="true"] { border-color: var(--line); box-shadow: 0 0 0 3px var(--glow); }
.v-label { font-size: .82rem; font-weight: 700; color: var(--muted); }
.diagram { width: 140px; height: 166px; }
.diagram .fret { stroke: var(--muted); stroke-width: 1.4; opacity: .7; }
.diagram .str { stroke: var(--text); stroke-width: 1.6; opacity: .85; }
.diagram .nut { fill: var(--text); }
.diagram .pos { fill: var(--line); font-size: 13px; font-weight: 800; }
.diagram .mute { fill: var(--bad); font-size: 17px; font-weight: 800; }
.diagram .open { fill: none; stroke: var(--ok); stroke-width: 2.2; }
.diagram .dot, .diagram .barre { fill: var(--primary); }
.diagram .finger { fill: #fff; font-size: 11px; font-weight: 800; }
.diagram .sn { fill: var(--muted); font-size: 9.5px; font-weight: 700; }

/* ---------- Paneles (ajustes / afinación propia) ---------- */
dialog.sheet {
  width: min(560px, 100%); max-height: 92dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: 24px 24px 0 0;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
dialog.sheet::backdrop { background: rgba(8, 4, 16, .6); backdrop-filter: blur(2px); }
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 24px; } }
.sheet-inner { padding: 8px 18px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 1.3rem; }
.field { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.field legend, .field h3 { font-weight: 800; margin: 0 0 6px; padding: 0; font-size: 1rem; }
.field p { margin: 0; }
.field-label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.tun-strings { display: flex; flex-direction: column; gap: 6px; }
.tun-row { display: flex; align-items: center; gap: 10px; }
.tun-idx { flex: 1; color: var(--muted); font-weight: 700; }
.tun-row output { min-width: 64px; text-align: center; font-weight: 900; font-size: 1.15rem; }

/* ---------- Pantalla completa (anuncio) ---------- */
.interstitial { position: fixed; inset: 0; z-index: 60; background: rgba(8, 4, 16, .86); display: grid; place-items: center; padding: 16px; }
.inter-box { width: min(420px, 100%); background: var(--surface); border-radius: 20px; padding: 12px; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.inter-top { display: flex; align-items: center; justify-content: space-between; }
.inter-tag { font-size: .78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.inter-close { min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); font-weight: 800; display: inline-flex; align-items: center; gap: 6px; }
.inter-slot { min-height: 250px; display: grid; place-items: center; }

/* ---------- Consentimiento ---------- */
.consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; max-width: 620px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .45);
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 80dvh; overflow-y: auto;
}
.consent h2 { margin: 0 0 6px; font-size: 1.15rem; }
.consent p { margin: 0 0 12px; font-size: .95rem; }
.consent-details { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.consent-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.consent-actions .btn-primary { grid-column: span 2; }
@media (min-width: 520px) { .consent-actions { grid-template-columns: 1fr 1fr 1fr; } .consent-actions .btn-primary { grid-column: auto; } }
body.consent-open::after { content: ""; position: fixed; inset: 0; background: rgba(8, 4, 16, .35); z-index: 65; }

/* ---------- Aviso breve ---------- */
.toast {
  position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 80;
  background: var(--text); color: var(--bg); font-weight: 800; padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow);
  max-width: calc(100% - 32px); text-align: center;
}
.noscript { position: fixed; inset: auto 0 0 0; padding: 16px; background: var(--bad); color: #000; font-weight: 700; z-index: 99; }

/* ---------- Modo escenario: todo en grande, sin banner, pantalla encendida ---------- */
body.stage .ad-banner { display: none; }
body.stage .brand-name, body.stage #btnSettings, body.stage #btnTheme { display: none; }
body.stage .tabbar { padding-bottom: env(safe-area-inset-bottom); }
body.stage .note { font-size: 6.6rem; }
body.stage .bpm-num { font-size: 9rem; }
body.stage .dot { width: 46px; height: 46px; }
body.stage .tuner-options, body.stage .tip, body.stage .tuning-row, body.stage #instSeg,
body.stage #metronomo .card, body.stage .search, body.stage .suggest, body.stage .roots, body.stage #acordes .card { display: none; }
body.stage .string-btn { min-height: 84px; font-size: 1.5rem; }
body.stage .chord-name { font-size: 4.2rem; }
body.stage .diagram { width: 180px; height: 214px; }
body.stage .voicings { grid-auto-columns: 196px; }

/* Pantallas más anchas */
@media (min-width: 720px) {
  main { padding-top: 22px; }
  .tabbar { grid-template-columns: repeat(3, 160px); justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
