/* ===================== TOKENS ===================== */
:root{
  --plum-900:#241333;
  --plum-800:#331c47;
  --plum-700:#452561;
  --cream:#FDF6EC;
  --coral:#FF6B4A;
  --coral-dim:#e35a3c;
  --gold:#F2B84B;
  --mint:#3FBF9F;
  --line: rgba(253,246,236,0.14);

  --font-display: "Baloo 2", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --radius-lg: 28px;
  --radius-md: 16px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--font-body);
  background:var(--plum-900);
  color:var(--cream);
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
}
button{ font-family:inherit; }
:focus-visible{ outline:2.5px solid var(--gold); outline-offset:3px; border-radius:8px; }

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:0.001ms !important; animation-iteration-count:1 !important; transition-duration:0.001ms !important; }
}

/* ===================== SCREENS ===================== */
.screen{ display:none; min-height:100dvh; }
.screen.is-active{ display:flex; }

/* ===================== LOGIN ===================== */
.screen-login{
  position:relative;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:
    radial-gradient(60% 50% at 80% 0%, rgba(255,107,74,0.20), transparent 60%),
    radial-gradient(50% 40% at 10% 100%, rgba(63,191,159,0.16), transparent 60%),
    var(--plum-900);
}

.bg-waves{ position:absolute; inset:0; overflow:hidden; pointer-events:none; }
.wave{
  position:absolute;
  left:50%; top:50%;
  width:120vmax; height:120vmax;
  border:1.5px solid var(--line);
  border-radius:50%;
  transform:translate(-50%,-50%) scale(0.2);
  animation: waveOut 9s ease-out infinite;
}
.w1{ animation-delay:0s; }
.w2{ animation-delay:3s; }
.w3{ animation-delay:6s; }
@keyframes waveOut{
  0%{ transform:translate(-50%,-50%) scale(0.15); opacity:0.55; }
  100%{ transform:translate(-50%,-50%) scale(0.55); opacity:0; }
}

.login-card{
  position:relative;
  z-index:1;
  width:100%;
  max-width:400px;
  background:linear-gradient(180deg, var(--plum-800), var(--plum-700));
  border:1px solid var(--line);
  border-radius:var(--radius-lg);
  padding:40px 32px 32px;
  text-align:center;
  box-shadow:0 30px 70px rgba(0,0,0,0.35);
}

.brand{ display:flex; align-items:center; justify-content:center; gap:10px; margin-bottom:6px; }
.brand-word{
  font-family:var(--font-display);
  font-weight:800;
  font-size:34px;
  letter-spacing:0.5px;
  margin:0;
  color:var(--cream);
}
.brand-mark.small{ display:none; }

.tagline{
  font-size:15px;
  color:rgba(253,246,236,0.7);
  margin:0 0 28px;
}

.login-form{ display:flex; flex-direction:column; gap:10px; text-align:left; }
.field-label{
  font-size:13px;
  font-weight:600;
  color:rgba(253,246,236,0.75);
  margin-bottom:2px;
}
.field-input{
  width:100%;
  padding:14px 16px;
  font-size:17px;
  font-family:var(--font-body);
  font-weight:600;
  letter-spacing:0.5px;
  color:var(--plum-900);
  background:var(--cream);
  border:2px solid transparent;
  border-radius:var(--radius-md);
  text-align:center;
  text-transform:uppercase;
}
.field-input:focus{ border-color:var(--gold); }

.btn-primary{
  margin-top:8px;
  padding:15px 18px;
  font-family:var(--font-display);
  font-weight:700;
  font-size:16px;
  color:var(--plum-900);
  background:var(--gold);
  border:none;
  border-radius:999px;
  cursor:pointer;
  transition:transform .15s ease, background .15s ease;
}
.btn-primary:hover{ background:#f5c869; transform:translateY(-1px); }
.btn-primary:active{ transform:translateY(0); }

.login-error{
  font-size:13px;
  color:var(--coral);
  background:rgba(255,107,74,0.12);
  border:1px solid rgba(255,107,74,0.3);
  border-radius:10px;
  padding:10px 12px;
  margin-top:4px;
}

.login-footnote{
  margin:22px 0 0;
  font-size:12.5px;
  color:rgba(253,246,236,0.45);
}

/* ===================== CONVO SCREEN ===================== */
.screen-convo{
  flex-direction:column;
  width:100%;
  background:var(--plum-900);
}

.convo-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 20px;
  border-bottom:1px solid var(--line);
}
.header-left{ display:flex; align-items:center; gap:8px; }
.header-left .brand-mark.small{ display:inline-flex; }
.header-name{
  font-family:var(--font-display);
  font-weight:700;
  font-size:16px;
}
.btn-ghost{
  background:transparent;
  border:1px solid var(--line);
  color:rgba(253,246,236,0.75);
  padding:8px 16px;
  border-radius:999px;
  font-size:13px;
  font-weight:600;
  cursor:pointer;
}
.btn-ghost:hover{ border-color:var(--coral); color:var(--cream); }

/* Level meter */
.level-meter{ padding:18px 20px 6px; }
.level-track{
  position:relative;
  display:grid;
  grid-template-columns:repeat(6,1fr);
  gap:4px;
}
.level-step{
  position:relative;
  z-index:1;
  padding:9px 0;
  text-align:center;
  font-size:11.5px;
  font-weight:700;
  letter-spacing:0.5px;
  color:rgba(253,246,236,0.4);
  background:var(--plum-800);
  border-radius:8px;
  transition:color .3s ease;
}
.level-step.is-current{ color:var(--plum-900); }
.level-indicator{
  position:absolute;
  top:0; left:0;
  width:calc(16.666% - 3.4px);
  height:100%;
  background:var(--gold);
  border-radius:8px;
  transition:transform .5s cubic-bezier(.3,1,.4,1);
  z-index:0;
}
.level-caption{
  display:block;
  margin-top:8px;
  font-size:11.5px;
  color:rgba(253,246,236,0.4);
  text-align:center;
}

