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

:root {
  --bg:       #f5f2ee;
  --surface:  #edeae5;
  --card:     #ffffff;
  --ink:      #1a1814;
  --ink2:     #6b6660;
  --ink3:     #b0ada8;
  --a:        #e8360a;
  --b:        #0a6ee8;
  --border:   rgba(26,24,20,0.1);
  --border2:  rgba(26,24,20,0.06);
  --mono:     'DM Mono', monospace;
  --display:  'Syne', sans-serif;
  --radius:   10px;
  --shadow:   0 2px 12px rgba(26,24,20,0.08), 0 1px 3px rgba(26,24,20,0.06);
  --header-bg: rgba(245,242,238,0.9);
  --delta-bg:  #1a1814;
  --btn-primary-bg:    #1a1814;
  --btn-primary-fg:    #ffffff;
  --btn-primary-hover: #2e2b27;
  --transition-theme: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

[data-theme="dark"] {
  --bg:       #111013;
  --surface:  #1a191d;
  --card:     #201f24;
  --ink:      #f0eee9;
  --ink2:     #9a9794;
  --ink3:     #7a7876;
  --a:        #ff4d1f;
  --b:        #3d8fff;
  --border:   rgba(240,238,233,0.09);
  --border2:  rgba(240,238,233,0.05);
  --shadow:   0 2px 16px rgba(0,0,0,0.35), 0 1px 4px rgba(0,0,0,0.25);
  --header-bg: rgba(17,16,19,0.92);
  --delta-bg: #0d0c10;
  --btn-primary-bg:    #f0eee9;
  --btn-primary-fg:    #111013;
  --btn-primary-hover: #d8d4ce;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition-theme);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 999;
  opacity: 0.4;
}

header {
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  flex-shrink: 0;
  display: block;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.logo-wordmark {
  display: flex;
  align-items: baseline;
  gap: 1px;
  line-height: 1;
}
.logo-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  transition: color 0.25s;
}
.logo-tld {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--ink3);
  letter-spacing: 0.02em;
  transition: color 0.25s;
}

.header-tag {
  font-family: var(--mono);
  font-size: 0.56rem;
  color: var(--ink3);
  letter-spacing: 0.08em;
  opacity: 0.75;
  line-height: 1;
}

.main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  padding: 16px;
  min-height: 0;
  overflow: hidden;
  height: calc(100vh - 56px);
}

/* ── Video Panel ── */
.video-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.drop-zone {
  flex: 1;
  background: var(--card);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 0;
}
.drop-zone:hover:not(.has-video) { border-color: var(--ink3); }
.drop-zone.drag-over { border-color: var(--ink); background: rgba(26,24,20,0.015); }
.drop-zone.has-video { cursor: default; border-style: solid; border-color: var(--border2); justify-content: flex-start; }

.drop-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 40px;
  user-select: none;
  pointer-events: none;
}

.drop-icon-wrap {
  width: 76px; height: 76px;
  border-radius: 18px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.2s;
}
.drop-zone:hover .drop-icon-wrap { transform: translateY(-2px); }
.drop-icon-wrap svg { color: var(--ink2); }
.drop-icon-wrap::before, .drop-icon-wrap::after {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  bottom: -4px;
}
.drop-icon-wrap::before { background: var(--a); left: 16px; }
.drop-icon-wrap::after  { background: var(--b); right: 16px; }

.drop-hint h2 {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.drop-hint p {
  font-family: var(--mono);
  font-size: 0.63rem;
  color: var(--ink3);
  letter-spacing: 0.03em;
}
.drop-badges {
  display: flex;
  gap: 5px;
}
.drop-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.drop-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink2);
  letter-spacing: 0.02em;
}
.drop-step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem;
  color: var(--ink);
  flex-shrink: 0;
}
.badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 7px;
  font-family: var(--mono);
  font-size: 0.56rem;
  color: var(--ink2);
  letter-spacing: 0.04em;
}

