:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #56625d;
  --line: #cbd6d1;
  --panel: #ffffff;
  --soft: #f2f7f4;
  --soft-warm: #fbf7ec;
  --gold: #86620f;
  --green: #276c4e;
  --green-dark: #174b35;
  --red: #9a3d34;
  --blue: #275f78;
  --bg: #ffffff;
  --shadow: 0 18px 48px rgba(30, 55, 45, .09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 78% 5%, rgba(226, 238, 231, .78), transparent 31rem),
    radial-gradient(circle at 8% 88%, rgba(251, 244, 222, .62), transparent 28rem),
    var(--bg);
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, input, select, textarea { accent-color: var(--green); }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 80px;
}

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

h1 {
  max-width: 920px;
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(2.5rem, 6vw, 4.8rem);
  font-weight: 400;
  line-height: .98;
}

h2, h3, p { margin-top: 0; }
h2 {
  margin-bottom: 10px;
  font-family: Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 400;
}
h3 {
  margin-bottom: 18px;
  font-family: Georgia, serif;
  font-size: 1.65rem;
  font-weight: 400;
}

.eyebrow, .section-label, .card-kicker {
  color: var(--gold);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.mode-pill {
  border: 1px solid #a9c5b7;
  border-radius: 999px;
  background: #eff8f3;
  color: var(--green-dark);
  padding: 9px 14px;
  font-size: .76rem;
  font-weight: 700;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  padding: clamp(20px, 4vw, 36px);
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }

.rules-intro {
  max-width: 760px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0 18px;
  padding: 0;
  list-style: none;
  counter-reset: encounter-rule;
}

.rule-grid li {
  position: relative;
  min-height: 128px;
  border: 1px solid #d6e0dc;
  border-radius: 15px;
  background: var(--soft);
  padding: 18px 18px 18px 56px;
  counter-increment: encounter-rule;
}

.rule-grid li::before {
  position: absolute;
  top: 16px;
  left: 17px;
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-dark);
  color: #ffffff;
  content: counter(encounter-rule);
  font-size: .76rem;
  font-weight: 800;
}

.rule-grid strong { display: block; margin-bottom: 7px; }
.rule-grid span { color: var(--muted); font-size: .88rem; line-height: 1.5; }

.artifact-note {
  margin: 0;
  border-left: 3px solid var(--gold);
  background: var(--soft-warm);
  color: #574b2f;
  padding: 12px 15px;
  font-size: .86rem;
  line-height: 1.5;
}

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

.entry-grid {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 26px;
}

.primary-card, .resume-card, .choice {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #ffffff;
  padding: 20px;
  text-align: left;
}

.primary-card, .choice { cursor: pointer; }
.primary-card:hover, .choice:hover, .choice.selected {
  border-color: #9d761c;
  background: #fffaf0;
  transform: translateY(-1px);
}

.primary-card strong, .resume-card strong, .choice strong {
  display: block;
  margin: 6px 0;
  font-size: 1.05rem;
}

.primary-card span:last-child, .choice span, small {
  color: var(--muted);
  line-height: 1.45;
}

.resume-card label {
  display: block;
  margin: 12px 0;
  color: var(--muted);
  font-size: .8rem;
}

input, select, textarea {
  width: 100%;
  border: 1px solid #aebdb6;
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  padding: 12px;
  margin-top: 5px;
}

textarea { min-height: 110px; resize: vertical; }

.resume-card button,
.primary-button,
.quiet-button,
.danger-button,
#retry-mouth,
#frozen-mouth {
  border: 1px solid #9fb0a8;
  border-radius: 999px;
  background: #ffffff;
  padding: 10px 17px;
  cursor: pointer;
}

.primary-button, .resume-card button {
  border-color: var(--green-dark);
  background: var(--green-dark);
  color: #ffffff;
  font-weight: 750;
}

