/* =========================================================
   VidSlice Studio — editor-first UI
   ========================================================= */

:root {
  --bg: #f1f3f7;
  --bg-2: #e7eaf0;
  --panel: #ffffff;
  --panel-2: #f7f8fb;
  --panel-3: #eceff4;
  --text: #111318;
  --muted: #5c6472;
  --muted-2: #8a91a0;
  --line: rgba(15, 20, 30, 0.08);
  --line-2: rgba(15, 20, 30, 0.15);
  --line-3: rgba(15, 20, 30, 0.24);
  --accent: #1a1c20;
  --accent-2: #3b3f46;
  --accent-text: #1a1c20;
  --accent-ink: #ffffff;
  --accent-soft: rgba(20, 22, 26, 0.08);
  --accent-glow: rgba(20, 22, 26, 0.2);
  --timeline-accent: #f3f4f6;
  --timeline-accent-ink: #0b0d10;
  --timeline-glow: rgba(255, 255, 255, 0.28);
  --btn-bg: #16181c;
  --btn-text: #ffffff;
  --btn-hover: #2b2e34;
  --danger: #d43c3c;
  --warning: #a66a00;
  --shadow: 0 24px 70px -28px rgba(25, 33, 55, 0.34);
  --shadow-soft: 0 12px 30px -18px rgba(25, 33, 55, 0.3);
  --inset: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --field: rgba(255, 255, 255, 0.8);
  --field-2: rgba(15, 20, 30, 0.035);
  --video-bg: #e4e8ef;
  --inspector-w: 330px;
  --welcome-bg: #eef1f6;
  --welcome-glow-1: rgba(20, 22, 26, 0.22);
  --welcome-glow-2: rgba(90, 95, 105, 0.16);
  --welcome-grid: rgba(15, 20, 30, 0.06);
  --welcome-card: rgba(255, 255, 255, 0.82);
  --welcome-border: rgba(255, 255, 255, 0.95);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  --bg: #08090b;
  --bg-2: #0b0d10;
  --panel: #111318;
  --panel-2: #15181e;
  --panel-3: #1a1e25;
  --text: #f2f4f7;
  --muted: #9299a8;
  --muted-2: #626a79;
  --line: rgba(255, 255, 255, 0.075);
  --line-2: rgba(255, 255, 255, 0.13);
  --line-3: rgba(255, 255, 255, 0.2);
  --accent: #f1f3f7;
  --accent-2: #c9cdd5;
  --accent-text: #f1f3f7;
  --accent-ink: #0b0d10;
  --accent-soft: rgba(241, 243, 247, 0.1);
  --accent-glow: rgba(241, 243, 247, 0.22);
  --timeline-accent: #f3f4f6;
  --timeline-accent-ink: #0b0d10;
  --timeline-glow: rgba(255, 255, 255, 0.28);
  --btn-bg: #f1f3f7;
  --btn-text: #0b0d10;
  --btn-hover: #ffffff;
  --danger: #ff6b6b;
  --warning: #ffc45c;
  --shadow: 0 30px 90px -30px rgba(0, 0, 0, 0.85);
  --shadow-soft: 0 16px 40px -22px rgba(0, 0, 0, 0.8);
  --inset: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --field: rgba(0, 0, 0, 0.24);
  --field-2: rgba(255, 255, 255, 0.04);
  --video-bg: #050607;
  --welcome-bg: #07080a;
  --welcome-glow-1: rgba(255, 255, 255, 0.1);
  --welcome-glow-2: rgba(150, 155, 165, 0.08);
  --welcome-grid: rgba(255, 255, 255, 0.045);
  --welcome-card: rgba(17, 20, 25, 0.8);
  --welcome-border: rgba(255, 255, 255, 0.12);
}

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

html {
  height: 100%;
  color-scheme: light;
}

html[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

[hidden] { display: none !important; }

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

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

button,
input,
a { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

svg { display: block; }

kbd {
  display: inline-block;
  padding: 1px 5px;
  margin: 0 1px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  background: var(--field-2);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.5;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  flex-shrink: 0;
}

/* =========================================================
   App shell
   ========================================================= */

.app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.topbar {
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px 0 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  position: relative;
  z-index: 20;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.logo__mark {
  width: 30px;
  height: 30px;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.18));
}

.logo__mark svg { width: 100%; height: 100%; }

.logo__word {
  font-size: 16px;
  font-weight: 720;
  letter-spacing: -0.035em;
}

.logo__word span {
  color: var(--muted-2);
}

html[data-theme="dark"] .logo__word span {
  color: var(--muted-2);
}

.logo__tag {
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translateY(1px);
}

.project {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  max-width: 440px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.project:focus-within {
  background: var(--field);
  border-color: var(--line-2);
}

.project__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
  flex-shrink: 0;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.project__dot.is-loading {
  background: var(--warning);
  box-shadow: 0 0 0 0 rgba(255, 196, 92, 0.45);
  animation: pulse-warn 1.6s ease-out infinite;
}

.project__dot.is-ready {
  background: var(--accent-2);
  box-shadow: 0 0 10px rgba(190, 195, 205, 0.7);
}

.project__dot.is-error {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

@keyframes pulse-warn {
  0% { box-shadow: 0 0 0 0 rgba(255, 196, 92, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(255, 196, 92, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 196, 92, 0); }
}

.project__name {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 0;
}

.project__state {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

/* =========================================================
   Buttons
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--field-2);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 14px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s cubic-bezier(0.2, 0.7, 0.2, 1), background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.btn:hover {
  background: var(--field);
  border-color: var(--line-3);
}

.btn:active { transform: scale(0.985); }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--btn-bg);
  color: var(--btn-text);
  border-color: transparent;
  box-shadow: 0 10px 26px -14px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.btn--primary:hover {
  background: var(--btn-hover);
  border-color: transparent;
  box-shadow: 0 14px 32px -14px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line-2);
}

.btn--ghost:hover { background: var(--field-2); }

.btn--sm {
  padding: 7px 11px;
  font-size: 12px;
  gap: 6px;
}

.btn--sm svg { width: 15px; height: 15px; }

.btn--lg {
  padding: 11px 18px;
  font-size: 13.5px;
  border-radius: 10px;
}

.btn--xl {
  min-height: 52px;
  padding: 13px 24px;
  font-size: 15px;
  border-radius: 12px;
}

.btn--xl svg { width: 19px; height: 19px; }

.btn--wide { width: 100%; }

.btn--quiet {
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.btn--quiet:hover {
  color: var(--text);
  background: var(--field-2);
  border-color: transparent;
}

.btn--cta {
  width: 100%;
  min-height: 52px;
  margin-top: 14px;
  border-radius: 10px;
  font-size: 14.5px;
  gap: 9px;
}

.btn--cta svg { width: 19px; height: 19px; }

.cta__meta {
  font-size: 10.5px;
  font-weight: 650;
  opacity: 0.55;
  padding-left: 9px;
  border-left: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.icon-btn:hover {
  background: var(--field-2);
  border-color: var(--line);
  color: var(--text);
}

.icon-btn:active { transform: scale(0.94); }

.icon-btn svg { width: 17px; height: 17px; }

.icon-btn--solid {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 6px 18px -8px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.icon-btn--solid:hover {
  background: var(--accent-2);
  color: var(--accent-ink);
}

.icon-btn--tiny {
  width: 27px;
  height: 27px;
  border-radius: 6px;
}

.icon-btn--tiny svg { width: 14px; height: 14px; }

.theme-toggle { position: relative; }
.icon--sun { display: none; }
.icon--moon { display: block; }
html[data-theme="dark"] .icon--sun { display: block; }
html[data-theme="dark"] .icon--moon { display: none; }

.icon--pause { display: none; }
.is-playing .icon--play { display: none; }
.is-playing .icon--pause { display: block; }

.icon--muted { display: none; }
.is-muted .icon--volume { display: none; }
.is-muted .icon--muted { display: block; }

/* =========================================================
   Studio layout
   ========================================================= */

.studio {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
}

.rail {
  border-right: 1px solid var(--line);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}

.rail__btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 58px;
  padding: 7px 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.rail__btn:hover {
  background: var(--field-2);
  color: var(--text);
}

.rail__btn.is-active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text);
}

.rail__btn.is-active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 15px;
  bottom: 15px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.rail__icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}

.rail__icon svg { width: 21px; height: 21px; }

.rail__btn.is-active .rail__icon { color: var(--accent-text); }

.rail__btn--muted { color: var(--muted-2); }
.rail__spacer { flex: 1; }

.workspace {
  min-width: 0;
  min-height: 0;
  padding: 10px;
}

.workspace__main {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--inspector-w, 330px);
  grid-template-rows: minmax(0, 1fr) 238px;
  gap: 10px;
}

/* =========================================================
   Preview
   ========================================================= */

.preview {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--video-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
}

.preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(80% 70% at 50% 0%, rgba(255, 255, 255, 0.04), transparent 65%),
    linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.35));
  pointer-events: none;
  z-index: 0;
}