#video-el {
  width: 100%;
  display: none;
  background: #0d0d0d;
  border-radius: var(--radius) var(--radius) 0 0;
  object-fit: contain;
  flex: 1;
  min-height: 0;
}
#file-input { display: none; }

/* ── Timeline ── */
.timeline-card {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 14px 10px;
  box-shadow: var(--shadow);
  display: none;
  flex-shrink: 0;
}
.timeline-card.visible { display: block; }

.timeline-track {
  position: relative;
  height: 30px;
  background: var(--surface);
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
  overflow: visible;
}
.timeline-progress {
  height: 100%;
  background: rgba(26,24,20,0.07);
  border-radius: 6px;
  pointer-events: none;
}
.range-highlight {
  position: absolute; top: 0; bottom: 0;
  pointer-events: none;
  border-radius: 3px;
  opacity: 0.1;
  background: var(--ink);
  display: none;
}
.marker-a, .marker-b {
  position: absolute; top: -2px; bottom: -2px;
  width: 3px; border-radius: 2px;
  transform: translateX(-50%);
  pointer-events: none; display: none;
}
.marker-a { background: var(--a); }
.marker-b { background: var(--b); }
.marker-a::before, .marker-b::before {
  content: attr(data-label);
  position: absolute; top: -18px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono); font-size: 0.54rem;
  font-weight: 500; letter-spacing: 0.06em; white-space: nowrap;
}
.marker-a::before { color: var(--a); }
.marker-b::before { color: var(--b); }
.timeline-playhead {
  position: absolute; top: -3px; bottom: -3px;
  width: 2px; background: var(--ink); border-radius: 2px;
  pointer-events: none; transform: translateX(-50%);
}
.timeline-playhead::before {
  content: ''; position: absolute; top: -5px; left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--ink);
}
.timeline-labels {
  display: flex; justify-content: space-between;
  margin-top: 5px;
  font-family: var(--mono); font-size: 0.57rem; color: var(--ink3);
}

/* ── Controls ── */
.controls-card {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 9px 12px;
  display: none;
  align-items: center;
  gap: 7px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.controls-card.visible { display: flex; }

.btn {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink2);
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.14s;
  border-radius: 7px;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--card); color: var(--ink); border-color: var(--ink3); box-shadow: var(--shadow); }
.btn:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-play { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border-color: var(--btn-primary-bg); min-width: 80px; }
.btn-play:hover:not(:disabled) { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); color: var(--btn-primary-fg); }

.btn-a { background: rgba(232,54,10,0.06); border-color: rgba(232,54,10,0.25); color: var(--a); }
.btn-a:hover:not(:disabled) { background: rgba(232,54,10,0.1); border-color: var(--a); color: var(--a); }

.btn-b { background: rgba(10,110,232,0.06); border-color: rgba(10,110,232,0.25); color: var(--b); }
.btn-b:hover:not(:disabled) { background: rgba(10,110,232,0.1); border-color: var(--b); color: var(--b); }

.btn-save { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border-color: var(--btn-primary-bg); }
.btn-save:hover:not(:disabled) { background: var(--btn-primary-hover); color: var(--btn-primary-fg); }

.current-time {
  font-family: var(--mono); font-size: 0.72rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 11px; border-radius: 7px;
  min-width: 96px; text-align: center; letter-spacing: 0.03em;
}

.speed-group {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 0.58rem; color: var(--ink3);
}
#speed-select {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink); font-family: var(--mono); font-size: 0.6rem;
  padding: 5px 7px; border-radius: 6px; cursor: pointer;
}

/* ── Side Panel ── */
.side-panel {
  display: flex; flex-direction: column;
  gap: 10px; overflow-y: auto; min-height: 0;
  padding-bottom: 2px;
}
.side-panel::-webkit-scrollbar { width: 3px; }
.side-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.card {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.card-label {
  font-family: var(--mono); font-size: 0.56rem;
  color: var(--ink3); letter-spacing: 0.12em;
  text-transform: uppercase; margin-bottom: 11px;
}

/* Points */
.points-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 10px; }
.point-box {
  background: var(--surface); border-radius: 8px;
  padding: 9px 11px; border: 1px solid var(--border2);
}
.point-box-label {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 0.54rem;
  color: var(--ink3); letter-spacing: 0.07em; margin-bottom: 4px;
}
.dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-a { background: var(--a); }
.dot-b { background: var(--b); }
.point-val { font-family: var(--mono); font-size: 0.85rem; font-weight: 500; color: var(--ink); }

