/* ============================================================
   Sesión Práctica — modo inverso Feynman
   ============================================================ */

/* Stage */
.sp-stage {
  position: fixed;
  inset: 0;
  z-index: 300;          /* takeover: cubre el navbar — solo se sale colgando */
  background: var(--bg);
  overflow: hidden;
}

/* Indicador "en llamada" */
.sp-call-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  animation: sp-call-pulse 1.6s ease-in-out infinite;
}
.sp-call-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--muted);
}
@keyframes sp-call-pulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* Botón colgar */
.sp-hangup-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 7px 14px;
  background: var(--err);
  color: #0A0A0A;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: box-shadow 0.14s, transform 0.08s;
}
.sp-hangup-btn:hover { box-shadow: 0 0 16px rgba(255,77,77,0.5); }
.sp-hangup-btn:active { transform: scale(0.97); }
.sp-hangup-btn svg { transform: rotate(135deg); }

/* Progress line */
.sp-progress {
  position: absolute;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--acento, var(--red));
  box-shadow: 0 0 8px var(--acento-glow, var(--red-glow));
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 20;
}

/* Topbar */
.sp-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  z-index: 10;
}

.sp-topbar-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.sp-topbar-code {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted-2);
  letter-spacing: 0.10em;
  flex-shrink: 0;
}

.sp-topbar-topic {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

.sp-topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.sp-timer {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--acento, var(--red));
  letter-spacing: 0.10em;
  min-width: 52px;
  flex-shrink: 0;
  text-align: center;
}

/* Circle wrapper — position set by JS */
.sp-ring-wrap {
  position: absolute;
  z-index: 4;
}
.sp-ring-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Julian subtitle — below circle, tenue */
.sp-julian-text {
  position: absolute;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.55;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 5;
  /* top/left/width/padding set by JS */
}
.sp-julian-text.visible { opacity: 1; }

/* Question card — the second visual protagonist */
.sp-card {
  position: absolute;
  background: rgba(21, 21, 21, 0.93);
  border: 1px solid var(--acento, var(--red));
  box-shadow: 0 0 20px var(--acento-glow, var(--red-glow));
  padding: 16px 18px;
  overflow-y: auto;
  transform: rotate(-1deg);
  transform-origin: top center;
  z-index: 5;
  /* left/top/width/max-height set by JS */
}

.sp-card.reveal-correct {
  animation: sp-card-ok 1.4s ease;
}

.sp-card.reveal-incorrect {
  animation: sp-card-shake 0.38s ease;
}

@keyframes sp-card-ok {
  0%   { box-shadow: 0 0 20px var(--acento-glow, var(--red-glow)); }
  35%  { box-shadow: 0 0 48px var(--acento-glow, var(--red-glow)), 0 0 90px var(--acento-glow, var(--red-glow)); }
  100% { box-shadow: 0 0 20px var(--acento-glow, var(--red-glow)); }
}

@keyframes sp-card-shake {
  0%   { transform: rotate(-1deg) translateX(0); }
  25%  { transform: rotate(-1deg) translateX(-5px); }
  75%  { transform: rotate(-1deg) translateX(5px); }
  100% { transform: rotate(-1deg) translateX(0); }
}

.sp-card-question {
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-2);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

/* Options */
.sp-card-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sp-card-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 5px 3px;
  transition: opacity 0.3s ease;
  position: relative;
}

.sp-card-opt.discarded {
  opacity: 0.22;
}
.sp-card-opt.discarded .sp-opt-text {
  text-decoration: line-through;
}

.sp-opt-letter {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted-2);
  flex-shrink: 0;
  letter-spacing: 0.08em;
  padding-top: 2px;
  min-width: 14px;
  transition: color 0.2s;
}

.sp-opt-text {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
  flex: 1;
  transition: color 0.2s;
}

/* Correct indicator dot — visible to user, not to Julian */
.sp-opt-indicator {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
  flex-shrink: 0;
  margin-top: 5px;
}

.sp-card-opt.correct .sp-opt-indicator {
  background: var(--acento, var(--red));
  box-shadow: 0 0 5px var(--acento-glow, var(--red-glow));
}

/* Reveal states */
.sp-card-opt.reveal-ok .sp-opt-letter,
.sp-card-opt.reveal-ok .sp-opt-text {
  color: var(--ok);
}

.sp-card-opt.reveal-wrong .sp-opt-text {
  text-decoration: line-through;
}
.sp-card-opt.reveal-wrong .sp-opt-letter,
.sp-card-opt.reveal-wrong .sp-opt-text {
  color: var(--err);
}

.sp-card-opt.julian-choice .sp-opt-letter {
  color: var(--amber);
}

