:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #5f6e65;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --line: #d9ded5;
  --mint: #d8eee1;
  --leaf: #2f6f57;
  --coral: #f47c62;
  --gold: #f3c456;
  --sky: #c8e8f2;
  --violet: #d9d1f3;
  --shadow: 0 20px 60px rgba(33, 47, 39, 0.12);
}

* {
  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(251, 250, 246, 0.14), rgba(251, 250, 246, 0.78)),
    url("assets/sentence-background.svg") center top / cover fixed,
    var(--paper);
  color: var(--ink);
}

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

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

.coach-panel,
.coach-output {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(217, 222, 213, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.coach-panel {
  border-radius: 8px;
  padding: 24px;
}

.topbar,
.output-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.brand-intro {
  display: grid;
  gap: 12px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  width: fit-content;
  max-width: 100%;
}

.brand-logo strong {
  display: block;
  color: var(--ink);
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  line-height: 1.05;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--mint);
  color: var(--leaf);
}

.brand-mark svg:first-child {
  width: 29px;
  height: 29px;
}

.brand-mark svg:last-child {
  position: absolute;
  right: -8px;
  bottom: 8px;
  width: 23px;
  height: 23px;
  color: var(--coral);
  stroke-width: 2.5;
}

.tool-banner {
  display: flex;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(217, 222, 213, 0.84);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 30px rgba(33, 47, 39, 0.08);
}

.tool-banner span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(216, 238, 225, 0.62);
  color: #21483a;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.tool-banner svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.4;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--leaf);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 680px;
  margin-bottom: 0;
  font-size: clamp(2.15rem, 5.6vw, 4.9rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.08;
}

.status-pill,
.ghost-action,
.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  border-radius: 8px;
  white-space: nowrap;
}

.status-pill {
  min-height: 54px;
  padding: 0 18px 0 14px;
  background: linear-gradient(90deg, #f3f7f3, #dce7e2);
  color: #0f1f3d;
  font-weight: 850;
  line-height: 1.16;
  text-align: left;
}

.status-pill span {
  display: block;
}

.status-pill svg,
button svg,
.card-title svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.25;
}

.status-pill svg {
  width: 26px;
  height: 26px;
  color: #0f1f3d;
}

.moment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.72fr);
  gap: 24px;
  margin-top: 28px;
}

.intake {
  display: grid;
  gap: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-group {
  display: grid;
  gap: 7px;
}

label,
legend {
  color: #26362f;
  font-size: 0.9rem;
  font-weight: 800;
}

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

textarea {
  resize: vertical;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(47, 111, 87, 0.15);
}

fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.calm-check {
  align-items: start;
}

.timer-setup {
  grid-column: span 2;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(47, 111, 87, 0.18);
  border-radius: 8px;
  background: rgba(216, 238, 225, 0.36);
}

.timer-setup[hidden] {
  display: none;
}

.timer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.timer-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--leaf);
  color: #fff;
  padding: 0 14px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.timer-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.4;
}

legend {
  padding: 0 6px;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-weight: 700;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--leaf);
}

.primary-action {
  border: 0;
  background: var(--ink);
  color: #fff;
  padding: 0 18px;
  font-weight: 900;
  cursor: pointer;
}

.ghost-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
  font-weight: 800;
  cursor: pointer;
}

.visual-card {
  display: grid;
  align-content: center;
  min-height: 100%;
  padding: 24px;
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(216, 238, 225, 0.74), rgba(255, 255, 255, 0.88) 56%, rgba(243, 196, 86, 0.22)),
    url("assets/sentence-background.svg") center / cover;
  overflow: hidden;
}

.visual-card p {
  max-width: 32ch;
  color: #44554c;
  font-weight: 650;
}

.coaching-visual {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 0.7fr 1fr;
  align-items: center;
  gap: 10px;
  min-height: 250px;
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid rgba(47, 111, 87, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.84), rgba(216, 238, 225, 0.72)),
    radial-gradient(circle at 20% 20%, rgba(244, 124, 98, 0.18), transparent 34%);
  box-shadow: 0 18px 42px rgba(33, 47, 39, 0.14);
  overflow: hidden;
}

.visual-node {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 132px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(217, 222, 213, 0.92);
  color: var(--ink);
  font-weight: 900;
  text-align: center;
}

.visual-node svg {
  width: 42px;
  height: 42px;
  color: var(--leaf);
}

.child-node svg {
  color: var(--coral);
}

.visual-path {
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--gold);
}

