/* Aula Interactiva — estilos (oscuro tipo Spotify, apto para celular, tablet y proyector). */

:root {
  --bg: #0e0e11;
  --bg-2: #15151a;
  --surface: #1b1b22;
  --surface-2: #24242d;
  --surface-3: #2e2e39;
  --line: #34343f;
  --text: #f4f4f6;
  --muted: #a6a6b3;
  --accent: #1ed760;
  --accent-ink: #062b14;
  --warn: #ffb02e;
  --danger: #ff5470;
  --ok: #1ed760;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --theme: #7c3aed;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 900; }
h2 { font-size: clamp(1.3rem, 3vw, 1.75rem); font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 800; }
p { margin: 0 0 .8em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code, kbd { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .9em; }
kbd { background: var(--surface-3); border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 0 .4em; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: .86rem; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.accent { color: var(--accent); }
.tc { text-align: center; }
.lead { font-size: 1.15rem; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; gap: .5rem; }
.row.center { justify-content: center; }
.gap { gap: .6rem; }
.wrap { flex-wrap: wrap; }
.container { max-width: 1240px; margin: 0 auto; padding: 16px; }
.container.wide { max-width: 1400px; }
.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.center-screen { min-height: 70vh; display: grid; place-items: center; padding: 16px; }
.big-emoji { font-size: 3.2rem; line-height: 1; margin-bottom: .4rem; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font: 700 .95rem var(--font); padding: .62rem 1.1rem; border-radius: 999px;
  cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: transform .08s ease, background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover { background: #3be477; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-warn { background: var(--warn); color: #2a1a00; border-color: transparent; }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.btn-sm { padding: .38rem .8rem; font-size: .85rem; }
.btn-lg { padding: .85rem 1.6rem; font-size: 1.08rem; }
.btn-block { width: 100%; }
.icon-btn {
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem;
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* ---------- formularios ---------- */
.input {
  width: 100%; background: var(--bg-2); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .65rem .8rem; font: 500 1rem var(--font);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.input-lg { padding: .85rem 1rem; font-size: 1.08rem; }
.input-num { max-width: 140px; }
textarea.input { resize: vertical; line-height: 1.55; }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .92rem; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
.label { display: block; font-weight: 700; font-size: .9rem; margin: 0 0 .35rem; }
.help { color: var(--muted); font-size: .82rem; margin-top: .3rem; }
.field { margin-bottom: 1rem; }
.switch { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; margin: .25rem 1rem .25rem 0; user-select: none; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.color { width: 52px; height: 40px; border: 0; background: none; padding: 0; cursor: pointer; }
.swatches { display: flex; gap: .35rem; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); cursor: pointer; }

/* ---------- tarjetas, píldoras, barras ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .7rem; border-radius: 999px;
  background: var(--surface-3); font-size: .82rem; font-weight: 700; white-space: nowrap; }
.pill-ok { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.pill-warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .6s ease; }
.note { background: var(--surface-2); border-left: 4px solid var(--accent); padding: .8rem 1rem; border-radius: 8px; margin: .8rem 0; white-space: pre-line; }
.chip-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 1rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toasts y modales ---------- */
.toasts { position: fixed; z-index: 1000; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { background: var(--surface-3); border: 1px solid var(--line); padding: .75rem 1rem; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; animation: up .25s ease; transition: opacity .3s, transform .3s; }
.toast-ok { border-color: var(--ok); }
.toast-warn { border-color: var(--warn); }
.toast-error { border-color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(10px); }
@keyframes up { from { opacity: 0; transform: translateY(12px); } }
.modal-back { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.65); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); width: min(100%, 520px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow); animation: up .2s ease; }
.modal-wide { width: min(100%, 900px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 0; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 16px 20px; overflow: auto; display: grid; gap: .7rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; padding: 0 20px 18px; flex-wrap: wrap; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1100; }

/* ---------- portada de inicio ---------- */
.landing { background: radial-gradient(1200px 600px at 20% -10%, #1f3d2b 0%, transparent 60%), radial-gradient(900px 600px at 110% 110%, #2c1d4d 0%, transparent 60%), var(--bg); }
.landing .center-screen { min-height: 100dvh; }
.landing-box { text-align: center; width: min(100%, 420px); }
.landing-logo { border-radius: 18px; margin-bottom: .5rem; }
.pin-form { display: grid; gap: .8rem; margin-top: 1rem; }
.input-pin { text-align: center; font-size: 2.2rem; font-weight: 900; letter-spacing: .3em; padding: .6rem; }
.pin-error { color: var(--danger); font-weight: 700; margin-top: .8rem; }
.teacher-link { position: fixed; right: 16px; bottom: 14px; color: var(--muted); font-size: .9rem; }

/* ---------- barra superior del jugador ---------- */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 1rem; padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 800; text-decoration: none !important; }
.brand img { border-radius: 8px; }
.steps { display: flex; gap: .35rem; list-style: none; margin: 0 auto; padding: 0; overflow-x: auto; scrollbar-width: none; }
.steps li { display: flex; align-items: center; gap: .35rem; padding: .25rem .65rem .25rem .3rem; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .82rem; font-weight: 700; white-space: nowrap; }
.steps li.now { background: var(--accent); color: var(--accent-ink); }
.steps li.done { color: var(--text); }
.step-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.1); font-size: .75rem; }
#who { white-space: nowrap; }
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: .4rem; padding: 8px 12px; }
  .brand span { display: none; }
  .steps { order: 3; width: 100%; margin: 0; }
  .step-l { display: none; }
  .steps li.now .step-l { display: inline; }
  #who { margin-left: auto; }
}

/* ---------- intro ---------- */
.hero { display: flex; gap: 24px; align-items: flex-end; padding: 28px; border-radius: var(--radius); margin-bottom: 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--theme) 75%, #000) 0%, var(--surface) 100%); }
.hero-cover { width: 200px; height: 200px; object-fit: cover; border-radius: 10px; box-shadow: 0 16px 40px rgba(0,0,0,.5); flex-shrink: 0; }
.hero-cover-empty { display: grid; place-items: center; background: var(--surface-3); font-size: 4rem; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 3.4rem); margin: .1em 0 .2em; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; font-weight: 800; color: rgba(255,255,255,.8); }
.hero-song { font-size: 1.1rem; color: rgba(255,255,255,.85); }
.intro-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.intro-grid .card { margin: 0; }
.howto { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.howto li { display: flex; gap: .7rem; align-items: center; background: var(--surface-2); padding: .6rem .8rem; border-radius: 12px; font-weight: 600; }
.howto li span { font-size: 1.4rem; }
.join-form { display: grid; gap: .8rem; }
@media (max-width: 760px) {
  .hero { flex-direction: column; align-items: flex-start; padding: 20px; }
  .hero-cover { width: 150px; height: 150px; }
  .intro-grid { grid-template-columns: 1fr; }
}

/* ---------- reproductor (Ahora suena) ---------- */
.sl { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.sl-player { position: sticky; top: 70px; }
.np { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.np-stage { border-radius: 10px; overflow: hidden; background: #000; }
.np-cover { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.np-cover-empty { display: grid; place-items: center; font-size: 5rem; background: linear-gradient(135deg, var(--theme), #111); }
.np-has-video .np-stage { aspect-ratio: 16 / 9; }
.media-video, .media-yt, .media-yt iframe { display: block; width: 100%; height: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; }
.np-info { display: flex; align-items: center; gap: .7rem; margin: 14px 0 6px; flex-wrap: wrap; }
.np-thumb { display: none; width: 48px; height: 48px; border-radius: 6px; overflow: hidden; background: var(--surface-3); flex-shrink: 0; place-items: center; }
.np-thumb img { width: 100%; height: 100%; object-fit: cover; }
.np-text { min-width: 0; flex: 1; }
.np-title { font-weight: 800; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { color: var(--muted); font-size: .92rem; }
.np-bar { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.np-range { -webkit-appearance: none; appearance: none; width: 100%; height: 5px; border-radius: 99px; cursor: pointer;
  background: linear-gradient(to right, var(--text) var(--p, 0%), var(--surface-3) var(--p, 0%)); }
.np-range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; }
.np-range::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
.np-range:hover { background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--surface-3) var(--p, 0%)); }
.np-buttons { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 8px; }
.np-play { width: 56px; height: 56px; border-radius: 50%; border: 0; background: #fff; color: #000; font-size: 1.3rem; font-weight: 900; cursor: pointer; transition: transform .1s; }
.np-play:hover { transform: scale(1.06); }
.np-small { border: 0; background: transparent; color: var(--muted); font: 800 .85rem var(--font); cursor: pointer; padding: .4rem; border-radius: 8px; min-width: 44px; }
.np-small:hover { color: var(--text); background: var(--surface-2); }
.np-msg { margin-top: 8px; color: var(--warn); font-size: .85rem; text-align: center; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.seg-btn { border: 0; background: transparent; color: var(--muted); font: 700 .8rem var(--font); padding: .3rem .7rem; border-radius: 999px; cursor: pointer; }
.seg-btn.on { background: var(--surface-3); color: var(--text); }

/* Reproductor reducido (etapas 2–4): barra fija abajo; el video sigue visible en miniatura. */
.sl-mini { grid-template-columns: 1fr; }
.sl-mini .sl-main { padding-bottom: 110px; }
.sl-mini .sl-player { position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; top: auto; }
.sl-mini .np { border-radius: 0; border-width: 1px 0 0; display: grid; grid-template-columns: auto 1fr minmax(220px, 420px); align-items: center; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); }
.sl-mini .np-stage { width: 56px; height: 56px; grid-row: 1; }
.sl-mini.has-video-mini .np-stage { width: 112px; }
.sl-mini .np-has-video .np-stage { width: 112px; height: 63px; aspect-ratio: auto; }
.sl-mini .np-cover { height: 100%; aspect-ratio: auto; }
.sl-mini .np-info { margin: 0; }
.sl-mini .np-info .seg { display: none; }
.sl-mini .np-controls { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.sl-mini .np-buttons { order: -1; margin: 0; gap: .2rem; }
.sl-mini .np-buttons .np-small { display: none; }
.sl-mini .np-play { width: 42px; height: 42px; font-size: 1rem; }
.sl-mini .np-msg { display: none; }
@media (max-width: 900px) {
  .sl { grid-template-columns: 1fr; }
  .sl-player { position: static; }
  .sl:not(.sl-mini) .np { display: grid; grid-template-columns: 96px 1fr; gap: 0 12px; align-items: center; }
  .sl:not(.sl-mini) .np-stage { grid-row: span 2; }
  .sl:not(.sl-mini) .np-has-video { grid-template-columns: 1fr; }
  .sl:not(.sl-mini) .np-has-video .np-stage { grid-row: auto; }
  .sl:not(.sl-mini) .np-info { margin: 0 0 4px; }
  .sl:not(.sl-mini) .np-controls, .sl:not(.sl-mini) .np-msg { grid-column: 1 / -1; }
  .sl:not(.sl-mini) .np-title { font-size: 1rem; }
  .sl-mini .np { grid-template-columns: auto 1fr; }
  .sl-mini .np-controls { grid-column: 1 / -1; }
  .sl-mini .sl-main { padding-bottom: 150px; }
}

/* ---------- etapas ---------- */
.stage-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.stage-title { margin-bottom: .2em; }
.stage-actions { display: flex; justify-content: flex-end; margin-top: 18px; gap: .6rem; flex-wrap: wrap; }
.ly-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }

/* Letra al estilo de Spotify: fondo de color y líneas grandes. */
.ly { background: var(--theme); border-radius: 14px; padding: 22px 22px 26px; margin-top: 12px; color: #fff;
  font-size: clamp(1.1rem, 2.4vw, 1.45rem); font-weight: 800; line-height: 1.55; }
.ly-line { padding: 2px 6px; border-radius: 8px; transition: color .25s, opacity .25s, background .25s; }
.ly-gap { height: .9em; }
.ly-timed { cursor: pointer; }
.ly-timed:hover { background: rgba(0,0,0,.12); }
.ly .ly-line.past { opacity: .6; }
.ly .ly-line.on { background: rgba(0,0,0,.2); }
.ly:has(.ly-line.on) .ly-line:not(.on):not(.past) { color: rgba(0,0,0,.72); }

.blank { display: inline-block; vertical-align: baseline; min-height: 1.4em; margin: 0 .15em; padding: 0 .45em; border: 0;
  border-bottom: 3px dashed rgba(255,255,255,.85); background: rgba(0,0,0,.22); color: #fff; font: inherit; border-radius: 8px 8px 2px 2px;
  cursor: pointer; letter-spacing: .02em; transition: background .15s, transform .15s; }
.blank:hover { background: rgba(0,0,0,.35); }
.blank.filled { border-bottom-style: solid; background: rgba(255,255,255,.95); color: #111; }
.blank.active { outline: 3px solid #fff; outline-offset: 2px; background: rgba(0,0,0,.45); animation: pulse 1.4s ease-in-out infinite; }
.blank.filled.active { background: #fff; }
@keyframes pulse { 50% { outline-color: rgba(255,255,255,.35); } }
.blank-select, .blank-input { font: inherit; font-size: .9em; color: #111; background: #fff; border: 0; border-radius: 8px; padding: .05em .35em; margin: 0 .15em; max-width: 90%; }
.blank-input::placeholder { color: #999; letter-spacing: .1em; }
.pop { animation: pop .25s ease; }
@keyframes pop { 50% { transform: scale(1.12); } }

.bank { position: sticky; bottom: 0; z-index: 40; margin-top: 12px; background: color-mix(in srgb, var(--surface-2) 96%, transparent);
  backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgba(0,0,0,.35); }
.bank-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin-bottom: 8px; }
.bank-chips { display: flex; flex-wrap: wrap; gap: .45rem; max-height: 34vh; overflow: auto; }
.chip { border: 1px solid var(--line); background: var(--surface-3); color: var(--text); font: 700 1rem var(--font); padding: .45rem .9rem; border-radius: 999px; cursor: pointer; transition: transform .08s, background .15s, opacity .15s; }
.chip:hover { background: #3a3a48; }
.chip:active { transform: scale(.94); }
.chip.used { opacity: .45; }
.chip-ok { border-color: var(--ok); color: var(--ok); background: transparent; cursor: default; }
.chip-bad { border-color: var(--danger); color: var(--danger); background: transparent; cursor: default; }

/* Rompecabezas */
.pz-stats { display: flex; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .92rem; margin-bottom: 12px; }
.pz-stats b { color: var(--text); }
.pz-wrap { position: relative; max-width: min(560px, 100%); margin: 0 auto; }
.pz-board { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; width: 100%; max-height: 70vh; background: var(--bg); padding: 3px; border-radius: 12px; touch-action: none; user-select: none; }
.pz-tile { border: 0; padding: 0; border-radius: 4px; background-repeat: no-repeat; cursor: grab; position: relative; transition: box-shadow .2s, filter .2s; touch-action: none; }
.pz-tile.ok { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 80%, transparent); }
.pz-tile.sel { box-shadow: inset 0 0 0 4px #fff; filter: brightness(1.15); z-index: 2; }
.pz-tile.dragging { z-index: 5; cursor: grabbing; box-shadow: 0 12px 30px rgba(0,0,0,.6); transition: none; }
.pz-board.solved { gap: 0; transition: gap .5s; }
.pz-board.solved .pz-tile { box-shadow: none; border-radius: 0; }
.pz-ref { position: absolute; inset: 0; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); pointer-events: none; }
.pz-ref img { width: 100%; height: 100%; object-fit: fill; opacity: .92; }
.pz-footer { display: flex; justify-content: center; gap: .6rem; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.pz-win { width: 100%; text-align: center; font-weight: 800; font-size: 1.15rem; color: var(--accent); }

/* Ordenar */
.ord-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; counter-reset: ord; }
.ord-item { display: flex; align-items: center; gap: .7rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .6rem .7rem .9rem; cursor: grab; touch-action: none; user-select: none; counter-increment: ord; }
.ord-item::before { content: counter(ord); font-weight: 900; color: var(--accent); min-width: 1.2em; }
.ord-item.dragging { z-index: 5; position: relative; background: var(--surface-3); box-shadow: var(--shadow); cursor: grabbing; }
.ord-handle { color: var(--muted); letter-spacing: -.2em; }
.ord-text { flex: 1; font-weight: 700; font-size: 1.05rem; }
.ord-arrows { display: flex; gap: 2px; }

/* Reflexión */
.emoji-grid { display: flex; flex-wrap: wrap; gap: .6rem; margin: .5rem 0 1rem; }
.emoji-btn { font-size: 2.2rem; width: 64px; height: 64px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface-2); cursor: pointer; transition: transform .1s, border-color .15s; }
.emoji-btn:hover { transform: scale(1.08); }
.emoji-btn.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); transform: scale(1.1); }

/* ---------- resultados ---------- */
.results { max-width: 760px; margin: 0 auto; }
.results-hero { text-align: center; background: linear-gradient(180deg, color-mix(in srgb, var(--theme) 55%, var(--surface)) 0%, var(--surface) 60%); }
.ring { --pct: 0; width: 190px; height: 190px; margin: 10px auto 14px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--surface-3) 0); }
.ring-in { width: 158px; height: 158px; border-radius: 50%; background: var(--surface); display: grid; place-content: center; }
.score-num { font-size: 3rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.results-meta { display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 14px; }
.stages { display: grid; gap: 12px; text-align: left; margin: 10px 0 18px; }
.stage-row-top { display: flex; justify-content: space-between; margin-bottom: 4px; }
.rank-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.rank-list li { display: grid; grid-template-columns: 52px 1fr auto 86px; align-items: center; gap: .5rem; background: var(--surface-2); border-radius: 10px; padding: .55rem .8rem; }
.rank-list li.me { outline: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface-2)); }
.rank-pos { font-weight: 900; font-size: 1.1rem; }
.rank-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name small { color: var(--muted); font-weight: 500; }
.rank-score { font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.rank-time { text-align: right; font-size: .82rem; }
.ly-review { font-size: 1.05rem; }
.rv { padding: 0 .3em; border-radius: 6px; margin: 0 .1em; }
.rv-ok { background: rgba(255,255,255,.95); color: #0a7a35; }
.rv-bad { background: rgba(0,0,0,.3); }
.rv-bad s { color: #ffc2cc; margin-right: .3em; }
.rv-answer { color: #fff; text-decoration: underline wavy #ffd23f; }
.rv-order { padding-left: 1.4em; }
@media (max-width: 560px) {
  .rank-list li { grid-template-columns: 40px 1fr auto; }
  .rank-time { display: none; }
}

/* ---------- ranking proyectable ---------- */
.ranking-page { background: radial-gradient(1000px 500px at 50% -10%, #1f3d2b, transparent 70%), var(--bg); }
.rk-head { display: flex; justify-content: space-between; gap: 1.5rem; align-items: center; flex-wrap: wrap; margin: 10px 0 24px; }
.rk-head h1 { font-size: clamp(2rem, 4vw, 3.4rem); }
.rk-join { display: flex; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.rk-join img { border-radius: 8px; background: #fff; }
.rk-pin { font-size: 1.6rem; }
.rk-pin b { color: var(--accent); letter-spacing: .1em; font-size: 2.2rem; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 16px; max-width: 900px; margin: 0 auto 28px; }
.podium-col { text-align: center; }
.podium-medal { font-size: 3rem; }
.podium-name { font-weight: 900; font-size: clamp(1.1rem, 2.4vw, 1.8rem); overflow-wrap: anywhere; }
.podium-score { color: var(--accent); font-weight: 900; font-size: 1.3rem; margin-bottom: 8px; }
.podium-bar { border-radius: 12px 12px 0 0; background: linear-gradient(180deg, var(--surface-3), var(--surface)); border: 1px solid var(--line); border-bottom: 0; }
.p1 .podium-bar { height: 180px; background: linear-gradient(180deg, #d4a017, #6b4f00); }
.p2 .podium-bar { height: 130px; background: linear-gradient(180deg, #a7b0bd, #4c5260); }
.p3 .podium-bar { height: 95px; background: linear-gradient(180deg, #c27a43, #5c3214); }
.flash { animation: flash 1s ease 2; }
@keyframes flash { 50% { transform: scale(1.06); filter: brightness(1.3); } }
.rank-big { max-width: 900px; margin: 0 auto; }
.rank-big li { font-size: 1.2rem; padding: .7rem 1rem; }

/* ---------- panel docente ---------- */
.admin-shell { min-height: 100vh; }
.admin-top { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 1rem; padding: 10px 20px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.admin-nav { display: flex; gap: .3rem; margin: 0 auto; overflow-x: auto; }
.admin-nav a { color: var(--muted); font-weight: 700; padding: .45rem .85rem; border-radius: 999px; white-space: nowrap; text-decoration: none; }
.admin-nav a:hover { color: var(--text); background: var(--surface); }
.admin-nav a.on { color: var(--text); background: var(--surface-2); }
.admin-user { display: flex; align-items: center; gap: .6rem; }
.admin-main { max-width: 1180px; margin: 0 auto; padding: 22px 16px 120px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: .1em 0 .2em; }
.page-head p { margin: 0; }
@media (max-width: 760px) {
  .admin-top { flex-wrap: wrap; padding: 8px 12px; }
  .admin-nav { order: 3; width: 100%; margin: 0; }
  .admin-user { margin-left: auto; }
}
.login { display: grid; gap: .8rem; text-align: center; justify-items: center; }
.login .input { text-align: left; }
.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.act-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, border-color .15s; }
.act-card:hover { transform: translateY(-2px); border-color: #4a4a58; }
.act-cover { aspect-ratio: 16 / 10; background: linear-gradient(135deg, #2b2b38, #15151a) center / cover; display: grid; place-items: center; font-size: 3rem; text-decoration: none !important; }
.act-body { padding: 14px; display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.act-body h3 { margin: .3rem 0 0; }
.act-body p { margin: 0; }
.act-actions { display: flex; gap: .35rem; margin-top: auto; padding-top: .6rem; flex-wrap: wrap; }
.empty { text-align: center; padding: 60px 16px; border: 2px dashed var(--line); border-radius: var(--radius); }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.type-card { display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; text-align: left; background: var(--surface-2); border: 2px solid var(--line); border-radius: 14px; padding: 14px; color: var(--text); font: inherit; cursor: pointer; }
.type-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
.type-card.soon { opacity: .5; cursor: default; }
.type-icon { font-size: 2rem; }

.share { display: grid; gap: 14px; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.share-main { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.share-main > div { display: grid; gap: .5rem; }
.share-pin { display: flex; align-items: baseline; gap: .6rem; }
.share-pin b { font-size: 2.4rem; font-weight: 900; letter-spacing: .12em; color: var(--accent); line-height: 1; }
code.link { background: var(--bg-2); border: 1px solid var(--line); padding: .3rem .6rem; border-radius: 8px; word-break: break-all; }
.qr { background: #fff; border-radius: 10px; padding: 4px; }

.ed-section { padding: 22px; }
.ed-head { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 14px; }
.ed-head h3 { margin: 0 0 .15rem; }
.ed-head p { margin: 0; }
.ed-icon { font-size: 1.6rem; line-height: 1; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.toolbar { margin-bottom: 8px; }
.ly-edit { font-size: 1.05rem; max-height: 470px; overflow: auto; margin-top: 8px; }
.tok { cursor: pointer; border-radius: 5px; padding: 0 .05em; }
.tok:hover { background: rgba(0,0,0,.25); }
.tok-blank { background: rgba(255,255,255,.95); color: #111; padding: 0 .3em; border-bottom: 3px solid #111; }
.tok-blank:hover { background: #ffd6dd; }
.sync-row { margin-top: 6px; }
.upl { display: flex; gap: 14px; align-items: center; background: var(--bg-2); border: 1px dashed var(--line); border-radius: 14px; padding: 12px; position: relative; flex-wrap: wrap; }
.upl.uploading { opacity: .8; }
.upl .bar { position: absolute; left: 12px; right: 12px; bottom: 6px; height: 5px; }
.upl-empty { width: 96px; height: 96px; display: grid; place-items: center; font-size: 2.2rem; background: var(--surface-2); border-radius: 10px; }
.upl-img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; }
.upl-audio { width: 100%; max-width: 260px; }
.upl-video { width: 180px; border-radius: 8px; background: #000; }
.upl-side { display: grid; gap: .3rem; flex: 1; min-width: 160px; }
.yt-thumb { display: flex; align-items: center; gap: .6rem; margin-top: .5rem; }
.yt-thumb img { width: 120px; border-radius: 8px; }
.order-preview { margin: .4rem 0 0; padding-left: 1.4em; color: var(--muted); }
.save-bar { position: sticky; bottom: 0; z-index: 30; display: flex; justify-content: flex-end; align-items: center; gap: 1rem; padding: 12px 16px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.sync { display: grid; grid-template-columns: 300px 1fr; gap: 16px; }
.sync-player { display: grid; gap: 10px; align-content: start; }
.sync-list { list-style: none; margin: 0; padding: 0; max-height: 55vh; overflow: auto; display: grid; gap: 4px; }
.sync-list li { display: grid; grid-template-columns: 64px 1fr; gap: .6rem; padding: .45rem .6rem; border-radius: 8px; cursor: pointer; background: var(--surface-2); }
.sync-list li.on { outline: 2px solid var(--accent); }
.sync-time { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; }
@media (max-width: 760px) { .sync { grid-template-columns: 1fr; } }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: .2rem; }
.tile b { font-size: 1.7rem; font-weight: 900; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.word-bars { display: grid; gap: 12px; }
.ly-review + h3 { margin-top: 1.2rem; }
.emoji-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.emoji-stat { display: grid; justify-items: center; background: var(--surface-2); border-radius: 14px; padding: 10px 14px; min-width: 76px; }
.emoji-big { font-size: 2rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--surface-3); vertical-align: middle; }
.table td.refl { max-width: 320px; }
.table tr.muted td { color: var(--muted); }

@media (max-width: 600px) {
  .bank { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .bank-head .muted { display: none; }
  .bank-head { margin-bottom: 4px; }
  .bank-chips { max-height: 24vh; gap: .35rem; }
  .chip { font-size: .92rem; padding: .35rem .7rem; }
  .ly { padding: 16px 12px 20px; }
  .stage-card { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
