:root {
  color-scheme: light;
  --bg: #efeae0;
  --bg-top: #f7f3ea;
  --ink: #1b1914;
  --muted: #4f4a42;
  --line: #e0d6c6;
  --line-strong: #cfc6b6;
  --card: #fbf8f2;
  --paper: #ffffff;
  --green: #14583a;
  --green-dark: #0f4630;
  --green-soft: #e7efe9;
  --clay: #7a3e24;
  --clay-soft: #f6ebe3;
  --danger: #7a2e22;
  --shadow: 0 1px 0 rgba(28, 25, 20, 0.04);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Segoe UI", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, var(--bg-top), var(--bg) 58%);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.5;
}

::selection {
  background: #d5e6db;
}

a {
  color: var(--green);
}

a:hover {
  color: var(--green-dark);
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: var(--green);
  color: #f4f7f4;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  z-index: 2;
  text-decoration: none;
}

.skip:focus {
  top: 0.75rem;
}

.shell {
  width: min(40rem, calc(100% - 2rem));
  margin: 0 auto;
}

.top {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 0.65rem 0;
  background: #f7f3ea;
  border-bottom: 1px solid rgba(224, 214, 198, 0.9);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mark {
  width: 56px;
  height: 56px;
  flex: none;
  display: block;
}

#result,
#upgrade {
  scroll-margin-top: 5.25rem;
}

.wordmark {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.tagline {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.intro h1 {
  margin: 1.15rem 0 0.6rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.85rem, 6vw, 2.35rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.lede {
  margin: 0 0 0.75rem;
  font-size: 1.08rem;
}

.price {
  margin: 0 0 1.25rem;
}

.tool {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-bottom: 0.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.05rem 1rem 1.15rem;
  box-shadow: var(--shadow);
}

.field {
  margin: 0 0 0.85rem;
}

.field label,
.tone legend {
  display: block;
  font-size: 0.92rem;
  font-weight: 650;
  margin-bottom: 0.35rem;
}

.hint,
.allowance,
.note,
.timing,
.chars,
.storage-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.hint {
  font-weight: 450;
}

label .hint {
  font-weight: 450;
}

.split {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.split .grow {
  flex: 1 1 0;
  min-width: 0;
}

.currency {
  width: 6.6rem;
  flex: none;
}

input,
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  min-height: 48px;
}

textarea {
  min-height: 6.2rem;
  resize: vertical;
  line-height: 1.4;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible,
.paid summary:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 0.35rem 0 0;
  min-height: 0;
}

.error:empty {
  display: none;
}

.amount-preview {
  margin: -0.35rem 0 0.85rem;
  min-height: 1.35rem;
}

.amount-preview:empty {
  display: none;
}

.timing {
  margin: 0.4rem 0 0;
}

.timing.is-overdue,
.result-meta.is-overdue {
  color: var(--clay);
}

.tone {
  border: 0;
  margin: 0 0 0.9rem;
  padding: 0;
}

.tone-options {
  display: flex;
  gap: 0.4rem;
}

.tone-options label {
  flex: 1;
  margin: 0;
  font-weight: 550;
  position: relative;
}

.tone-options input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  inset: 0.4rem auto auto 0.4rem;
}

.tone-options span {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 48px;
  padding: 0.45rem 0.3rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  line-height: 1.15;
  font-size: 0.92rem;
  white-space: nowrap;
}

.tone-options input:checked + span {
  background: var(--green);
  border-color: var(--green);
  color: #f4f7f4;
}

.tone-options input:focus-visible + span {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

.tone-help {
  margin: 0.45rem 0 0;
}

.allowance {
  margin: 0.2rem 0 0.55rem;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  min-height: 48px;
  font: inherit;
  font-size: 1rem;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  line-height: 1.2;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--green);
  color: #f4f7f4;
}

@media (hover: hover) {
  .btn-primary:hover {
    background: var(--green-dark);
    color: #f4f7f4;
  }
  .btn-secondary:hover,
  .btn-ghost:hover {
    background: var(--green-soft);
  }
}

.btn-secondary {
  background: transparent;
  color: var(--green);
  border-color: var(--green);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

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

.upgrade h2 {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-weight: 600;
}

.upgrade p {
  margin: 0 0 0.85rem;
}

.upgrade .btn {
  margin-bottom: 0.7rem;
}

.upgrade {
  border-color: var(--green);
}

.note {
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.paid summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--green);
  min-height: 44px;
  display: flex;
  align-items: center;
}

.paid summary:hover {
  color: var(--green-dark);
}

.inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.inline input {
  flex: 1;
  min-width: 0;
}

.inline .btn {
  flex: none;
}

.paid {
  padding: 0 0.15rem 0.2rem;
}

.tool.is-locked .paid {
  background: var(--card);
  border: 1px solid var(--green);
  border-radius: 18px;
  padding: 0.35rem 1rem 1rem;
}

.tool.is-locked #already summary {
  color: var(--ink);
}

.result h2,
.section-label {
  margin: 0.2rem 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 650;
  color: var(--muted);
}

.result-meta {
  display: inline-block;
  margin: 0 0 0.85rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.88rem;
}

.result-meta.is-overdue {
  background: var(--clay-soft);
}

.subject {
  margin: 0 0 0.7rem;
  font-weight: 650;
}

.letter {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.45;
  white-space: pre-wrap;
  background: var(--paper);
  border: 1px solid #eadfce;
  border-left: 4px solid var(--green);
  border-radius: 12px;
  padding: 0.9rem 0.95rem;
  margin: 0 0 0.75rem;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.1rem;
}

.actions .btn {
  flex: 1 1 10rem;
}

.chars {
  margin: -0.35rem 0 0.65rem;
}

.stale {
  margin: 0 0 0.8rem;
}

.noscript {
  margin: 1rem;
  padding: 0.8rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.site-footer {
  width: min(40rem, calc(100% - 2rem));
  margin: 1.5rem auto 0;
  padding: 0.4rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer h2 {
  margin: 1.15rem 0 0.2rem;
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 650;
  color: var(--ink);
}

.site-footer p {
  margin: 0;
}

.fine {
  margin-top: 1.2rem !important;
}

[hidden] {
  display: none !important;
}

@media (max-width: 380px) {
  .split {
    flex-direction: column;
  }
  .currency {
    width: auto;
  }
  .inline {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (min-width: 720px) {
  .shell,
  .site-footer {
    width: min(40rem, calc(100% - 4rem));
  }
  .card {
    padding: 1.25rem 1.3rem 1.35rem;
  }
  .top {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
  }
}
