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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0d1117;
  color: #e6edf3;
  min-height: 100vh;
}

.step {
  display: none;
}
.step.active {
  display: block;
}
.step.active.center-page {
  display: flex;
}
.hidden {
  display: none !important;
}

/* Center connect/verify steps */
.center-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
}

.recent-sessions {
  width: min(520px, 100%);
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-align: left;
}

.recent-sessions-title {
  font-size: 0.9rem;
  color: #8b949e;
}

.recent-session-item {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid #30363d;
  border-radius: 10px;
  background: #161b22;
  color: #e6edf3;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.recent-session-item:hover {
  border-color: #58a6ff;
  background: #1b2230;
}

.recent-session-name {
  font-weight: 600;
}

.recent-session-id {
  color: #8b949e;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
h1 .subtitle {
  color: #58a6ff;
  font-weight: 400;
}

h2 {
  font-size: 1.2rem;
  margin: 0;
}

.description {
  color: #8b949e;
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

/* ID Input */
.id-input-group {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
}

#session-id {
  font-size: 2rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 0.5rem;
  text-align: center;
  width: 240px;
  padding: 0.75rem 1rem;
  border: 2px solid #30363d;
  border-radius: 12px;
  background: #161b22;
  color: #e6edf3;
  outline: none;
  transition: border-color 0.2s;
}
#session-id:focus {
  border-color: #58a6ff;
}

#btn-connect {
  font-size: 1.1rem;
  padding: 0.85rem 2rem;
  border: none;
  border-radius: 12px;
  background: #238636;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}
#btn-connect:hover {
  background: #2ea043;
}
#btn-connect:disabled {
  background: #21262d;
  color: #484f58;
  cursor: not-allowed;
}

.error {
  color: #f85149;
  margin-top: 1rem;
}

/* Emojis */
.emojis {
  font-size: 4rem;
  letter-spacing: 1rem;
  margin: 2rem 0;
  text-align: center;
}

.waiting {
  color: #8b949e;
  text-align: center;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #30363d;
  border-top-color: #58a6ff;
  border-radius: 50%;
  margin: 1rem auto;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════
   SESSION LAYOUT — two columns
   ═══════════════════════════════════ */

.session-layout {
  display: flex;
  height: 100vh;
  gap: 0;
}

/* LEFT column: video + controls */
.left-column {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  padding: 12px;
  overflow-y: auto;
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.btn-danger {
  padding: 0.4rem 1rem;
  border: none;
  border-radius: 8px;
  background: #da3633;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}
.btn-danger:hover {
  background: #f85149;
}

.stream-container {
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #21262d;
  flex-shrink: 0;
}

#screen-video, #screen-image {
  width: 100%;
  display: block;
  background: #000;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

#screen-video.hidden, #screen-image-wrap.hidden {
  display: none;
}

#screen-image-wrap {
  position: relative;
  min-height: 200px;
  background: #000;
}

.screen-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8b949e;
  font-size: 1.1rem;
  background: #000;
  z-index: 1;
}

.screen-loading.hidden {
  display: none;
}

.frame-progress-bar {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: transparent;
  border-radius: 1px;
  z-index: 2;
}

.frame-progress-fill {
  height: 100%;
  width: 0%;
  background: rgba(88, 166, 255, 0.1);
  border-radius: 1px;
  transition: width 0.1s linear;
}

.frame-progress-fill.loading {
  animation: indeterminate 1s ease-in-out infinite;
  width: 30%;
}

@keyframes indeterminate {
  0% { margin-left: 0%; width: 30%; }
  50% { margin-left: 40%; width: 30%; }
  100% { margin-left: 70%; width: 30%; }
}

/* Stream mode toggle */
.stream-mode-toggle {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  flex-shrink: 0;
}

.mode-btn {
  flex: 1;
  padding: 6px 12px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #161b22;
  color: #8b949e;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s;
}

.mode-btn:hover {
  background: #21262d;
  color: #e6edf3;
}