/* Transcript */
.transcript{
  flex:1;
  overflow-y:auto;
  padding:14px 20px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.transcript-empty{
  margin:auto;
  text-align:center;
  color:rgba(253,246,236,0.4);
  max-width:260px;
}
.transcript-empty p{ margin:4px 0; font-size:14px; }
.transcript-empty-sub{ font-size:12.5px !important; }

.bubble{
  max-width:78%;
  padding:11px 15px;
  border-radius:18px;
  font-size:14.5px;
  line-height:1.4;
}
.bubble.student{
  align-self:flex-end;
  background:var(--coral);
  color:var(--cream);
  border-bottom-right-radius:6px;
}
.bubble.tutor{
  align-self:flex-start;
  background:var(--plum-700);
  color:var(--cream);
  border-bottom-left-radius:6px;
}

/* Voice dock */
.voice-dock{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
  padding:10px 20px 34px;
}
.status-line{
  font-size:13.5px;
  font-weight:600;
  color:rgba(253,246,236,0.6);
  min-height:18px;
}

.orb{
  position:relative;
  width:92px;
  height:92px;
  border:none;
  border-radius:50%;
  background:radial-gradient(circle at 35% 30%, #ff8a6c, var(--coral) 60%, var(--coral-dim) 100%);
  color:var(--cream);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  box-shadow:0 10px 30px rgba(255,107,74,0.35);
}
.orb-core{ position:relative; z-index:2; display:flex; }
.orb-ring{
  position:absolute;
  inset:0;
  border-radius:50%;
  border:2px solid var(--coral);
  opacity:0;
}

.orb.is-listening .orb-ring{ animation:ringPulse 1.6s ease-out infinite; }
.orb.is-listening .r2{ animation-delay:.4s; }
.orb.is-listening .r3{ animation-delay:.8s; }
.orb.is-listening{ background:radial-gradient(circle at 35% 30%, #58e0be, var(--mint) 65%, #2e9c81 100%); box-shadow:0 10px 30px rgba(63,191,159,0.4); }

.orb.is-speaking{ animation:orbTalk 0.9s ease-in-out infinite; }

.orb.is-disabled{
  opacity:0.4;
  cursor:not-allowed;
  filter:grayscale(0.6);
}

@keyframes ringPulse{
  0%{ transform:scale(1); opacity:.55; }
  100%{ transform:scale(1.9); opacity:0; }
}
@keyframes orbTalk{
  0%,100%{ transform:scale(1); }
  50%{ transform:scale(1.06); }
}

.hands-free-toggle{
  display:flex;
  align-items:center;
  gap:9px;
  font-size:13px;
  color:rgba(253,246,236,0.7);
  cursor:pointer;
  user-select:none;
}
.hands-free-toggle input{ position:absolute; opacity:0; width:0; height:0; }
.toggle-track{
  width:38px; height:22px;
  background:var(--plum-700);
  border-radius:999px;
  position:relative;
  transition:background .2s ease;
}
.toggle-thumb{
  position:absolute;
  top:2px; left:2px;
  width:18px; height:18px;
  background:var(--cream);
  border-radius:50%;
  transition:transform .2s ease;
}
.hands-free-toggle input:checked + .toggle-track{ background:var(--gold); }
.hands-free-toggle input:checked + .toggle-track .toggle-thumb{ transform:translateX(16px); background:var(--plum-900); }
.hands-free-toggle input:focus-visible + .toggle-track{ outline:2.5px solid var(--gold); outline-offset:2px; }

.btn-skip-warmup{
  background:transparent;
  border:1px solid var(--line);
  color:rgba(253,246,236,0.65);
  padding:9px 16px;
  border-radius:999px;
  font-size:12.5px;
  font-weight:600;
  cursor:pointer;
}
.btn-skip-warmup:hover{ border-color:var(--gold); color:var(--cream); }

/* Modal de material semanal (mismo patrón visual que el del panel del profesor) */
.modal-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,0.55);align-items:center;justify-content:center;padding:20px;z-index:100;}
.modal-overlay.active{display:flex;}
.modal-box{width:100%;max-width:480px;max-height:80vh;overflow-y:auto;background:linear-gradient(180deg,var(--plum-800),var(--plum-700));border:1px solid var(--line);border-radius:20px;padding:26px;}
.modal-box h2{font-family:var(--font-display);font-size:19px;margin:0 0 4px;}
.modal-box .modal-sub{font-size:12.5px;color:rgba(253,246,236,0.55);margin:0 0 18px;}
.material-modal-text{font-size:14px;line-height:1.6;color:rgba(253,246,236,0.85);white-space:pre-wrap;margin-bottom:16px;}
.modal-close{display:block;width:100%;margin-top:8px;background:transparent;border:1px solid var(--line);color:rgba(253,246,236,0.75);padding:10px;border-radius:999px;font-size:13px;cursor:pointer;}

/* ===================== RESPONSIVE ===================== */
@media (min-width:640px){
  .screen-convo{ max-width:520px; margin:0 auto; border-left:1px solid var(--line); border-right:1px solid var(--line); }
}
