:root {
  --bg: #0a0a0a;
  --panel: #111;
  --panel-2: #161616;
  --fg: #e8e8e8;
  --dim: #888;
  --muted: #555;
  --accent: #ffd166;
  --accent-2: #5cc8ff;
  --danger: #ff5c5c;
  --border: #1f1f1f;
  --border-2: #2a2a2a;
  --ghost: #6a6a6a;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, 'Cascadia Code', 'Fira Code', monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* TOP BAR */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand .title {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand .sub {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.2s, box-shadow 0.2s;
}

.dot.live {
  background: var(--danger);
  box-shadow: 0 0 12px rgba(255, 92, 92, 0.6);
  animation: pulse 1.5s ease-in-out infinite;
}

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

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--border-2);
  padding: 7px 12px;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn:hover { border-color: #444; background: #1c1c1c; }
.btn.primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.primary.recording { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; }

/* LAYOUT */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  min-height: 0;
}

.divider {
  background: var(--border);
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
  flex-shrink: 0;
}

.pane-header .hint {
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.7rem;
}

.pane-header kbd {
  font-family: var(--mono);
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  border-bottom-width: 2px;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.68rem;
  color: var(--fg);
}

/* EDITOR */
.editor-wrap {
  flex: 1;
  overflow: auto;
  padding: 24px 28px;
}

.editor {
  min-height: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--fg);
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.editor .ghost {
  color: var(--ghost);
  background: rgba(255, 209, 102, 0.06);
  border-radius: 2px;
  padding: 0 1px;
  user-select: none;
  cursor: pointer;
}

.editor .ghost .gh-fill {
  color: var(--accent);
  background: rgba(255, 209, 102, 0.18);
  border-bottom: 1px solid var(--accent);
}

.editor .ghost .gh-rest {
  color: var(--ghost);
}

/* TRANSCRIPT */
.transcript {
  flex: 1;
  overflow: auto;
  padding: 18px 22px;
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
}

.transcript .seg {
  margin-bottom: 10px;
  padding-left: 10px;
  border-left: 2px solid var(--border-2);
}

.transcript .seg .ts {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  margin-right: 8px;
  letter-spacing: 0.05em;
}

.transcript .seg .text {
  color: var(--fg);
}

.transcript .empty {
  color: var(--muted);
  font-style: italic;
}

.interim {
  padding: 10px 22px;
  font-style: italic;
  color: var(--dim);
  border-top: 1px dashed var(--border-2);
  background: var(--panel);
  min-height: 38px;
  font-size: 0.92rem;
  flex-shrink: 0;
}

.interim:empty::before {
  content: '…';
  color: var(--muted);
}

/* VERSION BADGE */
.version-badge {
  position: fixed;
  bottom: 10px;
  right: 12px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  pointer-events: none;
  z-index: 1000;
  user-select: text;
}

.version-badge .v {
  color: var(--accent-2);
  font-weight: 600;
  margin-right: 6px;
}

/* TOAST */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translate(-50%, -8px);
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  color: var(--fg);
  padding: 10px 16px;
  border-radius: 4px;
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
  max-width: 80%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: var(--danger);
  color: #ffb3b3;
}

/* MOBILE */
@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1px 1fr;
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .actions {
    justify-content: flex-start;
  }
}

::selection { background: var(--accent); color: #000; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #333; }
