* {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  background: #f6f7fb;
  color: #1f2330;
}

.top-bar {
  background: #2c3470;
  color: #fff;
  padding: 16px 24px;
}

.top-bar h1 { margin: 0 0 4px 0; font-size: 1.35rem; }
.top-bar p  { margin: 0; font-size: 0.88rem; opacity: 0.88; }

/* ── Controls bar ── */
.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 24px;
  border-bottom: 1px solid #d8dced;
  background: #fff;
  position: relative;
  z-index: 100;
}

.icon-buttons { margin-left: auto; display: flex; gap: 6px; }

.mode-toggle-btn {
  background: #fff;
  border: 1px solid #c8d0eb;
  color: #3844a5;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.mode-toggle-btn:hover { background: #edf0ff; filter: none; }
.mode-toggle-btn.active {
  background: #3844a5;
  border-color: #3844a5;
  color: #fff;
}

.icon-btn {
  background: none;
  border: 1px solid #c8d0eb;
  color: #3844a5;
  font-size: 1.2rem;
  padding: 6px 10px;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
}
.icon-btn:hover { background: #edf0ff; filter: none; }
.icon-btn.active { background: #edf0ff; border-color: #3844a5; }

select, button, textarea {
  border: 1px solid #c8d0eb;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.95rem;
}

button {
  background: #3844a5;
  color: #fff;
  border: 0;
  cursor: pointer;
}
button:hover { filter: brightness(1.06); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Overlay panel ── */
.overlay-panel {
  position: absolute;
  top: 100%;   /* anchored by JS to controls bar bottom */
  left: 0;
  width: 100%;
  z-index: 200;
  background: #fff;
  border-bottom: 1px solid #d8dced;
  box-shadow: 0 6px 24px rgba(44,52,112,0.13);
  max-height: 520px;
  overflow-y: auto;
  transition: opacity 0.15s;
}
.overlay-panel.hidden { display: none; }

/* Position the overlay below the controls bar */
.overlay-wrapper {
  position: relative;
}

.panel-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid #eef0f8;
  background: #f6f7fb;
}

.panel-back-btn {
  background: none;
  border: none;
  color: #3844a5;
  font-size: 0.95rem;
  padding: 4px 8px;
  cursor: pointer;
}
.panel-back-btn:hover { background: #edf0ff; filter: none; border-radius: 6px; }
.panel-back-btn.hidden { display: none; }

.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: #2c3470;
  flex: 1;
}

.panel-close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 1.1rem;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
}
.panel-close-btn:hover { background: #f0f0f0; filter: none; }

.panel-body { padding: 0; }

/* Panel views */
.pview { display: block; }
.pview.hidden { display: none; }

/* Navigation list (Jupyter-folder style) */
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid #f0f1fa;
  cursor: pointer;
  font-size: 0.97rem;
  transition: background 0.1s;
}
.nav-list li:hover { background: #f3f5ff; }
.nav-meta { color: #888; font-size: 0.9rem; }

/* Voice list */
.voice-list li { justify-content: flex-start; gap: 12px; }
.voice-list li.selected::after { content: "✓"; margin-left: auto; color: #3844a5; font-weight: 700; }

/* Pause page */
.pause-page {
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.pause-hint { margin: 0; color: #555; font-size: 0.92rem; text-align: center; max-width: 380px; }
.slider-wrap { display: flex; align-items: center; gap: 10px; }
.slider-wrap input[type="range"] {
  width: 220px;
  cursor: pointer;
  accent-color: #3844a5;
  border: none;
  padding: 0;
}
.slider-min, .slider-max { font-size: 0.82rem; color: #888; min-width: 20px; }
.pause-value-big {
  font-size: 2.2rem;
  font-weight: 700;
  color: #3844a5;
  letter-spacing: -0.02em;
}

/* SRS view */
.srs-section { padding: 16px 24px; border-bottom: 1px solid #f0f1fa; }
.srs-section h3 { margin: 0 0 10px; font-size: 1rem; color: #2c3470; }
.srs-vocab-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.srs-vocab-header h3 { margin: 0; }
.small-btn {
  background: none;
  border: 1px solid #c8d0eb;
  color: #3844a5;
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: 6px;
}
.small-btn:hover { background: #edf0ff; filter: none; }

/* ── Main layout: single column ── */
.layout {
  padding: 16px 24px 24px;
}

.panel {
  background: #fff;
  border: 1px solid #d8dced;
  border-radius: 14px;
  padding: 14px;
}
.panel h2 { margin: 0 0 10px 0; font-size: 1.1rem; }

.transcript-list {
  list-style: none;
  margin: 0 0 10px 0;
  padding: 0;
  max-height: 440px;
  overflow-y: auto;
  border: 1px solid #dde2f5;
  border-radius: 10px;
}
.transcript-list li {
  padding: 9px 10px;
  border-bottom: 1px solid #eef1fb;
  cursor: pointer;
}
.transcript-list li:hover { background: #f7f9ff; }
.line-user  { background: #eff6ff; }
.line-tutor { background: #fffdf4; }

.feedback-panel {
  background: #f7f8ff;
  border: 1px solid #dae0f8;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}
.feedback-panel h3 { margin: 0 0 8px 0; font-size: 0.95rem; }
#feedbackList { margin: 0; padding-left: 18px; }
#correctedSentence { margin: 8px 0 0; color: #3844a5; font-weight: 600; }

textarea { width: 100%; resize: vertical; background: #fff; }
#userInput { resize: none; overflow-y: hidden; }

.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.status { margin: 10px 0 0; font-size: 0.9rem; color: #4f5b7b; }

/* ── VAD indicator ── */
.vad-indicator {
  display: inline-block;
  margin: 6px 0 2px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.2s, color 0.2s;
}
.vad-idle       { background: #edf0ff; color: #5a6098; }
.vad-listening  { background: #d4f5e2; color: #1a7a45; animation: pulse 1s infinite; }
.vad-processing { background: #fff4d4; color: #8a6500; }
.vad-speaking   { background: #e0eeff; color: #1a4fa0; animation: pulse 1.4s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ── SRS panel elements ── */
.due-card {
  border: 1px solid #dde2f5;
  background: #f6f8ff;
  border-radius: 10px;
  min-height: 72px;
  padding: 10px;
  margin-bottom: 8px;
}
.grade-buttons {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}
.grade-buttons button { padding: 6px 0; }

.table-wrap {
  max-height: 240px;
  overflow: auto;
  border: 1px solid #dde2f5;
  border-radius: 10px;
}
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { border-bottom: 1px solid #eef1fb; padding: 7px 8px; text-align: left; }