.preview video {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

.preview__empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 7px;
  padding: 24px;
  background:
    radial-gradient(60% 60% at 50% 42%, rgba(255, 255, 255, 0.035), transparent 70%),
    var(--video-bg);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.preview__empty.is-hidden {
  opacity: 0;
  transform: scale(0.985);
  pointer-events: none;
}

.empty__mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: var(--field-2);
  color: var(--accent-text);
  box-shadow: 0 12px 30px -14px rgba(0, 0, 0, 0.5), var(--inset);
}

.empty__mark svg { width: 34px; height: 34px; }

.preview__empty h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: #f4f6f8;
}

.preview__empty p {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}

.preview__empty .btn { margin-top: 14px; }

.empty__hint {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.32);
}

.preview__hud {
  position: absolute;
  top: 11px;
  left: 11px;
  right: 11px;
  z-index: 3;
  display: flex;
  gap: 5px;
  pointer-events: none;
}

.hud-pill {
  max-width: 62%;
  padding: 5px 9px;
  border-radius: 6px;
  background: rgba(8, 10, 14, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: rgba(255, 255, 255, 0.9);
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-pill--muted { color: rgba(255, 255, 255, 0.55); }

.preview__overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.bigplay {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 12, 16, 0.44);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.25s ease;
}

.bigplay svg { width: 26px; height: 26px; }
.bigplay__pause { display: none; }

.bigplay:hover {
  transform: scale(1.06);
  background: rgba(20, 24, 30, 0.58);
}

.preview.is-playing .bigplay {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
}

.preview.is-playing .bigplay__play { display: none; }
.preview.is-playing .bigplay__pause { display: block; }

.preview__controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 22px 11px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
}

.preview__controls .icon-btn {
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
}

.preview__controls .icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.preview__controls .icon-btn--solid {
  color: var(--accent-ink);
  border-color: transparent;
  background: var(--accent);
}

.controls__spacer { flex: 1; }

.timecode {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.9);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timecode__sep,
.timecode__total { color: rgba(255, 255, 255, 0.45); }

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
  color: rgba(255, 255, 255, 0.7);
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.chip-btn svg { width: 13px; height: 13px; }
.chip-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }
.chip-btn:active { transform: scale(0.97); }

.preview:fullscreen {
  border-radius: 0;
  border: 0;
  background: #000;
}

.preview:fullscreen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview:fullscreen .bigplay,
.preview:fullscreen .preview__hud,
.preview:fullscreen .preview__controls {
  display: none;
}

/* =========================================================
   Inspector
   ========================================================= */

.inspector {
  grid-column: 2;
  grid-row: 1 / span 2;
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.inspector__head {
  height: 45px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid var(--line);
}

.inspector__title {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.inspector__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.inspector__body::-webkit-scrollbar { width: 6px; }
.inspector__body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

.panel {
  display: none;
  padding: 16px;
  animation: panel-in 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.panel.is-active { display: block; }

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

.panel__lead { margin-bottom: 18px; }

.panel__eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-text);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel__lead h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 680;
  letter-spacing: -0.035em;
}

.panel__lead p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.panel__note {
  margin: 14px 0 0;
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted-2);
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.media-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  margin-bottom: 9px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--field-2);
}

.media-card__icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.media-card__icon svg { width: 18px; height: 18px; }

.media-card__icon--music {
  background: var(--field-2);
  color: var(--muted);
}

html[data-theme="dark"] .media-card__icon--music {
  background: var(--field-2);
  color: var(--muted);
}

.media-card__body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.media-card__body strong {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card__body span {
  color: var(--muted-2);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card .btn--wide { margin-top: 2px; }

#addVideoBtn,
#addMusicBtn { margin-bottom: 9px; }

#addMusicBtn { margin-top: 1px; }

.info-strip {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 15px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--field-2);
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.5;
}

.info-strip svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}

.info-strip--warn {
  border-color: color-mix(in srgb, var(--warning) 24%, transparent);
  background: color-mix(in srgb, var(--warning) 7%, transparent);
  color: color-mix(in srgb, var(--warning) 82%, var(--text));
}

.segment-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--field-2);
}

.segment-summary .field-label { margin-bottom: 2px; }

.segment-summary strong {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
}

.segment-summary__count {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.trim-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field { display: block; min-width: 0; }

.field-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--field);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field-box:focus-within {
  border-color: var(--accent-text);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-box input {
  width: 100%;
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  padding: 0;
}

.field-box__hint {
  display: none;
  color: var(--muted-2);
  font-size: 8px;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.length-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 12px;
  font-size: 11px;
  color: var(--muted-2);
}

.length-row strong {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.segment-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 13px 0 10px;
}

.segment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--field-2);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.segment-item:hover { border-color: var(--line-2); }

.segment-item.is-active {
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
  background: var(--accent-soft);
}

.segment-item__index {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--field-2);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
}

.segment-item.is-active .segment-item__index {
  background: var(--accent);
  color: var(--accent-ink);
}

.segment-item__body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.segment-item__body strong {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.segment-item__body span {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
}

.segment-item__move {
  display: flex;
  gap: 1px;
}

.segment-item__move button {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  padding: 0;
}

.segment-item__move button:hover { background: var(--field); color: var(--text); }
.segment-item__move button:disabled { opacity: 0.25; cursor: default; }
.segment-item__move svg { width: 12px; height: 12px; }

.audio-block {
  padding: 11px;
  margin-bottom: 9px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--field-2);
}

.audio-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.audio-block__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.audio-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.audio-icon svg { width: 16px; height: 16px; }

.audio-icon--music {
  background: var(--field-2);
  color: var(--muted);
}

html[data-theme="dark"] .audio-icon--music {
  background: var(--field-2);
  color: var(--muted);
}

.audio-block__title div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.audio-block__title strong {
  font-size: 12px;
  font-weight: 600;
}

.audio-block__title span {
  color: var(--muted-2);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toggle {
  width: 34px;
  height: 19px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--field-2);
  padding: 2px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle span {
  display: block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--muted-2);
  transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1), background 0.2s ease;
}

.toggle[aria-checked="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
}

.toggle[aria-checked="true"] span {
  transform: translateX(15px);
  background: var(--accent);
}

.range-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  font-size: 10.5px;
  color: var(--muted-2);
}

.range-row > span { flex-shrink: 0; }

