*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f0f0f;
  --bg-surface: #1a1a1a;
  --bg-elevated: #252525;
  --border: #333;
  --text: #f0f0f0;
  --text-muted: #888;
  --accent: #4f9cf9;
  --accent-hover: #3b89e8;
  --danger: #e05252;
  --success: #4caf50;
  --sidebar-width: 230px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ─── Layout ───────────────────────────────────────────────────────────────── */

#app {
  display: flex;
  height: 100vh;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────── */

#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-title {
  font-weight: 600;
  font-size: 15px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.2s;
  line-height: 1;
}
.icon-btn:hover { color: var(--text); }

#session-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sessions-placeholder {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px 0;
}

.session-item {
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s;
}
.session-item:hover { background: var(--bg-elevated); }
.session-item.active {
  background: var(--bg-elevated);
  border-color: var(--accent);
}

.session-company {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Main Area ────────────────────────────────────────────────────────────── */

#main-area {
  flex: 1;
  padding: 32px 36px;
  overflow-y: auto;
}

/* ─── Setup Panel ──────────────────────────────────────────────────────────── */

#setup-panel h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 28px;
}

/* ─── Interview Panel ──────────────────────────────────────────────────────── */

#status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 20px;
}

#mic-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

#volume-bar-wrap {
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

#volume-bar {
  height: 100%;
  width: 0%;
  background: var(--success);
  border-radius: 3px;
  transition: width 0.1s;
}

.mic-dot {
  width: 10px;
  height: 10px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}
.mic-dot.idle {
  background: var(--text-muted);
  animation: none;
}

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

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-lang {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-lang:hover { border-color: var(--accent); color: var(--accent); }
.btn-lang.zh { border-color: #f59e0b; color: #f59e0b; }

.btn-resume {
  background: var(--success);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.2s;
  animation: gentle-pulse 1.5s ease-in-out infinite;
}
.btn-resume:hover { opacity: 0.85; }

@keyframes gentle-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(76, 175, 80, 0); }
}

#empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  padding: 60px 0;
}

#question-box {
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.box-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

#question-text {
  font-size: 16px;
  line-height: 1.6;
  outline: none;
  min-height: 40px;
  cursor: text;
}
#question-text:focus { color: #fff; }

#answer-box {
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 24px 28px;
}

#loading-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px 0;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

#answer-en {
  font-size: 22px;
  line-height: 1.65;
  color: var(--text);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.answer-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

#answer-cn {
  font-size: 16px;
  line-height: 1.75;
  color: #bbb;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-primary.full-width { width: 100%; }

.btn-ghost {
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.btn-ghost:hover { color: var(--text); border-color: #555; }
.btn-ghost.small { padding: 5px 10px; font-size: 12px; margin-top: 10px; }

.btn-danger {
  background: none;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ─── Form ─────────────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 5px;
  line-height: 1.5;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.btn-upload {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px dashed var(--border);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-upload:hover { border-color: var(--accent); color: var(--accent); }
.btn-upload:disabled { opacity: 0.5; cursor: default; }

.upload-status {
  font-size: 12px;
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ─── Settings Modal ───────────────────────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 32px;
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 24px;
}

/* ─── Utility ──────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }

/* ─── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  :root { --sidebar-width: 180px; }
  #main-area { padding: 20px 18px; }
  #answer-en { font-size: 18px; }
}
