:root {
  --red:      #fe2c55;
  --bg:       #000;
  --accent:   #25f4ee;
  --gold:     #ffd700;
  --card:     #111111;
  --panel:    #060606;
  --action:   var(--red);   /* 开始聆听按钮专用色，可独立于 --red */
  --btn-text: #ffffff;      /* source-btn active 文字色，浅色主题改深色 */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
.hidden { display: none !important; }

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: #e2e8f0;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ── 双栏布局 ── */
.app-layout {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

/* ── 左侧边栏 ── */
.sidebar {
  width: 260px;
  min-width: 180px;
  max-width: 520px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid rgba(255,255,255,0.07);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 0;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

/* ── 拖拽条 ── */
.drag-handle {
  width: 4px;
  flex-shrink: 0;
  background: transparent;
  cursor: col-resize;
  transition: background 0.2s;
  position: relative;
}
.drag-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 40px;
  border-radius: 2px;
  background: rgba(255,255,255,0.08);
}
.drag-handle:hover,
.drag-handle.dragging {
  background: rgba(var(--red-rgb, 254,44,85), 0.3);
}
.drag-handle:hover { background: color-mix(in srgb, var(--red) 30%, transparent); }
.drag-handle.dragging { background: color-mix(in srgb, var(--red) 40%, transparent); }
.drag-handle.dragging::after { background: var(--red); }

/* ── 右侧主区域 ── */
.main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  min-width: 180px;
}
.panel {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}
.panel.active { display: flex; }

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.title {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  flex: 1;
  letter-spacing: -0.3px;
}
.btn-icon {
  background: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 7px;
  flex-shrink: 0;
  color: #475569;
  transition: color 0.15s, background 0.15s;
}
.btn-icon:hover { color: #94a3b8; background: rgba(255,255,255,0.05); }

/* ── Session name ── */
.session-name-wrap { margin-bottom: 10px; }
.session-name {
  font-size: 11px;
  color: var(--red);
  background: color-mix(in srgb, var(--red) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 22%, transparent);
  padding: 3px 10px;
  border-radius: 999px;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Controls ── */
.controls {
  display: flex;
  gap: 6px;
  margin-bottom: 7px;
}
.btn {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-start  {
  background: var(--action);
  color: white;
  box-shadow: 0 0 14px color-mix(in srgb, var(--action) 35%, transparent);
}
.btn-start:hover:not(:disabled) {
  filter: brightness(1.15);
  box-shadow: 0 0 22px color-mix(in srgb, var(--action) 55%, transparent);
}
.btn-stop   { background: rgba(255,255,255,0.08); color: #94a3b8; border: 1px solid rgba(255,255,255,0.1); }
.btn-new    { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 25%, transparent); }
.btn-new:hover { background: color-mix(in srgb, var(--red) 22%, transparent); }
.btn-clear  { background: rgba(255,255,255,0.05); color: #475569; flex: 0 0 38px; border: 1px solid rgba(255,255,255,0.08); }
.btn-clear:hover { color: #64748b; }
.btn-record  { background: color-mix(in srgb, var(--red) 7%, transparent); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 22%, transparent); font-size: 11px; }
.btn-record:hover  { background: color-mix(in srgb, var(--red) 14%, transparent); }
.btn-export  { background: color-mix(in srgb, var(--accent) 7%, transparent); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); font-size: 11px; }
.btn-export:hover  { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.btn-summary { background: color-mix(in srgb, var(--gold) 7%, transparent); color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 22%, transparent); font-size: 11px; }
.btn-summary:hover { background: color-mix(in srgb, var(--gold) 14%, transparent); }

/* ── Lang select ── */
.lang-select {
  background: rgba(255,255,255,0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  flex: 0 0 90px;
  cursor: pointer;
  outline: none;
}
.lang-select:focus { border-color: color-mix(in srgb, var(--red) 40%, transparent); }

/* ── Status ── */
.status {
  font-size: 11px;
  color: #475569;
  margin-bottom: 6px;
  text-align: center;
}
.status.listening {
  color: var(--accent);
  text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent);
}

/* ── Speaker bar ── */
.speaker-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.speaker-bar-label {
  font-size: 10px;
  color: #334155;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.speaker-bar-btn {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: none;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}
.speaker-bar-btn:hover { border-color: rgba(255,255,255,0.2); color: #94a3b8; }
.speaker-bar-btn.active { border-color: currentColor; }
.speaker-bar-add {
  font-size: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px dashed #334155;
  background: none;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  line-height: 1;
}
.speaker-bar-add:hover { border-color: var(--red); color: var(--red); }

/* ── Sidebar spacer ── */
.sidebar-spacer { flex: 1; min-height: 12px; }

/* ── Export bar ── */
.export-bar {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* ── Tab bar ── */
.tab-bar {
  display: flex;
  gap: 4px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 8px 0;
  flex-shrink: 0;
}
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  border-radius: 10px;
  color: #334155;
  font-size: 10px;
  cursor: pointer;
  padding: 6px 4px;
  transition: background 0.15s, color 0.15s;
}
.tab-btn span:first-child { font-size: 16px; }
.tab-btn.active {
  background: color-mix(in srgb, var(--red) 10%, transparent);
  color: var(--red);
  text-shadow: 0 0 8px color-mix(in srgb, var(--red) 50%, transparent);
}

/* ── 主区域：记录列表 ── */
.records {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  min-height: 0;
}
.records::-webkit-scrollbar { width: 4px; }
.records::-webkit-scrollbar-track { background: transparent; }
.records::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

.empty-hint {
  color: #1e293b;
  font-size: 13px;
  text-align: center;
  margin-top: 60px;
}

/* ── 记录卡片 ── */
.record-item {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.05);
  border-left: 3px solid color-mix(in srgb, var(--red) 40%, transparent);
  flex-shrink: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
  max-width: 860px;
}
.record-item:hover {
  border-left-color: var(--red);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--red) 12%, transparent),
              0 4px 24px color-mix(in srgb, var(--red) 10%, transparent);
}

.record-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}
.record-original {
  font-size: 15px;
  color: #e2e8f0;
  margin-bottom: 5px;
  line-height: 1.6;
}
.record-translated {
  font-size: 13px;
  color: var(--accent);
  line-height: 1.6;
  text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 35%, transparent);
}
.record-time {
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  white-space: nowrap;
}
.translating { color: color-mix(in srgb, var(--accent) 20%, transparent); font-style: italic; }

/* ── Interim ── */
.interim-box {
  font-size: 13px;
  color: #334155;
  font-style: italic;
  min-height: 36px;
  padding: 8px 16px;
  border-top: 1px solid rgba(255,255,255,0.04);
  flex-shrink: 0;
}

/* ── 历史列表 ── */
.history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  min-height: 0;
}
.history-item {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  max-width: 700px;
  transition: border-color 0.15s, background 0.15s;
}
.history-item:hover { border-color: color-mix(in srgb, var(--red) 20%, transparent); filter: brightness(1.1); }
.history-item-name { font-size: 13px; font-weight: 600; color: #e2e8f0; }
.history-item-meta { font-size: 11px; color: #334155; margin-top: 3px; }
.history-item-del {
  background: none; border: none; color: #1e293b;
  font-size: 15px; cursor: pointer; padding: 4px 6px;
  border-radius: 6px; transition: color 0.15s, background 0.15s;
}
.history-item-del:hover { color: #f87171; background: rgba(248,113,113,0.08); }

/* ── Speaker badge ── */
.speaker-badge {
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  transition: opacity 0.15s;
  background: rgba(255,255,255,0.04);
  color: #64748b;
}
.speaker-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.speaker-badge:hover { opacity: 0.8; }

/* ── Modal ── */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-box {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 22px 20px;
  width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}
.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 16px;
  text-align: center;
}
.modal-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #e2e8f0;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.modal-input:focus { border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.modal-input::placeholder { color: #334155; }
.modal-input-gap { margin-top: 8px; }
.modal-btns { display: flex; gap: 8px; margin-top: 14px; }

/* ── Speaker picker ── */
.speaker-picker {
  position: fixed;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 6px;
  z-index: 200;
  min-width: 150px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.speaker-picker-label {
  font-size: 10px;
  color: #334155;
  padding: 4px 8px 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.speaker-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 13px;
  padding: 7px 10px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.12s;
}
.speaker-option:hover { background: rgba(255,255,255,0.06); }
.speaker-option-apply { color: var(--gold); font-size: 12px; }
.speaker-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 4px 0; }

/* ── Source toggle ── */
.source-toggle {
  display: flex;
  gap: 3px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 999px;
  padding: 3px;
  flex: 1;
}
.source-btn {
  flex: 1;
  padding: 5px;
  border: none;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  background: none;
  color: #475569;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.source-btn.active { background: var(--red); color: var(--btn-text); }
.source-toggle.locked .source-btn {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.source-toggle.locked .source-btn.active { opacity: 0.6; }

/* ── Theme picker (设置弹窗内) ── */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  margin-bottom: 4px;
}
.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}
.theme-swatch:hover { background: rgba(255,255,255,0.04); }
.theme-swatch.active { border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.06); }
.theme-dot-row {
  display: flex;
  gap: 3px;
}
.theme-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.theme-label {
  font-size: 10px;
  color: #64748b;
  text-align: center;
  white-space: nowrap;
}
.theme-swatch.active .theme-label { color: #cbd5e1; }

/* ── 响应式：小屏单栏 ── */
@media (max-width: 600px) {
  .app-layout { flex-direction: column; }
  .sidebar {
    width: 100% !important;
    max-width: none;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    overflow-y: visible;
    padding-bottom: 8px;
  }
  .sidebar-spacer { display: none; }
  .drag-handle { display: none; }
  .main-panel { min-height: 0; flex: 1; }
}
