/* ============================================================
   调频电台 · DESIGN SYSTEM — style.css
   ============================================================ */

:root {
  /* === 调频电台 Design Tokens === */
  --paper: #F3ECDC;
  --paper-deep: #E9DFC3;
  --ink: #1F1B14;
  --ink-soft: #7A6E54;
  --wood: #251C13;
  --wood-light: #352A1B;
  --copper: #C16E3A;
  --copper-deep: #9C5429;
  --copper-pale: #E9C9AE;
  --teal: #5C8A72;
  --teal-deep: #3E6650;
  --red: #B23A2F;
  --amber: #C99A3C;
  --green: #5C8A4C;
  --led-bg: #16241D;
  --led-amber: #F0C277;
  --line: rgba(31, 27, 20, 0.14);
  --line-strong: rgba(31, 27, 20, 0.28);

  /* === Legacy aliases — keeps all functional classes working === */
  --bg-app: var(--paper-deep);
  --bg-card: var(--paper);
  --bg-card-hover: var(--paper);
  --border-color: var(--line-strong);
  --border-focus: var(--copper);
  --color-primary: var(--copper);
  --color-primary-hover: var(--copper-deep);
  --color-secondary: var(--teal);
  --color-accent: var(--teal);
  --color-warning: var(--amber);
  --text-main: var(--ink);
  --text-secondary: var(--ink-soft);
  --text-muted: var(--ink-soft);
  --text-contrast: var(--ink);
  --grad-primary: var(--copper);
  --grad-primary-hover: var(--copper-deep);
  --shadow-card: 0 2px 8px rgba(31, 27, 20, 0.10);
  --shadow-focus: 0 0 0 3px rgba(193, 110, 58, 0.20);
  --border-radius-lg: 8px;
  --border-radius-md: 4px;
  --border-radius-sm: 4px;
  --waveform-height: clamp(80px, 10vh, 150px);
  --transition-smooth: all 0.25s ease;
}

/* ============================================================
   BASE RESET
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  background-color: #D9D0B6;
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   LAYOUT WRAPPER
   ============================================================ */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

/* ============================================================
   APP HEADER (shared nav bar — all pages)
   ============================================================ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 30px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  /* flatten the old card look */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  box-shadow: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* old image logo hidden; SVG logo used instead */
.brand-logo { display: none; }

/* old h1 style */
.brand h1 {
  font-family: 'Fraunces', serif;
  font-size: 18.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0;
  text-transform: none;
}
.brand h1 span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  font-weight: 400;
  text-transform: none;
  margin-left: 0;
  display: block;
}

.brand-name {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 18.5px;
  color: var(--ink);
}
.brand-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ============================================================
   NAV BUTTONS (.navbtn replaces the old header button styles)
   ============================================================ */
.header-controls { display: flex; align-items: center; gap: 8px; }
.top-actions     { display: flex; gap: 8px; }

/* Base navbtn — also applied to .btn-my-profile and .btn-logout-header
   so JS listeners that use those classes still work */
.navbtn,
.btn-my-profile,
.btn-logout-header {
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  padding: 8px 15px;
  border-radius: 99px;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
  text-decoration: none;
  box-shadow: none;
  transform: none;
}
.navbtn:hover, .btn-my-profile:hover { color: var(--ink); transform: none; box-shadow: none; }

/* Solid / primary button (logout, main CTA) */
.navbtn.solid,
.btn-logout-header {
  background: var(--copper);
  color: #2A150A;
  font-weight: 500;
}
.navbtn.solid:hover,
.btn-logout-header:hover {
  background: var(--copper-deep);
  color: #2A150A;
  transform: none;
  box-shadow: none;
}

/* Hide old FA icons inside header buttons */
.btn-my-profile i,
.btn-logout-header i { display: none; }

/* ============================================================
   CARD
   ============================================================ */
.card {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-card); }

.card-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.5px;
  color: var(--ink-soft);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}
.card-label i { color: var(--copper); }

/* ============================================================
   MAIN GRID
   ============================================================ */
.main-container {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
  gap: clamp(16px, 1.8vw, 24px);
  flex-grow: 1;
  align-items: start;
}
@media (max-width: 1180px) { .main-container { grid-template-columns: 1fr; } }

.pane { display: flex; flex-direction: column; gap: clamp(16px, 1.4vw, 20px); min-width: 0; }

/* ============================================================
   CUSTOM DROPDOWN
   ============================================================ */
.dropdown-card { z-index: 100; overflow: visible !important; }

.custom-select-wrapper { position: relative; width: 100%; user-select: none; }

