/* Spelling Trainer: exercise-book look.
   Ink on cool paper, pale blue ruling, one red margin line. */

:root {
  --paper: #FAFBFD;
  --ink: #1B2944;
  --pencil: #5A6374;
  --rule: #D5DDEA;
  --wash: #EDF2F9;
  --margin: #C2323E;
  --tick: #2E7A4E;
  --focus: #2F5FD0;

  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.7rem;
  --step-3: 2.4rem;
  --step-4: clamp(2.4rem, 6vw, 3.6rem);

  --measure: 42rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.55;
}

/* The page sits right of a red margin line, like an exercise book. */
.sheet {
  position: relative;
  max-width: calc(var(--measure) + var(--gutter) * 2 + 3rem);
  margin: 0 auto;
  padding: 0 var(--gutter) 4rem calc(var(--gutter) + 2rem);
  min-height: 100vh;
}
.sheet::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: calc(var(--gutter) + 0.75rem);
  width: 2px;
  background: var(--margin);
  opacity: 0.55;
}

/* Header and footer */
.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1.5rem 0 1rem;
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--step-1);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.masthead nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.masthead nav a { color: var(--pencil); text-decoration: none; padding: 0.2rem 0; }
.masthead nav a:hover, .masthead nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 0.3em; }

.site-foot {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--pencil);
  font-size: var(--step--1);
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem;
}
.site-foot a { color: var(--pencil); }

/* Notices */
.offer {
  margin: 1.25rem 0 0;
  padding: 0.7rem 1rem;
  background: var(--wash);
  border-left: 3px solid var(--tick);
}
.setup-note {
  margin: 1.25rem 0 0;
  padding: 0.7rem 1rem;
  border: 1px dashed var(--margin);
  color: var(--margin);
}
.msg { margin: 0.75rem 0; min-height: 1.5em; color: var(--pencil); }
.msg.error { color: var(--margin); }
.msg.good { color: var(--tick); }

/* Type */
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; letter-spacing: -0.015em; font-weight: 600; }
h1 { font-size: var(--step-3); margin: 2.5rem 0 1rem; }
h2 { font-size: var(--step-2); margin: 3rem 0 0.75rem; }
h3 { font-size: var(--step-1); margin: 2rem 0 0.5rem; }
p, li { max-width: var(--measure); }
a { color: var(--ink); text-underline-offset: 0.2em; }
.lede { font-size: var(--step-1); color: var(--pencil); line-height: 1.45; }
.small { font-size: var(--step--1); color: var(--pencil); }
.hidden { display: none !important; }

/* Buttons and fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: inherit; font-weight: 700;
  padding: 0.65rem 1.2rem;
  border-radius: 6px;
  border: 2px solid var(--ink);
  background: var(--ink); color: var(--paper);
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: #26375A; }
.btn.quiet { background: transparent; color: var(--ink); }
.btn.quiet:hover { background: var(--wash); }
.btn.danger { background: transparent; color: var(--margin); border-color: var(--margin); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

label { display: block; font-weight: 700; margin: 1rem 0 0.35rem; }
input[type="text"], input[type="email"], input[type="date"], input[type="number"], select, textarea {
  font: inherit;
  width: 100%; max-width: 28rem;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--pencil);
  border-radius: 6px;
  background: #fff; color: var(--ink);
}
textarea { min-height: 6rem; max-width: var(--measure); }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; vertical-align: -0.15rem; margin-right: 0.4rem; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Letter tiles: the hidden word */
.tiles {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  margin: 1.5rem 0;
  min-height: 3.6rem;
}
.tile {
  width: 2.4rem; height: 3.2rem;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.7rem; font-weight: 600;
  border-bottom: 3px solid var(--ink);
  background: linear-gradient(transparent 70%, var(--wash) 70%);
}
.tile.right { color: var(--tick); border-color: var(--tick); }
.tile.wrong { color: var(--margin); border-color: var(--margin); }
@media (max-width: 480px) {
  .tile { width: 1.7rem; height: 2.5rem; font-size: 1.25rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .tiles.revealed .tile { animation: ink 0.25s ease-out both; animation-delay: calc(var(--i, 0) * 35ms); }
  @keyframes ink { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
}

.answer-input {
  font-family: var(--serif) !important;
  font-size: var(--step-2) !important;
  max-width: 24rem !important;
  letter-spacing: 0.04em;
}
.verdict { font-family: var(--serif); font-size: var(--step-1); margin: 0.5rem 0; min-height: 1.6em; }
.verdict.right { color: var(--tick); }
.verdict.wrong { color: var(--margin); }

.counter { color: var(--pencil); font-size: var(--step--1); }
.keys { color: var(--pencil); font-size: var(--step--1); margin-top: 1.5rem; }
kbd {
  font-family: var(--sans); font-size: 0.85em;
  border: 1px solid var(--rule); border-bottom-width: 2px;
  border-radius: 4px; padding: 0 0.35em; background: #fff;
}

/* Hero on the home page */
.hero { padding: 1rem 0 0.5rem; }
.hero h1 { font-size: var(--step-4); margin-top: 2rem; max-width: 14ch; }
.try { margin-top: 2rem; padding: 1.25rem 0 0.5rem; border-top: 1px solid var(--rule); }

ol.steps { padding-left: 1.4rem; }
ol.steps li { margin: 0.4rem 0; padding-left: 0.3rem; }
ol.steps li::marker { font-family: var(--serif); font-weight: 600; color: var(--margin); }

/* Plans table */
.table-wrap { overflow-x: auto; margin: 1rem 0; }
table.plans { border-collapse: collapse; width: 100%; min-width: 34rem; }
table.plans th, table.plans td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.plans thead th { font-family: var(--serif); font-size: var(--step-1); border-bottom: 2px solid var(--ink); }
table.plans tbody th { font-weight: 400; color: var(--pencil); }
table.plans .full { background: var(--wash); }

.price-line { font-family: var(--serif); font-size: var(--step-2); margin: 0.25rem 0; }

/* Simple two-column facts (account and admin) */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.5rem; margin: 1rem 0; }
dl.facts dt { color: var(--pencil); }
dl.facts dd { margin: 0; font-weight: 700; }

table.list { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
table.list th, table.list td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.list th { color: var(--pencil); font-weight: 700; }

details.report { margin-top: 1rem; }
details.report summary { cursor: pointer; color: var(--pencil); }

.legal h2 { font-size: var(--step-1); }
.fill { background: #FFF4C2; padding: 0 0.2em; }
table.plans .price-line { font-size: var(--step-1); line-height: 1.3; display: block; }
