/* ==========================================================================
   Touch Typing Quest, all in one: the landing page.
   ========================================================================== */
:root {
  --ink: #12162b; --muted: #5a6279; --line: #e1e5f0; --card: #fff; --bg: #f5f6fb; --soft: #eceffa;
  --accent: #5b3df5; --accent-ink: #fff; --good: #0f8a4b; --bad: #c62828;
  --kids-1: #2a0f6b; --kids-2: #6d28d9; --kids-3: #d9468f;
  --pro-1: #0e1620; --pro-2: #103a3f; --pro-3: #14b8a6;
  --radius: 22px; --shadow: 0 18px 50px rgba(20, 20, 60, .16);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fredoka", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font: 17px/1.6 var(--font); color: var(--ink); background: var(--bg); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: clamp(28px, 3.6vw, 40px); text-align: center; }
h3 { font-size: 22px; }
p { margin: 0 0 1em; }
a { color: var(--accent); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 820px; }
.centre { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 10px 16px; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid #ffb703; outline-offset: 3px; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 26px; padding: 12px 26px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; font: 700 20px var(--display); color: var(--ink); text-decoration: none; margin-right: auto; }
.keys { display: inline-flex; gap: 4px; }
.keys i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: linear-gradient(#fff, #e6eaf5); border: 1px solid #cfd6e6; border-bottom-width: 3px; font: 700 14px var(--mono); font-style: normal; color: #2a0f6b; }
.keys i:last-child { background: linear-gradient(#7ff3e0, #14b8a6); border-color: #0f766e; color: #042f2e; }
.top nav { display: flex; gap: 22px; }
.top nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15.5px; }
.top nav a:hover { text-decoration: underline; text-underline-offset: 5px; }
.signin-menu { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 10px); background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 12px; width: 250px; }
.menu a { display: block; padding: 8px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.menu a:hover { background: var(--soft); }
.menu-h { margin: 8px 12px 2px; font: 700 13px var(--font); color: var(--muted); }
.menu-btn { display: block; width: 100%; padding: 8px 12px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: 600 15px var(--font); text-align: left; cursor: pointer; }
.menu-btn:hover { background: var(--soft); }

/* ---------- buttons ---------- */
.btn { display: inline-block; font: 700 16.5px/1.2 var(--font); padding: 13px 24px; border-radius: 14px; border: 0; cursor: pointer; background: var(--soft); color: var(--ink); text-decoration: none; text-align: center; transition: transform .12s ease, filter .12s ease; }
.btn:hover { filter: brightness(.97); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #ffcf4a, #f5a51a); color: #3d2200; box-shadow: inset 0 -3px 0 rgba(140, 70, 0, .35); }
.btn.solid { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); padding: 10px 20px; font-size: 15.5px; }
.btn.wide { display: block; width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; filter: none; }

/* ---------- hero and the two doors ---------- */
.hero { position: relative; color: #fff; background: linear-gradient(118deg, #171238 0%, #231050 38%, #0b2d3d 100%); padding: 56px 0 70px; overflow: hidden; }
.hero .wrap { position: relative; }
.stars { position: absolute; inset: 0; background-image: radial-gradient(1.4px 1.4px at 20px 30px, #fff8, transparent), radial-gradient(1.2px 1.2px at 120px 80px, #fff6, transparent), radial-gradient(1.6px 1.6px at 200px 160px, #fff5, transparent), radial-gradient(1.2px 1.2px at 280px 40px, #fff7, transparent); background-size: 320px 200px; opacity: .5; }
.hero h1 { font-size: clamp(34px, 5.4vw, 60px); text-align: center; margin-bottom: .35em; }
.lead { max-width: 62ch; margin: 0 auto 34px; text-align: center; font-size: clamp(17px, 1.8vw, 20px); color: #dfe4ff; }
.note { text-align: center; color: #c6cdf0; font-size: 15px; margin: 28px 0 0; }
.gift-note { margin-top: 8px; }
.linklike { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: #fff; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linklike.dark { color: var(--accent); }
.doors { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.door { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; scroll-margin-top: 90px; }
.door.kids { background: linear-gradient(160deg, var(--kids-1), var(--kids-2) 62%, var(--kids-3)); }
.door.pro { background: linear-gradient(160deg, var(--pro-1), var(--pro-2) 70%, #16464a); }
.covers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px 16px 0; }
.cv { margin: 0; }
.la-box { position: relative; display: block; aspect-ratio: 240 / 150; overflow: hidden; border-radius: 16px; border: 2px solid rgba(255, 255, 255, .28); background: #0c1030; }
.la-box .la-cover { position: absolute; inset: 0; width: 100%; height: 100%; }
.la-box .la-hero { position: absolute; left: 50%; bottom: 2%; height: 74%; width: auto; transform: translateX(-50%); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .45)); }
.cv figcaption { font-size: 13px; font-weight: 700; text-align: center; margin-top: 8px; color: #eef0ff; }
.door-body { padding: 22px 28px 28px; display: flex; flex-direction: column; flex: 1; }
.door h2 { text-align: left; font-size: clamp(30px, 3vw, 38px); margin-bottom: .2em; }
.door-lead { font-size: 18px; color: #f0f2ff; margin-bottom: .9em; }
.door .ticks { color: #f7f8ff; }
.ticks { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 9px; }
.ticks li { position: relative; padding-left: 30px; }
.ticks li::before { content: '✓'; position: absolute; left: 0; top: 1px; width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: #22c55e; color: #fff; font: 700 13px/1 var(--font); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: auto; }
.cta .btn { flex: 1 1 150px; }
.door .btn.solid { background: rgba(255, 255, 255, .16); border: 1.5px solid rgba(255, 255, 255, .5); color: #fff; }
.door .btn.solid:hover { background: rgba(255, 255, 255, .26); }
.door .price { margin: 14px 0 0; color: #e6e9ff; font-weight: 600; min-height: 1.5em; }

/* ---------- sections ---------- */
.plain, .soft { padding: 72px 0; }
.plain { background: #fff; }
.soft { background: var(--bg); }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 34px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.steps li { counter-increment: s; border: 1px solid var(--line); border-radius: 20px; padding: 26px; background: #fff; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--accent); color: #fff; font: 700 20px var(--display); margin-bottom: 12px; }
.steps b { display: block; font: 600 21px var(--display); margin-bottom: 4px; }
.steps span { color: var(--muted); }

/* ---------- licences ---------- */
.segmented { display: flex; width: max-content; margin: 20px auto 30px; background: #e6e9f6; border-radius: 16px; padding: 5px; }
.segmented button { border: 0; background: transparent; font: 700 17px var(--font); padding: 12px 34px; border-radius: 12px; cursor: pointer; color: var(--ink); }
.segmented button[aria-selected="true"] { background: #fff; box-shadow: 0 2px 10px rgba(20, 20, 60, .14); }
.lic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.lic { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; box-shadow: 0 6px 24px rgba(20, 20, 60, .06); }
.lic h3 { font-size: 26px; margin-bottom: 2px; }
.lic-who { color: var(--muted); margin-bottom: 10px; }
.lic-price { font: 600 26px var(--display); min-height: 1.5em; margin-bottom: 14px; }
.lic-price small { font: 600 16px var(--font); color: var(--muted); }
.lic .ticks { color: var(--ink); flex: 1; align-content: start; }
.lic .btn + .btn, .lic .btn + p { margin-top: 10px; }
.tier-table { margin-top: 26px; }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.tiers button { border: 1.5px solid var(--line); background: #fff; border-radius: 16px; padding: 14px 8px; cursor: pointer; font: inherit; color: inherit; }
.tiers button:hover { border-color: var(--accent); }
.tiers b { display: block; font: 600 20px var(--display); }
.tiers span { display: block; font-weight: 700; }
.tiers small { color: var(--muted); font-size: 13.5px; }
.tiers-label { text-align: center; font-weight: 600; margin: 0 0 12px; }

/* ---------- panel previews ---------- */
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 34px; }
.panels > *, .lic-grid > *, .doors > *, .steps > * { min-width: 0; }
.panel-card { margin: 0; overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: 0 6px 24px rgba(20, 20, 60, .06); }
.pv-top { display: flex; justify-content: space-between; margin-bottom: 10px; }
.pv-top span { color: var(--muted); font-weight: 600; font-size: 14px; }
.pv { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.pv th { text-align: left; color: var(--muted); font-size: 12.5px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.pv td { padding: 8px; border-bottom: 1px solid #eef0f7; }
.pv td:nth-child(n+2):not(:last-child) { text-align: center; }
.pv td.d { background: #dcfce7; color: #166534; font-weight: 800; }
.pv td.l { background: #fef3c7; color: #92400e; font-weight: 800; }
.pv td.m { background: #fee2e2; color: #b91c1c; font-weight: 800; }
.pv td.n { background: #dbeafe; color: #1d4ed8; font-weight: 800; }
figcaption { color: var(--muted); font-size: 15px; margin-top: 12px; }

/* ---------- questions ---------- */
details { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 4px 20px; margin-bottom: 12px; }
summary { cursor: pointer; font: 600 18px var(--display); padding: 14px 0; list-style-position: outside; }
details[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
details p { margin-bottom: 14px; }

/* ---------- footer ---------- */
.foot { background: #12162b; color: #c9cfe8; padding: 30px 0; font-size: 15px; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; }
.foot a { color: #fff; margin-left: 18px; }

/* ---------- the sign-up dialog ---------- */
.su { border: 0; border-radius: 24px; padding: 0; width: min(760px, 94vw); max-height: 92vh; box-shadow: var(--shadow); color: var(--ink); }
.su::backdrop { background: rgba(10, 12, 40, .6); backdrop-filter: blur(3px); }
.su-in { padding: 30px 34px 32px; }
.su-x { position: absolute; right: 14px; top: 14px; border: 0; background: var(--soft); width: 42px; height: 42px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.su h2 { text-align: left; font-size: 30px; margin-bottom: .2em; padding-right: 50px; }
.su .sub { color: var(--muted); margin-bottom: 20px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.choice { text-align: left; border: 2px solid var(--line); border-radius: 18px; background: #fff; padding: 20px; cursor: pointer; font: inherit; color: inherit; }
.choice:hover, .choice:focus-visible { border-color: var(--accent); }
.choice[aria-checked="true"] { border-color: var(--accent); background: #f2efff; }
.choice b { display: block; font: 600 21px var(--display); margin-bottom: 3px; }
.choice span { color: var(--muted); display: block; font-size: 15.5px; }
.su-tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.su-tiers button { border: 2px solid var(--line); border-radius: 16px; background: #fff; padding: 14px 6px; cursor: pointer; font: inherit; color: inherit; }
.su-tiers button[aria-checked="true"] { border-color: var(--accent); background: #f2efff; }
.su-tiers b { display: block; font: 600 21px var(--display); }
.su-tiers span { display: block; font-weight: 700; }
.su-tiers small { color: var(--muted); font-size: 13px; }
.su form label { display: block; font-weight: 600; margin-bottom: 12px; }
.su input { display: block; width: 100%; font: 17px var(--font); padding: 11px 13px; border: 1.5px solid #cfd6e6; border-radius: 12px; margin-top: 5px; }
.su input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px #d9d2ff; }
.su input.code-in { font: 600 21px var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.su input.code-in::placeholder { font: 500 17px var(--font); letter-spacing: 0; text-transform: none; }
.su .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.su .check { display: flex; gap: 10px; font-weight: 500; align-items: flex-start; }
.su .check input { width: 20px; height: 20px; margin: 2px 0 0; }
.su small { color: var(--muted); font-weight: 500; }
.su .error { color: var(--bad); font-weight: 700; }
.su .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.su .actions .btn { flex: 1; }
.su .backlink { border: 0; background: none; color: var(--accent); font: 600 15.5px var(--font); text-decoration: underline; padding: 0; cursor: pointer; margin-bottom: 8px; }
.summary-line { background: var(--soft); border-radius: 14px; padding: 12px 16px; font-weight: 600; margin-bottom: 16px; }
.spin { display: inline-block; width: 18px; height: 18px; border: 3px solid #c9c2ff; border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 10px; width: min(560px, 92vw); }
.toast { background: #12162b; color: #fff; border-radius: 14px; padding: 14px 20px; box-shadow: var(--shadow); font-weight: 600; }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .doors, .lic-grid, .panels, .steps { grid-template-columns: 1fr; }
  .top nav { display: none; }
  .su-tiers { grid-template-columns: repeat(2, 1fr); }
  .covers { gap: 6px; }
}
@media (max-width: 560px) {
  .top { padding: 10px 16px; }
  .brand span:last-child { display: none; }
  .su-in { padding: 24px 20px; }
  .choices, .su .grid2 { grid-template-columns: 1fr; }
  .wrap { padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .btn, .spin { transition: none; animation-duration: 2s; } }

/* ---------- pages that are only words: terms, privacy, page not found ---------- */
.docpage { display: flex; flex-direction: column; min-height: 100vh; }
.docpage main { flex: 1; padding: 46px 0 70px; }
.docpage .top { position: static; }
.doc h1 { font-size: clamp(32px, 4.4vw, 46px); }
.doc h2 { font-size: 25px; text-align: left; margin: 1.6em 0 .4em; }
.doc-lead { font-size: 19px; color: var(--muted); }
.doc li { margin-bottom: .5em; }
.doc a { overflow-wrap: anywhere; }
.doc-scroll { overflow-x: auto; margin: 0 0 1em; }
.doc-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); font-size: 16px; }
.doc-table th, .doc-table td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.doc-table thead th { background: var(--soft); }
.doc-table tbody th { width: 34%; font-weight: 600; }
.foot-links { display: flex; flex-wrap: wrap; }
.lost { text-align: center; padding: 30px 0; }
.lost .actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 26px; }
.lost-keys { display: flex; gap: 12px; justify-content: center; margin-bottom: 26px; }
.lost-keys span { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 18px; background: linear-gradient(#fff, #e6eaf5); border: 1px solid #cfd6e6; border-bottom-width: 7px; font: 700 40px var(--mono); color: #2a0f6b; }
@media (max-width: 620px) {
  .doc-nav { display: none !important; }
  .lost-keys span { width: 66px; height: 66px; font-size: 32px; }
}
@media print {
  .docpage .top, .docpage .foot, .docpage .skip { display: none; }
  .docpage { display: block; background: #fff; }
  .docpage main { padding: 0; }
  .docpage .wrap { max-width: none; padding: 0; }
  .doc h1 { font-size: 30px; }
  .doc h2 { font-size: 20px; break-after: avoid; }
  .doc { font-size: 15px; line-height: 1.5; }
  .doc p, .doc li, .doc tr { break-inside: avoid; }
}

/* ==========================================================================
   Touch Typing Quest, all in one: a free licence drawn as a voucher.
   Used by the landing page, both games and the owner's page, on light and dark
   pages alike, so it brings all its own colours. The markup is in gift-words.js.
   ========================================================================== */
.voucher { --v1: #2a0f6b; --v2: #6d28d9; --v3: #c2317f; max-width: 460px; margin: 6px auto 20px; text-align: center; color: #fff; filter: drop-shadow(0 8px 16px rgba(10, 10, 40, .28)); }
.voucher.v-pro { --v1: #123c46; --v2: #115e59; --v3: #0f766e; }
.voucher.v-any { --v1: #2a0f6b; --v2: #3b2fb0; --v3: #0f766e; }
.voucher .v-main, .voucher .v-foot { background: linear-gradient(100deg, var(--v1), var(--v2) 62%, var(--v3)); }
/* the two halves meet at a tear line, with a notch cut out of each end of it */
.voucher .v-main { padding: 20px 24px 16px; border-radius: 20px 20px 0 0; border-bottom: 2px dashed rgba(255, 255, 255, .5);
  -webkit-mask: radial-gradient(11px at 0 100%, transparent 96%, #000) 0 0 / 51% 100% no-repeat, radial-gradient(11px at 100% 100%, transparent 96%, #000) 100% 0 / 51% 100% no-repeat;
  mask: radial-gradient(11px at 0 100%, transparent 96%, #000) 0 0 / 51% 100% no-repeat, radial-gradient(11px at 100% 100%, transparent 96%, #000) 100% 0 / 51% 100% no-repeat; }
.voucher .v-foot { padding: 11px 24px 13px; border-radius: 0 0 20px 20px; font-size: 15px; font-weight: 700; color: #f3f1ff;
  -webkit-mask: radial-gradient(11px at 0 0, transparent 96%, #000) 0 0 / 51% 100% no-repeat, radial-gradient(11px at 100% 0, transparent 96%, #000) 100% 0 / 51% 100% no-repeat;
  mask: radial-gradient(11px at 0 0, transparent 96%, #000) 0 0 / 51% 100% no-repeat, radial-gradient(11px at 100% 0, transparent 96%, #000) 100% 0 / 51% 100% no-repeat; }
.voucher .v-top { display: block; font-size: 15px; font-weight: 700; color: #f0ecff; }
.voucher .v-long { display: block; font-family: var(--display, inherit); font-size: 40px; line-height: 1.15; font-weight: 700; color: #ffe08a; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); margin: 2px 0 4px; }
.voucher .v-who { display: block; font-size: 16.5px; font-weight: 700; color: #fff; }