.custom-select-display {
  width: 100%;
  padding: 11px 40px 11px 14px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--border-radius-md);
  color: var(--ink);
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 12.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition-smooth);
  position: relative;
}
.custom-select-display:hover             { border-color: var(--copper); }
.custom-select-display.open              { border-color: var(--copper); box-shadow: var(--shadow-focus); }
.custom-select-display.open .select-arrow{ border-top-color: var(--copper); transform: translateY(-50%) rotate(180deg); }

.custom-select-content  { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 15px; }
.custom-select-text     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--border-radius-md);
  box-shadow: 0 8px 24px rgba(31, 27, 20, 0.14);
  z-index: 100;
  max-height: 320px;
  overflow-y: auto;
  display: none;
}
.custom-select-dropdown.show { display: block; }

.custom-select-list { list-style: none; padding: 6px 0; margin: 0; }

.custom-option {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 12.5px;
  color: var(--ink);
  transition: var(--transition-smooth);
}
.custom-option:hover    { background: var(--paper-deep); }
.custom-option.selected {
  background: rgba(193, 110, 58, 0.08);
  color: var(--copper-deep);
  font-weight: 600;
  border-left: 3px solid var(--copper);
}

.custom-option-left    { display: flex; align-items: center; gap: 8px; }
.custom-option-index   {
  color: var(--copper-deep);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: rgba(193, 110, 58, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(193, 110, 58, 0.2);
}
.custom-option-duration { color: var(--ink-soft); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.custom-option-score    { font-weight: 700; font-family: 'JetBrains Mono', monospace; font-size: 12px; }

.score-emerald { color: var(--teal-deep); }
.score-amber   { color: var(--amber); }
.score-red     { color: var(--red); }
.score-none    { color: var(--ink-soft); font-weight: 400; }

.select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--ink-soft);
  transition: var(--transition-smooth);
}

/* ============================================================
   VIDEO AREA
   ============================================================ */
.video-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.video-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  flex: 0 0 auto;
  min-height: 0;
  max-height: min(62vh, 720px);
  background: #000;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

#main-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  background: #000;
}

.viewport-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--copper-pale);
  text-align: center;
  padding: 20px;
  z-index: 1;
  width: 100%;
}
.placeholder-icon { font-size: 38px; color: var(--copper-pale); opacity: 0.5; }
.viewport-placeholder p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--copper-pale);
  opacity: 0.6;
  letter-spacing: 0.5px;
}

/* ============================================================
   ACTION BAR / MAIN BUTTON
   ============================================================ */
.action-bar { display: flex; }

.btn {
  width: 100%;
  padding: 12px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  border-radius: var(--border-radius-md);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition-smooth);
}
.btn-primary {
  background: var(--copper);
  color: #2A150A;
  box-shadow: none;
}
.btn-primary:hover:not(:disabled) { background: var(--copper-deep); transform: none; box-shadow: none; }
.btn-primary:active:not(:disabled){ transform: none; }
.btn-primary:disabled {
  background: var(--paper-deep);
  color: var(--ink-soft);
  cursor: not-allowed;
  border: 1px solid var(--line-strong);
  opacity: 0.7;
}

/* ============================================================
   RIGHT PANE: WAVEFORM
   ============================================================ */
.waveform-card { height: auto; display: flex; flex-direction: column; min-height: 480px; }

.waveform-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}
.waveform-header .card-label { margin-bottom: 0; }

.waveform-controls {
  display: flex; align-items: center; gap: 12px;
  opacity: 0.4; pointer-events: none;
  transition: var(--transition-smooth);
}
.waveform-controls.active { opacity: 1; pointer-events: auto; }

.control-btn {
  background: var(--paper-deep);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition-smooth);
}
.control-btn:hover { background: var(--copper); color: #2A150A; border-color: var(--copper); transform: none; }

.zoom-slider-container {
  display: flex; align-items: center; gap: 8px;
  background: var(--paper-deep);
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
}
.zoom-slider-container i { font-size: 11px; color: var(--ink-soft); }

#wave-zoom-slider {
  width: 80px; height: 3px;
  background: var(--line-strong);
  border-radius: 2px; outline: none; cursor: pointer; appearance: none;
}
#wave-zoom-slider::-webkit-slider-thumb {
  appearance: none; width: 11px; height: 11px;
  border-radius: 50%; background: var(--copper); cursor: pointer;
}
#wave-zoom-slider::-webkit-slider-thumb:hover { background: var(--copper-deep); }

