:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #5f6674;
  --line: #d9e0e8;
  --paper: #f5f7fb;
  --panel: #ffffff;
  --teal: #0f766e;
  --orange: #f97316;
  --blue: #2563eb;
  --shadow: 0 22px 70px rgba(17, 24, 39, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
.pay-link {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--ink);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  min-height: 40px;
  padding: 0 14px;
  text-decoration: none;
}

button:hover,
.pay-link:hover {
  background: #263244;
}

.app-shell {
  min-height: 100vh;
  padding: clamp(14px, 2vw, 24px);
}

.workspace {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 1380px;
}

.topbar,
.stage-header,
.status-line,
.list-head,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  border-bottom: 1px solid var(--line);
  padding: 8px 2px 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.98;
}

h2 {
  font-size: clamp(1.2rem, 2vw, 1.7rem);
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  min-height: 72vh;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.file-drop {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 126px;
  border: 1px dashed #a9b5c4;
  border-radius: 8px;
  background: #f9fbfe;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-drop span {
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 900;
}

.file-drop small,
.status-line,
.export-card p {
  color: var(--muted);
  font-size: 0.86rem;
}

.control-row,
.timeline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.timeline {
  border: 0;
  margin: 0;
  padding: 0;
}

.timeline legend {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  min-height: 40px;
  padding: 0 10px;
}

input[type="range"] {
  accent-color: var(--teal);
  padding: 0;
}

.button-row button {
  flex: 1;
}

.region-list,
.export-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
}

#regionCount {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 28px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--teal);
  font-weight: 900;
}

#regions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
}

.region-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  padding: 9px;
  text-align: left;
}

.region-item.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.region-item span {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
}

.region-item small {
  color: var(--muted);
}

.stage {
  display: grid;
  grid-template-rows: auto minmax(280px, 1fr) auto auto;
  gap: 14px;
  min-width: 0;
  padding: 16px;
}

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

#timeLabel {
  min-width: 62px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.canvas-wrap {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #0b1220;
  min-height: 430px;
}

canvas {
  display: block;
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  touch-action: none;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  pointer-events: none;
}

.empty-state.hidden {
  display: none;
}

.mock-window {
  width: min(620px, 88%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #111827;
  padding: 20px;
}

.mock-bar,
.mock-row,
.mock-secret,
.mock-grid span {
  border-radius: 6px;
}

.mock-bar {
  width: 42%;
  height: 12px;
  background: #14b8a6;
}

.mock-row {
  width: 64%;
  height: 18px;
  margin-top: 22px;
  background: #334155;
}

.mock-row.wide {
  width: 86%;
}

.mock-secret {
  width: 52%;
  height: 32px;
  margin-top: 18px;
  background: repeating-linear-gradient(90deg, var(--orange) 0 12px, #fdba74 12px 24px);
}

.mock-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.mock-grid span {
  height: 70px;
  background: #1f2937;
}

#scrubber {
  width: 100%;
}

.status-line {
  min-height: 28px;
}

.status-line a,
.legal-page a {
  color: var(--blue);
  font-weight: 850;
  text-decoration: none;
}

#exportStatus {
  color: var(--teal);
  font-weight: 850;
}

.legal-page,
.seo-page {
  display: grid;
  gap: 14px;
  margin: 0 auto;
  max-width: 760px;
  min-height: 100vh;
  padding: clamp(28px, 6vw, 72px) 20px;
}

.legal-page h1,
.seo-page h1 {
  font-size: clamp(2rem, 5vw, 4rem);
}

.legal-page p,
.seo-page p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.seo-page section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.seo-page h2 {
  font-size: 1.35rem;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .controls {
    order: 2;
  }

  .stage {
    order: 1;
  }

  .canvas-wrap {
    min-height: 260px;
  }
}

@media (max-width: 560px) {
  .topbar,
  .stage-header,
  .status-line {
    align-items: flex-start;
    flex-direction: column;
  }

  .control-row,
  .timeline {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.15rem;
  }
}
