:root {
  --bg: #121110;
  --surface: #1a1816;
  --surface-2: #23201d;
  --surface-3: #2d2925;
  --line: #36312b;
  --text: #f4eee5;
  --muted: #a89f93;
  --dim: #6f675d;
  --accent: #ffb347;
  --accent-ink: #1d1406;
  --accent-soft: rgba(255, 179, 71, 0.14);
  --chord: #7ad3c8;
  --danger: #ff7a6b;
  --ok: #9bd67a;
  --radius: 14px;
  --ui: "Bricolage Grotesque", system-ui, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", Consolas, "Cascadia Mono", monospace;
  --lyric-size: 34px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ------------------------------------------------ piezas comunes */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface-2);
  padding: 10px 16px; border-radius: 999px; cursor: pointer;
  font-weight: 600; font-size: 15px; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-3); border-color: #4a433b; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #ffc16b; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex: none; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.on { color: var(--accent); }
.icon-btn svg { width: 20px; height: 20px; }

input[type=text], input[type=url], input[type=number], input[type=search], input[type=email], textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; font-family: var(--mono); font-size: 14px; line-height: 1.5; min-height: 280px; }
label.field { display: grid; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 500; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-3); color: var(--muted);
}
.badge.ok { color: var(--ok); background: rgba(155, 214, 122, .1); }
.badge.accent { color: var(--accent); background: var(--accent-soft); }
.badge svg { width: 12px; height: 12px; }

#toast {
  position: fixed; left: 50%; bottom: 110px; transform: translate(-50%, 20px);
  background: var(--surface-3); border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100;
  max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { border-color: var(--danger); color: var(--danger); }

/* ------------------------------------------------ biblioteca */
.library { max-width: 1180px; margin: 0 auto; padding: 36px 24px 80px; }
.lib-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.logo { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.logo-mark { width: 44px; height: 44px; }
.logo-word { font-size: 36px; font-weight: 800; letter-spacing: -0.003em; line-height: 1; color: var(--accent); }
.logo-word span { color: var(--accent); }
.logo-sub { color: var(--dim); font-size: 13px; margin-top: 3px; }
.lib-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search input { padding-left: 42px; border-radius: 999px; }
.search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; color: var(--dim); }
.chips { display: flex; gap: 6px; }
.chip {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px;
}
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card {
  position: relative; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); aspect-ratio: 4 / 3;
  display: flex; flex-direction: column; justify-content: flex-end;
  transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); border-color: #50483f; }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .5; transition: opacity .2s, transform .4s; }