/* Waveform viewport container */
.waveform-viewport {
  position: relative; width: 100%; flex-grow: 1;
  background: var(--paper);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--line-strong);
  display: flex; flex-direction: column; justify-content: space-evenly;
  min-height: 180px; overflow: hidden;
}

.waveform-workspace-row {
  display: none; align-items: center; gap: 20px;
  width: 100%; padding: 4px 16px 6px;
  flex-grow: 1; position: relative;
}
#waveform-workspace { flex-direction: column; align-items: stretch; justify-content: center; gap: 0; }
.waveform-row-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  min-width: 0;
}

#user-waveform-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.waveform-meta-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px 4px; opacity: 0; pointer-events: none;
  transition: var(--transition-smooth); width: 100%; margin-top: 4px;
}
.waveform-meta-row.active { opacity: 1; pointer-events: auto; }

.play-large-btn {
  background: var(--copper); border: none; color: #2A150A;
  width: 34px; height: 34px; min-width: 34px;
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; transition: var(--transition-smooth);
  box-shadow: none;
}
.play-large-btn:hover { background: var(--copper-deep); transform: none; box-shadow: none; }
.play-large-btn i        { margin-left: 2px; }
.play-large-btn i.fa-pause { margin-left: 0; }

#waveform, #user-waveform {
  width: 100%; height: var(--waveform-height);
  padding: 10px 0; display: none;
  overflow: hidden; flex-grow: 1; min-width: 0;
}

/* Scrollbar for zoomed waveform */
#waveform > div::-webkit-scrollbar,
#user-waveform > div::-webkit-scrollbar { height: 4px; }
#waveform > div::-webkit-scrollbar-track,
#user-waveform > div::-webkit-scrollbar-track { background: var(--paper-deep); border-radius: 2px; }
#waveform > div::-webkit-scrollbar-thumb,
#user-waveform > div::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }
#waveform > div::-webkit-scrollbar-thumb:hover,
#user-waveform > div::-webkit-scrollbar-thumb:hover { background: var(--copper); }
#waveform > div, #user-waveform > div {
  padding-bottom: 0 !important; overflow-y: hidden !important; position: relative !important;
}

#extracted-audio { display: none; }

/* Sentence words container */
.waveform-words-container {
  position: relative; display: flex; flex-wrap: wrap;
  justify-content: center; padding: 24px 20px 14px;
  width: 100%; z-index: 10;
  background: var(--paper); border-bottom: 1px solid var(--line);
}

.waveform-translation-container {
  display: flex; justify-content: center; align-items: center;
  padding: 6px 20px 16px; width: 100%; z-index: 10;
  background: var(--paper); border-bottom: 1px solid var(--line);
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 15px; font-weight: 500;
  color: var(--copper-deep); text-align: center; line-height: 1.6;
}

/* Word labels (karaoke highlight) */
.word-label {
  font-family: 'Inter', sans-serif;
  font-size: 22px; font-weight: 600; color: var(--ink);
  background: transparent; border: none;
  padding: 1px 3px; margin: 1px 2px;
  border-radius: 3px; white-space: nowrap;
  cursor: pointer; transition: var(--transition-smooth);
}
.word-label:hover { background: var(--paper-deep); }
.word-label.highlighted {
  color: #2A150A; background: var(--copper);
  transform: scale(1.06); box-shadow: none; z-index: 15;
}

/* Waveform loading overlay */
.waveform-overlay {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(243, 236, 220, 0.93);
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; z-index: 5; padding: 30px; text-align: center;
}

.spinner {
  width: 40px; height: 40px;
  border: 2px solid var(--paper-deep);
  border-radius: 50%;
  border-top-color: var(--copper);
  border-right-color: var(--teal);
  animation: spin 1s infinite linear;
}

