:root {
  color-scheme: dark;
  --ink: #f7f4e9;
  --muted: #a9b5ae;
  --panel: rgba(19, 35, 31, 0.82);
  --line: rgba(219, 235, 221, 0.14);
  --forest: #061410;
  --green: #55d98a;
  --gold: #f0bd57;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 14%, rgba(45, 125, 83, 0.28), transparent 32rem),
    radial-gradient(circle at 90% 80%, rgba(240, 189, 87, 0.11), transparent 28rem),
    var(--forest);
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 34px;
}

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 42px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 7vw, 6.8rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.88;
}

.lede,
.panel-heading p,
.empty-state p {
  color: var(--muted);
}

.lede {
  margin: 22px 0 0;
  font-size: 1.05rem;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(3, 13, 10, 0.62);
  color: var(--muted);
  font-size: 0.85rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px var(--green);
}

.context-panel {
  display: grid;
  gap: 22px;
  margin-bottom: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(85, 217, 138, 0.08), transparent 48%),
    rgba(9, 25, 20, 0.82);
  backdrop-filter: blur(18px);
}

.context-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(280px, 1fr);
  column-gap: 36px;
  align-items: end;
}

.context-heading .eyebrow {
  grid-column: 1 / -1;
}

.context-heading h2 {
  max-width: 580px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 3.5vw, 2.65rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.02;
}

.context-heading > p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

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

.context-grid article {
  min-height: 170px;
  padding: 20px;
  border: 1px solid var(--line);
  border-top-color: rgba(240, 189, 87, 0.55);
  border-radius: 16px;
  background: rgba(3, 13, 10, 0.48);
}

.context-grid span {
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.context-grid h3 {
  margin: 12px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.28rem;
  font-weight: 500;
}

.context-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.context-boundary {
  margin: 0;
  padding: 13px 15px;
  border-left: 3px solid var(--green);
  border-radius: 0 12px 12px 0;
  color: #dbe4dd;
  background: rgba(85, 217, 138, 0.075);
  font-size: 0.82rem;
  line-height: 1.5;
}

.context-boundary strong {
  color: var(--green);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(350px, 0.95fr);
  gap: 18px;
}

.recall-panel {
  margin-top: 18px;
}

.recall-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
}

.recall-form button {
  width: auto;
  min-width: 230px;
  margin-top: 20px;
}

.recall-summary {
  margin-top: 18px;
}

.model-label {
  color: var(--muted);
  font-size: 0.75rem;
}

.recall-list {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  padding-left: 0;
  list-style: none;
}

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

.recall-list small {
  color: var(--muted);
}

.recall-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recall-item-header .evidence-state {
  margin-top: 0;
}

.evidence-state.approved {
  color: #c6f9d8;
  background: rgba(85, 217, 138, 0.14);
}

.similarity {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
}

.panel {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.panel-heading {
  display: flex;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.panel-heading > span {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 1.25rem;
}

h2,
.panel-heading p {
  margin: 0;
}

h2 {
  font-size: 1.08rem;
}

.panel-heading p {
  margin-top: 5px;
  font-size: 0.86rem;
}

label {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  color: #dbe4dd;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: rgba(4, 14, 11, 0.74);
  font: inherit;
  font-weight: 400;
  line-height: 1.5;
}

textarea {
  min-height: 84px;
  padding: 13px 14px;
  resize: vertical;
}

textarea.source {
  min-height: 145px;
}

input {
  height: 46px;
  padding: 0 14px;
}

textarea:focus,
input:focus {
  border-color: rgba(85, 217, 138, 0.75);
  box-shadow: 0 0 0 3px rgba(85, 217, 138, 0.1);
}

button {
  width: 100%;
  margin-top: 22px;
  padding: 14px 18px;
  border: 0;
  border-radius: 12px;
  color: #06140f;
  background: var(--green);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.07);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

button.secondary {
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
}

button.warning {
  color: #2b1b02;
  background: var(--gold);
}

button.danger {
  border: 1px solid rgba(255, 127, 127, 0.36);
  color: #ffd5d5;
  background: rgba(151, 46, 46, 0.32);
}

.message {
  min-height: 1.2em;
  margin: 12px 0 0;
  color: var(--gold);
  font-size: 0.84rem;
}

.result-panel {
  min-height: 620px;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 460px;
  text-align: center;
}

.empty-state h3 {
  margin: 18px 0 0;
}

.empty-state p {
  max-width: 300px;
  margin: 8px 0 0;
  line-height: 1.5;
}

.compass {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(240, 189, 87, 0.34);
  border-radius: 50%;
  color: var(--gold);
  font-size: 2rem;
}

.task-result {
  padding-top: 24px;
}

.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pill {
  padding: 7px 10px;
  border-radius: 999px;
  color: #c6f9d8;
  background: rgba(85, 217, 138, 0.14);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

code {
  overflow: hidden;
  max-width: 200px;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
}

.task-result h3 {
  margin: 22px 0;
  font-family: Georgia, serif;
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1.25;
}

.lineage {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--gold);
  color: var(--muted);
  background: rgba(240, 189, 87, 0.055);
  font-size: 0.76rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

ol {
  display: grid;
  gap: 10px;
  padding-left: 28px;
}

li {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #d7e1da;
  background: rgba(2, 12, 9, 0.48);
  line-height: 1.5;
}

.evidence-content {
  margin: 0;
}

.memory-event {
  display: grid;
  gap: 12px;
}

.memory-event.programme_plan {
  border-color: rgba(85, 217, 138, 0.34);
}

.memory-event.duty_check {
  border-color: rgba(240, 189, 87, 0.34);
}

.memory-event-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.event-role {
  color: var(--green);
  font-size: 0.82rem;
}

.event-kind {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.structured-content {
  display: grid;
  gap: 10px;
}

.structured-content p {
  margin: 0;
}

.structured-content ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.structured-content li {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.8rem;
}

.structured-content small {
  color: var(--muted);
}

.structured-content .revision-context {
  padding: 8px 10px;
  border-left: 3px solid var(--gold);
  color: #f4dca8;
  background: rgba(240, 189, 87, 0.07);
}

.evidence-state {
  display: inline-flex;
  margin-top: 10px;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.adult-review,
.decision-result {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(240, 189, 87, 0.24);
  border-radius: 16px;
  background: rgba(240, 189, 87, 0.055);
}

.review-heading {
  display: grid;
  gap: 4px;
}

.review-heading span {
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.review-heading strong {
  font-family: Georgia, serif;
  font-size: 1.1rem;
  font-weight: 500;
}

.adult-review textarea {
  min-height: 76px;
}

.decision-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.decision-actions button {
  margin-top: 0;
  padding-inline: 10px;
  font-size: 0.78rem;
}

.decision-result p {
  margin: 14px 0 8px;
  color: #dbe4dd;
  line-height: 1.5;
}

.decision-result small {
  color: var(--muted);
}

.decision-result button {
  margin-top: 16px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px max(20px, calc((100vw - 1180px) / 2));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
}

@media (max-width: 820px) {
  main {
    width: min(100% - 24px, 640px);
    padding-top: 34px;
  }

  .masthead,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .context-heading,
  .context-grid {
    grid-template-columns: 1fr;
  }

  .context-heading {
    row-gap: 12px;
  }

  .context-grid article {
    min-height: 0;
  }

  .result-panel {
    min-height: 520px;
  }

  .decision-actions {
    grid-template-columns: 1fr;
  }

  .recall-form {
    grid-template-columns: 1fr;
  }

  .recall-form button {
    width: 100%;
    margin-top: 0;
  }
}