/* Delta */
.delta-box {
  background: var(--delta-bg); border-radius: 8px;
  padding: 14px; text-align: center; position: relative; overflow: hidden;
  display: none;
}
.delta-box.visible { display: block; }
.delta-box::before {
  content: ''; position: absolute;
  top: -24px; right: -24px;
  width: 80px; height: 80px;
  background: rgba(255,255,255,0.025); border-radius: 50%;
}
.delta-label {
  font-family: var(--mono); font-size: 0.53rem;
  color: rgba(255,255,255,0.35); letter-spacing: 0.15em;
  text-transform: uppercase; margin-bottom: 7px;
}
.delta-value {
  font-family: var(--mono); font-size: 2rem; font-weight: 500;
  color: #fff; line-height: 1; letter-spacing: -0.02em; margin-bottom: 3px;
}
.delta-ms-val {
  font-family: var(--mono); font-size: 0.7rem;
  color: rgba(255,255,255,0.4); letter-spacing: 0.04em;
}

/* Log */
.log-scroll { max-height: 200px; overflow-y: auto; }
.log-scroll::-webkit-scrollbar { width: 3px; }
.log-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.log-list { display: flex; flex-direction: column; gap: 5px; }

.log-entry {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 7px; padding: 8px 10px;
  animation: fadein 0.18s ease;
}
@keyframes fadein { from { opacity:0; transform:translateY(3px); } to { opacity:1; transform:translateY(0); } }

.log-body { flex: 1; min-width: 0; }
.log-del {
  position: absolute; top: 5px; right: 6px;
  background: none; border: none; padding: 0 2px;
  font-size: 0.5rem; color: var(--ink3);
  cursor: pointer; line-height: 1; opacity: 0;
  transition: opacity 0.12s, color 0.12s;
}
.log-entry:hover .log-del { opacity: 1; }
.log-del:hover { color: var(--ink); }
.log-num { font-family: var(--mono); font-size: 0.68rem; color: var(--ink3); letter-spacing: 0.05em; }
.log-delta { font-family: var(--mono); font-size: 0.68rem; font-weight: 600; color: var(--ink); flex-shrink: 0; }
.log-pts { display: flex; align-items: center; gap: 6px; }
.log-pt { display: flex; align-items: center; gap: 3px; font-family: var(--mono); font-size: 0.56rem; color: var(--ink3); }
.log-pt .dot { width: 5px; height: 5px; }
.log-arrow { font-size: 0.56rem; color: var(--ink3); }

.empty-state {
  text-align: center; padding: 18px 0;
  font-family: var(--mono); font-size: 0.6rem;
  color: var(--ink3); line-height: 2;
}

/* Compare strip */
.compare-strip {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  margin-top: 6px;
}
.compare-strip.visible { display: flex; }
.compare-label {
  font-family: var(--mono); font-size: 0.55rem;
  color: var(--ink3); letter-spacing: 0.08em; text-transform: uppercase;
}
.compare-vals { display: flex; align-items: center; gap: 6px; }
.compare-val { font-family: var(--mono); font-size: 0.75rem; font-weight: 600; color: var(--ink); }
.compare-sep { font-family: var(--mono); font-size: 0.55rem; color: var(--ink3); }