/* Voice-analyzer loader (complex animation) */
.voice-analyzer-loader {
  position: relative; width: 140px; height: 140px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.loader-ring { position: absolute; border-radius: 50%; border: 2px dashed transparent; }
.loader-ring.outer {
  width: 130px; height: 130px;
  border-top-color: var(--copper); border-bottom-color: var(--teal);
  opacity: 0.6; animation: spin-clockwise 6s linear infinite;
}
.loader-ring.inner {
  width: 100px; height: 100px;
  border-left-color: var(--teal); border-right-color: var(--copper);
  opacity: 0.8; animation: spin-counter-clockwise 4s linear infinite;
}
.loader-core {
  width: 68px; height: 68px; background: var(--copper);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  z-index: 2; animation: core-pulse 2s ease-in-out infinite alternate;
}
.loader-core i { font-size: 26px; color: #2A150A; animation: mic-scale 2s ease-in-out infinite; }

.loader-wave-bars {
  position: absolute; bottom: -12px;
  display: flex; align-items: flex-end; gap: 4px; height: 28px; z-index: 3;
}
.loader-wave-bars .bar {
  width: 3px; background: var(--copper); border-radius: 2px;
  transform-origin: bottom; animation: bounce-bar 1.2s ease-in-out infinite;
}
.loader-wave-bars .bar:nth-child(1){ animation-delay:0.1s; height:8px; }
.loader-wave-bars .bar:nth-child(2){ animation-delay:0.4s; height:14px; }
.loader-wave-bars .bar:nth-child(3){ animation-delay:0.2s; height:20px; }
.loader-wave-bars .bar:nth-child(4){ animation-delay:0.6s; height:26px; }
.loader-wave-bars .bar:nth-child(5){ animation-delay:0.3s; height:11px; }
.loader-wave-bars .bar:nth-child(6){ animation-delay:0.7s; height:22px; }
.loader-wave-bars .bar:nth-child(7){ animation-delay:0.5s; height:17px; }
.loader-wave-bars .bar:nth-child(8){ animation-delay:0.8s; height:12px; }
.loader-wave-bars .bar:nth-child(9){ animation-delay:0.2s; height:8px; }

#loader-message {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--ink-soft);
  margin-top: 8px; letter-spacing: 0.5px;
}

.loader-progress-container {
  width: 80%; max-width: 220px; height: 4px;
  background: var(--paper-deep); border-radius: 4px;
  overflow: hidden; border: 1px solid var(--line-strong); margin-top: 14px;
}
.loader-progress-bar { width: 0%; height: 100%; background: var(--copper); border-radius: 4px; }

/* ============================================================
   EQ BARS (New component — replaces purple static waveform)
   ============================================================ */
.eq { display: flex; align-items: flex-end; gap: 4px; height: 48px; justify-content: center; }
.eq span { width: 4px; border-radius: 2px; background: var(--copper); transform-origin: bottom; }
.eq.mine span { background: var(--teal); }

@keyframes eqA { 0%,100%{ height:18%; } 50%{ height:88%; } }
@keyframes eqB { 0%,100%{ height:55%; } 50%{ height:20%; } }
@keyframes eqC { 0%,100%{ height:30%; } 50%{ height:95%; } }

/* ============================================================
   SCORE BADGE / GAUGE AREA
   ============================================================ */
.score-badge-footer {
  display: flex; justify-content: center;
  width: 100%; margin-top: 0;
  transition: all 0.3s ease;
}
.score-badge-footer:has(.score-badge-container:not([style*="display: none"])) {
  margin-top: 12px; margin-bottom: 8px; min-height: 80px;
}
.score-badge-footer:has(.score-badge-container.folded:not([style*="display: none"])) {
  min-height: 40px;
}

.score-badge-container {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  padding: 20px 22px 18px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-card);
  transition: all 0.3s ease;
  width: 100%; text-align: center;
}
.score-badge-container.folded { gap: 0; }

.score-row {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; width: 100%;
}

.fold-toggle-icon { font-size: 13px; color: var(--ink-soft); transition: var(--transition-smooth); cursor: pointer; }
.score-badge-container.folded .fold-toggle-icon { transform: rotate(180deg); }

.score-explanation {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 13px; line-height: 1.75; color: var(--ink-soft);
  white-space: pre-line; max-height: 2000px; opacity: 1;
  transition: all 0.35s ease; overflow: hidden;
  width: 100%; text-align: left;
}
.score-badge-container.folded .score-explanation {
  max-height: 0; opacity: 0; margin: 0; padding: 0; pointer-events: none;
}

.feedback-table-title {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600;
  color: var(--ink-soft); margin-top: 14px; margin-bottom: 8px;
  text-align: left; width: 100%; text-transform: uppercase; letter-spacing: 1px;
  font-style: normal;
}

.feedback-table {
  width: 100%; border-collapse: collapse; margin: 4px 0 6px;
  font-size: 13px; text-align: left; font-style: normal;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--border-radius-md);
  overflow: hidden;
}
.feedback-table th {
  background: var(--paper-deep); color: var(--ink-soft);
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600;
  padding: 8px 12px; border-bottom: 1px solid var(--line-strong);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.feedback-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  color: var(--ink); font-family: 'Noto Sans SC', sans-serif;
  line-height: 1.65; vertical-align: top;
}
.feedback-table tr:last-child td { border-bottom: none; }
.feedback-table tr:hover { background: var(--paper-deep); }