.visual-path span {
  display: block;
  width: 2px;
  height: 38px;
  background: rgba(47, 111, 87, 0.2);
}

.visual-path svg {
  width: 34px;
  height: 34px;
  stroke-width: 2.6;
}

.visual-note {
  position: absolute;
  z-index: 2;
  min-width: 74px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  color: var(--leaf);
  border: 1px solid rgba(217, 222, 213, 0.9);
  box-shadow: 0 10px 24px rgba(33, 47, 39, 0.1);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
}

.note-one {
  left: 20px;
  top: 18px;
}

.note-two {
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
}

.note-three {
  right: 20px;
  top: 18px;
}

.coach-output {
  margin-top: 20px;
  border-radius: 8px;
  padding: 22px;
}

.parent-state {
  display: grid;
  gap: 12px;
  margin: 18px 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.parent-state.calm {
  background: rgba(216, 238, 225, 0.5);
}

.parent-state.not-calm {
  background: rgba(243, 196, 86, 0.2);
  border-color: rgba(244, 124, 98, 0.36);
}

.parent-state-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.parent-state-title svg {
  width: 20px;
  height: 20px;
  color: var(--leaf);
}

.parent-state p,
.parent-state span {
  margin: 0;
  color: #45564d;
  line-height: 1.42;
}

.parent-state span {
  font-weight: 800;
}

.sentence-grader {
  display: grid;
  gap: 14px;
  margin: 18px 0;
  padding: 17px;
  border: 1px solid rgba(47, 111, 87, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(216, 238, 225, 0.42)),
    url("assets/sentence-background.svg") center / cover;
}

.grader-header,
.grader-actions,
.grader-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.grader-header h2 {
  margin: 0;
}

.grader-score {
  display: grid;
  place-items: center;
  width: 78px;
  aspect-ratio: 1;
  border: 1px solid rgba(47, 111, 87, 0.28);
  border-radius: 50%;
  background: #fff;
  color: var(--leaf);
  box-shadow: 0 12px 30px rgba(33, 47, 39, 0.1);
  font-size: 1.35rem;
  font-weight: 950;
}

.grader-input {
  display: grid;
  gap: 10px;
}

.grader-actions {
  justify-content: flex-start;
}

.grader-actions .recording {
  border-color: rgba(244, 124, 98, 0.48);
  background: rgba(244, 124, 98, 0.12);
  color: #8b3a2e;
}

.grader-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.42;
}

.grader-result {
  display: grid;
  gap: 12px;
}

.grader-result[hidden] {
  display: none;
}

.grader-summary {
  justify-content: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.grader-summary strong {
  color: var(--ink);
  font-weight: 950;
}

.grader-summary span {
  color: var(--muted);
  font-weight: 750;
}

.grader-rewrite {
  padding: 13px;
  border-left: 4px solid var(--coral);
  border-radius: 8px;
  background: #fff;
}

.grader-rewrite strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-weight: 950;
}

.grader-rewrite p {
  margin: 0;
  color: #33433b;
  font-weight: 800;
  line-height: 1.3;
}

.rewrite-option {
  display: grid;
  gap: 5px;
  padding: 11px;
  border: 1px solid rgba(217, 222, 213, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.rewrite-option + .rewrite-option {
  margin-top: 9px;
}

.rewrite-option span {
  color: var(--leaf);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.primary-rewrite {
  border-left: 4px solid var(--coral);
}

.primary-rewrite p {
  font-size: clamp(1.05rem, 1.6vw, 1.28rem);
  font-weight: 900;
}

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

.rubric-card {
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.rubric-card strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--ink);
  font-weight: 950;
}

.rubric-card small {
  color: var(--leaf);
  font-weight: 950;
}

.rubric-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.42;
}

.parent-state-copy {
  display: grid;
  gap: 6px;
}

.calm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.calm-actions span {
  color: var(--ink);
  font-weight: 900;
}

.calm-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
  font-weight: 900;
  cursor: pointer;
}

.calm-choice.selected {
  border-color: rgba(47, 111, 87, 0.42);
  background: var(--leaf);
  color: #fff;
}

.priority-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.priority {
  min-height: 82px;
  border-radius: 8px;
  padding: 12px;
  background: #f7f8f5;
  border: 1px solid var(--line);
}

.priority strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.priority p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

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

.advice-card,
.talk-track,
.repair-catalog,
.revisit-panel,
.system-panel,
.troubleshooting-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 17px;
}

