:root {
  --paper: #f7f4ec;
  --grid: rgba(60, 80, 110, 0.08);
  --ink: #1d1d1f;
  --muted: #6f6f6f;
  --faint: #c9c4b8;
  --card: #fffdf8;
  --blue: #2f5bd3;
  --yellow: #ffd84d;
  --red: #c1121f;

  /* Scene colours, shared with the app's drawings (js/scene.js) */
  --bread: #e8b170;
  --crust: #c98545;
  --glass: rgba(190, 215, 235, 0.45);
  --glass-line: #9fb3c8;
  --hair: #6b4a35;
  --night: #e3e7ef;
  --lamp: rgba(255, 216, 77, 0.28);
  --chalkboard: #2e2e2e;
  --chalk: #f4f1e8;
  --wood: #f1e4cf;
  --beer: #f3c443;
  --bottle-green: #8fb28a;
  --bottle-brown: #b07d4f;
  --bottle-clear: #dfe8e4;
  --river: #cfe0f2;
  --street: #e4dfd3;
  --leaf: #8fb28a;
  --blue-soft: #b9c8ef;
  --tie: #c1121f;
  --ginger: #c8642f;

  --hand: 'Patrick Hand', cursive;
  --marker: 'Permanent Marker', cursive;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

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

.hl {
  background: linear-gradient(transparent 55%, var(--yellow) 55%, var(--yellow) 90%, transparent 90%);
  padding: 0 4px;
}

h1, h2 { font-family: var(--hand); font-weight: 400; line-height: 1.15; margin: 0 0 12px; }
h1 { font-size: clamp(2.8rem, 7vw, 4.4rem); }
h2 { font-size: clamp(2rem, 5vw, 2.8rem); }

.button {
  display: inline-block;
  padding: 12px 26px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--blue);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.button:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.button.small { padding: 6px 16px; font-size: 0.9rem; }

.fine { font-size: 0.85rem; color: var(--muted); margin-top: 10px; }

/* ---- Header ---- */

.top {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wordmark {
  font-family: var(--marker);
  font-size: 2rem;
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(transparent 45%, var(--yellow) 45%, var(--yellow) 85%, transparent 85%);
  padding: 0 6px;
}

main { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---- Hero ---- */

.hero { padding: 32px 0 24px; text-align: center; }
.hero-text { max-width: 680px; margin: 0 auto 24px; }
.lead { font-size: 1.2rem; margin: 0 0 24px; }

.bubble {
  display: inline-block;
  position: relative;
  margin: 0 0 20px;
  padding: 6px 18px;
  font-family: var(--hand);
  font-size: 1.3rem;
  color: var(--blue);
  background: var(--card);
  border: 2px solid var(--blue);
  border-radius: 999px;
}
.bubble::after {
  content: "";
  position: absolute;
  left: 34px;
  bottom: -10px;
  width: 14px;
  height: 14px;
  background: var(--card);
  border-right: 2px solid var(--blue);
  border-bottom: 2px solid var(--blue);
  transform: rotate(45deg) skew(10deg, 10deg);
}

/* ---- Scene demos ---- */

.demo { margin: 0; position: relative; }
.demo svg { width: 100%; height: auto; display: block; }

.subtitle {
  position: relative;
  max-width: 640px;
  min-height: 84px;
  margin: 4px auto 0;
  padding: 16px 18px 12px;
  text-align: left;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
}
.subtitle .who {
  position: absolute;
  top: -11px;
  left: 14px;
  padding: 2px 9px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
}
.subtitle.you .who { background: var(--blue); }
.subtitle .de { margin: 0; font-size: 1.15rem; font-weight: 700; line-height: 1.35; }
.subtitle .rest { color: #b8b8b8; }
.subtitle .en { margin: 4px 0 0; font-size: 0.85rem; color: var(--muted); min-height: 1.2em; }

.note {
  position: absolute;
  top: 6%;
  right: 2%;
  max-width: 240px;
  padding: 10px 14px;
  font-family: var(--hand);
  font-size: 1.05rem;
  line-height: 1.35;
  background: #fff8c9;
  border: 1.5px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  transform: rotate(2deg);
}
.note ul { margin: 4px 0 0; padding-left: 18px; }
.note p { margin: 4px 0 0; }
.note s { color: var(--red); }
.note.mistake { right: auto; left: 2%; transform: rotate(-2deg); }

/* ---- Features ---- */

.feature {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 40px;
  align-items: center;
  padding: 56px 0;
}
.feature.flip { grid-template-columns: 1.6fr 1fr; }
.feature.flip .feature-text { order: 2; }
.feature.solo { grid-template-columns: 1fr; max-width: 720px; margin: 0 auto; text-align: center; padding-top: 32px; }
.feature-text p { margin: 0 0 14px; }

/* ---- Town map ---- */

.town { padding: 56px 0; text-align: center; }
.town > p { margin: 0 0 16px; }
.town svg { width: 100%; height: auto; display: block; }
.place { cursor: pointer; outline: none; }
.place .lift { transition: transform 0.15s; }
.place:hover .lift, .place:focus-visible .lift { transform: translateY(-5px); }
.place:focus-visible .building { stroke: var(--blue); stroke-width: 4; }

/* ---- Meaning ---- */

.meaning {
  max-width: 680px;
  margin: 24px auto;
  padding: 28px 32px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-0.5deg);
}
.meaning .word { font-family: var(--marker); font-size: 2.2rem; margin: 0; line-height: 1.2; }
.meaning .word small { font-family: var(--hand); font-size: 1.1rem; color: var(--muted); }
.meaning .definition { font-family: var(--hand); font-size: 1.4rem; margin: 0 0 14px; }
.meaning p:last-child { margin: 0; }

/* ---- Register ---- */

.register { max-width: 560px; margin: 0 auto; padding: 72px 0 40px; text-align: center; }
.register form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 20px;
  padding: 24px;
  text-align: left;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
}
.register label { font-weight: 700; font-size: 0.9rem; margin-top: 8px; }
.register .optional { font-weight: 400; color: var(--muted); }
.register input, .register select {
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
}
.register input:focus, .register select:focus { outline: 3px solid var(--yellow); outline-offset: 1px; }
.register .button { margin-top: 18px; align-self: flex-start; }
.gotcha { position: absolute; left: -9999px; }
.form-status { margin: 4px 0 0; font-weight: 700; }
.form-status.ok { color: #2d6a4f; }
.form-status.error { color: var(--red); }

footer { text-align: center; padding: 32px 16px 48px; font-size: 0.85rem; color: var(--muted); }

/* ---- Small screens ---- */

@media (max-width: 760px) {
  .feature, .feature.flip { grid-template-columns: 1fr; gap: 16px; padding: 40px 0; }
  .feature.flip .feature-text { order: 0; }
  .note { position: static; max-width: none; margin: 8px 0; transform: none; }
  .note.mistake { transform: none; }
  .meaning { padding: 22px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