.score-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.5px; color: var(--ink-soft);
}
.score-val {
  font-family: 'Fraunces', serif;
  font-size: 52px; font-weight: 600; color: var(--copper-deep); line-height: 1;
}

/* Score level classes set by JS */
.score-badge-container.excellent { border-color: var(--teal); }
.score-badge-container.excellent .score-val { color: var(--teal-deep); }
.score-badge-container.good      { border-color: var(--amber); }
.score-badge-container.good .score-val      { color: var(--amber); }
.score-badge-container.poor      { border-color: var(--red); }
.score-badge-container.poor .score-val      { color: var(--red); }

.score-summary     { width: 100%; text-align: center; font-family: 'Noto Sans SC', sans-serif; font-size: 14px; color: var(--ink-soft); padding: 2px 0 6px; }
.score-metrics-strip{ width: 100%; text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-soft); line-height: 1.6; }
.feedback-dimension-cell { width: 100px; color: var(--copper-deep) !important; font-weight: 600; white-space: normal; }
.feedback-detail-cell    { color: var(--ink); word-break: break-word; }

/* ===== 调频电台 · 仪表盘得分卡 ===== */
.gauge-card { width: 100%; }

.gauge-flex {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
  justify-content: center;
}

.gauge-readout {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  flex: 1;
  min-width: 190px;
}

.ro-cell {
  background: var(--paper-deep);
  border-radius: 4px;
  padding: 9px 12px;
}

.ro-cell .k {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ro-cell .v {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16.5px;
  color: var(--copper-deep);
  margin-top: 3px;
  font-weight: 600;
}

/* 仪表盘 score-explanation 区域重置 */
.gauge-card .score-explanation {
  white-space: normal !important;
  text-align: left;
  padding: 0;
}

/* 反馈报告列表 */
.report-list {
  margin-top: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  overflow: hidden;
}

.report-row {
  display: flex;
  gap: 14px;
  padding: 12px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.report-row:last-child { border-bottom: none; }
.report-row:hover { background: var(--paper-deep); }

.report-row .dim {
  font-family: 'Noto Sans SC', sans-serif;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--ink);
  min-width: 84px;
  flex-shrink: 0;
  padding-left: 11px;
  border-left: 3px solid var(--copper);
  line-height: 1.5;
}

.report-row.ok .dim { border-left-color: var(--teal); }

.report-row .note {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.65;
}

.meta-item  { display: flex; align-items: center; gap: 6px; font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.meta-label { color: var(--ink-soft); }
#wave-duration, #wave-current-time { color: var(--ink); font-weight: 600; font-family: 'JetBrains Mono', monospace; }

/* ============================================================
   RECORDING / VOICE INPUT
   ============================================================ */
.user-waveform-placeholder {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; color: var(--ink-soft);
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  border: 1px dashed var(--line-strong); border-radius: var(--border-radius-md);
  padding: 10px 16px; background: var(--paper-deep);
  width: 100%; height: calc(var(--waveform-height) + 20px);
  transition: var(--transition-smooth); text-align: center;
}
.user-waveform-placeholder i { font-size: 18px; color: var(--teal); opacity: 0.8; }

.recording-action-container {
  display: none; align-items: center; justify-content: center;
  gap: 20px; margin: 0; padding: 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  width: 100%;
}

.record-mic-btn {
  background: var(--red); border: none; color: #fff;
  width: 56px; height: 56px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; transition: var(--transition-smooth); position: relative;
  box-shadow: none;
}
.record-mic-btn:hover:not(:disabled) { background: #8C2820; transform: scale(1.05); box-shadow: none; }
.record-mic-btn:active:not(:disabled){ transform: scale(0.97); }
.record-mic-btn:disabled {
  background: var(--paper-deep); color: var(--ink-soft);
  cursor: not-allowed; border: 1px solid var(--line-strong);
  box-shadow: none; opacity: 0.6;
}
.record-mic-btn.recording {
  background: var(--red);
  animation: record-pulse 1.5s infinite;
  box-shadow: none;
}
.record-mic-btn.recording i           { animation: mic-shake 0.5s infinite alternate; }
.record-mic-btn.countdown-active {
  background: var(--red); color: #fff;
  font-weight: 700; font-size: 22px; cursor: wait;
  animation: button-pulse 1s infinite alternate;
}

.playback-toggle-container {
  display: flex; align-items: center; gap: 12px;
  background: var(--paper-deep);
  border: 1px solid var(--line-strong);
  padding: 8px 16px; border-radius: var(--border-radius-md);
  transition: var(--transition-smooth);
}
.playback-toggle-container:hover { border-color: var(--copper); }
.toggle-label { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-soft); }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 44px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--line-strong); transition: .3s; border-radius: 22px; border: none;
}
.slider:before {
  position: absolute; content: ""; height: 14px; width: 14px;
  left: 4px; bottom: 4px; background: var(--paper); transition: .3s; border-radius: 50%;
}
input:checked + .slider             { background: var(--copper); border-color: transparent; }
input:checked + .slider:before      { transform: translateX(22px); background: #fff; }
input:focus + .slider               { box-shadow: 0 0 0 2px rgba(193,110,58,0.25); }

/* Active recording states */
#user-waveform-workspace.recording-active { border-color: rgba(178, 58, 47, 0.2) !important; }

.user-waveform-placeholder.recording {
  border: 1px solid rgba(178, 58, 47, 0.45) !important;
  background: rgba(178, 58, 47, 0.03) !important;
  color: var(--red) !important;
  animation: recordingGlow 2s infinite alternate;
}
.user-waveform-placeholder.recording i { color: var(--red) !important; animation: recordingPulse 1.5s infinite alternate; }
.user-waveform-placeholder.recording span { font-weight: 600 !important; letter-spacing: 0.5px !important; }

.rec-dot {
  display: inline-block; width: 7px; height: 7px; background: var(--red);
  border-radius: 50%; margin-right: 6px; vertical-align: middle;
  animation: dotPulse 1s infinite alternate;
}

/* ============================================================
   COLLAPSIBLE SECTIONS (main.html waveform area)
   ============================================================ */
.collapsible-section {
  width: 100%; background: transparent; transition: var(--transition-smooth);
}
.collapsible-section:last-of-type { border-bottom: none; }

.section-toggle-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px;
  background: var(--paper-deep);
  cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--line);
  transition: var(--transition-smooth);
}
.section-toggle-header:hover { background: var(--paper); }

