/* ─── Reset & Variables ─────────────────────────────────────────────────── */
:root {
  --bg0:       #0d0f14;
  --bg1:       #161b22;
  --bg2:       #1e2430;
  --bg3:       #252d3a;
  --border:    #2d3748;
  --text:      #e2e8f0;
  --text-dim:  #718096;
  --accent:    #7c5cbf;
  --accent-h:  #9470d6;
  --success:   #48bb78;
  --error:     #fc8181;
  --warn:      #f6ad55;

  /* annotation palette */
  --c-sibl:   #f56565;
  --c-over:   #ed8936;
  --c-clip:   #e53e3e;
  --c-noise:  #667eea;
  --c-sync:   #48bb78;
  --c-edit:   #4299e1;
  --c-custom: #a78bfa;
}

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

html, body {
  height: 100%;
  background: var(--bg0);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

button { cursor: pointer; font: inherit; border: none; outline: none; }
input, textarea, select { font: inherit; outline: none; }
a { color: var(--accent-h); text-decoration: none; }

/* ─── Screens ───────────────────────────────────────────────────────────── */
/* dvh (dynamic viewport height) tracks the *visible* area, so the top bar is
   never tucked behind Android Chrome's address bar the way 100vh allowed. */
.screen { display: none; height: 100vh; height: 100dvh; flex-direction: column; }
.screen.active { display: flex; }

/* ─── Auth Screen ───────────────────────────────────────────────────────── */
#auth-screen {
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 40%, #1a1035 0%, var(--bg0) 70%);
}

.auth-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 56px 64px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
  max-width: 400px;
  width: 90%;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.auth-logo svg { width: 36px; height: 36px; }

.auth-tagline {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: -16px;
}

.btn-google {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: #fff;
  color: #3c4043;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  transition: box-shadow .15s;
  width: 100%;
  justify-content: center;
}

.btn-google:hover { box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.btn-google svg { width: 20px; height: 20px; flex-shrink: 0; }

/* ─── File Screen ───────────────────────────────────────────────────────── */
#file-screen { background: var(--bg0); }

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

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

.top-bar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
}

.top-bar-logo svg { width: 22px; height: 22px; }
.brand-mark { flex-shrink: 0; }

.menu-btn {
  background: none;
  color: var(--text-dim);
  border-radius: 6px;
  flex-shrink: 0;
  transition: color .15s, background .15s;
}
.menu-btn:hover { color: var(--text); background: var(--bg3); }

.top-bar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-name-text { font-size: 13px; color: var(--text-dim); }

.btn-link {
  background: none;
  color: var(--text-dim);
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.btn-link:hover { color: var(--text); background: var(--bg3); }

.file-screen-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.file-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.file-card h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: -12px;
}

.file-card p { color: var(--text-dim); font-size: 13px; }

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--accent-h); }
.btn-primary:active { transform: scale(.98); }
.btn-primary svg { width: 18px; height: 18px; }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-secondary {
  padding: 10px 16px;
  background: var(--bg3);
  color: var(--text);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--border); }

/* ─── Settings (file screen) ────────────────────────────────────────────── */
.setting-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.setting-hint {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 2px;
  opacity: .75;
}

.folder-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.folder-pick-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: left;
  transition: border-color .15s, color .15s;
  overflow: hidden;
}
.folder-pick-btn:hover { border-color: var(--accent); color: var(--text); }
.folder-pick-btn svg { flex-shrink: 0; }
.folder-pick-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-pick-btn.has-value { color: var(--text); }

.folder-clear-btn {
  padding: 8px 10px;
  background: var(--bg3);
  color: var(--text-dim);
  border-radius: 8px;
  font-size: 13px;
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
.folder-clear-btn:hover { background: var(--border); color: var(--error); }

/* ─── Review Screen ─────────────────────────────────────────────────────── */
#review-screen { overflow: hidden; }

#review-screen .top-bar { gap: 12px; }

.file-title {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  min-width: 0; /* allow shrink+ellipsis so the buttons aren't pushed off-screen */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ─── Player pane ───────────────────────────────────────────────────────── */
.player-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: #000;
}

.media-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

#video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

#audio-display {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
  height: 100%;
  background: var(--bg1);
}