.card:hover .card-bg { opacity: .65; transform: scale(1.04); }
.card-bg.none { background: radial-gradient(120% 90% at 20% 10%, #3a2a17 0%, var(--surface) 60%); opacity: 1; }
.card-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(12,11,10,.96) 12%, rgba(12,11,10,.35) 60%, rgba(12,11,10,.1)); }
.card-body { position: relative; padding: 16px 18px; }
.card-title { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.card-artist { color: var(--muted); font-size: 15px; margin-top: 3px; }
.card-badges { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.card-edit { position: absolute; top: 10px; right: 10px; opacity: 0; transition: opacity .15s; background: rgba(18,17,16,.75); backdrop-filter: blur(6px); }
.card:hover .card-edit, .card:focus-within .card-edit { opacity: 1; }
.card-play {
  position: absolute; top: 14px; left: 14px; width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
  opacity: 0; transform: scale(.85); transition: opacity .2s, transform .2s;
}
.card-play svg { width: 20px; height: 20px; margin-left: 2px; }
.card:hover .card-play { opacity: 1; transform: scale(1); }

.empty {
  border: 1px dashed var(--line); border-radius: 20px; padding: 64px 24px; text-align: center; color: var(--muted);
}
.empty h2 { color: var(--text); margin: 0 0 8px; font-size: 26px; letter-spacing: -0.02em; }
.empty p { margin: 0 auto 22px; max-width: 460px; line-height: 1.55; }
.hint { color: var(--dim); font-size: 13px; margin-top: 30px; text-align: center; }
kbd {
  font-family: var(--mono); font-size: 12px; padding: 2px 6px; border-radius: 6px;
  background: var(--surface-3); border: 1px solid var(--line); border-bottom-width: 2px; color: var(--text);
}

.quick {
  display: flex; align-items: center; gap: 10px; margin-bottom: 26px; padding: 8px 8px 8px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  transition: border-color .15s, box-shadow .15s;
}
.quick:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.quick-icon { color: var(--accent); display: grid; }
.quick-icon svg { width: 22px; height: 22px; }
.quick input { border: none; background: transparent; padding: 10px 4px; box-shadow: none !important; font-size: 16px; }

/* ------------------------------------------------ editor */
.editor { max-width: 1180px; margin: 0 auto; padding: 28px 24px 120px; }
.ed-head { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.ed-head h1 { font-size: 28px; margin: 0; letter-spacing: -0.02em; margin-right: auto; }
.panel.magic { margin-bottom: 22px; border-color: #4a3a22; background: linear-gradient(135deg, #221b12, var(--surface) 60%); }
.panel.magic h2 svg { width: 20px; height: 20px; color: var(--accent); }
.magic-row { display: flex; gap: 10px; align-items: center; }
.magic-row input { flex: 1; }
.magic-row.small { margin-bottom: 12px; }
.magic-row.small input { padding: 8px 12px; font-size: 14px; }
.steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; }
.steps li svg { width: 16px; height: 16px; flex: none; }
.steps li.ok { color: var(--text); }
.steps li.ok svg { color: var(--ok); }
.steps li.warn { color: var(--accent); }
.steps li.err { color: var(--danger); }
.steps b { font-weight: 600; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.magic-done { display: flex; align-items: center; gap: 14px; margin-top: 16px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.status a { color: inherit; }

.ed-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.ed-col { display: grid; gap: 22px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel h2 { font-size: 17px; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.panel h2 .num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
}
.panel .sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; line-height: 1.5; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.row.tight { gap: 8px; align-items: center; }
.row.tight > * { flex: none; }
.stack { display: grid; gap: 12px; }
.results { display: grid; gap: 6px; max-height: 300px; overflow: auto; margin-top: 12px; }
.result {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer;
}
.result:hover { border-color: var(--accent); }
.result.sel { border-color: var(--accent); background: var(--accent-soft); }
.result-main { flex: 1; min-width: 0; }
.result-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-meta { color: var(--muted); font-size: 13px; }
.status { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.status svg { width: 16px; height: 16px; flex: none; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--accent); }
.status.err { color: var(--danger); }
.yt-preview { display: flex; gap: 14px; align-items: center; margin-top: 12px; }
.yt-preview img { width: 160px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: var(--surface-3); }
.links { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.preview-sheet {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 16px;
  max-height: 520px; overflow: auto; font-family: var(--mono); font-size: 13px; line-height: 1.35;
}
.preview-sheet .pv-chords { color: var(--chord); font-weight: 700; white-space: pre; }
.preview-sheet .pv-lyric { white-space: pre; }
.preview-sheet .pv-lyric.nomatch { color: var(--dim); }
.preview-sheet .pv-sec { color: var(--accent); font-weight: 700; margin-top: 8px; font-family: var(--ui); text-transform: uppercase; font-size: 11px; letter-spacing: .08em; }
.preview-sheet .pv-t { color: var(--dim); font-size: 11px; display: inline-block; width: 44px; }
.ed-foot {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 24px;
  background: rgba(18,17,16,.9); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
  display: flex; justify-content: center;
}
.ed-foot-in { max-width: 1180px; width: 100%; display: flex; gap: 10px; align-items: center; }
.ed-foot-in .spacer { flex: 1; }

/* ------------------------------------------------ modo tocar */
.player { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.pl-top {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px; z-index: 5;
  background: linear-gradient(to bottom, var(--bg) 60%, rgba(18,17,16,0));
  transition: opacity .4s;
}
.pl-title { min-width: 0; margin-right: auto; }
.pl-title b { font-size: 18px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-title span { color: var(--muted); font-size: 14px; }
.pl-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.chord-strip {
  display: flex; gap: 6px; padding: 0 18px 8px; overflow-x: auto; z-index: 5; scrollbar-width: none;
  transition: opacity .4s;
}
.chord-strip::-webkit-scrollbar { display: none; }
.cs-item {
  flex: none; display: grid; justify-items: center; gap: 0; padding: 6px 6px 2px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); min-width: 62px;
}
.cs-item b { font-family: var(--mono); color: var(--chord); font-size: 14px; }
.diagram { width: 56px; height: 66px; }
.diagram .fret, .diagram .string { stroke: #5a534a; stroke-width: 1; }
.diagram .nut { fill: #cfc6b8; }
.diagram .dot { fill: var(--text); }
.diagram .open { fill: none; stroke: var(--text); stroke-width: 1.2; }
.diagram .mark, .diagram .fretnum { fill: var(--muted); font-size: 8px; font-family: var(--mono); }

.stage {
  flex: 1; overflow-y: auto; position: relative; scrollbar-width: thin; scrollbar-color: var(--line) transparent;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 80%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 80%, transparent 100%);
}
.sheet { max-width: 1100px; margin: 0 auto; padding: 38vh 40px 60vh; }
.sheet.mono { font-family: var(--mono); }
.ln {
  font-size: var(--lyric-size); line-height: 1.25; padding: 6px 14px; border-radius: 12px;
  color: var(--muted); transition: color .35s, opacity .35s, background .35s, transform .35s;
  cursor: pointer; transform-origin: left center;
}
.sheet.mono .ln { font-size: calc(var(--lyric-size) * .78); }
.ln:hover { background: rgba(255,255,255,.03); }
.ln.past { color: var(--dim); opacity: .55; }
.ln.now { color: var(--text); background: var(--accent-soft); }
.ln.now .ly { background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--text) var(--p, 0%)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ln .ch { color: var(--chord); font-weight: 700; white-space: pre; font-size: .82em; line-height: 1.2; min-height: 1em; }
.ln .ly { white-space: pre-wrap; display: inline; }
.sheet.mono .ln .ly { white-space: pre; }
.ln.past .ch { color: #3f6b66; }
.ln .ch .c { transition: color .2s, text-shadow .2s; }
.ln .ch .c.on { color: var(--accent); text-shadow: 0 0 18px rgba(255, 179, 71, .55); }

/* panel lateral de acordes */
.rail {
  position: absolute; right: 18px; top: 118px; bottom: 92px; width: var(--rail-w); z-index: 4;
  display: flex; flex-direction: column; gap: 12px; overflow-y: auto; scrollbar-width: none;
  pointer-events: none; transition: width .3s;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { pointer-events: auto; flex: none; }
.player { --rail-w: 240px; }
.player.rail-wide { --rail-w: min(460px, 40vw); }
.chord-panel {
  position: relative;
  background: rgba(26, 24, 22, .94); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px 16px;
  display: grid; gap: 8px; box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.cp-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
}
.cp-label span { letter-spacing: 0; text-transform: none; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.cp-now { display: grid; justify-items: center; gap: 2px; min-height: 186px; align-content: center; }
.cp-now b { font-family: var(--mono); font-size: 46px; line-height: 1; color: var(--chord); }
.cp-now .diagram { width: 118px; height: 140px; }
.cp-now b.none, .cp-next-body b.none { color: var(--dim); }
.cp-wait { color: var(--dim); font-size: 13px; margin-top: 8px; }
.cp-now.pop { animation: cp-pop .28s ease-out; }
@keyframes cp-pop { from { transform: scale(.9); opacity: .5; } to { transform: none; opacity: 1; } }
.cp-next { border-top: 1px solid var(--line); padding-top: 10px; }
.cp-next-body { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 70px; }
.cp-next-body b { font-family: var(--mono); font-size: 28px; color: var(--text); transition: color .2s; }
.cp-next-body .diagram { width: 54px; height: 64px; }
.cp-bar { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.cp-bar div { height: 100%; width: 0; background: var(--accent); }
.chord-panel.soon .cp-next-body b, .chord-panel.soon .cp-label span { color: var(--accent); }
.player.has-rail .sheet { max-width: none; padding-left: max(32px, calc((100vw - 1100px) / 2 - 120px)); padding-right: calc(var(--rail-w) + 52px); }
.ln.sec {
  font-family: var(--ui); font-size: 14px; text-transform: uppercase; letter-spacing: .14em; font-weight: 700;
  color: var(--accent); opacity: .75; padding-top: 22px; cursor: default;
}
.ln.sec:hover { background: none; }
.ln.blank { height: calc(var(--lyric-size) * .6); padding: 0; cursor: default; }
.ln.blank:hover { background: none; }
.ln.tab { font-family: var(--mono); font-size: calc(var(--lyric-size) * .5); white-space: pre; color: var(--chord); }
.sheet.plain .ln { cursor: default; }

.no-lyrics { text-align: center; color: var(--muted); padding-top: 30vh; }
.no-lyrics h2 { color: var(--text); }

.pl-dock {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 18px; z-index: 6;
  background: rgba(30,27,24,.92); backdrop-filter: blur(14px); border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0,0,0,.45); transition: opacity .4s, transform .4s;
  max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none;
}
.pl-dock::-webkit-scrollbar { display: none; }
.dock-sep { width: 1px; height: 26px; background: var(--line); margin: 0 6px; flex: none; }
.play-btn {
  width: 54px; height: 54px; border-radius: 14px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; border: none; cursor: pointer; flex: none;
}
.play-btn svg { width: 24px; height: 24px; }
.dock-group { display: flex; align-items: center; gap: 2px; flex: none; }
.dock-val { font-family: var(--mono); font-size: 13px; color: var(--muted); min-width: 58px; text-align: center; }
.dock-label { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; display: block; text-align: center; }
.dock-time { font-family: var(--mono); font-size: 13px; color: var(--muted); padding: 0 10px; min-width: 104px; text-align: center; flex: none; }

.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; z-index: 7; cursor: pointer; }
.progress div { height: 100%; background: var(--accent); width: 0; }
.progress:hover { height: 6px; }

/* franja del punteo: debajo de la letra, nunca encima */
.tab-lane {
  flex: none; margin: 0 18px 92px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden; z-index: 3; position: relative;
}
.player.has-rail .tab-lane { margin-right: calc(var(--rail-w) + 36px); }
.tl-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.tl-title { display: flex; align-items: center; gap: 7px; font-weight: 700; color: var(--text); }
.tl-title svg { width: 16px; height: 16px; color: var(--accent); }
.tl-label { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: 11px; }
.tl-count { color: var(--dim); font-family: var(--mono); font-size: 12px; margin-right: auto; }
.tl-src a { color: var(--dim); font-size: 12px; }
.tl-fwd svg { transform: rotate(180deg); }
.tl-body { --tab-size: 14px; padding: 10px 14px 12px; display: grid; gap: 8px; }
.tl-body.arrive .tl-sys.now { animation: tl-in .35s ease-out; }
.tl-body.arrive .tl-sys.next { animation: tl-in2 .35s ease-out; }
@keyframes tl-in { from { transform: translateY(40%); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes tl-in2 { from { transform: translateY(60%); opacity: 0; } to { transform: none; opacity: .5; } }
.tl-sys { position: relative; font-family: var(--mono); font-size: var(--tab-size); }
.tl-sys pre { margin: 0; line-height: 1.22; color: var(--text); white-space: pre; font: inherit; }
.tl-sys.next { opacity: .5; font-size: calc(var(--tab-size) * .75); }
.tl-sys.next pre { color: var(--muted); }
.tl-chords { color: var(--chord); font-weight: 700; white-space: pre; line-height: 1.3; }
.tl-cursor {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -12px; background: var(--accent);
  box-shadow: 0 0 12px rgba(255, 179, 71, .7); border-radius: 2px; transition: left .12s linear;
}
.tl-empty { padding: 6px 0 4px; color: var(--muted); }
.tl-empty p { margin: 0 0 10px; }
.tl-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tl-actions input { flex: 1; min-width: 220px; padding: 7px 12px; font-size: 14px; }
textarea.tabtext { min-height: 160px; font-size: 12px; line-height: 1.25; white-space: pre; }
.panel h2 .opt { font-size: 11px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; }
.st-tabprev { font-family: var(--mono); font-size: 13px; line-height: 1.2; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; margin: 4px 0; }

/* video: vive en la columna derecha, debajo de los acordes */
.video-card {
  border-radius: 14px; overflow: hidden; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.vc-head { display: flex; align-items: center; gap: 2px; padding: 4px 6px 4px 12px; }
.vc-title { margin-right: auto; display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.vc-title svg { width: 14px; height: 14px; color: var(--accent); }
.vc-btn {
  width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; color: var(--muted);
  cursor: pointer; display: grid; place-items: center; transition: background .15s, color .15s;
}
.vc-btn:hover { background: var(--surface-3); color: var(--text); }
.vc-btn svg { width: 14px; height: 14px; }
.vc-body { position: relative; aspect-ratio: 16 / 9; background: #000; }
.vc-body > div, .vc-body iframe { width: 100%; height: 100%; border: 0; display: block; }
/* minimizado: queda la barrita; el video sigue sonando (se achica a 1px, no se apaga) */
.video-card.mode-mini .vc-body { aspect-ratio: auto; height: 1px; opacity: 0; }
.video-card.mode-mini .vc-title::after { content: "· sonando"; color: var(--dim); font-weight: 500; }
/* cerrado: sale de la pantalla pero sigue sonando */
.video-card.mode-off { position: fixed; left: -10000px; top: 0; width: 320px; }
.video-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; text-align: center; background: var(--surface); font-size: 13px; color: var(--muted); }

/* estudio */
.studio { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.st-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; padding: 8px 22px 22px; min-height: 0; }
.st-main { overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.st-side { display: flex; flex-direction: column; gap: 12px; }
.st-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; max-width: 760px; }
.st-card h2 { margin: 0 0 16px; font-size: 22px; }
.st-opt { display: flex; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; cursor: pointer; background: var(--surface-2); }
.st-opt input { width: 20px; height: 20px; accent-color: var(--accent); margin-top: 2px; flex: none; }
.st-opt span { display: grid; gap: 4px; }
.st-opt em { font-style: normal; color: var(--muted); font-size: 14px; line-height: 1.45; }
.st-opt.off { opacity: .55; cursor: default; }
.st-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.st-rate { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; margin-right: auto; }
.st-rate select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.st-note { color: var(--dim); font-size: 13px; margin: 14px 0 0; line-height: 1.5; }
.st-mark { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 20px 10px; }
.st-count { color: var(--dim); font-size: 13px; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.st-prev { color: var(--dim); font-size: 22px; }
.st-prev span { font-family: var(--mono); font-size: 13px; margin-left: 8px; }
.st-cur-label { color: var(--accent); font-size: 14px; font-weight: 600; margin-top: 8px; }
.st-cur { font-size: clamp(28px, 4vw, 48px); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.st-cur.done { font-size: 22px; color: var(--ok); font-weight: 600; }
.st-next { color: var(--muted); font-size: 22px; }
.st-controls { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 0 4px; }
.st-controls kbd { margin-left: 6px; }
.st-big { padding: 14px 28px; font-size: 18px; }
.st-big kbd { background: rgba(0,0,0,.15); color: var(--accent-ink); border-color: rgba(0,0,0,.2); }
.st-live { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 10px; min-height: 60px; }
.st-live:empty { display: none; }
.st-time { font-family: var(--mono); color: var(--muted); font-size: 13px; }
.st-live-chords { display: grid; gap: 4px; }
.st-live-chords span { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--dim); font-weight: 700; }
.st-live-chords b { font-family: var(--mono); color: var(--chord); font-size: 24px; }
.st-prog { position: relative; height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.st-sheet { margin-top: 12px; max-height: 340px; white-space: pre; color: var(--text); }
.plain-box { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.plain-box summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
.plain-box .sub { margin-top: 10px; }
textarea.plain { min-height: 200px; font-family: var(--ui); font-size: 15px; }
.studio-link { margin-top: 14px; margin-bottom: 0; }
@media (max-width: 900px) {
  .st-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .st-side { flex-direction: row; align-items: flex-start; }
  .st-side .video-card { width: 260px; flex: none; }
  .st-side .st-live { flex: 1; }
  .st-side .st-prog { display: none; }
}

.tune-hint { cursor: pointer; border: 0; font: inherit; font-size: 12px; font-weight: 600; }
.tune-hint svg, .badge.ok svg { width: 12px; height: 12px; }
.icon-btn.tuning { animation: tune-pulse 1.4s ease-in-out infinite; }
@keyframes tune-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,179,71,.5); } 50% { box-shadow: 0 0 0 6px rgba(255,179,71,0); } }

.player.idle .pl-top, .player.idle .chord-strip { opacity: .12; }
.player.idle .pl-dock { opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }
.player.idle { cursor: none; }

.help {
  position: absolute; inset: 0; background: rgba(10,9,8,.8); backdrop-filter: blur(6px); z-index: 20;
  display: grid; place-items: center; padding: 20px;
}
.help-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px 30px; max-width: 520px; width: 100%; }
.help-card h2 { margin: 0 0 16px; }
.help-card dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0; align-items: center; }
.help-card dt { text-align: right; }
.help-card dd { margin: 0; color: var(--muted); }

.modal-back { position: fixed; inset: 0; background: rgba(10,9,8,.7); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; max-width: 420px; width: 100%; }
.modal h3 { margin: 0 0 8px; }
.modal p { color: var(--muted); margin: 0 0 20px; line-height: 1.5; }
.modal .row.tight { justify-content: flex-end; }

@media (max-height: 620px) {
  .rail { top: 104px; }
  .cp-now { min-height: 0; }
  .cp-now .diagram { width: 84px; height: 100px; }
  .cp-now b { font-size: 36px; }
}
@media (max-width: 900px) {
  .player { --rail-w: 170px; }
  .player.rail-wide { --rail-w: 46vw; }
  .rail { right: 10px; }
  .cp-next-body .diagram { display: none; }
  .player.has-rail .sheet { padding-left: 16px; padding-right: calc(var(--rail-w) + 24px); }
  .ed-grid { grid-template-columns: 1fr; }
  .sheet { padding-left: 16px; padding-right: 16px; }
  :root { --lyric-size: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}


/* ================================================================ versión web */
body.web .only-local { display: none !important; }
.lib-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn svg[viewBox="0 0 24 24"] path[fill] { stroke: none; }
.account-menu { position: relative; }
.account-menu summary { list-style: none; cursor: pointer; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary img { width: 24px; height: 24px; border-radius: 50%; }
.account-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 230px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
  display: grid; gap: 8px; box-shadow: 0 16px 40px rgba(0,0,0,.4);
}
.account-mail { color: var(--muted); font-size: 13px; word-break: break-all; }
.sync-banner {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid #5a4424; color: var(--text);
  border-radius: 14px; padding: 12px 16px; margin-bottom: 20px; font-size: 15px;
}
.site-foot { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-top: 34px; color: var(--dim); font-size: 13px; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--text); }
.site-foot b { color: var(--accent); font-weight: 700; }

/* reproductor de YouTube: siempre visible y de al menos 200×200 px (reglas de YouTube) */
.vc-body { aspect-ratio: auto; height: max(200px, calc(var(--rail-w) * 9 / 16)); }
.player .rail { min-width: 200px; }

/* ================================================================ celular */
@media (max-width: 640px) {
  :root { --lyric-size: 23px; }
  .library, .editor { padding-left: 14px; padding-right: 14px; }
  .logo-word { font-size: 28px; }
  .lib-head { gap: 12px; }
  .lib-actions { width: 100%; }
  .lib-actions .btn.primary { margin-left: auto; }
  .quick { padding-left: 12px; }
  .quick .btn { padding: 9px 12px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card-title { font-size: 16px; }
  .card-body { padding: 10px 12px; }
  .ed-foot { padding: 10px 14px; }
  .ed-foot-in .btn { padding: 9px 12px; font-size: 14px; }
  .magic-row { flex-wrap: wrap; }
  .magic-row input { min-width: 100%; }

  /* modo tocar: arriba el video + el acorde de ahora, abajo la letra a todo el ancho */
  .player { --rail-w: 100vw; }
  .player > .pl-top { order: 0; padding: 6px 10px; }
  .player > .rail { order: 1; }
  .player > .chord-strip { display: none; }
  .player > .stage { order: 2; }
  .player > .tab-lane { order: 3; margin: 0 10px 88px !important; }
  .rail {
    position: relative; inset: auto; right: auto; top: auto; bottom: auto; width: auto; min-width: 0;
    flex-direction: row; align-items: stretch; gap: 8px; padding: 0 10px 6px; overflow: visible;
  }
  .rail > .video-card { flex: 1 1 auto; min-width: 200px; order: 0; }
  .rail > .chord-panel { width: 112px; flex: none; order: 1; padding: 8px 10px; gap: 4px; }
  .vc-head { display: none; }
  .vc-body { height: 200px; }
  .cp-now { min-height: 0; }
  .cp-now b { font-size: 30px; }
  .cp-now .diagram { width: 64px; height: 76px; }
  .cp-next-body { min-height: 0; gap: 6px; }
  .cp-next-body b { font-size: 18px; }
  .cp-next-body .diagram, .cp-wait { display: none; }
  .player.has-rail .sheet, .sheet { padding: 18vh 12px 50vh !important; max-width: none; }
  .pl-dock { bottom: 10px; padding: 4px; gap: 2px; }
  .pl-dock .icon-btn { width: 38px; height: 38px; }
  .play-btn { width: 48px; height: 48px; }
  .dock-time { min-width: 0; padding: 0 6px; font-size: 12px; }
  #sz-dn, #sz-up, #full, #helpb { display: none; }
  .pl-meta .badge:not(.accent) { display: none; }
}

/* ventana de cuenta */
a.logo { color: inherit; text-decoration: none; }
.account-modal { display: grid; gap: 12px; max-width: 400px; }
.account-modal h3 { margin: 0; font-size: 22px; }
.account-modal p { margin: 0; }
.am-warn { background: var(--accent-soft); color: var(--text) !important; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.45; }
.am-google { justify-content: center; background: var(--text); color: var(--bg); border-color: var(--text); }
.am-google:hover { background: #fff; }
.am-google svg { width: 18px; height: 18px; }
.am-or { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 13px; }
.am-or::before, .am-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.am-form { display: grid; gap: 8px; }
.am-form .btn { justify-content: center; }
.am-help { color: var(--dim) !important; font-size: 13px; }
.am-status { font-size: 14px; min-height: 1em; }
.am-status.ok { color: var(--ok); }
.am-status.err { color: var(--danger); }
.am-close { justify-self: center; }
.google-slot { display: flex; justify-content: center; }
.google-slot:empty { display: none; }