.primary-button:hover, .resume-card button:hover { background: #0e3928; }
button:disabled { opacity: .42; cursor: not-allowed; }
.quiet-button:hover, #retry-mouth:hover, #frozen-mouth:hover { border-color: var(--gold); background: #fffaf0; }
.danger-button { align-self: center; border-color: #b55b52; color: #7d2f28; }
.danger-button:hover { background: #fff2f0; }

.agent-card {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 18px;
}
.agent-card .quiet-button { margin-left: auto; }

.agent-orb {
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  border: 1px solid #b89b59;
  border-radius: 50%;
  background: #fffaf0;
  padding: 7px;
  box-shadow: 0 10px 28px rgba(64, 88, 76, .14);
}

.agent-orb span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f4d89a, #7aa98f 52%, #315f4c 78%);
  animation: breathe 5s ease-in-out infinite;
}

.agent-orb.critical span {
  background: radial-gradient(circle at 35% 30%, #e7aaa3, #a75f57 55%, #65352f 82%);
  animation-duration: 2.5s;
}

@keyframes breathe { 50% { transform: scale(.92); filter: saturate(.82); } }

.body-band { color: var(--green); font-weight: 700; }
.body-band.critical { color: var(--red); }
.disclosure, #history-wrap, .strategy-coach, .ask-panel, .response-panel, .outcome-panel, #debrief-panel { margin-top: 18px; }
.history-cards, .debrief-events, .roster { display: grid; gap: 10px; }

.history-card, .debrief-event, .roster button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  padding: 14px;
}

.history-card { display: grid; gap: 14px; }
.history-card p { margin: 0; color: #30463c; line-height: 1.55; white-space: pre-wrap; }
.history-card .history-heading { color: var(--ink); font-weight: 600; }
.history-person { color: var(--ink); font-weight: 700; }

.roster { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.roster button { text-align: left; cursor: pointer; }
.roster button:hover { border-color: var(--gold); }
.demo-label { margin-top: 24px; }
.demo-tracks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 8px 0 14px; }
.demo-tracks button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft-warm);
  padding: 13px;
  text-align: left;
  cursor: pointer;
}
.demo-tracks button:hover { border-color: var(--gold); }

.panel-heading, .ask-actions, .protection-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.field-label { display: block; margin: 18px 0 8px; color: var(--muted); font-size: .82rem; }
.free-framing { margin-top: 14px; }
.free-framing label, .ask-actions label { color: var(--muted); font-size: .85rem; }
.free-framing input, .ask-actions input { width: auto; }
.ask-actions { margin-top: 22px; }
.expression-mode-note { margin-right: auto; }

.request-card {
  display: block;
  width: 100%;
  border: 1px solid #9d761c;
  border-radius: 15px;
  background: var(--soft-warm);
  padding: 18px 20px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.request-card span {
  display: block;
  font-family: Georgia, serif;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.55;
}

.request-card small { display: block; margin-top: 10px; }
.request-card:not(:disabled):hover { border-color: var(--green-dark); background: #fffaf0; }
.request-card:disabled { opacity: .72; }

blockquote {
  margin: 12px 0 26px;
  color: #20352c;
  font-family: Georgia, serif;
  font-size: clamp(1.2rem, 3vw, 1.85rem);
  line-height: 1.5;
  white-space: pre-wrap;
}

.hold-button {
  position: relative;
  min-width: 260px;
  min-height: 72px;
  overflow: hidden;
  border: 1px solid var(--green);
  border-radius: 14px;
  background: #eff8f3;
  cursor: pointer;
}

.hold-button span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(76, 155, 112, .25);
  transition: width .18s linear;
}

.hold-button strong, .hold-button small { position: relative; display: block; }
#hold-status, .status { margin-top: 8px; color: var(--muted); font-size: .82rem; }
.outcome-panel { border-color: #9dc7b3; background: #fbfefc; }
.strategy-coach { border-color: #d8c38b; background: #fffcf4; }
.coach-goal { min-width: 190px; color: var(--muted); font-size: .76rem; }
.coach-goal select { margin-top: 6px; }
.coach-recommendation { margin-bottom: 12px; font-family: Georgia, serif; font-size: 1.25rem; }
.coach-metrics, .coach-alternatives { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.coach-metrics span, .coach-alternatives span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--muted);
  font-size: .76rem;
}
.status { min-height: 1.3em; padding: 12px 4px; color: var(--red); }

@media (max-width: 700px) {
  .shell { width: min(100% - 20px, 1080px); padding-top: 20px; }
  .masthead { align-items: flex-start; flex-direction: column; }
  .entry-grid, .choice-row, .rule-grid, .demo-tracks { grid-template-columns: 1fr; }
  .rule-grid li { min-height: auto; }
  .agent-card { align-items: flex-start; flex-wrap: wrap; }
  .agent-card .quiet-button { margin-left: 0; }
  .panel-heading, .ask-actions, .protection-actions { align-items: stretch; flex-direction: column; }
  .expression-mode-note { margin-right: 0; }
  .hold-button { min-width: 0; width: 100%; }
  .danger-button { align-self: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
