/* ===== 表达训练 - Web 版 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

button, input, select, textarea, .subtitle-scroll, .feedback-content, .modal-body {
  font-family: inherit;
}

.hidden { display: none !important; }

/* ===== 三列布局 ===== */
.layout {
  display: grid;
  grid-template-columns: 200px 1fr 280px;
  height: 100vh;
  height: 100dvh;
  gap: 0;
}

/* 左栏 */
.panel-left {
  padding: 60px 16px 16px;
  border-right: 1px solid #1a1a1a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 右栏 */
.panel-right {
  padding: 60px 16px 16px;
  border-left: 1px solid #1a1a1a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-title {
  font-size: 13px;
  color: #888;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #222;
}

.btn-sm {
  padding: 3px 8px;
  font-size: 11px;
  border: 1px solid #333;
  border-radius: 4px;
  background: #1a1a1a;
  color: #aaa;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-sm:hover {
  background: #333;
  color: #fff;
  border-color: #E5007E;
}

.subtitle-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px 0;
  flex-shrink: 0;
}

.subtitle-topbar-right {
  display: flex;
  gap: 4px;
}

.btn-paste-top {
  background: #1a1a1a;
  border-color: #444;
  color: #ccc;
  padding: 5px 12px;
  font-size: 12px;
}

.btn-paste-top:hover {
  border-color: #E5007E;
  color: #fff;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* 左栏标签、颜色图例与训练历史 */
.left-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid #222; flex-shrink: 0; }
.left-tab { border: 0; border-radius: 6px; padding: 7px 5px; background: transparent; color: #666; font-size: 12px; cursor: pointer; }
.left-tab:hover { color: #fff; background: #151515; }
.left-tab.active { color: #fff; background: #222; }
.left-panel-content { min-height: 0; padding-top: 8px; }
.color-legend { margin-top: 18px; padding-top: 12px; border-top: 1px solid #1a1a1a; display: grid; gap: 8px; }
.legend-title { color: #555; font-size: 11px; margin-bottom: 2px; }
.legend-item { display: flex; align-items: center; gap: 8px; color: #777; font-size: 12px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.legend-filler { background: #ff6b6b; }
.legend-hedge { background: #ffa94d; }
.legend-vague { background: #ffd43b; }
.legend-emotion { background: #b197fc; }
.history-panel { flex: 1; overflow: hidden; }
.history-list { height: 100%; overflow-y: auto; padding-right: 2px; }
.history-row { position: relative; }
.history-item { width: 100%; text-align: left; border: 0; border-bottom: 1px solid #1a1a1a; background: transparent; color: #ccc; padding: 11px 26px 11px 4px; cursor: pointer; }
.history-item:hover { background: #111; }
.history-title { display: block; color: #eee; font-size: 12px; line-height: 1.4; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.history-time { display: block; color: #555; font-size: 10px; margin-top: 4px; }
.history-meta { display: block; margin-top: 6px; color: #777; font-size: 10px; }
.history-delete { position: absolute; top: 9px; right: 2px; border: 0; background: transparent; color: #444; padding: 3px; cursor: pointer; }
.history-delete:hover { color: #ff6b6b; }
.history-empty { color: #444; text-align: center; font-size: 12px; padding: 40px 8px; }

/* 统计 */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}
.stat-label { font-size: 13px; color: #666; }
.stat-value { font-size: 18px; font-weight: 600; font-family: "SF Mono", monospace; }
.stat-red { color: #ff6b6b; }
.stat-orange { color: #ffa94d; }
.stat-yellow { color: #ffd43b; }
.stat-green { color: #69db7c; }

/* 实时反馈 */
.feedback-content {
  flex: 1;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  color: #ccc;
}
.feedback-live {
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid rgba(229, 0, 126, 0.45);
  border-radius: 8px;
  background: rgba(229, 0, 126, 0.06);
  font-size: 12px;
  line-height: 1.55;
}
.feedback-live-title { color: #E5007E; font-weight: 600; margin-bottom: 4px; }
.feedback-live-item { color: #ccc; overflow-wrap: anywhere; }
.feedback-live-item.type-vague { color: #ffd43b; }
.feedback-live-item.type-filler { color: #ff8a8a; }
.feedback-live-item.type-hedge { color: #ffa94d; }
.feedback-live-item.type-emotion { color: #b197fc; }
.feedback-item {
  padding: 8px 0;
  border-bottom: 1px solid #1a1a1a;
  color: #ddd;
}
.feedback-item:last-child { border-bottom: none; }
.feedback-item.type-vague { color: #ffd43b; }
.feedback-item.type-filler { color: #888; font-size: 12px; }
.feedback-item.type-hedge { color: #ffa94d; }
.feedback-item.type-emotion { color: #b197fc; }
.feedback-item.type-ai { color: #fff; }
.feedback-item.type-good { color: #69db7c; }

/* ===== 中间主区域 ===== */
.main-area {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* 顶栏 */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  flex-shrink: 0;
}
.app-title { font-size: 13px; color: #555; letter-spacing: 1px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.asr-status {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: #69db7c;
}
.asr-status[data-state="recovering"] { color: #ffa94d; }
.asr-status[data-state="paused"] { color: #aaa; }
.asr-status[data-state="error"], .asr-status[data-state="unsupported"] { color: #ff6b6b; }
.timer { font-size: 16px; font-family: "SF Mono", monospace; color: #555; }
.timer.active { color: #E5007E; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.5;} }
.btn-icon { background:none; border:none; font-size:18px; cursor:pointer; padding:4px; }

/* 字幕滚动区 */
.subtitle-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 40px 20px;
  min-height: 0;
  border: 1.5px solid rgba(229, 0, 126, 0.3);
  border-radius: 12px;
  margin: 0 8px;
  animation: subtitleGlow 3s ease-in-out infinite;
}
@keyframes subtitleGlow {
  0%, 100% { border-color: rgba(229,0,126,0.2); box-shadow: inset 0 0 10px rgba(229,0,126,0.03); }
  50% { border-color: rgba(229,0,126,0.5); box-shadow: inset 0 0 15px rgba(229,0,126,0.06); }
}
.subtitle-container {
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.subtitle-line {
  font-size: 26px;
  font-weight: 300;
  line-height: 1.7;
  color: #fff;
  word-break: break-word;
}
.subtitle-line.old { color: #666; font-size: 22px; }
.subtitle-line.hint { color: #444; font-size: 20px; }
.subtitle-line.interim-line { color: #aaa; }

/* 高亮 */
.subtitle-line .filler { color: #ff6b6b; text-decoration: underline wavy; }
.subtitle-line .hedge { color: #ffa94d; }
.subtitle-line .vague { color: #ffd43b; border-bottom: 2px dashed #ffd43b; }
.subtitle-line .emotion { color: #b197fc; border-bottom: 1px solid #b197fc; }

/* 底部按钮栏 */
.action-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  flex-shrink: 0;
}
.btn-main {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 14px; border: none; border-radius: 20px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.btn-icon-inner { font-size: 13px; }
.btn-label { font-size: 12px; }

.btn-start { background: #E5007E; color: #fff; }
.btn-start:hover { background: #cc006e; transform: scale(1.02); }
.btn-pause { background: #ffa94d; color: #000; }
.btn-pause:hover { background: #e09540; }
.btn-resume { background: #E5007E; color: #fff; }
.btn-resume:hover { background: #cc006e; }
.btn-stop { background: #ff4444; color: #fff; }
.btn-stop:hover { background: #cc3333; }
.btn-report { background: #222; color: #fff; border: 1px solid #E5007E; }
.btn-report:hover { background: #333; }

/* ===== 少女icon ===== */
.girl-icon {
  position: fixed;
  bottom: 16px; right: 60px;
  opacity: 0.4;
  z-index: 50;
  pointer-events: none;
}

/* ===== 社交链接 ===== */
.social-links {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 100;
}
.social-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1a1a1a;
  border: 1px solid #333;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.social-toggle:hover {
  border-color: #E5007E;
  background: #222;
}
.social-panel {
  position: absolute;
  bottom: 44px;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
}
.social-panel a {
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: all 0.2s;
}
.social-panel a:hover {
  color: #E5007E;
  background: #1a1a1a;
}

/* ===== 水印 ===== */
.watermark {
  position: fixed;
  bottom: 8px;
  right: 16px;
  font-size: 10px;
  color: rgba(229, 0, 126, 0.3);
  cursor: pointer;
  z-index: 50;
  transition: color 0.2s;
}
.watermark:hover {
  color: rgba(229, 0, 126, 0.6);
}

/* ===== 弹窗 ===== */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: #111;
  border: 1px solid #E5007E;
  border-radius: 16px;
  width: 92%;
  min-width: 0;
  max-width: 800px;
  height: 88vh;
  display: flex;
  flex-direction: column;
}
#report-modal .modal-content { max-width: 960px; }
.modal-content.modal-sm {
  max-width: 480px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 24px;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}
.modal-header h2 { font-size: 16px; font-weight: 600; }
.btn-close { background:none; border:none; color:#888; font-size:22px; cursor:pointer; }
.btn-close:hover { color:#fff; }
.modal-body {
  padding: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-width: 0;
  min-height: 0;
  font-size: 14px;
  line-height: 1.9;
  color: #ddd;
}
.modal-body h2 { color: #E5007E; margin-top: 20px; margin-bottom: 8px; font-size: 16px; }
.modal-body h3 { color: #fff; margin-top: 14px; font-size: 14px; }
.modal-body blockquote { border-left: 3px solid #E5007E; padding-left: 12px; color: #999; margin: 8px 0; }
.modal-body code { background: #1a1a1a; padding: 2px 6px; border-radius: 4px; color: #E5007E; font-size: 13px; }
.modal-body table { width: 100%; table-layout: fixed; border-collapse: collapse; margin: 8px 0; }
.modal-body th, .modal-body td { border: 1px solid #333; padding: 6px 10px; overflow-wrap: anywhere; word-break: break-word; text-align: left; font-size: 13px; }
.modal-body th { background: #1a1a1a; color: #E5007E; }
.report { min-width: 0; overflow-wrap: anywhere; color: #ddd; }
.report-section { min-width: 0; padding: 22px 0; margin: 0; border-top: 1px solid #2b2b2b; }
.summary-card { background: #151515; border-radius: 10px; padding: 16px 18px; margin: 0 0 16px; }
.report-section h2, .summary-card h2 { margin: 0 0 10px; color: #fff; }
.report-meta, .muted, .finding-label { color: #888; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 12px 0 20px; }
.metric { min-width: 0; background: #1b1b1b; border: 1px solid #2b2b2b; border-radius: 8px; padding: 10px; }
.metric-label { display: block; color: #888; font-size: 11px; }
.metric-value { display: block; overflow-wrap: anywhere; color: #E5007E; font-size: 18px; font-weight: 600; margin-top: 3px; }
.report-list { margin: 0; padding-left: 20px; }
.finding { background: #1b1b1b; border-left: 3px solid #E5007E; border-radius: 0 6px 6px 0; padding: 9px 12px; margin: 8px 0; }
.finding p, .behavior-item p { margin: 4px 0; }
.behavior-item + .behavior-item { margin-top: 16px; }
.report .transcript { width: 100%; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; overflow-x: hidden; background: #0a0a0a; color: #ddd; border-radius: 8px; padding: 12px; display: block; }
.report .optimized-transcript { background: #181818; font-family: inherit; }
.report .vocabulary { width: 100%; table-layout: fixed; border-collapse: collapse; }
.report .vocabulary th, .report .vocabulary td { overflow-wrap: anywhere; word-break: break-word; vertical-align: top; }

/* ===== 设置表单 ===== */
.settings-group {
  margin-bottom: 16px;
}
.settings-label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
}
.settings-input, .settings-select, .settings-textarea {
  width: 100%;
  padding: 10px 12px;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.settings-input:focus, .settings-select:focus, .settings-textarea:focus {
  border-color: #E5007E;
}
.settings-select {
  appearance: none;
  cursor: pointer;
}
.settings-textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.6;
}
.settings-actions {
  margin-top: 20px;
  text-align: right;
}

/* ===== 移动端底部Tab ===== */
.mobile-tabs {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: #111;
  border-top: 1px solid #222;
  z-index: 200;
}
.mobile-tab {
  flex: 1;
  background: none;
  border: none;
  font-size: 20px;
  color: #555;
  cursor: pointer;
  transition: color 0.2s;
}
.mobile-tab.active {
  color: #E5007E;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ===== 响应式：手机端 ===== */
@media (max-width: 768px) {
  .modal-header { align-items: flex-start; padding: 14px 16px; }
  .modal-header-actions { width: 100%; }
  .modal-body { padding: 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout {
    grid-template-columns: 1fr;
    height: calc(100dvh - 48px);
  }

  .panel-left, .panel-right {
    display: none;
    padding: 16px;
    border: none;
    height: calc(100dvh - 48px);
    overflow-y: auto;
  }

  .panel-left.mobile-active,
  .panel-right.mobile-active {
    display: flex;
    flex-direction: column;
  }

  .main-area {
    height: calc(100dvh - 48px);
  }

  .main-area.mobile-hidden {
    display: none;
  }

  .mobile-tabs {
    display: flex;
  }

  .topbar {
    padding: 12px 16px;
  }

  .app-title {
    font-size: 11px;
  }

  .subtitle-scroll {
    padding: 16px 20px;
    margin: 0 4px;
  }

  .subtitle-line {
    font-size: 20px;
  }

  .subtitle-line.old {
    font-size: 18px;
  }

  .subtitle-line.hint {
    font-size: 16px;
  }

  .girl-icon {
    display: none;
  }

  .social-links {
    left: 8px;
    bottom: 56px;
  }

  .watermark {
    bottom: 56px;
    right: 8px;
    font-size: 9px;
  }

  .modal-content {
    width: 96%;
    max-height: 92vh;
    border-radius: 12px;
  }
}

@media (max-width: 480px) {
  .subtitle-line {
    font-size: 18px;
  }
  .subtitle-line.old {
    font-size: 16px;
  }
  .action-bar {
    gap: 6px;
    padding: 8px 8px;
  }
  .btn-main {
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* 水印 */
.watermark-inner {
  position: absolute;
  bottom: 12px;
  left: 16px;
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.5px;
  pointer-events: none;
  user-select: none;
  z-index: 10;
}
.watermark-inner.hidden { display: none; }