.range-row strong {
  width: 34px;
  text-align: right;
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  flex: 1;
  border-radius: 999px;
  background: var(--line-2);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  cursor: pointer;
  user-select: none;
}

.check-row input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.check-row__box {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: 1px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  background: var(--field);
  display: grid;
  place-items: center;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.check-row__box::after {
  content: "";
  width: 7px;
  height: 4px;
  border-left: 1.6px solid var(--accent-ink);
  border-bottom: 1.6px solid var(--accent-ink);
  transform: rotate(-45deg) translateY(-1px) scale(0);
  transition: transform 0.16s ease;
}

.check-row input:checked + .check-row__box {
  background: var(--accent);
  border-color: var(--accent);
}

.check-row input:checked + .check-row__box::after { transform: rotate(-45deg) translateY(-1px) scale(1); }

.check-row input:focus-visible + .check-row__box {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

.check-row__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.check-row__text strong {
  font-size: 11.5px;
  font-weight: 600;
}

.check-row__text small {
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.4;
}

.check-row--compact { margin-top: 9px; }

.export-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-bottom: 15px;
}

.export-summary > div {
  padding: 8px 7px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--field-2);
}

.export-summary span {
  display: block;
  color: var(--muted-2);
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.export-summary strong {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--field-2);
  margin-bottom: 6px;
}

.segmented--wide .segmented__btn { flex: 1; }

.segmented__btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.segmented__btn:hover { color: var(--text); }

.segmented__btn.is-active {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 12px -6px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.segmented__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.mode-desc {
  margin: 0 0 13px;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.5;
}

.quality-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 3px;
  margin-bottom: 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--field-2);
}

.quality-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 6px 2px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.quality-btn:hover { color: var(--text); }

.quality-btn.is-active {
  background: var(--field);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), var(--inset);
}

#engineNote { text-align: center; }

/* =========================================================
   Timeline
   ========================================================= */

.timeline {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 7px 9px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.timeline__toolbar {
  height: 31px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 5px;
}

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

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.tool-btn svg { width: 14px; height: 14px; }
.tool-btn:hover { background: var(--field-2); color: var(--text); }
.tool-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.tool-btn--quiet { color: var(--muted-2); }

.timeline__divider {
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: var(--line);
}

.timeline__meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.timeline__ruler {
  position: relative;
  height: 17px;
  flex-shrink: 0;
  margin: 0 0 3px 78px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  user-select: none;
  pointer-events: none;
}

.ruler__tick {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 4px;
  background: var(--line-2);
}

.ruler__tick--major { height: 7px; }

.ruler__label {
  position: absolute;
  bottom: 8px;
  transform: translateX(-50%);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  white-space: nowrap;
}

.timeline__tracks {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
}

.track {
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-height: 0;
}

.track--video { flex: 1; min-height: 82px; }
.track--audio { flex-shrink: 0; height: 30px; }

.track__label {
  width: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.track__icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--field-2);
  color: var(--muted);
}

.track__icon svg { width: 12px; height: 12px; }

.track__lane {
  position: relative;
  flex: 1;
  min-width: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--video-bg);
  border: 1px solid var(--line);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.track__lane--audio {
  height: 30px;
  background: var(--field-2);
  border-color: var(--line);
  overflow: hidden;
}

#filmstrip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.track__lane.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.06) 50%, transparent 80%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.segments {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.segment-block {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 6px;
  border: 1px solid rgba(150, 156, 168, 0.24);
  background: rgba(150, 156, 168, 0.045);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
  cursor: grab;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
  touch-action: none;
}

.segment-block::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 38%);
  pointer-events: none;
}

.segment-block:hover {
  border-color: rgba(150, 156, 168, 0.5);
  background: rgba(150, 156, 168, 0.08);
}

.segment-block.is-active {
  border-color: var(--timeline-accent);
  background: rgba(150, 156, 168, 0.1);
  box-shadow: 0 0 0 1px rgba(243, 244, 246, 0.35), 0 0 22px -6px var(--timeline-glow);
}

.segment-block.is-dragging {
  cursor: grabbing;
  z-index: 4;
  opacity: 0.9;
  transform: scale(1.01);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--timeline-accent);
}

.segment-block.is-drop-target {
  border-color: var(--timeline-accent);
  box-shadow: 0 0 0 2px rgba(243, 244, 246, 0.35);
}

.segment-block__label {
  position: absolute;
  left: 6px;
  top: 4px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.36);
  color: rgba(255, 255, 255, 0.78);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  pointer-events: none;
}

.segment-block.is-active .segment-block__label {
  background: var(--timeline-accent);
  color: var(--timeline-accent-ink);
}

.timeline__shade {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  background: rgba(4, 6, 10, 0.55);
  pointer-events: none;
  opacity: 0;
}

.timeline__selection {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 3;
  border-top: 2px solid var(--timeline-accent);
  border-bottom: 2px solid var(--timeline-accent);
  background: rgba(150, 156, 168, 0.035);
  pointer-events: none;
  opacity: 0;
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  margin-left: -0.5px;
  z-index: 5;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.65);
  pointer-events: none;
  will-change: left;
}

.playhead span {
  position: absolute;
  top: 0;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.playhead--audio { z-index: 4; opacity: 0.7; }

.timeline__handle {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 44px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: var(--timeline-accent);
  color: var(--timeline-accent-ink);
  display: grid;
  place-items: center;
  cursor: ew-resize;
  z-index: 6;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
}

.timeline__handle:hover {
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 0 3px var(--timeline-glow), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.timeline__handle:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.timeline__handle span {
  width: 6px;
  height: 14px;
  opacity: 0.55;
  background:
    linear-gradient(currentColor, currentColor) left center / 1.5px 100% no-repeat,
    linear-gradient(currentColor, currentColor) right center / 1.5px 100% no-repeat;
}

.timeline__handle--start { left: 0; }
.timeline__handle--end { left: 100%; }

.timeline__handle:disabled { display: none; }

.track__lane.is-dragging { cursor: grabbing; }

.music-clip {
  position: absolute;
  inset: 3px;
  border-radius: 5px;
  border: 1px solid rgba(190, 195, 205, 0.3);
  background: rgba(190, 195, 205, 0.1);
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 8px;
}

.music-clip__name {
  position: relative;
  z-index: 2;
  max-width: 70%;
  color: #d7dae0;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-clip__pattern {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image: repeating-linear-gradient(90deg, rgba(190, 195, 205, 0.5) 0 1px, transparent 1px 5px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.timeline__hint {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 2px 0;
  color: var(--muted-2);
  font-size: 9.5px;
}

.kbd-hint { white-space: nowrap; }

/* =========================================================
   Welcome
   ========================================================= */

.welcome {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 22px 28px 20px;
  background:
    radial-gradient(90% 70% at 50% -10%, rgba(255, 255, 255, 0.42), transparent 60%),
    var(--welcome-bg);
  transition: opacity 0.55s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0.55s ease;
}

html[data-theme="dark"] .welcome {
  background:
    radial-gradient(90% 70% at 50% -10%, rgba(255, 255, 255, 0.035), transparent 60%),
    var(--welcome-bg);
}

.welcome.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.welcome__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.55;
}

.welcome__glow--1 {
  width: 48vw;
  height: 48vw;
  min-width: 420px;
  min-height: 420px;
  top: -22vw;
  left: -8vw;
  background: var(--welcome-glow-1);
  animation: welcome-drift 18s ease-in-out infinite alternate;
}

.welcome__glow--2 {
  width: 40vw;
  height: 40vw;
  min-width: 360px;
  min-height: 360px;
  right: -12vw;
  bottom: -18vw;
  background: var(--welcome-glow-2);
  animation: welcome-drift 22s ease-in-out infinite alternate-reverse;
}

@keyframes welcome-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4vw, 3vw, 0) scale(1.1); }
}