#audio-display.visible { display: flex; }

#audio-player { display: none; }

.audio-icon { opacity: .25; }
.audio-icon svg { width: 96px; height: 96px; }

.audio-file-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
  max-width: 60%;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Spectrum canvas */
#spectrum-canvas {
  width: 100%;
  height: 80px;
  display: block;
  background: transparent;
}

.spectrum-wrapper {
  width: 100%;
  padding: 0 20px 8px;
  flex-shrink: 0;
}

/* ─── Timeline ──────────────────────────────────────────────────────────── */
.timeline-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg1);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  user-select: none;
}

.time-label {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  white-space: nowrap;
  min-width: 48px;
}
#time-current { text-align: right; }

.timeline-track-wrapper {
  position: relative;
  flex: 1;
  height: 28px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.timeline-track {
  position: absolute;
  inset: 0;
  margin: auto 0;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: visible;
}

.timeline-progress {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width .05s linear;
  pointer-events: none;
}

.annotation-markers-layer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}

.ann-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: all;
  transition: transform .1s;
  border: 2px solid rgba(0,0,0,.4);
  z-index: 2;
}

.ann-marker:hover {
  transform: translate(-50%, -50%) scale(1.5);
  z-index: 10;
}

.ann-marker-tooltip {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 20;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ann-marker:hover .ann-marker-tooltip { opacity: 1; }

.timeline-playhead {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  cursor: grab;
  z-index: 5;
  box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(0,0,0,.5);
  transition: left .05s linear;
}

.timeline-track-wrapper:active .timeline-playhead { cursor: grabbing; }

/* ─── Transport controls ────────────────────────────────────────────────── */
.transport-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: var(--bg1);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.transport-group {
  display: flex;
  align-items: center;
  gap: 3px;
}

.sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 6px;
}

.t-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  background: var(--bg3);
  color: var(--text);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  transition: background .12s, color .12s;
}
.t-btn:hover { background: var(--border); }

.t-btn-play {
  min-width: 42px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
}
.t-btn-play:hover { background: var(--accent-h); }

.speed-group { display: flex; align-items: center; gap: 3px; }
.speed-label { font-size: 11px; color: var(--text-dim); margin-right: 2px; }

.speed-btn {
  height: 28px;
  padding: 0 8px;
  background: var(--bg3);
  color: var(--text-dim);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  transition: background .12s, color .12s;
}
.speed-btn:hover { color: var(--text); background: var(--border); }
.speed-btn.active { background: var(--accent); color: #fff; }

.fps-group { display: flex; align-items: center; gap: 6px; }
.fps-label { font-size: 11px; color: var(--text-dim); }

.fps-select {
  height: 28px;
  padding: 0 6px;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
}

/* ─── Annotations pane ──────────────────────────────────────────────────── */
.annotations-pane {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg1);
  border-left: 1px solid var(--border);
  overflow: hidden;
}

.pane-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pane-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-dim);
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}

.sync-status.synced .sync-dot { background: var(--success); }
.sync-status.syncing .sync-dot {
  background: var(--warn);
  animation: pulse-dot 1s infinite;
}
.sync-status.error .sync-dot { background: var(--error); }
.sync-status.synced .sync-label { color: var(--success); }
.sync-status.syncing .sync-label { color: var(--warn); }
.sync-status.error .sync-label { color: var(--error); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}

/* Quick annotation buttons */
.quick-btns {
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.quick-btn-row { display: flex; gap: 6px; }

.ann-btn {
  flex: 1;
  padding: 8px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  border: 1px solid transparent;
  transition: opacity .12s, transform .1s, border-color .12s;
  color: #fff;
}
.ann-btn:hover { opacity: .85; }
.ann-btn:active { transform: scale(.96); }

.ann-btn.custom-btn {
  grid-column: 1 / -1;
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border);
  font-size: 12px;
  padding: 10px;
}
.ann-btn.custom-btn:hover { border-color: var(--accent); color: var(--accent-h); }