/* Log entry selection */
.log-entry { cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.log-entry:hover { border-color: var(--ink3); }
.log-entry.selected {
  border-color: var(--ink2);
  background: var(--card);
}

.btn-row { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; }
.btn-export { flex: 1; background: var(--btn-primary-bg); color: var(--btn-primary-fg); border-color: var(--btn-primary-bg); font-size: 0.63rem; text-align:center; }
.btn-export:hover:not(:disabled) { background: var(--btn-primary-hover); color: var(--btn-primary-fg); }
.btn-clr { font-size: 0.6rem; padding: 6px 10px; }

/* Shortcuts */
.kbd-grid { display: flex; flex-direction: column; gap: 5px; }
.kbd-row { display: flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 0.57rem; color: var(--ink3); }
kbd {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 6px;
  font-family: var(--mono); font-size: 0.54rem; color: var(--ink);
  min-width: 20px; text-align: center;
  box-shadow: 0 1px 0 var(--border);
}

/* ── Theme Switch ── */
.theme-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.theme-switch-label {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--ink3);
  letter-spacing: 0.06em;
  transition: color 0.2s;
  min-width: 28px;
}

.switch-track {
  width: 40px;
  height: 22px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  position: relative;
  transition: background 0.25s, border-color 0.25s;
  flex-shrink: 0;
}

[data-theme="dark"] .switch-track {
  background: var(--ink3);
  border-color: var(--ink3);
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--card);
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), background 0.25s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
}

[data-theme="dark"] .switch-thumb {
  transform: translateX(18px);
  background: var(--ink);
}

.switch-icon-sun, .switch-icon-moon { position: absolute; transition: opacity 0.2s; }
.switch-icon-moon { opacity: 0; }
[data-theme="dark"] .switch-icon-sun  { opacity: 0; }
[data-theme="dark"] .switch-icon-moon { opacity: 1; }

/* Toast */
.toast {
  position: fixed; bottom: 18px; left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--btn-primary-bg); color: var(--btn-primary-fg);
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em;
  padding: 7px 16px; border-radius: 100px;
  opacity: 0; transition: all 0.18s;
  pointer-events: none; z-index: 9999; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Info Button ── */
.btn-info {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.14s;
  flex-shrink: 0;
}
.btn-info:hover { background: var(--card); color: var(--ink); border-color: var(--ink3); box-shadow: var(--shadow); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  position: relative;
  transform: translateY(8px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}


.modal-close {
  width: 28px; height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink3);
  font-size: 0.65rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.14s;
}
.modal-close:hover { color: var(--ink); background: var(--card); }

.modal-logo {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.modal-logo .logo-mark { width: 28px; height: 28px; }
.modal-logo .logo-name { font-family: var(--display); font-weight: 800; font-size: 1.1rem; letter-spacing: -0.02em; color: var(--ink); }
.modal-logo .logo-tld  { font-family: var(--mono); font-size: 0.58rem; color: var(--ink3); }


.modal-desc {
  font-family: var(--display); font-size: 0.8rem;
  color: var(--ink2); line-height: 1.65;
  margin-bottom: 16px;
}

.modal-privacy {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--mono); font-size: 0.58rem;
  color: var(--ink2); line-height: 1.6;
  margin-bottom: 18px;
}
.modal-privacy svg { flex-shrink: 0; margin-top: 1px; color: var(--ink3); }

.modal-links {
  display: flex; flex-direction: row; gap: 8px;
  margin-bottom: 18px;
  justify-content: center;
}
.modal-links a {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 0.62rem;
  color: var(--ink2); text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  transition: all 0.14s;
}
.modal-links a:hover { color: var(--ink); border-color: var(--ink3); background: var(--card); box-shadow: var(--shadow); }

.modal-copy {
  font-family: var(--mono); font-size: 0.54rem;
  color: var(--ink3); letter-spacing: 0.04em;
  text-align: center;
}

