:root {
  --forest: #2d5016;
  --forest-dark: #1f3710;
  --moss: #58713f;
  --cream: #f5f0e8;
  --paper: #fffdf8;
  --ink: #2c2c2c;
  --muted: #625f58;
  --gold: #d4a017;
  --rust: #a94e36;
  --line: #d9d2c3;
  --shadow: 0 18px 50px rgba(18, 41, 34, .11);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

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

button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  padding: .75rem 1rem;
  color: white;
  background: var(--forest-dark);
}

.skip-link:focus { top: 1rem; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 0 clamp(1rem, 4vw, 4rem);
  color: white;
  background: var(--forest-dark);
}

.brand {
  display: inline-flex;
  gap: .65rem;
  align-items: center;
  color: inherit;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
  font-weight: 700;
  text-decoration: none;
}

.compass { color: var(--gold); font-size: 1.5rem; }

.header-link { color: white; font-weight: 700; text-decoration: none; }
.header-link:hover { text-decoration: underline; text-underline-offset: 4px; }

main > section, footer {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

.hero { padding: clamp(4rem, 8vw, 7rem) 0 3rem; }

.eyebrow, .card-label, .tool-number {
  margin: 0 0 .65rem;
  color: var(--moss);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

h1, h2, h3 {
  margin-top: 0;
  color: var(--forest-dark);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.08;
}

h1 {
  max-width: 870px;
  margin-bottom: 1.25rem;
  font-size: clamp(2.55rem, 7vw, 5.35rem);
  letter-spacing: -.035em;
}

h2 { font-size: clamp(1.8rem, 3vw, 2.65rem); }
h3 { font-size: clamp(1.55rem, 2.5vw, 2.2rem); }

.lede {
  max-width: 760px;
  color: #39433b;
  font-size: clamp(1.08rem, 2vw, 1.35rem);
}

.hero-explainer {
  max-width: 780px;
  margin-top: 1.5rem;
  padding: .15rem 0 .15rem 1.1rem;
  border-left: 4px solid var(--gold);
  color: #39433b;
}

.hero-explainer p { margin: 0; }
.hero-explainer p + p { margin-top: .7rem; }
.hero-explainer strong { color: var(--forest-dark); }

.hero-actions, .editor-actions, .dialog-actions, .data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  align-items: center;
}

.hero-actions { margin-top: 1.7rem; }

.button {
  display: inline-flex;
  min-height: 45px;
  align-items: center;
  justify-content: center;
  padding: .72rem 1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
}

.button:focus-visible, .text-button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, .tool-button:focus-visible {
  outline: 3px solid rgba(198, 155, 75, .55);
  outline-offset: 2px;
}

.button-primary { color: white; background: var(--forest); }
.button-primary:hover { background: var(--forest-dark); }
.button-secondary, .button-quiet { color: var(--forest); border-color: var(--forest); background: transparent; }
.button-danger { color: var(--rust); border-color: #d7a397; background: #fff8f5; }

.no-gate { margin: .7rem 0 0; color: var(--muted); font-size: .9rem; }

.edition-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding-bottom: 2rem;
}

.edition-card {
  padding: clamp(1.4rem, 3vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.free-kit-card { border-top: 5px solid var(--gold); }
.status-line { color: var(--muted); font-size: .9rem; }

.privacy-banner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
  margin-block: 1.5rem 3.5rem;
  padding: 1.3rem 1.5rem;
  border-radius: 14px;
  color: white;
  background: var(--forest);
}

.privacy-banner h2 { margin-bottom: .35rem; color: white; font-size: 1.45rem; }
.privacy-banner p { margin: 0; color: rgba(255, 255, 255, .86); }
.privacy-mark { color: var(--gold); font-size: 1.4rem; }

.workspace { padding: 1rem 0 4rem; }

.workspace-heading {
  display: flex;
  gap: 1rem;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.workspace-heading h2 { margin-bottom: 0; }

.text-button {
  padding: .35rem .15rem;
  border: 0;
  color: var(--forest);
  background: transparent;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.file-button { display: inline-flex; }
.danger-text { color: var(--rust); }

.workspace-grid {
  display: grid;
  grid-template-columns: 305px minmax(0, 1fr);
  min-height: 640px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.tool-rail {
  padding: 1rem;
  border-right: 1px solid var(--line);
  background: #ece7da;
}

.tool-group + .tool-group { margin-top: 1.25rem; }

.tool-group-title {
  margin: 0 0 .45rem .55rem;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tool-button {
  display: grid;
  grid-template-columns: 1.7rem 1fr;
  gap: .45rem;
  width: 100%;
  margin-bottom: .3rem;
  padding: .72rem .65rem;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.tool-button:hover { background: rgba(255, 255, 255, .66); }
.tool-button.active { color: white; background: var(--forest); }
.tool-button-number { color: var(--moss); font-weight: 800; }
.tool-button.active .tool-button-number { color: var(--gold); }

.tool-panel { min-width: 0; padding: clamp(1.25rem, 4vw, 3rem); }

.empty-state { max-width: 600px; margin: 10vh auto; text-align: center; }

.tool-header {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}

.tool-header h3 { margin-bottom: .45rem; }
.tool-purpose { max-width: 620px; margin: 0; color: var(--muted); }

.record-controls { min-width: 190px; }
.record-controls label { display: block; margin-bottom: .35rem; font-size: .8rem; font-weight: 750; }

select, input, textarea {
  width: 100%;
  padding: .72rem .75rem;
  border: 1px solid #bdb8ac;
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.field.full { grid-column: 1 / -1; }

.field label {
  display: block;
  margin-bottom: .35rem;
  font-size: .87rem;
  font-weight: 750;
}

.field-help { display: block; margin-top: .3rem; color: var(--muted); font-size: .78rem; }

.rule-card {
  margin: 1.2rem 0;
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--gold);
  background: #f3ead5;
}

.rule-card span { color: var(--moss); font-size: .72rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.rule-card p { margin: .3rem 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.08rem; }

.editor-actions { padding-top: 1rem; border-top: 1px solid var(--line); }
.save-status { min-height: 1.5em; color: var(--moss); font-size: .88rem; }

.extended-library {
  margin-bottom: 4rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px dashed #aaa18f;
  border-radius: var(--radius);
}

.extended-library h2 { margin-bottom: .5rem; }
.extended-library p:last-child { max-width: 820px; margin-bottom: 0; }

footer {
  padding: 2rem 0 4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.fine-print { max-width: 820px; font-size: .82rem; }

dialog {
  width: min(460px, calc(100% - 2rem));
  padding: 1.5rem;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
}

dialog::backdrop { background: rgba(11, 27, 23, .66); }

@media (max-width: 850px) {
  .edition-grid, .workspace-grid { grid-template-columns: 1fr; }
  .workspace-heading, .tool-header { align-items: stretch; flex-direction: column; }
  .tool-rail { max-height: 360px; overflow-y: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
}

@media (max-width: 520px) {
  .site-header { padding-inline: 1rem; }
  .header-link { font-size: .82rem; }
  main > section, footer { width: min(100% - 1.2rem, 1180px); }
  .hero { padding-top: 3.2rem; }
  .hero-explainer { padding-left: .85rem; }
  .privacy-banner { grid-template-columns: 1fr; }
  .tool-panel { padding: 1.1rem; }
  .button { width: 100%; }
}

@media print {
  @page { margin: .55in; size: letter; }

  body { color: #000; background: #fff; font-size: 10.5pt; }
  .site-header, .hero, .edition-grid, .privacy-banner, .workspace-heading,
  .tool-rail, .editor-actions, .save-status, .extended-library, footer,
  .record-controls, dialog { display: none !important; }
  main > section { width: 100%; }
  .workspace { padding: 0; }
  .workspace-grid { display: block; min-height: 0; border: 0; box-shadow: none; }
  .tool-panel { padding: 0; }
  .tool-header { display: block; padding-bottom: .16in; }
  .tool-header h3 { font-size: 20pt; }
  .tool-purpose { color: #000; }
  .form-grid { gap: .14in .22in; margin: .18in 0; }
  .field { break-inside: avoid; }
  .field label { font-size: 9pt; }
  input, textarea, select { min-height: .36in; border: 1px solid #555; color: #000; background: white; }
  textarea { min-height: .65in; }
  .rule-card { margin-top: .18in; border-left-color: #222; background: #eee; }
}