/* Annotation list */
.ann-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 6px;
  flex-shrink: 0;
}

.ann-list-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
}

.ann-count {
  background: var(--bg3);
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.ann-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 20px;
}

.ann-list::-webkit-scrollbar { width: 4px; }
.ann-list::-webkit-scrollbar-track { background: transparent; }
.ann-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.ann-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid rgba(255,255,255,.03);
}
.ann-item:hover { background: var(--bg2); }

.ann-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.ann-item-body { flex: 1; min-width: 0; }

.ann-item-comment {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.ann-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-dim);
}

.ann-item-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent-h);
}

.ann-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}

/* Archived notes: toggle + per-row archive button */
.ann-list-header { gap: 8px; }

.archived-toggle {
  margin-left: auto;
  background: var(--bg3);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.archived-toggle:hover { color: var(--text); border-color: var(--accent); }
.archived-toggle.active { color: var(--accent-h); border-color: var(--accent); }

.ann-item-archive {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s, color .12s, background .12s;
}
.ann-item:hover .ann-item-archive { opacity: 1; }
.ann-item-archive:hover { background: var(--bg3); color: var(--error); }
.ann-item.archived { opacity: .55; }
.ann-item.archived .ann-item-archive { opacity: 1; color: var(--accent-h); }
.ann-item.archived .ann-item-archive:hover { color: var(--accent-h); }

/* Recent reviews (previous work) list on the file screen */
.prev-work-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}
.prev-work-list::-webkit-scrollbar { width: 4px; }
.prev-work-list::-webkit-scrollbar-track { background: transparent; }
.prev-work-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.prev-work-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.prev-work-item:hover { border-color: var(--accent); background: var(--bg3); }

.prev-work-body { flex: 1; min-width: 0; }

.prev-work-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prev-work-meta {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}

.prev-work-arrow { color: var(--text-dim); flex-shrink: 0; }
.prev-work-item:hover .prev-work-arrow { color: var(--accent-h); }

.prev-work-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}

/* ─── Custom note modal ─────────────────────────────────────────────────── */
/* ─── App menu (hamburger flyout) ───────────────────────────────────────── */
.app-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 89;
  backdrop-filter: blur(2px);
}
.app-menu-backdrop.visible { display: block; }

.app-menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 290px;
  max-width: 86vw;
  background: var(--bg1);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 28px rgba(0,0,0,.4);
  z-index: 90;
  transform: translateX(-100%);
  transition: transform .18s ease;
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 6px;
}
.app-menu.visible { transform: translateX(0); }

.app-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 4px 0 8px;
  margin-bottom: 4px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.brand-logo .brand-mark { width: 24px; height: 24px; }

.app-menu-section { display: flex; flex-direction: column; gap: 2px; }
.app-menu-section + .app-menu-section {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 8px;
}

.app-menu-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-dim);
  padding: 4px 8px;
}

.app-menu-files {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 42vh;
  overflow-y: auto;
}
.app-menu-empty { font-size: 12px; color: var(--text-dim); padding: 6px 8px; }

.app-menu-item,
.menu-file {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 10px 8px;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: 13px;
  transition: background .15s, color .15s;
}
.app-menu-item:hover,
.menu-file:hover { background: var(--bg3); }
.app-menu-item svg { flex-shrink: 0; color: var(--text-dim); }

.menu-file { color: var(--text-dim); }
.menu-file-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}
.menu-file-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-file.active {
  color: var(--text);
  background: var(--bg2);
  font-weight: 600;
}
.menu-file.active .menu-file-dot { background: var(--accent); }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.modal-overlay.visible { display: flex; }

.modal-box {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: -10px;
}