.mode-btn.active {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

.audio-controls {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-shrink: 0;
}

.audio-control {
  flex: 1;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 8px 12px;
}

.audio-control label {
  display: block;
  color: #8b949e;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.audio-control input[type="range"] {
  width: calc(100% - 40px);
  vertical-align: middle;
  accent-color: #58a6ff;
}

.audio-control span {
  display: inline-block;
  width: 36px;
  text-align: right;
  font-size: 0.8rem;
  color: #8b949e;
}

/* Helper audio panel */
.helper-audio-panel {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* Helper audio indicator */
.helper-audio-indicator {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.helper-audio-indicator.prompter {
  background: #7c3aed22;
  border: 1px solid #7c3aed;
  color: #a78bfa;
}

.helper-audio-indicator.stealth {
  background: #dc262622;
  border: 1px solid #dc2626;
  color: #f87171;
}

.helper-audio-indicator.muted {
  background: #30363d44;
  border: 1px solid #30363d;
  color: #8b949e;
}

/* Helper mic device selector */
.helper-mic-select {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.helper-mic-select label {
  font-size: 0.8rem;
  color: #8b949e;
  font-weight: 600;
}

.helper-mic-select select {
  padding: 6px 8px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #161b22;
  color: #e6edf3;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
}

.helper-mic-select select:focus {
  border-color: #58a6ff;
}

/* Whisper button (stealth mode) */
.btn-whisper {
  margin-top: 8px;
  padding: 16px;
  border: 2px solid #dc2626;
  border-radius: 12px;
  background: #161b22;
  color: #f87171;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.15s;
}

.btn-whisper:hover {
  background: #1c1c2e;
}

.btn-whisper.active {
  background: #dc2626;
  color: #fff;
  border-color: #ef4444;
  box-shadow: 0 0 20px rgba(220, 38, 38, 0.4);
}

.tips {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  flex-shrink: 0;
}

.tips span {
  font-size: 0.75rem;
  color: #484f58;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Column resizer handle */
.column-resizer {
  width: 5px;
  cursor: col-resize;
  background: #21262d;
  flex-shrink: 0;
  transition: background 0.15s;
}
.column-resizer:hover,
.column-resizer.active {
  background: #58a6ff;
}

/* MIDDLE column: chat + editor */
.middle-column {
  width: 340px;
  min-width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #0d1117;
}

/* RIGHT column: LLM output */
.right-column {
  width: 380px;
  min-width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #0d1117;
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-header {
  padding: 10px 12px;
  border-bottom: 1px solid #21262d;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.chat-header h3 {
  font-size: 0.85rem;
  color: #8b949e;
  font-weight: 600;
  margin: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

/* Bubbles */
.chat-bubble {
  padding: 6px 10px;
  border-radius: 8px;
  word-wrap: break-word;
  line-height: 1.4;
  font-size: 0.88rem;
  position: relative;
  cursor: pointer;
  transition: outline 0.12s;
  flex-shrink: 0;
}

.chat-bubble:hover {
  outline: 1px solid #58a6ff44;
}

.chat-bubble.selected {
  outline: 2px solid #58a6ff;
}

.chat-bubble.interviewer {
  background: #1c2d4a;
  border: 1px solid #1f428766;
  align-self: flex-start;
  max-width: 95%;
}

.chat-bubble.user {
  background: #1a3a2a;
  border: 1px solid #23863666;
  align-self: flex-end;
  max-width: 95%;
}

.chat-sender {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-bubble.interviewer .chat-sender {
  color: #58a6ff;
}

.chat-bubble.user .chat-sender {
  color: #3fb950;
}

.chat-text {
  color: #e6edf3;
}

.chat-bubble.streaming::after {
  content: ' ▊';
  color: #58a6ff;
  animation: blink 0.7s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.chat-bubble.final::after {
  content: none;
}

/* Prompt editor — always visible */
.prompt-editor {
  border-top: 1px solid #21262d;
  padding: 8px;
  flex-shrink: 0;
  background: #161b22;
}

.prompt-editor textarea {
  width: 100%;
  min-height: 56px;
  max-height: 180px;
  padding: 8px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
  color: #e6edf3;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.prompt-editor textarea:focus {
  border-color: #58a6ff;
}

/* Image previews */
.image-previews {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.image-preview-item {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #30363d;
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: #da3633;
  color: #fff;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.image-preview-item:hover .image-remove {
  opacity: 1;
}

.prompt-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  justify-content: space-between;
  align-items: center;
}

.prompt-actions-right {
  display: flex;
  gap: 6px;
}

.btn-attach {
  font-size: 1.2rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.2s;
  user-select: none;
}

.btn-attach:hover {
  background: #21262d;
}

.btn-send {
  padding: 6px 16px;
  border: none;
  border-radius: 8px;
  background: #238636;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.btn-send:hover {
  background: #2ea043;
}

/* LLM status indicator */
.llm-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}

.llm-status.generating {
  color: #d29922;
  background: #d2992222;
  animation: pulse 1.5s ease-in-out infinite;
}

.llm-status.fast-done {
  color: #58a6ff;
  background: #58a6ff22;
}

.llm-status.smart-done {
  color: #3fb950;
  background: #3fb95022;
}

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

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 3px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}

/* ═══════════════════════════════════
   SETTINGS PANEL
   ═══════════════════════════════════ */

.prompts-panel {
  margin-top: 12px;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  flex-shrink: 0;
  padding: 8px 12px 10px;
}

.prompts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.prompts-header h3 {
  font-size: 0.85rem;
  color: #8b949e;
  font-weight: 600;
  margin: 0;
}

.prompts-columns {
  display: flex;
  gap: 10px;
}

.prompts-columns .setting-group {
  flex: 1;
  padding: 0;
}

.setting-group {
  padding: 0 12px 10px;
}

.setting-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #8b949e;
  margin-bottom: 4px;
}

.setting-hint {
  font-weight: 400;
  color: #484f58;
}

.setting-group textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #0d1117;
  color: #e6edf3;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

.setting-group textarea:focus {
  border-color: #58a6ff;
}

.btn-save-prompts {
  padding: 4px 12px;
  border: none;
  border-radius: 6px;
  background: #238636;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  transition: background 0.2s;
}

.btn-save-prompts:hover {
  background: #2ea043;
}

.save-indicator {
  font-size: 0.78rem;
  color: #3fb950;
  margin-left: 8px;
}

/* ═══════════════════════════════════
   OUTPUT PANEL (right column)
   ═══════════════════════════════════ */

.output-header {
  padding: 10px 12px;
  border-bottom: 1px solid #21262d;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.output-header h3 {
  font-size: 0.85rem;
  color: #8b949e;
  font-weight: 600;
  margin: 0;
}

.output-tier {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}

.output-tier.fast {
  color: #d29922;
  background: #d2992222;
}

.output-tier.smart {
  color: #3fb950;
  background: #3fb95022;
}

.output-tier.streaming {
  animation: pulse 1.5s ease-in-out infinite;
}

.output-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #e6edf3;
  min-height: 0;
}

.output-content::-webkit-scrollbar {
  width: 6px;
}
.output-content::-webkit-scrollbar-track {
  background: transparent;
}
.output-content::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 3px;
}

.output-placeholder {
  color: #484f58;
  font-style: italic;
}

.output-text {
  color: #e6edf3;
}

.output-text h2, .output-text h3, .output-text h4 {
  color: #58a6ff;
  margin: 8px 0 4px;
}

.output-text h2 { font-size: 1.1rem; }
.output-text h3 { font-size: 1rem; }
.output-text h4 { font-size: 0.9rem; }

.output-text strong {
  color: #f0f6fc;
}

.output-text .inline-code {
  background: #161b22;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.84rem;
  color: #79c0ff;
}

.output-code {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  overflow-x: auto;
  position: relative;
}

.output-code code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #e6edf3;
  white-space: pre;
}

.code-lang {
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 0.7rem;
  color: #484f58;
  font-family: 'SF Mono', 'Fira Code', monospace;
  text-transform: uppercase;
}

.output-block-math {
  margin: 8px 0;
  padding: 8px 0;
  overflow-x: auto;
}

.output-text li {
  margin-left: 16px;
  margin-bottom: 2px;
}

.output-text p {
  margin: 0 0 6px;
}
