/* Typing page (2026-11-25): hub tiles, Letters lessons, sentence / paragraph runner, Records.
   Loaded after admin.css. Tiles reuse the home page's .landing-tile look. */

/* The old start card of the falling-words game is replaced by the hub (its tile starts the game). */
html body #typegame-start-overlay { display: none !important; }

.tp-hub { display: flex; flex-direction: column; gap: 10px; }
.tp-hub[hidden], .tp-panel[hidden], .tp-back-row[hidden], #tp-panel-words[hidden] { display: none !important; }
.tp-hub-title { margin: 18px 2px 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-family: var(--font-heading); font-size: 1.35rem; color: var(--text); }
.tp-hub-level { font-size: .9rem; font-weight: 700; color: var(--muted); }

/* Settings on the light page: a mint pill; opened, the choices sit on a mint panel (the chips' own colours expect it). */
html body #tp-hub .fs-settings-sum { background: var(--card-bg); color: var(--accent-dark); text-shadow: none; border: 2px solid #a9dccb; justify-content: flex-start; }
html body #tp-hub .fs-settings-sum::after { border-color: var(--accent-dark); margin-left: auto; }
html body #tp-hub .fs-settings-ico { filter: none; }
html body #tp-hub .fs-settings-now { color: var(--muted); font-weight: 700; }
html body #tp-hub .fs-settings-body { margin-top: 8px; padding: 14px 12px; border-radius: 18px; background: linear-gradient(180deg, #1fbf9a 0%, #0f9a7c 100%); box-shadow: 0 3px 0 #0b6b57; }
html body #tp-hub .fs-settings-body .qz-pick { gap: 8px; }
html body #tp-hub .fs-settings-body .qz-seg { gap: 6px; }
html body #tp-hub .tp-topic-box { width: 100%; }
html body #tp-hub .tp-topic-grid { margin-top: 2px; }
html body #tp-hub .tp-topic-box .town-foot, html body #tp-hub .tp-topic-box .town-more { color: #fff; }
html[data-theme="dark"] body #tp-hub .fs-settings-sum { border-color: rgba(110, 224, 168, .28); }
html[data-theme="dark"] body #tp-hub .fs-settings-body { background: linear-gradient(180deg, #1b5446 0%, #143d33 100%); box-shadow: 0 3px 0 #0c241e; }