.section-header-title {
  display: flex; align-items: center; gap: 8px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--ink-soft); transition: var(--transition-smooth);
}
.section-toggle-header:hover .section-header-title { color: var(--ink); }

.section-icon { color: var(--copper); font-size: 12px; transition: var(--transition-smooth); }
.section-toggle-header:hover .section-icon { transform: scale(1.1); color: var(--copper-deep); }

.section-fold-icon { font-size: 11px; color: var(--ink-soft); transition: var(--transition-smooth); }
.section-toggle-header:hover .section-fold-icon { color: var(--ink-soft); }
.collapsible-section.folded .section-fold-icon { transform: rotate(-180deg); }

.collapsible-section.folded .waveform-translation-container,
.collapsible-section.folded .waveform-workspace-row { display: none !important; }
.collapsible-section .waveform-translation-container { border-bottom: none; background: transparent; }

/* ============================================================
   COUNTDOWN OVERLAY
   ============================================================ */
.countdown-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(233, 223, 195, 0.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 100; opacity: 0; transition: opacity 0.3s ease;
  pointer-events: all; border-radius: var(--border-radius-md);
}
.countdown-overlay.show { opacity: 1; }
.words-countdown-overlay { background: transparent !important; backdrop-filter: none !important; pointer-events: none; }

.countdown-number {
  font-family: 'Fraunces', serif;
  font-size: 72px; font-weight: 600; color: var(--copper-deep);
  animation: countdownPulse 1s infinite ease-out; line-height: 1;
  filter: none;
}
.countdown-message {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 600; color: var(--ink-soft);
  margin-top: 8px; letter-spacing: 1.5px; text-transform: uppercase; line-height: 1;
}

/* ============================================================
   MODALS
   ============================================================ */