/* ── Name modal ── */
.name-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(3px);
  z-index: 1001;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s;
}
.name-modal.open { opacity: 1; pointer-events: all; }
.name-modal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: 100%; max-width: 300px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  transform: translateY(6px);
  transition: transform 0.15s;
}
.name-modal.open .name-modal-box { transform: translateY(0); }
.name-modal-label {
  font-family: var(--display); font-weight: 700;
  font-size: 0.85rem; color: var(--ink);
}
.name-modal-label span {
  font-family: var(--mono); font-weight: 400;
  font-size: 0.58rem; color: var(--ink3);
  margin-left: 4px;
}
.name-modal-input {
  width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px; padding: 8px 11px;
  font-family: var(--mono); font-size: 0.72rem; color: var(--ink);
  outline: none; margin: 10px 0 12px;
  transition: border-color 0.15s;
}
.name-modal-input:focus { border-color: var(--ink3); }
.name-modal-input::placeholder { color: var(--ink3); }
.name-modal-btns { display: flex; gap: 6px; }

/* Log tag */
.log-tag-row { margin: 3px 0 2px; }
.log-tag {
  display: inline-block;
  font-family: var(--mono); font-size: 0.55rem;
  color: var(--ink2);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Language selector ── */
.lang-selector { margin-bottom: 2px; }
#lang-select {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--ink3);
  font-family: var(--mono);
  font-size: 0.56rem;
  padding: 3px 6px;
  cursor: pointer;
  transition: border-color 0.14s, color 0.14s;
  letter-spacing: 0.03em;
}
#lang-select:hover { border-color: var(--ink3); color: var(--ink2); }
#lang-select:focus { outline: none; border-color: var(--ink3); }

/* ── YouTube ── */
.yt-divider {
  font-family: var(--mono);
  font-size: 0.55rem;
  color: var(--ink3);
  letter-spacing: 0.08em;
}

.yt-url-row {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 320px;
  pointer-events: auto;
}

#yt-url-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 11px;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}
#yt-url-input:focus { border-color: var(--ink3); }
#yt-url-input::placeholder { color: var(--ink3); }

#yt-container {
  display: none;
  width: 100%;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: #0d0d0d;
}
#yt-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.yt-warning {
  display: none;
  align-items: center;
  gap: 7px;
  background: rgba(200, 159, 0, 0.07);
  border: 1px solid rgba(200, 159, 0, 0.28);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--ink2);
  flex-shrink: 0;
  line-height: 1.5;
}
.yt-warning.visible { display: flex; }
.yt-warning svg { flex-shrink: 0; color: #b89000; }
[data-theme="dark"] .yt-warning svg { color: #d4ab00; }

/* ── Mobile ── */
@media (max-width: 480px) {
  .modal-links {
    flex-direction: column;
  }
  .modal-links a {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  header {
    padding: 0 16px;
  }

  /* === No video: full-height drop zone === */
  .main {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
    padding: 12px;
    gap: 12px;
  }

  .drop-zone {
    min-height: calc(100svh - 140px);
    flex: none;
  }

  body:not(.has-video) .card:first-child {
    display: none;
  }

  /* === With video: full-screen layout === */
  body.has-video {
    height: 100svh;
    overflow: hidden;
  }

  body.has-video footer {
    display: none;
  }

  body.has-video .main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    gap: 8px;
  }

  body.has-video .video-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  body.has-video .drop-zone {
    flex: 1;
    min-height: 160px;
    height: auto;
    justify-content: center;
  }

  body.has-video #video-el {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-height: none;
  }

  body.has-video .side-panel {
    flex: none;
    overflow-y: visible;
    padding-bottom: 16px;
  }

  /* === Shared mobile styles === */
  .side-panel {
    overflow-y: visible;
  }

  .log-scroll {
    max-height: none;
  }

  .controls-card.visible {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
  }

  .controls-card .btn-play,
  .controls-card .current-time,
  .controls-card .btn-a,
  .controls-card .btn-b,
  .controls-card .btn-change {
    flex: 1 1 calc(50% - 3px);
    text-align: center;
    box-sizing: border-box;
  }

  .controls-card .btn-save { display: none; }

  .controls-card .speed-group {
    flex: 1 1 calc(50% - 3px);
    margin-left: 0;
    justify-content: center;
  }

  .card-shortcuts,
  .card-measurements {
    display: none !important;
  }
}