/* Tiles: 2 across on phones, 3 from tablet up — same card as the home menu. */
html body #tp-tiles.landing-tiles { grid-template-columns: repeat(2, 1fr); margin-top: 4px; }
@media (min-width: 700px) { html body #tp-tiles.landing-tiles { grid-template-columns: repeat(3, 1fr); } }
html:root:root:root:root:not([data-theme="dark"]) body #tp-tiles .landing-tile { border: 2px solid #a9dccb !important; }
html:root:root:root:root:not([data-theme="dark"]) body #tp-tiles .landing-tile:hover { border-color: #6cc9ad !important; }
html:root:root:root:root[data-theme="dark"] body #tp-tiles .landing-tile { border: 2px solid rgba(110, 224, 168, 0.28) !important; }
html body #tp-tiles .tp-ico-svg { width: 72%; height: 72%; display: block; }
html:root:root:root:not([data-theme="dark"]) body #tp-tiles .tp-tile-today .landing-tile-icon { background: #fff6d8 !important; border-color: #e7b93a !important; }
.tp-hub-msg { margin: 4px 2px 0; padding: 10px 12px; border-radius: 12px; background: #fff7dc; color: #6b4a00; font-weight: 600; }
html[data-theme="dark"] .tp-hub-msg { background: #3a3220; color: #ffe8b0; }

/* Panels */
.tp-back-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 8px; }
.tp-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px 6px 10px; border: 0; border-radius: 12px; background: var(--card-bg); color: var(--accent-dark); font-family: var(--font-heading); font-weight: 700; font-size: .95rem; box-shadow: 0 3px 0 #cfeee3; cursor: pointer; }
html[data-theme="dark"] .tp-back { color: #6ee0a8; box-shadow: 0 3px 0 #0c241e; }
.tp-run-meta { color: var(--muted); font-size: .85rem; font-weight: 600; min-width: 0; }
.tp-panel-title { margin: 4px 0 8px; font-family: var(--font-heading); font-size: 1.15rem; }
.tp-lead { color: var(--muted); margin: 0 0 8px; }
.tp-note { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: #eef6ff; color: #29496b; font-size: .85rem; line-height: 1.45; }
html[data-theme="dark"] .tp-note { background: #1b2a3a; color: #c9dcf0; }
.tp-loading { color: var(--muted); text-align: center; padding: 24px 8px; margin: 0; }
.tp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tp-over-back { margin-left: 0; }

/* Runner (sentences / paragraphs / today) */
.tp-run-card { position: relative; }
.tp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; font-variant-numeric: tabular-nums; margin-bottom: 12px; }
.tp-stats b { display: block; font-family: var(--font-heading); font-size: 1.45rem; line-height: 1.1; color: var(--accent-dark); }
.tp-stats span { font-size: .75rem; color: var(--muted); font-weight: 600; }
html[data-theme="dark"] .tp-stats b { color: #6ee0a8; }
.tp-stats-big { grid-template-columns: repeat(3, 1fr); margin: 6px 0 10px; }
.tp-stats-big b { font-size: 2rem; }
.tp-listen-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: .85rem; color: var(--muted); }
.tp-text-wrap { position: relative; border-radius: 16px; background: #f6fbf9; box-shadow: inset 0 0 0 2px #d6efe6; padding: 16px; cursor: text; max-height: 52vh; overflow-y: auto; }
html[data-theme="dark"] .tp-text-wrap { background: #18231f; box-shadow: inset 0 0 0 2px #24413a; }
.tp-text { font-family: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace; font-size: 1.25rem; line-height: 1.95; color: var(--muted); overflow-wrap: break-word; }
.tp-text.is-para { font-size: 1.1rem; }
@media (min-width: 700px) { .tp-text { font-size: 1.45rem; } .tp-text.is-para { font-size: 1.2rem; } }
.tp-word { display: inline-block; white-space: nowrap; }
.tp-ch { border-radius: 3px; }
.tp-ch.ok { color: var(--accent-dark); }
html[data-theme="dark"] .tp-ch.ok { color: #6ee0a8; }
.tp-ch.bad { background: #ffd9d2; color: #a2321b; }
html[data-theme="dark"] .tp-ch.bad { background: #5a2a22; color: #ffc9bd; }
.tp-ch.todo { color: #7a8783; }
.tp-ch.cur { box-shadow: -2px 0 0 #2f8cff; animation: tp-blink 1s steps(2) infinite; }
@keyframes tp-blink { 50% { box-shadow: -2px 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .tp-ch.cur { animation: none; } }
.tp-text.is-listen .tp-ch.todo { color: #a9b6b2; letter-spacing: .05em; }
/* The real input sits invisibly over the text so a tap opens the phone keyboard. */
.tp-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; resize: none; border: 0; padding: 0; font-size: 16px; color: transparent; background: transparent; caret-color: transparent; }
.tp-text-wrap:focus-within { box-shadow: inset 0 0 0 3px #22c9a3; }
.tp-hint { margin: 10px 0 0; }

.tp-result { text-align: center; }
.tp-result h3 { margin: 4px 0; font-family: var(--font-heading); }
.tp-stars { font-size: 2.1rem; letter-spacing: 4px; }
.tp-stars span { color: #d8e2df; }
.tp-stars span.on { color: #f5b91e; text-shadow: 0 2px 0 #c98a00; }
.tp-rank-line { margin: 6px 0; font-weight: 700; color: var(--text); }
.tp-done-text { margin: 10px auto; max-width: 62ch; color: var(--muted); font-size: .92rem; line-height: 1.55; text-align: left; }
.tp-result-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.tp-newwords { margin: 12px auto 0; max-width: 520px; text-align: left; }
.tp-newwords h4 { margin: 18px 0 8px; font-family: var(--font-heading); font-size: 1rem; }
.tp-newwords-list { display: flex; flex-direction: column; gap: 6px; }
.tp-nw { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: #f2faf7; cursor: pointer; }
html[data-theme="dark"] .tp-nw { background: #1a2925; }
.tp-nw input { width: 20px; height: 20px; accent-color: #0b7a62; flex: none; }
.tp-nw > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tp-nw small { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.tp-nw-say { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--card-bg); box-shadow: 0 2px 0 #cfeee3; cursor: pointer; }
.tp-nw-add { margin-top: 8px; }
.tp-nw-msg { margin: 6px 0 0; color: var(--accent-dark); font-weight: 700; }

/* Letters: lesson list */
.tp-lesson-group { margin: 18px 0 8px; font-family: var(--font-heading); font-size: .95rem; color: var(--muted); }
.tp-lesson-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 700px) { .tp-lesson-grid { grid-template-columns: repeat(6, 1fr); } }
.tp-lesson { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 84px; padding: 8px 4px; border: 2px solid #a9dccb; border-radius: 14px; background: var(--card-bg); color: var(--text); cursor: pointer; font: inherit; box-shadow: 0 2px 0 #cfeee3; }
.tp-lesson.next { border-color: #22c9a3; background: #eafaf4; }
.tp-lesson.done .tp-lesson-n { background: #22c9a3; color: #fff; }
html[data-theme="dark"] .tp-lesson { border-color: rgba(110, 224, 168, .28); box-shadow: none; }
html[data-theme="dark"] .tp-lesson.next { background: #1c3a31; }
.tp-lesson-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #e4f4ee; color: #0b6b57; font-weight: 800; font-size: .8rem; }
.tp-lesson-k { font-family: ui-monospace, Consolas, Menlo, monospace; font-weight: 700; font-size: 1rem; }
.tp-lesson-s i { font-style: normal; color: #d8e2df; font-size: .85rem; }
.tp-lesson-s i.on { color: #f5b91e; }

/* Letters: a lesson */
.tp-lesson-bar { height: 8px; border-radius: 4px; background: #e4f4ee; overflow: hidden; margin-bottom: 14px; }
.tp-lesson-bar i { display: block; height: 100%; width: 0; background: #22c9a3; transition: width .2s ease; }
.tp-lesson-stage { min-height: 96px; display: flex; flex-direction: column; justify-content: center; }
.tp-intro-tag { margin: 0; font-size: .75rem; font-weight: 800; letter-spacing: .08em; color: var(--muted); }
.tp-intro { margin: 6px 0 0; font-size: 1.35rem; line-height: 1.5; color: var(--text); }
.tp-cap { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px; margin: 0 4px; border-radius: 10px; background: #2f8cff; color: #fff; font-family: ui-monospace, Consolas, Menlo, monospace; font-weight: 700; box-shadow: 0 3px 0 #1b5fb5; vertical-align: middle; }
.tp-boxes { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tp-box { width: 46px; height: 54px; display: grid; place-items: center; border-radius: 10px; background: var(--card-bg); box-shadow: 0 0 0 2px #d6efe6; font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 1.35rem; color: var(--text); }
.tp-box.sp { color: #b7c4c0; font-size: 1rem; }
.tp-box.done { color: #0b7a62; background: #e4f7ef; box-shadow: none; }
.tp-box.now { box-shadow: 0 0 0 2px #d6efe6, inset 0 -4px 0 #2f8cff; }
@media (max-width: 480px) { .tp-box { width: 36px; height: 44px; font-size: 1.1rem; } }
.shake { animation: tp-shake .3s; }
@keyframes tp-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; outline: 2px solid #e8743b; } }

/* Finger colours */
.f-lp, .f-rp { --fc: #ff9aa8; } .f-lr, .f-rr { --fc: #ffc46b; } .f-lm, .f-rm { --fc: #9be08a; } .f-li { --fc: #7cc8ff; } .f-ri { --fc: #c9a7ff; } .f-th { --fc: #b8c4c1; }
.tp-kb { margin: 18px auto 0; max-width: 620px; display: flex; flex-direction: column; gap: 5px; padding: 10px; border-radius: 14px; background: #eef7f3; }
html[data-theme="dark"] .tp-kb { background: #17241f; }
.tp-kb-row { display: flex; gap: 5px; justify-content: center; }
.tp-kb-row.r1 { padding-left: 2%; } .tp-kb-row.r2 { padding-left: 0; }
.tp-k { flex: 1 1 0; max-width: 50px; min-width: 0; height: 40px; border-radius: 8px; display: grid; place-items: center; background: var(--card-bg); box-shadow: 0 2px 0 #cfdcd8; border-bottom: 4px solid var(--fc, transparent); font-family: ui-monospace, Consolas, Menlo, monospace; font-size: .85rem; color: var(--text); }
.tp-k.wide { flex: 1.6 1 0; max-width: 76px; font-size: .7rem; border-bottom-color: #ff9aa8; }
.tp-k.space { flex: none; width: 46%; max-width: 280px; font-size: .7rem; color: var(--muted); }
.tp-k.hot, .tp-k.hot-shift { background: #2f8cff; color: #fff; box-shadow: 0 0 0 4px rgba(47, 140, 255, .28); }
@media (max-width: 480px) { .tp-k { height: 32px; font-size: .72rem; border-radius: 6px; } .tp-kb { gap: 4px; padding: 6px; } .tp-kb-row { gap: 3px; } }
/* Koala paws: four fingers + thumb; the finger to use lights up and bobs. */
.tp-hands { display: flex; justify-content: center; gap: 12%; margin-top: 14px; }
.tp-paw { position: relative; width: 130px; height: 92px; }
.tp-palm { position: absolute; left: 12px; right: 12px; bottom: 0; height: 48px; border-radius: 28px 28px 34px 34px; background: radial-gradient(ellipse 46% 40% at 50% 58%, #f3c9c4 0 98%, transparent 100%), #a9b3b0; box-shadow: inset 0 -4px 0 rgba(0,0,0,.08); }
.tp-finger { position: absolute; bottom: 30px; width: 20px; height: 48px; border-radius: 11px 11px 6px 6px; background: linear-gradient(180deg, #8f9996 0 9px, #b9c2bf 9px); border: 3px solid transparent; transition: transform .15s ease; }
.tp-paw.left .f-lp { left: 14px; height: 38px; } .tp-paw.left .f-lr { left: 38px; height: 50px; } .tp-paw.left .f-lm { left: 62px; height: 56px; } .tp-paw.left .f-li { left: 86px; height: 50px; }
.tp-paw.left .f-th { left: 104px; bottom: 6px; height: 24px; width: 30px; --r: -30deg; transform: rotate(var(--r)); }
.tp-paw.right .f-th { left: -4px; bottom: 6px; height: 24px; width: 30px; --r: 30deg; transform: rotate(var(--r)); }
.tp-paw.right .f-ri { left: 24px; height: 50px; } .tp-paw.right .f-rm { left: 48px; height: 56px; } .tp-paw.right .f-rr { left: 72px; height: 50px; } .tp-paw.right .f-rp { left: 96px; height: 38px; }
.tp-finger.hot { background: linear-gradient(180deg, #6d7774 0 9px, var(--fc) 9px); border-color: #2f8cff; transform: translateY(-6px); }
.tp-paw .tp-finger.f-th.hot { transform: translateY(-4px) rotate(var(--r, 0deg)); }
html[data-theme="dark"] .tp-palm { background: #44514d; } html[data-theme="dark"] .tp-finger { background: #56635f; }
@media (max-width: 480px) { .tp-paw { transform: scale(.8); transform-origin: top center; margin-bottom: -18px; } }
.tp-key-input { position: absolute; opacity: 0; width: 1px; height: 1px; left: 0; top: 0; font-size: 16px; }
.tp-lesson-card { position: relative; text-align: center; }

/* Records */
.tp-tabs { display: flex; overflow-x: auto; border-bottom: 3px solid #d6efe6; margin: 6px 0 12px; scrollbar-width: none; }
.tp-tabs::-webkit-scrollbar { display: none; }
.tp-tab { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 8px 6px; border: 0; background: transparent; color: var(--muted); font-family: var(--font-heading); font-weight: 700; font-size: .9rem; white-space: nowrap; cursor: pointer; border-radius: 12px 12px 0 0; }
.tp-tab.on { background: #22c9a3; color: #fff; }
html[data-theme="dark"] .tp-tabs { border-color: #24413a; }
.tp-rec-filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
/* Filter chips on a light card: mint text, filled when chosen. */
html body .tp-rec-seg { justify-content: flex-start; }
html body .tp-rec-seg .qz-seg-btn { background: #eef7f3 !important; color: #0b6b57 !important; box-shadow: none !important; border: 0 !important; min-height: 40px; }
html body .tp-rec-seg .qz-seg-btn.on { background: #0b7a62 !important; color: #fff !important; }
html[data-theme="dark"] body .tp-rec-seg .qz-seg-btn { background: #1a2925 !important; color: #b9e9d6 !important; }
html[data-theme="dark"] body .tp-rec-seg .qz-seg-btn.on { background: #22c9a3 !important; color: #0e1a17 !important; }
.tp-table-wrap { overflow-x: auto; }
.tp-table { width: 100%; min-width: 460px; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .9rem; }
.tp-table th { text-align: left; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 2px solid #d6efe6; white-space: nowrap; }
.tp-table td { padding: 9px 8px; border-bottom: 1px solid #e6f3ee; white-space: nowrap; }
.tp-table tr.me td { background: #e4f7ef; font-weight: 800; }
html[data-theme="dark"] .tp-table tr.me td { background: #1c3a31; }
html[data-theme="dark"] .tp-table th, html[data-theme="dark"] .tp-table td { border-color: #24413a; }
.tp-table .tp-rank { font-weight: 800; }
.tp-table .tp-name small { color: var(--muted); font-weight: 600; }
.tp-table .tp-when { color: var(--muted); font-size: .8rem; }
.tp-table tr.tp-gap td { text-align: center; color: var(--muted); padding: 2px; }
.tp-me-name { margin: 10px 2px 0; color: var(--muted); font-size: .85rem; font-weight: 600; }

/* Phones: the four record tabs fit on one line (icon over the word), and the table fits without sideways scrolling. */
.tp-tab-ico { margin-right: 4px; }
@media (max-width: 560px) {
  .tp-tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .78rem; padding: 6px 2px; }
  .tp-tab-ico { margin: 0; font-size: 1.15rem; }
  .tp-table { min-width: 0; font-size: .82rem; }
  .tp-table th, .tp-table td { padding: 8px 4px; }
  .tp-table td.tp-name, .tp-table td.tp-when { white-space: normal; }
  .tp-table .tp-when { font-size: .72rem; }
}
