/* Morphology Forge.
   Deliberately not styled like a children's game. He is seven and reading at
   fourth-grade level, and software that looks like it is for little kids is
   itself a way of talking down to him. This reads like a workbench. */

:root {
  --ink: #0d1b2a;
  --paper: #f6f4ef;
  --line: #d9d3c6;
  --accent: #0f6d63;
  --accent-soft: #d9ece8;
  --warn: #9a4a2f;
  --warn-soft: #f6e3da;
  --muted: #6a6459;
}

* { box-sizing: border-box; }

/* The `hidden` attribute only gets `display: none` from the browser default
   stylesheet, so ANY author rule that sets display beats it. `.feedback` sets
   `display: grid`, which meant the previous round's answer stayed on screen
   underneath the next question. Global and !important on purpose: this is a
   trap every new hidden element on the page would fall into. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}

.masthead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.masthead h1 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
.masthead .back { font-size: 14px; color: var(--muted); text-decoration: none; }
.masthead .back:hover { color: var(--accent); }

.scoreboard { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.scoreboard b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- name screen ---- */
#name-screen h2 { font-size: 26px; margin: 24px 0 6px; }
#name-screen p { color: var(--muted); margin: 0 0 20px; }
#name-form { display: flex; gap: 10px; flex-wrap: wrap; }
#name-input {
  flex: 1 1 200px; min-height: 48px; padding: 10px 14px; font-size: 17px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: inherit;
}
#name-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- prompt ---- */
.prompt-kind {
  font-size: 12px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--accent); font-weight: 700; margin-bottom: 8px;
}
.prompt { display: grid; gap: 8px; margin-bottom: 22px; }
.prompt .clue { font-size: 22px; line-height: 1.35; }
.prompt .root-hint { font-size: 15px; color: var(--muted); }
.prompt .origin { opacity: .7; }

/* ---- word sum ---- */
.sum {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  min-height: 60px; padding: 12px 14px; margin-bottom: 16px;
  background: #fff; border: 1px dashed var(--line); border-radius: 12px;
}
.sum-empty { color: var(--muted); font-size: 15px; }
.sum-part { font-weight: 700; font-size: 20px; }
.plus { color: var(--muted); }

.tray { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.chip {
  min-height: 48px; padding: 10px 18px; font: inherit; font-weight: 700; font-size: 18px;
  background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  transition: transform .08s ease, background .12s ease;
}
.chip:hover:not(.used) { background: var(--accent-soft); border-color: var(--accent); }
.chip:active:not(.used) { transform: translateY(1px); }
.chip.used { opacity: .28; cursor: default; }

/* ---- choices ---- */
.choices { display: grid; gap: 10px; margin-bottom: 18px; }
.choice {
  min-height: 52px; padding: 12px 16px; font: inherit; font-size: 17px; text-align: left;
  background: #fff; color: inherit; border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.choice:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.choice:disabled { opacity: .55; cursor: default; }

/* ---- buttons ---- */
.row { display: flex; gap: 10px; }
.primary, .ghost {
  min-height: 48px; padding: 10px 22px; font: inherit; font-weight: 600; font-size: 16px;
  border-radius: 10px; cursor: pointer; border: 1px solid transparent;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover { filter: brightness(1.08); }
.ghost { background: transparent; color: var(--muted); border-color: var(--line); }

/* ---- feedback ---- */
.feedback {
  padding: 14px 16px; border-radius: 12px; margin: 16px 0; display: grid; gap: 6px; font-size: 16px;
}
.feedback .verdict { font-weight: 700; }
.feedback .gloss { display: block; font-size: 14px; color: var(--muted); }
.feedback.good { background: var(--accent-soft); }
.feedback.bad, .feedback.nudge { background: var(--warn-soft); }

.hint {
  padding: 12px 14px; border-left: 3px solid var(--accent); background: #fff;
  font-size: 15px; color: var(--muted); margin-bottom: 14px; border-radius: 0 8px 8px 0;
}

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