.welcome__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--welcome-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--welcome-grid) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 42%, #000 10%, transparent 78%);
  mask-image: radial-gradient(70% 60% at 50% 42%, #000 10%, transparent 78%);
  opacity: 0.65;
}

.welcome__top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.welcome__brand {
  font-size: 14px;
  font-weight: 720;
  letter-spacing: -0.03em;
}

.welcome__brand em {
  margin-left: 4px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.welcome__center {
  position: relative;
  z-index: 3;
  width: min(760px, 100%);
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px 0 10px;
}

.welcome__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--welcome-card);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  box-shadow: var(--inset);
}

.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(190, 195, 205, 0.5);
  animation: pulse 2.4s ease-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(190, 195, 205, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(190, 195, 205, 0); }
  100% { box-shadow: 0 0 0 0 rgba(190, 195, 205, 0); }
}

.welcome h1 {
  margin: 18px 0 0;
  font-size: clamp(52px, 8vw, 94px);
  line-height: 0.92;
  letter-spacing: -0.06em;
  font-weight: 720;
}

.welcome__accent {
  color: var(--muted-2);
}

html[data-theme="dark"] .welcome__accent {
  color: var(--muted-2);
}

.welcome__lead {
  max-width: 590px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
}

.welcome__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 25px;
}

.welcome__drop {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 18px;
  color: var(--muted-2);
  font-size: 11px;
}

.welcome__drop svg { width: 14px; height: 14px; }

.welcome__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 17px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

.welcome__preview {
  position: absolute;
  right: 3.5vw;
  bottom: 6.5vh;
  z-index: 2;
  width: min(430px, 34vw);
  transform: rotate(-2.5deg);
  opacity: 0.72;
  pointer-events: none;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.35));
  animation: mock-float 9s ease-in-out infinite alternate;
}

@keyframes mock-float {
  from { transform: rotate(-2.5deg) translateY(0); }
  to { transform: rotate(-1.2deg) translateY(-12px); }
}

.mock-window {
  border-radius: 12px;
  border: 1px solid var(--welcome-border);
  background: var(--welcome-card);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, 0.45), var(--inset);
  overflow: hidden;
}

.mock-window__bar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 27px;
  padding: 0 9px;
  border-bottom: 1px solid var(--line);
}

.mock-window__bar span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-3);
}

.mock-window__bar em {
  margin-left: 6px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  font-style: normal;
}

.mock-window__stage {
  display: flex;
  gap: 7px;
  padding: 8px;
}

.mock-window__screen {
  position: relative;
  flex: 1;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  background:
    radial-gradient(60% 80% at 50% 50%, rgba(150, 156, 168, 0.18), transparent 70%),
    #0a0c10;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
}

.mock-window__play {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  position: relative;
}

.mock-window__play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  border-left: 7px solid rgba(255, 255, 255, 0.8);
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  transform: translate(-40%, -50%);
}

.mock-window__caption {
  position: absolute;
  left: 7px;
  bottom: 6px;
  color: rgba(255, 255, 255, 0.45);
  font-family: var(--mono);
  font-size: 7px;
}

.mock-window__side {
  width: 72px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 2px;
}

.mock-line {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--line-2);
}

.mock-line--1 { width: 80%; }
.mock-line--2 { width: 58%; }
.mock-line--3 { width: 70%; }

.mock-swatch {
  display: block;
  height: 24px;
  margin-top: 3px;
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(150, 156, 168, 0.3), rgba(190, 195, 205, 0.15));
  border: 1px solid rgba(150, 156, 168, 0.2);
}

.mock-timeline {
  position: relative;
  display: flex;
  gap: 4px;
  height: 33px;
  padding: 7px 8px;
  border-top: 1px solid var(--line);
}

.mock-clip {
  display: block;
  height: 100%;
  border-radius: 3px;
  border: 1px solid rgba(150, 156, 168, 0.24);
  background: rgba(150, 156, 168, 0.1);
}

.mock-clip--1 { width: 28%; }
.mock-clip--2 { width: 38%; }
.mock-clip--3 { width: 22%; }

.mock-playhead {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 56%;
  width: 1px;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.mock-playhead::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: #fff;
  transform: translateX(-50%);
}

