:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef2ee;
  --ink: #1f2523;
  --muted: #66706b;
  --line: #d7ddd7;
  --accent: #176b5d;
  --accent-strong: #0e4f44;
  --accent-soft: #dcebe7;
  --warning: #8b5e16;
  --shadow: 0 18px 44px rgba(31, 37, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
select,
input {
  font: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 244, 0.94);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 10px;
  font-size: 16px;
  line-height: 1.25;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-control {
  display: flex;
  align-items: end;
  gap: 8px;
}

.icon-button,
.primary-button,
.secondary-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 72px;
  height: 72px;
  color: #ffffff;
  background: var(--accent);
  font-size: 42px;
  font-weight: 900;
  line-height: 0;
}

.icon-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.secondary-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.icon-button:disabled {
  color: var(--accent-strong);
  border-color: #b9cbc5;
  background: #e4eeeb;
}

.select-wrap,
.input-wrap {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

select,
.input-wrap input {
  min-width: 320px;
  max-width: 44vw;
  height: 40px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  text-transform: none;
}

.input-wrap input {
  min-width: 160px;
  max-width: 220px;
}

.user-save-button {
  height: 40px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(520px, 1.18fr);
  gap: 24px;
  width: min(1760px, 100%);
  margin: 0 auto;
  padding: 24px 28px 32px;
}

.script-section,
.comparison-section {
  min-width: 0;
}

.script-section {
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.script-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.status-pill {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--warning);
  background: #fff8eb;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.complete {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.overview {
  margin-bottom: 18px;
  color: #38413d;
  font-size: 15px;
  line-height: 1.55;
}

.script-content {
  display: grid;
  gap: 18px;
}

.scene-block {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.shot-list {
  display: grid;
  gap: 12px;
}

.shot-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.shot-title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-strong);
}

.shot-copy {
  display: grid;
  gap: 8px;
  color: #3b4540;
  font-size: 13px;
  line-height: 1.5;
}

.shot-copy strong {
  color: var(--ink);
}

.comparison-section {
  display: grid;
  gap: 18px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.video-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111614;
}

.metrics {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  margin: 0;
  padding: 0 0 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.metric-row legend {
  float: left;
  width: 260px;
  padding: 0;
  font-size: 15px;
  font-weight: 800;
}

.choice-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px;
  width: min(360px, 100%);
}

.choice-group label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  font-weight: 800;
}

.choice-group input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-group label:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

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

.primary-button,
.secondary-button {
  min-height: 40px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.secondary-button {
  color: var(--ink);
  background: var(--surface);
}

@media (max-width: 1100px) {
  .app-header,
  .layout,
  .metric-row {
    grid-template-columns: 1fr;
  }

  .app-header {
    position: static;
    align-items: stretch;
  }

  .layout {
    display: grid;
  }

  .script-section {
    max-height: none;
  }

  .nav-controls {
    justify-content: space-between;
  }

  .user-control {
    align-items: end;
  }

  select,
  .input-wrap input {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 760px) {
  .app-header,
  .layout {
    padding-left: 16px;
    padding-right: 16px;
  }

  .video-grid,
  .choice-group {
    grid-template-columns: 1fr;
  }

  .metric-row {
    display: grid;
    align-items: stretch;
  }

  .metric-row legend {
    float: none;
    width: auto;
  }

  .form-actions {
    display: grid;
  }
}