.premium-modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(31, 27, 20, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.premium-modal-overlay.active { opacity: 1; pointer-events: auto; }

.premium-modal-box {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--border-radius-lg);
  padding: 32px; width: 90%; max-width: 400px; text-align: center;
  box-shadow: 0 20px 40px rgba(31, 27, 20, 0.18);
  transform: scale(0.88) translateY(10px);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.premium-modal-box.has-qrcode { max-width: 560px; }
.premium-modal-overlay.active .premium-modal-box { transform: scale(1) translateY(0); }
.premium-modal-box.warning { border-color: rgba(178, 58, 47, 0.3); }

.premium-modal-icon {
  width: 52px; height: 52px; background: rgba(178, 58, 47, 0.1);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; color: var(--red); font-size: 24px;
  animation: pulse-red 2s infinite alternate;
}
.premium-modal-title  { font-family: 'Fraunces', serif; font-size: 18px; font-weight: 600; color: var(--ink); margin-bottom: 14px; }
.premium-modal-body   { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 24px; margin-bottom: 24px; text-align: left; }
.premium-modal-box:not(.has-qrcode) .premium-modal-body { text-align: center; }
.premium-modal-message{ font-family: 'Noto Sans SC', sans-serif; font-size: 14px; color: var(--ink-soft); line-height: 1.65; flex: 1; }
.premium-modal-qrcode {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: var(--paper-deep); border: 1px solid var(--line-strong);
  padding: 14px; border-radius: var(--border-radius-md);
}
.premium-modal-qrcode img   { width: 160px; height: 160px; object-fit: contain; border-radius: 4px; }
.premium-modal-qrcode span  { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--ink-soft); }

.premium-modal-btn {
  background: var(--copper); color: #2A150A; border: none;
  padding: 10px 24px; font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 600; border-radius: var(--border-radius-md);
  cursor: pointer; transition: var(--transition-smooth);
}
.premium-modal-btn:hover { background: var(--copper-deep); transform: none; }
.premium-modal-btn:active { transform: none; }

/* ============================================================
   RADIO PAGE STATUS / EQUALIZER
   ============================================================ */
.status-badge {
  background: var(--paper-deep);
  border: 1px solid var(--line-strong);
  padding: 6px 14px; border-radius: 20px;
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px;
  color: var(--ink-soft); letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none; transition: all 0.25s ease;
}
.status-badge:hover  { border-color: var(--copper); }
.status-badge.active { border-color: var(--copper); background: var(--paper); }

.status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--teal);
  transition: background-color 0.3s, box-shadow 0.3s;
}
.status-dot.playing { background: var(--teal);   box-shadow: 0 0 6px var(--teal); }
.status-dot.paused  { background: var(--amber);  box-shadow: 0 0 6px var(--amber); }
.status-dot.loading { background: var(--copper); box-shadow: 0 0 6px var(--copper); }
.status-dot.active  { animation: pulse 1.5s infinite alternate; }

.equalizer-container { display: flex; align-items: flex-end; gap: 3px; height: 28px; }
.equalizer-bar {
  width: 4px; height: 28px; background: var(--copper);
  border-radius: 2px; transform-origin: bottom;
  transform: scaleY(0.125); transition: transform 0.1s ease;
}
.equalizer-container.playing .equalizer-bar              { animation: bounce 0.8s ease-in-out infinite alternate; }
.equalizer-container.playing .equalizer-bar:nth-child(2) { animation-delay: 0.15s; }
.equalizer-container.playing .equalizer-bar:nth-child(3) { animation-delay: 0.30s; }
.equalizer-container.playing .equalizer-bar:nth-child(4) { animation-delay: 0.45s; }
.equalizer-container.playing .equalizer-bar:nth-child(5) { animation-delay: 0.60s; }
.equalizer-container.playing .equalizer-bar:nth-child(6) { animation-delay: 0.75s; }
.equalizer-container.playing .equalizer-bar:nth-child(7) { animation-delay: 0.90s; }

