:root {
  --bg0: #1a1714;
  --bg1: #241f1a;
  --bg2: #2e2822;
  --ink: #f3ebe1;
  --muted: #a89886;
  --line: rgba(243, 235, 225, 0.12);
  --accent: #e08a3c;
  --accent-2: #3cb8a0;
  --danger: #d95c4a;
  --cut: rgba(217, 92, 74, 0.45);
  --draft: rgba(224, 138, 60, 0.35);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --font: "Outfit", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg0);
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(224, 138, 60, 0.18), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(60, 184, 160, 0.12), transparent 55%),
    linear-gradient(165deg, #1f1b17 0%, #14110e 55%, #1a1714 100%);
}

.top {
  padding: 1.5rem 1.5rem 0.5rem;
  max-width: 1280px;
  margin: 0 auto;
}

.top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 14px;
  height: 28px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 24px rgba(224, 138, 60, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.tagline {
  margin: 0.35rem 0 0 1.65rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.lang-switch select {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 0.4rem 0.55rem;
  font: inherit;
}

.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.main-col {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.panel {
  background: linear-gradient(180deg, rgba(46, 40, 34, 0.92), rgba(36, 31, 26, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.load-row,
.export-row,
.transport,
.cut-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

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

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

.btn.primary {
  background: var(--accent);
  color: #1a120a;
}

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

.btn.danger {
  color: #ffd4cc;
  border-color: rgba(217, 92, 74, 0.4);
}

.btn.icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--bg2);
  border-color: var(--line);
  color: var(--ink);
}

.file-btn {
  display: inline-flex;
  align-items: center;
}

.status {
  margin: 0.75rem 0 0;
  font-size: 0.92rem;
}

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

.mono {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.video-shell {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0b0908;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}

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

.empty-video {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: 1rem;
  text-align: center;
}

.transport {
  margin-top: 0.85rem;
}

.step-select {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.step-select select {
  background: var(--bg0);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 0.4rem 0.45rem;
  font: inherit;
}

.mark-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.seek {
  flex: 1;
  min-width: 160px;
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.timeline-head h2 {
  margin-bottom: 0.85rem;
}

.timeline-wrap {
  position: relative;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
    #171310;
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}

#script-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  pointer-events: none;
  transform: translateX(-1px);
}

.cut-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cut-region {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--cut);
  border-left: 1px solid rgba(255, 180, 170, 0.55);
  border-right: 1px solid rgba(255, 180, 170, 0.55);
}

.draft-range {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--draft);
  border: 1px dashed rgba(224, 138, 60, 0.9);
  pointer-events: none;
}

.cut-controls {
  margin-top: 1rem;
  display: grid;
  gap: 0.85rem;
}

.range-block {
  display: grid;
  gap: 0.35rem;
}

.range-block label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.range-block input[type="text"] {
  width: 7.5rem;
  background: var(--bg0);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 0.35rem 0.5rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.cut-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.cut-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: rgba(217, 92, 74, 0.12);
  border: 1px solid rgba(217, 92, 74, 0.28);
  font-size: 0.9rem;
}

.cut-list button {
  background: transparent;
  border: none;
  color: #ffc3ba;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.export-name {
  display: grid;
  gap: 0.35rem;
  flex: 1;
  min-width: 180px;
  color: var(--muted);
  font-size: 0.85rem;
}

.export-name input,
.export-name select,
#output-name {
  background: var(--bg0);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  padding: 0.65rem 0.75rem;
  font: inherit;
}

.export-result {
  margin-top: 0.85rem;
  padding: 0.85rem;
  border-radius: 10px;
  background: rgba(60, 184, 160, 0.12);
  border: 1px solid rgba(60, 184, 160, 0.35);
}

.ad-rail {
  position: sticky;
  top: 1rem;
}

.ad-slot {
  border: 1px solid rgba(243, 235, 225, 0.1);
  border-radius: 12px;
  padding: 0.55rem;
  background: rgba(0, 0, 0, 0.18);
  text-align: center;
  overflow: hidden;
}

.ad-slot [id^="ytrgt-"] {
  min-height: 250px;
  display: grid;
  place-items: center;
}

.ad-bottom [id^="ytrgt-"] {
  min-height: 90px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .ad-rail {
    order: 2;
    position: static;
  }

  .main-col {
    order: 1;
  }
}

@media (max-width: 700px) {
  .top,
  .layout {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .tagline {
    margin-left: 0;
  }
}