.welcome__footer {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.welcome__footer-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.welcome .icon-btn { color: var(--muted); }

/* =========================================================
   Drop overlay
   ========================================================= */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(5, 7, 10, 0.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.drop-overlay__inner {
  width: min(480px, 86vw);
  padding: 36px 28px;
  border-radius: 18px;
  border: 1.5px dashed var(--accent);
  background: rgba(150, 156, 168, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 7px;
  color: #fff;
  box-shadow: 0 0 60px -12px var(--accent-glow);
}

.drop-overlay__inner svg {
  width: 42px;
  height: 42px;
  color: var(--accent);
  margin-bottom: 5px;
}

.drop-overlay__inner strong {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.drop-overlay__inner span {
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
}

/* =========================================================
   Modals
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 8, 0.7);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: fade-in 0.25s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal__card {
  position: relative;
  width: min(500px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 26px;
  border-radius: 18px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  box-shadow: var(--shadow), var(--inset);
  animation: modal-in 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.modal__card--help { width: min(560px, 100%); }

.modal__card h2 {
  margin: 8px 0 4px;
  font-size: 23px;
  font-weight: 680;
  letter-spacing: -0.035em;
}

.export-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 4px 4px;
}

.progress-ring {
  position: relative;
  width: 124px;
  height: 124px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}

.progress-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke-width: 7;
}

.progress-ring__track { stroke: var(--line); }

.progress-ring__value-circle {
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 0.25s ease;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.progress-ring__value {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.export-progress h2 { margin-top: 0; }

.export-progress p {
  margin: 0;
  min-height: 17px;
  color: var(--muted);
  font-size: 12px;
}

.processing__bar {
  width: min(300px, 100%);
  height: 5px;
  margin-top: 16px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.processing__bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px var(--accent-glow);
  transition: width 0.2s ease;
}

.export-progress .btn { margin-top: 18px; }

.export-result {
  text-align: center;
  padding: 4px 0 0;
}

.result__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--accent-text);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.result__badge svg { width: 13px; height: 13px; }

.result__sub {
  margin: 0;
  color: var(--muted-2);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.export-result video {
  display: block;
  width: 100%;
  max-height: 260px;
  margin: 14px 0;
  border-radius: 10px;
  background: #000;
  border: 1px solid var(--line-2);
}

.result__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.result__stats > div {
  padding: 9px 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--field-2);
}

.result__stats span {
  display: block;
  color: var(--muted-2);
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result__stats strong {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.result__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 15px;
}

.result__actions .btn--cta {
  width: auto;
  min-width: 210px;
  margin-top: 0;
  min-height: 44px;
  font-size: 13px;
}

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.help-grid > div {
  padding: 10px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--field-2);
}

.help-grid strong {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  font-weight: 650;
}

.help-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.help-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 10.5px;
}

/* =========================================================
   Toasts
   ========================================================= */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: min(360px, calc(100% - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 13px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--accent-2);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
  pointer-events: auto;
}

.toast.is-visible {
  opacity: 1;
  transform: none;
}

.toast.is-error { border-left-color: var(--danger); }

.toast svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--accent-2);
}

.toast.is-error svg { color: var(--danger); }

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1180px) {
  .workspace__main { grid-template-columns: minmax(0, 1fr) var(--inspector-w, 310px); }
  .welcome__preview { width: min(380px, 32vw); opacity: 0.5; }
}

@media (max-width: 980px) {
  .workspace__main { grid-template-columns: minmax(0, 1fr) var(--inspector-w, 286px); }
  .rail { width: auto; }
  .studio { grid-template-columns: 68px minmax(0, 1fr); }
  .rail__btn { min-height: 54px; font-size: 9px; }
  .welcome__preview { display: none; }
}

@media (max-width: 760px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100dvh; }
  .topbar { height: 54px; gap: 10px; padding: 0 10px; }
  .logo__tag { display: none; }
  .project { max-width: none; }
  .project__state { display: none; }
  .topbar__import span { display: none; }
  .topbar__import { padding: 7px 9px; }
  .studio { display: flex; flex-direction: column; min-height: 0; }
  .rail {
    order: 2;
    flex-direction: row;
    align-items: stretch;
    gap: 2px;
    padding: 5px 7px;
    border-right: 0;
    border-top: 1px solid var(--line);
    overflow-x: auto;
    background: var(--bg);
  }
  .rail__btn {
    flex: 1;
    min-width: 62px;
    min-height: 48px;
    flex-direction: row;
    gap: 5px;
    padding: 5px 6px;
    font-size: 9.5px;
  }
  .rail__btn.is-active::before { display: none; }
  .rail__spacer { display: none; }
  .rail__btn--muted { flex: 0 0 44px; min-width: 44px; }
  .rail__btn--muted span:last-child { display: none; }
  .workspace { order: 1; padding: 7px; }
  .workspace__main {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    gap: 7px;
  }
  .preview { order: 1; }
  .timeline { order: 2; }
  .inspector { order: 3; }
  .preview {
    height: 38vh;
    min-height: 220px;
    max-height: 420px;
    flex-shrink: 0;
  }
  .preview__empty h2 { font-size: 18px; }
  .preview__empty p { font-size: 12px; }
  .preview__empty .btn--lg { min-height: 40px; padding: 9px 14px; font-size: 12px; }
  .timeline { height: 212px; flex-shrink: 0; }
  .inspector {
    max-height: 52vh;
    flex-shrink: 0;
  }
  .timeline__hint { display: none; }
  .timeline__ruler { margin-left: 66px; }
  .track__label { width: 60px; }
  .track__label span:last-child { display: none; }
  .track__label { justify-content: center; }
  .welcome { padding: 16px; overflow-y: auto; }
  .welcome__center { padding-top: 8vh; padding-bottom: 4vh; }
  .welcome h1 { font-size: clamp(44px, 13vw, 70px); }
  .welcome__lead { font-size: 13px; }
  .welcome__actions { flex-direction: column; width: 100%; max-width: 320px; }
  .welcome__actions .btn { width: 100%; }
  .welcome__footer { margin-top: auto; }
  .modal__card { padding: 20px; }
  .help-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .topbar { height: 50px; }
  .logo__word { font-size: 14px; }
  .logo__mark { width: 26px; height: 26px; }
  .project__name { font-size: 12px; }
  .topbar__actions .btn span { display: none; }
  .topbar__actions .btn { padding: 7px 9px; }
  .topbar__actions .btn svg { width: 16px; height: 16px; }
  .icon-btn { width: 30px; height: 30px; }
  .preview { height: 34vh; min-height: 190px; }
  .preview__controls { gap: 5px; padding: 18px 8px 8px; }
  .preview__controls .chip-btn { display: none; }
  .timecode { font-size: 10px; }
  .timeline { height: 204px; padding: 6px 7px 5px; }
  .timeline__meta { font-size: 8.5px; }
  .tool-btn span { display: none; }
  .tool-btn { padding: 5px 6px; }
  .timeline__ruler { margin-left: 0; }
  .track__label { display: none; }
  .segment-block__label { font-size: 7px; }
  .inspector { max-height: 58vh; }
  .export-summary strong { font-size: 10px; }
  .welcome__eyebrow { font-size: 9px; }
  .welcome__meta { font-size: 8.5px; gap: 7px; }
  .welcome__drop { font-size: 10px; }
  .result__actions .btn--cta { width: 100%; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   Launch screen — compact editor-first card
   ========================================================= */

.welcome {
  background: rgba(238, 241, 246, 0.62);
  -webkit-backdrop-filter: blur(9px) saturate(115%);
  backdrop-filter: blur(9px) saturate(115%);
}

html[data-theme="dark"] .welcome {
  background: rgba(5, 6, 9, 0.6);
}

.welcome__glow {
  opacity: 0.18;
  filter: blur(120px);
}

.welcome__grid {
  opacity: 0.2;
}

.welcome__top {
  align-items: center;
}

.welcome__brand {
  font-size: 15px;
}

.welcome__center {
  width: min(520px, 100%);
  max-height: calc(100dvh - 110px);
  margin: auto;
  padding: 30px 30px 26px;
  overflow-y: auto;
  align-items: stretch;
  text-align: left;
  border-radius: 22px;
  border: 1px solid var(--welcome-border);
  background: var(--welcome-card);
  -webkit-backdrop-filter: blur(30px) saturate(165%);
  backdrop-filter: blur(30px) saturate(165%);
  box-shadow: 0 34px 90px -34px rgba(0, 0, 0, 0.62), var(--inset);
  animation: launch-card-in 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.welcome__center::-webkit-scrollbar { width: 6px; }
.welcome__center::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

@keyframes launch-card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.welcome__eyebrow {
  align-self: flex-start;
  background: var(--field-2);
  border-color: var(--line-2);
  box-shadow: none;
}

.welcome h1 {
  margin: 16px 0 0;
  font-size: clamp(30px, 4.2vw, 40px);
  line-height: 1.04;
  letter-spacing: -0.05em;
  font-weight: 720;
  text-align: left;
}

.welcome__lead {
  max-width: none;
  margin: 12px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  text-align: left;
}

.welcome__actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 22px;
}

.welcome__actions .btn--xl {
  min-height: 48px;
  padding: 11px 18px;
  font-size: 14px;
  border-radius: 11px;
}

.welcome__actions .btn--primary {
  flex: 1 1 180px;
}

.welcome__actions .btn--ghost {
  flex: 0 1 auto;
}

.welcome__drop {
  justify-content: flex-start;
  margin-top: 14px;
}

.welcome__meta {
  justify-content: flex-start;
  margin-top: 14px;
}

.welcome__footer {
  margin-top: auto;
}

.welcome__preview {
  display: none !important;
}

@media (max-width: 860px) {
  .welcome {
    padding: 16px;
    overflow-y: auto;
  }
  .welcome__center {
    width: min(520px, 100%);
    max-height: none;
    margin: auto;
    padding: 24px 20px 22px;
    border-radius: 18px;
  }
  .welcome h1 {
    font-size: clamp(28px, 8vw, 36px);
  }
  .welcome__lead {
    font-size: 12.5px;
  }
  .welcome__actions {
    flex-direction: column;
    align-items: stretch;
  }
  .welcome__actions .btn {
    flex: 0 0 auto;
    width: 100%;
  }
  .welcome__footer {
    justify-content: center;
    margin-top: 22px;
  }
}

@media (max-width: 520px) {
  .welcome__center {
    padding: 20px 16px 18px;
  }
  .welcome h1 {
    font-size: 27px;
  }
  .welcome__meta {
    font-size: 8.5px;
    gap: 7px;
  }
}

/* =========================================================
   Small editor refinements
   ========================================================= */

.inspector.is-hidden {
  display: none;
}

.workspace__main.is-inspector-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.quality-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.segment-block {
  overflow: hidden;
}

.track__lane.is-reordering {
  cursor: grabbing;
}

.segment-block.is-dragging {
  pointer-events: none;
}

.drop-overlay {
  z-index: 150;
}



/* =========================================================
   Account / profile
   ========================================================= */

.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px 4px 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--field-2);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.18s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.account-btn:hover {
  background: var(--field);
  border-color: var(--line-2);
  transform: translateY(-1px);
}

.account-btn:active { transform: scale(0.98); }

.account-btn__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--text);
  color: var(--panel);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.account-btn__label {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-btn--welcome {
  background: var(--welcome-card);
  border-color: var(--welcome-border);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

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

.account__lead {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.account__form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account__field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.account__field em {
  color: var(--muted-2);
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.75;
}

.account__field .field-box { padding: 9px 10px; }

.account__field .field-box input {
  font-family: var(--font);
  font-size: 13px;
  font-variant-numeric: normal;
}

/* =========================================================
   Editor entrance / micro-animations
   ========================================================= */

.app.is-entered .workspace {
  animation: workspace-in 0.62s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.app.is-entered .rail {
  animation: rail-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes workspace-in {
  from { transform: translateY(10px) scale(0.996); }
  to { transform: none; }
}

@keyframes rail-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: none; }
}

.segment-block:hover {
  transform: translateY(-1px);
}

.segment-block.is-active:hover {
  transform: translateY(-1px);
}

.timeline__handle:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.rail__btn .rail__icon {
  transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.rail__btn:hover .rail__icon {
  transform: translateY(-1px);
}

.btn--primary:hover {
  transform: translateY(-1px);
}

.btn--primary:active {
  transform: translateY(0) scale(0.985);
}

@media (max-width: 860px) {
  .account-btn__label { display: none; }
  .account-btn { padding-right: 5px; }
  .welcome__top-actions .account-btn__label { display: none; }
}


/* Launch card mini timeline */
.welcome__strip {
  position: relative;
  height: 30px;
  margin-top: 18px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0d0f13;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 20px -14px rgba(0, 0, 0, 0.6);
}

.welcome__strip::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 26px);
  opacity: 0.6;
}

.welcome__strip-clip {
  position: absolute;
  top: 5px;
  bottom: 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 55%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 14px),
    rgba(255, 255, 255, 0.06);
}

.welcome__strip-clip:nth-child(2) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 55%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 12px),
    rgba(255, 255, 255, 0.09);
}

