:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #66736b;
  --line: #d7ded7;
  --panel: #f7f8f3;
  --paper: #ffffff;
  --accent: #156f61;
  --accent-strong: #0d5148;
  --warn: #ad6b16;
  --soft: #eaf2ef;
  --shadow: 0 16px 40px rgba(23, 32, 27, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef1ea;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
textarea,
select {
  font: inherit;
}

.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
}

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

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

h2 {
  margin-bottom: 8px;
  font-size: 18px;
}

p,
li {
  color: var(--muted);
  line-height: 1.48;
}

.top-actions,
.scene-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(480px, 1.35fr);
  gap: 18px;
  padding: 18px;
}

.input-panel,
.output-panel {
  min-width: 0;
}

.input-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
  align-self: start;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 230px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

select {
  height: 42px;
  padding: 0 10px;
}

textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(21, 111, 97, 0.12);
}

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

.prompt-rules {
  display: grid;
  gap: 8px;
  margin: 4px 0 16px;
  padding: 12px;
  background: var(--soft);
  border-radius: 8px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink);
  line-height: 1.35;
}

.check input {
  margin-top: 2px;
}

.primary,
.secondary,
.tab {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
}

.primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

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

.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.secondary:hover,
.tab:hover {
  border-color: var(--accent);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  background: #fff;
  border-color: var(--line);
}

.tab.active {
  background: var(--ink);
  color: #fff;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.summary-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-bar span {
  color: var(--muted);
}

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

.scene-card,
.training-grid article,
.video-grid article {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 22px rgba(23, 32, 27, 0.06);
}

.scene-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.mode-pill {
  flex: 0 0 auto;
  max-width: 220px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.score-row {
  display: grid;
  grid-template-columns: auto 1fr 42px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.score-label {
  color: var(--muted);
  font-size: 13px;
}

.score-track {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #e1e6df;
}

.score-track span {
  display: block;
  height: 100%;
  width: 50%;
  background: var(--accent);
}

.prompt-blocks {
  display: grid;
  gap: 10px;
}

.prompt-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.prompt-block h3 {
  margin: 0;
  padding: 9px 10px;
  background: #f2f5ef;
  font-size: 13px;
}

.prompt-block pre {
  min-height: 72px;
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #25302a;
  line-height: 1.45;
}

.scene-actions {
  margin-top: 12px;
}

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

.training-grid ul {
  margin-bottom: 0;
  padding-left: 20px;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #eef1ea;
  color: var(--accent-strong);
}

video {
  width: 100%;
  max-height: 360px;
  background: #000;
  border-radius: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 10;
}

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

  .input-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .workspace {
    padding: 12px;
  }

  .controls-grid,
  .training-grid,
  .video-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .tab {
    flex: 0 0 auto;
  }

  .scene-card-head,
  .score-row {
    grid-template-columns: 1fr;
  }

  .scene-card-head {
    display: grid;
  }

  .mode-pill {
    max-width: none;
  }
}