.modal-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
  transition: border-color .15s;
}
.modal-textarea:focus { border-color: var(--accent); }
.modal-textarea::placeholder { color: var(--text-dim); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-cancel {
  padding: 10px 18px;
  background: var(--bg3);
  color: var(--text);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background .12s;
}
.btn-cancel:hover { background: var(--border); }

/* ─── Toast notifications ───────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  animation: toast-in .2s ease forwards;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--error);   color: var(--error); }

@keyframes toast-in  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }

/* ─── Loading spinner ───────────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Scrollbars (global) ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Keyboard hint ─────────────────────────────────────────────────────── */
.kbd-hint {
  display: inline-block;
  padding: 1px 5px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 10px;
  font-family: monospace;
  color: var(--text-dim);
  vertical-align: middle;
}

/* ─── Icon buttons (gear / close) ───────────────────────────────────────── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  line-height: 0;
}
.icon-btn svg { display: block; }

/* ─── Settings modal ────────────────────────────────────────────────────── */
.settings-box {
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  gap: 20px;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-section { display: flex; flex-direction: column; gap: 8px; }

.settings-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.settings-tags { display: flex; flex-direction: column; gap: 6px; }

/* Grid columns: visible | colour | label | key | prompt | up | down | delete */
.tag-row {
  display: grid;
  grid-template-columns: 24px 30px 1fr 34px 30px 26px 26px 26px;
  gap: 6px;
  align-items: center;
}

.tag-row-head {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 0 2px;
}
.tag-row-head span { text-align: center; overflow: hidden; }
.tag-row-head span:nth-child(3) { text-align: left; }

.tag-row input[type="text"] {
  height: 30px;
  padding: 0 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  min-width: 0;
}
.tag-row input[type="text"]:focus { border-color: var(--accent); }
.tag-row .tag-key { text-align: center; text-transform: uppercase; }

.tag-row input[type="color"] {
  width: 30px;
  height: 28px;
  padding: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.tag-row input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }

.tag-row .tag-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 13px;
}

.tag-row .tag-move,
.tag-row .tag-del {
  height: 28px;
  background: var(--bg3);
  color: var(--text-dim);
  border-radius: 6px;
  font-size: 12px;
  transition: background .12s, color .12s;
}
.tag-row .tag-move:hover { background: var(--border); color: var(--text); }
.tag-row .tag-move:disabled { opacity: .3; cursor: default; }
.tag-row .tag-del:hover { background: var(--border); color: var(--error); }

.settings-tag-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.delay-row { display: flex; align-items: center; gap: 10px; }

.delay-input {
  width: 90px;
  height: 36px;
  padding: 0 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
.delay-input:focus { border-color: var(--accent); }
.delay-unit { font-size: 13px; color: var(--text-dim); }

/* ─── Calibration ───────────────────────────────────────────────────────── */
.calib-status {
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  padding: 16px 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calib-progress {
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  min-height: 16px;
}

.calib-buttons { padding: 0; border-bottom: none; }

/* ─── Responsive: portrait phones / narrow windows ──────────────────────── */
@media (max-width: 768px) {
  .review-body { flex-direction: column; }

  .player-pane {
    flex: none;
    height: 40vh;
    height: 40dvh;
  }
  /* Audio has no frame to show — give the controls/log more room. */
  .player-pane:has(#audio-display.visible) { height: 24vh; height: 24dvh; }

  .annotations-pane {
    width: auto;
    flex: 1;
    min-height: 0;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  #review-screen .top-bar { padding: 0 12px; gap: 8px; }
  .user-name-text { display: none; }
  .file-title { font-size: 13px; }

  .timeline-bar { padding: 8px 10px; gap: 6px; }
  .time-label { min-width: 40px; }
  .transport-row { padding: 8px 10px; gap: 6px; row-gap: 8px; }
  .sep { margin: 0 3px; }

  .settings-box { max-width: 100%; max-height: 92vh; max-height: 92dvh; padding: 20px; }
  .tag-row { grid-template-columns: 22px 28px 1fr 30px 26px 24px 24px 24px; gap: 4px; }
}

/* Version label — unobtrusive, fixed to the bottom-right corner. */
.app-version {
  position: fixed;
  right: 8px;
  bottom: 6px;
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}