.main-card {
  grid-column: span 3;
  display: grid;
  gap: 8px;
  background: linear-gradient(135deg, #fff, rgba(216, 238, 225, 0.52));
}

.main-card p {
  margin: 0;
  max-width: 62rem;
  font-size: clamp(1.35rem, 2vw, 2.05rem);
  line-height: 1.2;
  font-weight: 850;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--leaf);
  font-size: 0.88rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.script-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.script-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid rgba(47, 111, 87, 0.28);
  border-radius: 8px;
  background: #fff;
  color: var(--leaf);
  padding: 0 12px;
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
}

.script-next:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.script-count {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

ol,
ul {
  margin: 0;
  padding-left: 20px;
}

li {
  margin: 0 0 10px;
  color: #33433b;
  line-height: 1.42;
}

li:last-child {
  margin-bottom: 0;
}

.brain-plan {
  display: grid;
  gap: 10px;
}

.brain-card {
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 1px solid rgba(217, 222, 213, 0.9);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(216, 238, 225, 0.38));
}

.brain-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--leaf);
}

.brain-card-title svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

.brain-card-title strong {
  color: var(--ink);
  font-weight: 950;
}

.brain-card p {
  margin: 0;
  color: #45564d;
  line-height: 1.38;
}

.talk-track,
.repair-catalog,
.revisit-panel,
.system-panel,
.troubleshooting-panel {
  margin-top: 14px;
}

.script-stack {
  display: grid;
  gap: 10px;
}

.script-line {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 8px;
  background: #f8faf7;
  border-left: 4px solid var(--coral);
}

.script-line strong {
  color: var(--ink);
}

.script-line span {
  color: var(--muted);
}

.inline-link {
  display: inline-flex;
  margin-left: 4px;
  color: var(--leaf);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.repair-catalog {
  background: linear-gradient(135deg, #fff, rgba(200, 232, 242, 0.32));
}

.repair-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.repair-header p {
  max-width: 32rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

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

.repair-card {
  min-height: 132px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.repair-card strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-weight: 900;
}

.repair-card p {
  margin: 0;
  color: #45564d;
  line-height: 1.42;
}

.revisit-panel {
  background: linear-gradient(135deg, #fff, rgba(217, 209, 243, 0.26));
}

.revisit-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.revisit-header p {
  max-width: 38rem;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.4;
}

.revisit-script {
  margin-bottom: 10px;
  padding: 13px;
  border: 1px solid rgba(47, 111, 87, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.revisit-script strong,
.revisit-card > strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-weight: 900;
}

.revisit-script p {
  margin: 0;
  color: #45564d;
  line-height: 1.45;
}

.revisit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr) minmax(0, 0.8fr);
  gap: 10px;
}

.revisit-card {
  max-height: 360px;
  overflow: auto;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.revisit-card li strong {
  color: var(--ink);
}

.system-panel {
  background: linear-gradient(135deg, #fff, rgba(216, 238, 225, 0.46));
}

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

.system-card {
  min-height: 132px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.system-card strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-weight: 900;
}

.system-card p {
  margin: 0;
  color: #45564d;
  line-height: 1.42;
}

.troubleshooting-panel {
  background: linear-gradient(135deg, #fff, rgba(243, 196, 86, 0.16));
}

.troubleshooting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.trouble-card {
  min-height: 104px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.trouble-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.trouble-card p {
  margin: 0;
  color: #45564d;
  line-height: 1.42;
}

.trouble-list {
  grid-column: span 2;
}

.trouble-list ul {
  margin: 0;
}

@media (max-width: 860px) {
  .topbar,
  .output-header {
    flex-direction: column;
  }

  .moment-layout,
  .cards-grid,
  .priority-strip,
  .rubric-grid,
  .repair-grid,
  .revisit-grid,
  .system-grid,
  .troubleshooting-grid {
    grid-template-columns: 1fr;
  }

  .repair-header,
  .revisit-header {
    display: grid;
  }

  .script-card-header {
    display: grid;
  }

  .main-card {
    grid-column: span 1;
  }

  .trouble-list {
    grid-column: span 1;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .coach-panel,
  .coach-output {
    padding: 16px;
  }

  .field-row,
  .timer-row,
  fieldset {
    grid-template-columns: 1fr;
  }

  .timer-setup {
    grid-column: span 1;
  }

  h1 {
    font-size: 2.55rem;
  }

  .status-pill,
  .tool-banner,
  .grader-actions .ghost-action,
  .grader-actions .primary-action,
  .ghost-action,
  .primary-action,
  .timer-button,
  .script-next {
    width: 100%;
    white-space: normal;
  }
}
