:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #657186;
  --panel: #ffffff;
  --line: #d8dee9;
  --field: #f4f7fb;
  --blue: #2b6cb0;
  --teal: #0f766e;
  --coral: #c2410c;
  --gold: #b7791f;
  --green: #2f855a;
  --shadow: 0 16px 42px rgba(24, 38, 64, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(47, 133, 90, 0.13), transparent 34%),
    linear-gradient(315deg, rgba(43, 108, 176, 0.12), transparent 38%),
    #eef3f8;
  color: var(--ink);
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.top-band {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 0 18px;
}

.eyebrow,
.scenario-type {
  margin: 0 0 5px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.stats {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 6px 18px rgba(24, 38, 64, 0.08);
  font-weight: 800;
}

.controls {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

select,
input {
  min-height: 42px;
  padding: 0 12px;
}

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

select:focus,
input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.16);
}

.controls button,
.form-actions button,
.panel-heading button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

#ideaBtn {
  background: var(--teal);
}

#clearBtn,
#clearJournalBtn {
  background: var(--coral);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 360px;
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.scenario-panel,
.helper-panel,
.starter-panel,
.journal-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.scenario-panel {
  padding: clamp(14px, 2vw, 20px);
}

.scenario-heading {
  padding: 4px 0 18px;
}

.scenario-heading h2 {
  max-width: 820px;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.12;
}

.solution-form {
  display: grid;
  gap: 14px;
}

fieldset {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

legend {
  padding: 0 6px;
  color: var(--ink);
  font-weight: 900;
}

.choice-row {
  display: grid;
  grid-template-columns: minmax(130px, 180px) 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feedback {
  min-height: 58px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.feedback.success {
  border-color: #9ae6b4;
  background: #ecfdf5;
  color: #166534;
}

.feedback.notice {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.side-panel {
  display: grid;
  gap: 14px;
}

.helper-panel,
.starter-panel,
.journal-panel {
  padding: 16px;
}

.builder-grid {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 8px 10px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.35;
}

.builder-grid span:nth-child(odd) {
  color: var(--ink);
  font-weight: 950;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-heading button {
  min-height: 34px;
}

.starter-list,
.journal-list {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
}

.starter-list li {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--muted);
  font-weight: 800;
}

.journal-list li {
  display: grid;
  gap: 7px;
  padding: 10px;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  background: #fff8e6;
  color: #4a3520;
  line-height: 1.35;
}

.journal-list strong {
  color: var(--ink);
}

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

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .journal-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100vw - 18px, 1180px);
    padding-top: 10px;
  }

  .top-band {
    align-items: start;
    flex-direction: column;
  }

  .stats {
    justify-content: start;
  }

  .controls {
    align-items: stretch;
  }

  .controls label,
  .controls button,
  .form-actions button {
    flex: 1 1 135px;
  }

  .choice-row,
  .side-panel {
    grid-template-columns: 1fr;
  }
}