.welcome__strip-clip:nth-child(3) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), transparent 55%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 16px),
    rgba(255, 255, 255, 0.05);
}

.welcome__strip-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1.5px;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  animation: strip-play 6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes strip-play {
  0% { left: 2%; }
  50% { left: 62%; }
  100% { left: 98%; }
}

@media (max-width: 860px) {
  .welcome__strip { margin-top: 15px; }
}


/* Mini timeline polish */
.welcome__strip {
  height: 34px;
  padding: 6px 0;
  background: #0a0c10;
}

.welcome__strip::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px 26px);
  opacity: 0.55;
}

.welcome__strip-clip {
  top: 7px;
  bottom: 5px;
  border-color: rgba(255, 255, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 58%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.11) 0 1px, transparent 1px 14px),
    rgba(255, 255, 255, 0.12);
}

.welcome__strip-clip:nth-child(2) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 58%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.13) 0 1px, transparent 1px 12px),
    rgba(255, 255, 255, 0.17);
}

.welcome__strip-clip:nth-child(3) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 58%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 16px),
    rgba(255, 255, 255, 0.1);
}

.welcome__strip-playhead {
  width: 2px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.95);
}

.welcome__strip-playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: -3px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #ffffff;
}


/* =========================================================
   Empty timeline + compact viewport layout
   ========================================================= */

.track__empty {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--muted-2);
  font-size: 10.5px;
  letter-spacing: 0.01em;
  text-align: center;
  pointer-events: none;
}

.track__empty svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.7;
}

.track__lane.has-media .track__empty { display: none; }

.timeline.is-empty .timeline__ruler { opacity: 0.3; }