.word-span {
  font-family: 'Inter', sans-serif;
  font-size: clamp(26px, 2.8vw, 38px); font-weight: 500; color: var(--ink);
  background: transparent; padding: 0 3px; margin: 0;
  border-radius: 3px; line-height: 1.1;
  transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer;
}
.word-span:hover     { background: var(--paper-deep); }
.word-span.highlighted { color: #2A150A; background: var(--copper); transform: scale(1.06); box-shadow: none; }

/* ============================================================
   SYSTEM STATUS CHIP (compat, mostly unused)
   ============================================================ */
.system-status      { display: flex; align-items: center; gap: 8px; background: rgba(92,138,114,0.08); padding: 5px 10px; border-radius: 20px; border: 1px solid rgba(92,138,114,0.2); }
.status-indicator   { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.status-indicator.active { animation: pulse 1.5s infinite alternate; }
.status-text        { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--teal); }

/* ============================================================
   MISC COMPAT
   ============================================================ */
.btn-logout:hover   { color: var(--red) !important; }
.user-profile:hover { border-color: rgba(193, 110, 58, 0.3) !important; }

/* ============================================================
   KEYFRAME ANIMATIONS
   ============================================================ */
@keyframes spin               { 100%{ transform: rotate(360deg); } }
@keyframes spin-clockwise     { 100%{ transform: rotate(360deg); } }
@keyframes spin-counter-clockwise { 100%{ transform: rotate(-360deg); } }
@keyframes core-pulse         { 0%{ transform:scale(1); } 100%{ transform:scale(1.06); } }
@keyframes mic-scale          { 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.1); } }
@keyframes bounce-bar         { 0%,100%{ transform:scaleY(1); } 50%{ transform:scaleY(4); } }
@keyframes bounce             { 0%{ transform:scaleY(0.15); } 100%{ transform:scaleY(1); } }
@keyframes record-pulse       { 0%{ transform:scale(1); box-shadow:0 0 0 0 rgba(178,58,47,0.6); } 70%{ transform:scale(1.04); box-shadow:0 0 0 12px rgba(178,58,47,0); } 100%{ transform:scale(1); } }
@keyframes mic-shake          { 0%{ transform:rotate(-3deg); } 100%{ transform:rotate(3deg); } }
@keyframes dotPulse           { 0%{ opacity:0.4; transform:scale(0.8); } 100%{ opacity:1; transform:scale(1.2); } }
@keyframes countdownPulse     { 0%{ transform:scale(0.6); opacity:0; } 20%{ transform:scale(1.05); opacity:1; } 80%{ transform:scale(1); opacity:1; } 100%{ transform:scale(1.2); opacity:0; } }
@keyframes recordingGlow      { 0%{ border-color:rgba(178,58,47,0.2); } 100%{ border-color:rgba(178,58,47,0.5); } }
@keyframes recordingPulse     { 0%{ transform:scale(0.95); opacity:0.7; } 100%{ transform:scale(1.05); opacity:1; } }
@keyframes pulse              { 0%{ transform:scale(0.95); opacity:0.7; } 100%{ transform:scale(1.05); opacity:1; } }
@keyframes heartbeat          { 0%,80%,100%{ transform:scale(1); } 20%{ transform:scale(1.08); } 60%{ transform:scale(1.1); } }
@keyframes pulse-red          { 0%{ transform:scale(0.95); box-shadow:0 0 0 0 rgba(178,58,47,0.4); } 100%{ transform:scale(1.04); box-shadow:0 0 0 8px rgba(178,58,47,0); } }
@keyframes button-pulse       { 0%{ transform:scale(1); } 100%{ transform:scale(1.05); } }
@keyframes fadeIn             { from{ opacity:0; } to{ opacity:1; } }
@keyframes slideUp            { from{ opacity:0; transform:translateY(20px); } to{ opacity:1; transform:translateY(0); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  :root { --waveform-height: 70px; }
  .app-wrapper { padding: 12px; }
  .app-header  {
    padding: 14px 16px;
    gap: 14px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .header-controls {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .card        { padding: 14px; }
  .btn         { padding: 12px 16px; font-size: 13px; }
  .navbtn, .btn-my-profile, .btn-logout-header {
    min-width: 0;
    justify-content: center;
    padding: 10px 8px;
    font-size: 12px;
  }
  .video-viewport { max-height: none; }
  .waveform-card { min-height: auto; }
  .waveform-header {
    flex-direction: column;
    align-items: stretch;
  }
  .waveform-controls {
    width: 100%;
    justify-content: space-between;
  }
  .zoom-slider-container {
    width: 100%;
    justify-content: center;
  }
  .waveform-workspace-row {
    padding: 8px 12px 10px;
    gap: 12px;
  }
  .waveform-row-inner { gap: 12px; }
  .recording-action-container { padding: 12px 0; }
  .score-badge-container { padding: 14px; }
  .score-row {
    gap: 8px;
    flex-wrap: wrap;
  }
  .score-val { font-size: 44px; }
  .custom-select-display {
    align-items: flex-start;
    padding-right: 42px;
  }
  .custom-select-text {
    white-space: normal;
    line-height: 1.4;
  }
  .word-span { font-size: clamp(20px, 5.5vw, 28px); }
  .word-label    { font-size: 18px; }
}
@media (max-width: 480px) {
  .app-wrapper { padding: 10px; }
  .main-container { gap: 14px; }
  .header-controls { grid-template-columns: 1fr; }
  .btn-my-profile, .btn-logout-header { width: 100%; }
  .brand-name { font-size: 16px; }
  .brand-sub  { display: none; }
  .brand h1   { font-size: 16px; }
  .brand h1 span { display: none; }
  .waveform-meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .feedback-table {
    display: block;
    overflow-x: auto;
  }
}
