/* training.css — the rehearsal/playback screen layout + controls */

/* Make training screen fill the remaining viewport, and split into scrollable content + anchored controls */
#screen-train{
  flex: 1 1 auto;
  width: 100%;
  max-width: 680px;
  display: none;
  flex-direction: column;
  padding: 14px 20px;
  gap: 12px;
  overflow: hidden;
  height: 100vh; /* fallback */
  height: 100dvh; /* iOS-friendly */
  max-height: 100%;
}

#screen-train.active{ display: flex; }

/* Floating progress/role bar at top of speaking screen */
.train-topbar{
  position: fixed;
  top: 86px; /* below floating header */
  left: 50%;
  transform: translateX(-50%);
  width: calc(100vw - (var(--pane-side-margin) * 2));
  max-width: var(--pane-max-width);

  background: rgba(26,16,8,0.88);
  border: 1px solid #5a3a10;
  border-radius: 14px;
  padding: 12px 12px;
  z-index: 55;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}

.progress-row{
  display:flex;
  align-items:center;
  gap: 10px;
}

.progress-num{
  min-width: 32px;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  color: #a08060;
}

/* Scrubber */
.progress-slider{
  flex: 1;
  width: auto;
  margin-top: 0;
  height: 10px;
  accent-color: #c9a227;
}

.progress-slider::-webkit-slider-runnable-track{
  height: 4px;
  background: rgba(201,162,39,0.25);
  border-radius: 999px;
}

.progress-slider::-webkit-slider-thumb{
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  background: #c9a227;
  border: 2px solid rgba(26,16,8,0.9);
  border-radius: 50%;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

/* Scrollable area containing the text + status */
.train-scroll{
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: 86px; /* space for floating topbar */
  padding-bottom: 220px; /* space for floating controls */
}

.script-box{ background: #231508; border: 1px solid #5a3a10; border-radius: 10px; padding: 20px; min-height: 140px; }
.script-speaker{ font-family: 'Cinzel', serif; font-size: 0.78rem; color: #c9a227; letter-spacing: 1px; margin-bottom: 8px; }
.script-text{ font-size: 1.12rem; line-height: 1.7; color: #e8d5a3; }

/* Word highlighting while TTS is reading other roles */
.script-text .w{ padding: 0 1px; }
.script-text .w.active-word{
  color: #1a1008;
  background: #f0d060;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(201,162,39,0.35);
}

.script-text.stage-dir{ font-style: italic; color: #907050; font-size: 1rem; }
.script-text.your-turn{ color: #f0d060; }

/* Selection tint */
.script-text.your-turn::selection{ background: rgba(240,208,96,0.25); }

/* Masking layout for user lines */
.script-text.your-turn .w{
  display: inline-block;
  position: relative;
  padding: 0 1px;
  vertical-align: baseline;
}

/* Teach mode: active word highlight */
#scriptText .w.teach-active{
  outline: 2px solid #c9a227;
  border-radius: 999px;
  padding: 0 6px;
}

/* Status + heard */
.status-badge{ margin-top: 10px; display: inline-flex; align-items: center; justify-content: center; font-family:'Cinzel',serif; font-size:0.72rem; letter-spacing:0.8px; padding: 8px 12px; border-radius: 999px; border: 1px solid #5a3a10; background: rgba(46,27,8,0.55); color:#e8d5a3; }
.status-badge.idle{ opacity: 0.9; }
.status-badge.listening{ border-color:#c9a227; color:#f0d060; }
.status-badge.correct{ border-color:#5aa66a; color:#a8e6c1; }
.status-badge.incorrect{ border-color:#a03020; color:#ffb1a0; }

.heard-box{ display:none; background: rgba(46,27,8,0.55); border: 1px solid #3a2010; border-radius: 12px; padding: 12px; color:#e8d5a3; }
.heard-box.visible{ display:block; }

.prompt-hint{ display:none; background: rgba(46,27,8,0.55); border: 1px solid #3a2010; border-radius: 12px; padding: 12px; color:#a08060; }
.prompt-hint.visible{ display:block; }

/* Bottom controls block */
.train-controls{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  width: calc(100vw - (var(--pane-side-margin) * 2));
  max-width: var(--pane-max-width);
  z-index: 50;

  background: rgba(26,16,8,0.92);
  border: 1px solid #5a3a10;
  border-radius: 14px;
  padding: 12px;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
}

.transport-row{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 8px;
}

.icon-btn{
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid #5a3a10;
  background: rgba(46,27,8,0.65);
  color: #e8d5a3;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.icon-btn.primary{
  background: linear-gradient(135deg, #c9a227, #a07820);
  border-color: #c9a227;
  color: #1a1008;
  font-weight: 700;
}

.icon-btn:disabled{ opacity: 0.35; cursor: not-allowed; }
.icon-btn:hover:not(:disabled){ border-color:#c9a227; color:#c9a227; }
.icon-btn.primary:hover:not(:disabled){ opacity: 0.9; color:#1a1008; }

.learn-row{ margin-top: 10px; }
.learn-label{ color:#a08060; font-size: 0.95rem; margin-bottom: 6px; }
.learn-slider{ width: 100%; accent-color:#c9a227; }
.learn-ticks{ display:flex; justify-content: space-between; font-size: 0.62rem; color:#a08060; margin-top: 6px; }

.actions-row{ display:flex; gap: 10px; margin-top: 10px; }
.mini-btn{
  flex: 1;
  border: 1px solid #5a3a10;
  background: rgba(46,27,8,0.55);
  color: #e8d5a3;
  border-radius: 12px;
  padding: 10px 10px;
  cursor: pointer;
  font-size: 1rem;
}
.mini-btn:hover{ border-color:#c9a227; color:#c9a227; }
.mini-btn:disabled{ opacity: 0.35; cursor: not-allowed; }

@media (max-width: 420px){
  .icon-btn{ width: 44px; height: 44px; border-radius: 12px; }
  .train-controls{ padding: 10px; }
}