@media (max-width: 760px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .app {
    height: 100dvh;
    min-height: 0;
  }

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

  .workspace {
    order: 1;
    flex: 1;
    min-height: 0;
    display: flex;
    padding: 7px;
  }

  .workspace__main {
    flex: 1;
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
  }

  .preview {
    order: 1;
    flex: 1 1 auto;
    height: auto;
    min-height: 140px;
    max-height: none;
  }

  .timeline {
    order: 2;
    flex: 0 0 auto;
    height: clamp(176px, 30dvh, 218px);
  }

  .rail {
    order: 2;
    flex: 0 0 auto;
  }

  .inspector {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(59px + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    height: clamp(176px, 30dvh, 218px);
    max-height: none;
    border-radius: 16px;
    box-shadow: 0 -24px 64px -24px rgba(0, 0, 0, 0.7), var(--inset);
    animation: inspector-sheet-in 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .app.is-entered .workspace {
    animation: none;
  }

  .inspector.is-hidden { display: none; }

  .inspector__head {
    height: 42px;
    padding-left: 16px;
  }

  .panel {
    padding: 12px 14px;
  }

  .panel__lead {
    margin-bottom: 10px;
  }

  .panel__lead h3,
  .panel__lead p {
    display: none;
  }

  .panel[data-panel="media"] .info-strip {
    display: none;
  }

  .welcome {
    padding: 16px;
    overflow-y: auto;
  }

  .welcome__center {
    width: 100%;
    max-height: calc(100dvh - 64px);
    padding: 24px 20px 22px;
  }

  .welcome h1 {
    font-size: clamp(34px, 9.5vw, 48px);
  }

  .welcome__actions {
    max-width: none;
  }

  .welcome__actions .btn {
    width: 100%;
  }
}

@keyframes inspector-sheet-in {
  from { opacity: 0; transform: translateY(18px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

/* =========================================================
   Feature batch: saved badge, theme morph, sheet grip,
   compression, projects library, red export CTA
   ========================================================= */

.project__saved {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  animation: saved-in 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.project__saved svg {
  width: 11px;
  height: 11px;
}

@keyframes saved-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

/* Moon turns into sun and back */
.icon-btn.is-switching svg,
.welcome__theme.is-switching svg {
  animation: theme-morph 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes theme-morph {
  0% { opacity: 0; transform: rotate(-130deg) scale(0.35); }
  55% { opacity: 1; transform: rotate(9deg) scale(1.12); }
  100% { opacity: 1; transform: rotate(0) scale(1); }
}

/* Mobile sheet grabber */
.sheet-grip { display: none; }

/* Compression controls */
.compress-toggle { margin-top: 4px; }
.compress-controls { margin-top: 2px; }
.compress-hint { margin: 2px 0 13px; }

/* Red CTA shown only after export */
.btn--red {
  background: #e5484d;
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 12px 28px -14px rgba(229, 72, 77, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn--red:hover {
  background: #d93a40;
  color: #ffffff;
  border-color: transparent;
}

.result__note {
  margin: 10px 0 0;
  text-align: center;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.45;
}

/* Projects library */
.modal__card--projects { width: min(640px, 100%); }

.projects__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 12px;
}

.projects__ttl {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.projects__ttl select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 150px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--field);
  color: var(--text);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.projects__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.projects__empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px 14px;
  text-align: center;
  border-radius: 12px;
  border: 1px dashed var(--line-2);
  color: var(--muted);
}

.projects__empty strong { color: var(--text); font-size: 13px; }
.projects__empty span { font-size: 11px; line-height: 1.5; }

.project-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--field-2);
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.project-card:hover {
  border-color: var(--line-2);
  transform: translateY(-1px);
}

.project-card__thumb {
  width: 92px;
  height: 56px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 7px;
  background: var(--video-bg);
  color: var(--muted-2);
}

.project-card__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card__thumb svg { width: 20px; height: 20px; }

.project-card__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-card__body strong {
  font-size: 12.5px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-card__body span {
  color: var(--muted-2);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-card__expiry { color: var(--muted-2); font-size: 9.5px; }

.project-card__actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

@media (max-width: 760px) {
  .sheet-grip {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 18px;
    flex-shrink: 0;
    touch-action: none;
    cursor: grab;
  }

  .sheet-grip span {
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--line-3);
    transition: background 0.18s ease;
  }

  .sheet-grip:active span { background: var(--muted-2); }
  .inspector.is-dragging { animation: none; }
  .inspector.is-dragging .sheet-grip { cursor: grabbing; }
  .topbar__projects span { display: none; }
  .project__saved { display: none; }
}

@media (max-width: 520px) {
  .project-card { grid-template-columns: 64px minmax(0, 1fr); }
  .project-card__thumb { width: 64px; height: 44px; }
  .project-card__actions { grid-column: 1 / -1; justify-content: flex-end; }
  .result__stats { grid-template-columns: repeat(2, 1fr); }
  .projects__toolbar { align-items: stretch; }
  .projects__toolbar .btn { width: 100%; }
  .projects__ttl select { width: 100%; }
}

/* Compact timeline toolbar before the mobile breakpoint */
.timeline__hint > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .tool-btn span { display: none; }
  .tool-btn { padding: 5px 6px; }
  .topbar__projects span { display: none; }
  .topbar__projects { padding: 7px 9px; }
}

/* Keep the project name readable on very narrow phones */
@media (max-width: 520px) {
  .topbar__actions { gap: 4px; }
  #saveProjectBtn { display: none; }
  .project__name { min-width: 40px; }
  .project { min-width: 0; }
}

/* =========================================================
   Light theme preview + auth feedback + entry animation
   ========================================================= */

html[data-theme="light"] .preview::before {
  background:
    radial-gradient(80% 70% at 50% 0%, rgba(15, 20, 30, 0.035), transparent 65%),
    linear-gradient(180deg, transparent 60%, rgba(15, 20, 30, 0.06));
}

html[data-theme="light"] .preview__empty {
  background:
    radial-gradient(60% 60% at 50% 42%, rgba(15, 20, 30, 0.04), transparent 70%),
    var(--video-bg);
}

html[data-theme="light"] .preview__empty h2 { color: var(--text); }
html[data-theme="light"] .preview__empty p { color: var(--muted); }
html[data-theme="light"] .empty__hint { color: var(--muted-2); }

html[data-theme="light"] .track__empty {
  color: var(--muted-2);
}

html[data-theme="light"] .hud-pill {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(15, 20, 30, 0.12);
  color: var(--text);
}

html[data-theme="light"] .hud-pill--muted { color: var(--muted); }

html[data-theme="light"] .preview__controls {
  background: linear-gradient(transparent, rgba(228, 232, 239, 0.94));
}

html[data-theme="light"] .preview__controls .icon-btn {
  color: var(--text);
  border-color: rgba(15, 20, 30, 0.12);
  background: rgba(255, 255, 255, 0.74);
}

html[data-theme="light"] .preview__controls .icon-btn:hover {
  background: #ffffff;
  color: var(--accent-text);
}

html[data-theme="light"] .timecode { color: var(--text); }
html[data-theme="light"] .timecode__sep,
html[data-theme="light"] .timecode__total { color: var(--muted-2); }

html[data-theme="light"] .bigplay {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(15, 20, 30, 0.14);
  color: var(--text);
  box-shadow: 0 18px 44px rgba(25, 33, 55, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .bigplay:hover {
  background: #ffffff;
}

.account__error {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--danger) 34%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.45;
}

.account__error.is-shaking,
.modal__card.is-shaking {
  animation: auth-shake 0.36s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.account__link {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.account__link:hover { color: var(--text); }

.account__help {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--field-2);
}

.enter-flash {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 8, 11, 0.34);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.enter-flash.is-visible {
  opacity: 1;
}

.enter-flash__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 180px;
  padding: 22px 26px 20px;
  border-radius: 18px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  box-shadow: var(--shadow), var(--inset);
  transform: translateY(10px) scale(0.96);
  transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.enter-flash.is-visible .enter-flash__card {
  transform: none;
}

.enter-flash__check {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin-bottom: 3px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 24px -12px var(--accent-glow);
}

.enter-flash__check svg {
  width: 24px;
  height: 24px;
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  animation: enter-check 0.42s 0.08s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

@keyframes enter-check {
  to { stroke-dashoffset: 0; }
}

.enter-flash__card strong {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.enter-flash__card > span:last-child {
  color: var(--muted-2);
  font-size: 10.5px;
  text-align: center;
}

/* Inspector width handle */
.inspector-resize {
  position: absolute;
  left: -5px;
  top: 0;
  bottom: 0;
  z-index: 8;
  width: 10px;
  cursor: col-resize;
  touch-action: none;
}

.inspector-resize::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  width: 3px;
  height: 34px;
  margin-top: -17px;
  border-radius: 999px;
  background: var(--line-2);
  opacity: 0;
  transition: opacity 0.18s ease, background 0.18s ease;
}

.inspector-resize:hover::after,
body.is-resizing .inspector-resize::after {
  opacity: 1;
  background: var(--muted-2);
}

body.is-resizing {
  cursor: col-resize;
  user-select: none;
}

/* Rail drag reorder */
.rail__btn[draggable="true"] {
  cursor: grab;
}

.rail__btn.is-dragging {
  opacity: 0.4;
}

.rail__btn.is-drop-target {
  outline: 2px dashed var(--line-3);
  outline-offset: -2px;
}

@media (max-width: 760px) {
  .inspector-resize { display: none; }
  .rail__btn[draggable="true"] { cursor: pointer; }
}

/* =========================================================
   Discord-like motion polish
   ========================================================= */

.modal__close svg,
.icon-btn svg {
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal__close:hover svg {
  transform: rotate(90deg) scale(1.08);
}

.icon-btn:hover svg {
  transform: translateY(-1px) scale(1.06);
}

.icon-btn:active svg {
  transform: scale(0.88);
}

.rail__btn .rail__icon {
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
}

.rail__btn:hover .rail__icon {
  transform: translateY(-2px) scale(1.09);
}

.rail__btn:active .rail__icon {
  transform: scale(0.92);
}

.rail__btn.is-active .rail__icon {
  animation: rail-pop 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rail-pop {
  0% { transform: scale(0.82); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.btn {
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease,
    border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.985); }

.tool-btn {
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease,
    transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.tool-btn:hover { transform: translateY(-1px); }
.tool-btn:active { transform: scale(0.96); }

.account-btn {
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.account-btn:hover { transform: translateY(-1px); }
.account-btn:active { transform: scale(0.97); }

.account-btn__avatar {
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.account-btn:hover .account-btn__avatar {
  transform: scale(1.08) rotate(-4deg);
}

.modal__card {
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.seg__btn,
.chip,
.toggle,
.tab {
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease,
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease;
}

.seg__btn:hover,
.chip:hover,
.tab:hover { transform: translateY(-1px); }

.seg__btn:active,
.chip:active,
.tab:active { transform: scale(0.97); }

/* Icon + label micro pop when a rail item is dropped in a new place */
.rail__btn.is-dropped .rail__icon {
  animation: rail-drop-pop 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rail-drop-pop {
  0% { transform: scale(0.7) rotate(-8deg); }
  55% { transform: scale(1.14) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}

/* =========================================================
   Account shell — dark, theme-independent (Epic-style)
   ========================================================= */

.modal.modal--account {
  padding: 24px;
}

.account-backdrop {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.07), transparent 58%),
    #050506;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  animation: account-backdrop-in 0.3s ease;
}

@keyframes account-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.account-shell {
  /* Local monochrome palette: the shell ignores the app theme */
  --text: #f4f4f5;
  --text-2: #d9d9dd;
  --muted: #a4a4ac;
  --muted-2: #8c8c95;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.15);
  --line-3: rgba(255, 255, 255, 0.28);
  --field: #1c1c20;
  --field-2: #161619;
  --panel: #101012;
  --btn-bg: #f5f5f6;
  --btn-text: #0a0a0b;
  --btn-hover: #ffffff;
  --danger: #ff7a7a;
  --accent-text: #ffffff;
  --accent-glow: rgba(255, 255, 255, 0.12);

  position: relative;
  display: flex;
  flex-direction: column;
  width: min(452px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, #141416 0%, #0e0e10 100%);
  color: var(--text);
  box-shadow:
    0 40px 120px -28px rgba(0, 0, 0, 0.9),
    0 2px 0 rgba(255, 255, 255, 0.04) inset,
    0 0 0 1px rgba(0, 0, 0, 0.6);
  font-family: var(--font);
  animation: account-shell-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes account-shell-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.modal--account .account-close {
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  z-index: 5;
}

.modal--account .account-close:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

/* ---------- Brand header ---------- */

.account-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}

.account-brand__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: #1a1a1e;
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.account-brand__mark svg {
  width: 19px;
  height: 19px;
}

.account-brand__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.account-brand__text strong {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.account-brand__text span {
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 500;
}

.account-brand__badge {
  margin-left: auto;
  margin-right: 34px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.account-brand__badge.is-online {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* ---------- Screens ---------- */

.account-screens {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.account-screen {
  display: flex;
  flex-direction: column;
  padding: 22px;
}

.account-screen[hidden] {
  display: none !important;
}

.account-screen.is-entering {
  animation: account-screen-in 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes account-screen-in {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: none; }
}

.account-screen.is-shaking {
  animation: auth-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.account-screen h2 {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 24px;
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.18;
}

.account__lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.account__lead strong {
  color: var(--text-2);
  font-weight: 650;
  word-break: break-all;
}

/* ---------- Fields / form ---------- */

.account__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account__field {
  gap: 6px;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.account__field em {
  margin-left: 6px;
  color: var(--muted-2);
  opacity: 0.6;
}

.account__field .field-box {
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--field-2);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.account__field .field-box:hover {
  border-color: var(--line-2);
}

.account__field .field-box:focus-within {
  border-color: rgba(255, 255, 255, 0.45);
  background: #1b1b1f;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.07);
}

.account__field .field-box input {
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  font-variant-numeric: normal;
  caret-color: var(--text);
}

.account__field .field-box input::placeholder {
  color: #66666e;
}

.account__submit {
  width: 100%;
  height: 44px;
  margin-top: 4px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.account__submit svg {
  width: 16px;
  height: 16px;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.account__submit:hover svg {
  transform: translateX(3px);
}

/* ---------- Links / helpers ---------- */

.account__link {
  align-self: flex-start;
  margin-top: 14px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.account__link:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.account__link:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: none;
}

.account__link--danger {
  color: #ff8f8f;
  margin-top: 18px;
}

.account__link--danger:hover {
  color: #ffadad;
}

.account__link--avatar {
  margin-top: -8px;
  margin-bottom: 4px;
  align-self: flex-start;
  font-size: 10.5px;
}

.account__legal {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: #70707a;
  font-size: 10px;
  line-height: 1.55;
}

.account__help {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted-2);
  font-size: 10.5px;
}

.panel__note.account__code-note {
  margin: 0;
  color: var(--muted-2);
  font-size: 10.5px;
  text-align: center;
}

/* ---------- Errors ---------- */

.account__error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 122, 122, 0.32);
  background: rgba(255, 90, 90, 0.09);
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.5;
  animation: account-error-in 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes account-error-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.account-screen.is-shaking .account__error {
  animation: none;
}

/* ---------- Back button ---------- */

.account__back {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  margin: 0 0 14px;
  padding: 5px 9px 5px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease,
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.account__back svg {
  width: 14px;
  height: 14px;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.account__back:hover {
  border-color: var(--line-2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.account__back:hover svg {
  transform: translateX(-2px);
}

.account__back:active {
  transform: scale(0.97);
}

/* ---------- Code screen ---------- */

.account-screen--code h2 {
  text-align: center;
}

.account-screen--code .account__lead {
  text-align: center;
}

.code-inputs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 2px 0 4px;
}

.code-input {
  width: 52px;
  height: 62px;
  flex: 0 1 52px;
  min-width: 0;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--field-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  caret-color: var(--text);
  outline: 0;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease,
    transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.code-input:hover {
  border-color: var(--line-3);
}

.code-input:focus {
  border-color: rgba(255, 255, 255, 0.7);
  background: #1e1e23;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.09);
  transform: translateY(-1px);
}

.code-input.is-filled {
  border-color: rgba(255, 255, 255, 0.34);
  background: #202025;
}

.code-input:disabled {
  opacity: 0.55;
}

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

.account__code-actions .account__link {
  margin-top: 12px;
}

/* ---------- Profile screen ---------- */

.account-hero {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.account-hero__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.account-hero__body h2 {
  margin: 0;
  font-size: 21px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-hero__body p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-badge {
  align-self: flex-start;
  margin-top: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.account-avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: #f2f2f3;
  color: #0b0b0c;
  font-family: var(--font);
  font-weight: 750;
  font-size: 26px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.account-avatar--lg {
  width: 82px;
  height: 82px;
}

.account-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.account-avatar:hover {
  transform: translateY(-1px);
  border-color: var(--line-3);
  box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.8);
}

.account-avatar__edit {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 10, 12, 0.82);
  color: #fff;
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.account-avatar__edit svg {
  width: 12px;
  height: 12px;
}

.account-avatar:hover .account-avatar__edit,
.account-avatar:focus-visible .account-avatar__edit {
  opacity: 1;
  transform: scale(1);
}

/* ---------- Rows (email / password) ---------- */

.account__rows {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field-2);
  overflow: hidden;
}

.account__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
}

.account__row + .account__row {
  border-top: 1px solid var(--line);
}

.account__row-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.account__row-label span {
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.account__row-label strong {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account__row-note {
  color: var(--muted-2);
  font-size: 10px;
  white-space: nowrap;
}

.account__row-btn {
  flex-shrink: 0;
  padding: 6px 11px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.account__row-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--line-3);
}

.account__row-btn:active {
  transform: scale(0.96);
}

/* Saved micro-pulse on the profile screen */
.account-screen.is-saved .account__submit {
  animation: account-save-pulse 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes account-save-pulse {
  0% { transform: scale(1); }
  45% { transform: scale(0.985); }
  100% { transform: scale(1); }
}

/* Busy state */
.account-shell.is-busy .account__submit {
  cursor: progress;
}

/* ---------- Mobile ---------- */

@media (max-width: 560px) {
  .modal.modal--account {
    padding: 12px;
  }

  .account-shell {
    max-height: calc(100dvh - 24px);
    border-radius: 14px;
  }

  .account-brand {
    padding: 16px 17px 13px;
  }

  .account-brand__badge {
    margin-right: 30px;
  }

  .account-screen {
    padding: 18px 17px 20px;
  }

  .account-screen h2 {
    font-size: 21px;
  }

  .code-inputs {
    gap: 6px;
  }

  .code-input {
    height: 54px;
    flex: 1 1 0;
    font-size: 21px;
  }

  .account-hero {
    gap: 13px;
  }

  .account-avatar--lg {
    width: 70px;
    height: 70px;
    font-size: 22px;
  }

  .account-hero__body h2 {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