/* Voice canvas */
.sp-voz-canvas {
  position: absolute;
  display: block;
  z-index: 3;
  /* bottom/left/width/height set by JS */
}

/* Input bar */
.sp-input-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  z-index: 6;
}

/* Normal state — mic + text + send */
.sp-input-idle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

/* Revealed state — next button centered */
.sp-input-next {
  display: none;
  flex: 1;
  justify-content: center;
}

.sp-mic-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
  flex-shrink: 0;
  transition: background 0.3s;
}
.sp-mic-dot.active {
  background: var(--acento, var(--red));
  box-shadow: 0 0 6px rgba(var(--acento-rgb, 255,42,42), 0.6);
  animation: sp-mic-pulse 1.9s ease-in-out infinite;
}

@keyframes sp-mic-pulse {
  0%, 100% { box-shadow: 0 0 3px rgba(var(--acento-rgb, 255,42,42), 0.4); }
  50%       { box-shadow: 0 0 10px rgba(var(--acento-rgb, 255,42,42), 0.85); }
}

.sp-interim {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.sp-input-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.sp-text-input {
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  width: 180px;
  transition: border-color 0.14s;
}
.sp-text-input:focus {
  outline: none;
  border-color: var(--acento, var(--red));
}
.sp-text-input::placeholder { color: var(--muted-2); }
.sp-text-input:disabled { opacity: 0.35; }

.sp-send-btn, .sp-next-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 6px 14px;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: border-color 0.14s, color 0.14s;
  white-space: nowrap;
}
.sp-send-btn:hover:not(:disabled),
.sp-next-btn:hover {
  border-color: var(--acento, var(--red));
  color: var(--acento, var(--red));
}
.sp-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.sp-commit-btn {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 5px 10px;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted-2);
  cursor: pointer;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  transition: border-color 0.14s, color 0.14s;
  white-space: nowrap;
  display: none;
}
.sp-commit-btn:hover { border-color: var(--muted); color: var(--muted); }

/* Guide trigger — bottom left */
.sp-guide-btn {
  position: absolute;
  bottom: 58px;
  left: 16px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 5px 12px;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted-2);
  cursor: pointer;
  z-index: 7;
  transition: border-color 0.14s, color 0.14s;
}
.sp-guide-btn:hover { border-color: var(--muted); color: var(--muted); }
.sp-guide-btn.active {
  border-color: var(--acento, var(--red));
  color: var(--acento, var(--red));
}

/* Guide panel — right side */
.sp-guide {
  position: absolute;
  top: 44px; right: 0; bottom: 0;
  width: 220px;
  border-left: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  z-index: 5;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.sp-guide.collapsed { width: 32px; }
.sp-guide.collapsed .sp-guide-title,
.sp-guide.collapsed .sp-guide-body { display: none; }

.sp-guide-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.sp-guide-title {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sp-guide-toggle {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.14s;
}
.sp-guide-toggle:hover { color: var(--ink); }

.sp-guide-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sp-guide-loading {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--muted-2);
  letter-spacing: 0.08em;
  animation: sp-blink 1.6s ease-in-out infinite;
}

.sp-guide-point {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.sp-guide-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--acento, var(--red));
  flex-shrink: 0;
  margin-top: 5px;
}

.sp-guide-point-text {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}

/* Animations */
@keyframes sp-blink {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.85; }
}

/* ── Timer expiry prompt ────────────────────────────────── */
.sp-timer-prompt {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  max-width: 480px;
  width: max-content;
  z-index: 8;
  animation: sp-fade-up 0.35s ease;
}

@keyframes sp-fade-up {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.sp-timer-msg {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.4;
  flex: 1;
  min-width: 200px;
}

.sp-timer-msg strong {
  color: var(--acento, var(--red));
}

.sp-timer-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.sp-tp-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 5px 12px;
  background: none;
  border: 1px solid var(--line-2);
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: border-color 0.14s, color 0.14s;
  white-space: nowrap;
}
.sp-tp-btn:hover { border-color: var(--muted); color: var(--ink); }
.sp-tp-primary {
  border-color: var(--acento, var(--red));
  color: var(--acento, var(--red));
}
.sp-tp-primary:hover { box-shadow: 0 0 10px rgba(var(--acento-rgb, 255,42,42), 0.25); }

.sp-timer.urgent {
  color: var(--acento, var(--red));
  animation: sp-blink 1s ease-in-out infinite;
}

@keyframes sp-blink {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* Mobile */
@media (max-width: 600px) {
  .sp-guide { display: none; }
  .sp-guide-btn { display: none; }
  .sp-text-input { width: 130px; }
  .sp-topbar-topic { max-width: 160px; }
  .sp-timer-prompt { bottom: 58px; padding: 8px 12px; }
}
