/* MOE GOT IT - TYPE TO WIN!
   Navy, metallic silver, chrome and white. Dark mode is the default; light mode and Easy Mode are overrides below. */

:root {
  --navy: #041e42;
  --navy-deep: #020f24;
  --navy-2: #0b2d63;
  --navy-3: #12407f;
  --silver: #c5ccd6;
  --silver-2: #8d98a8;
  --ice: #a9d1ff;
  --ok: #3ddc84;
  --bad: #ff5c6c;
  --gold: #f2c14e;
  --flame: #ff6a1a;
  --chrome: linear-gradient(180deg, #ffffff 0%, #dfe4ea 38%, #a7b0bd 52%, #cfd5dd 70%, #f4f6f9 100%);
  --chrome-line: linear-gradient(90deg, transparent, #f4f6f9 20%, #9aa5b3 50%, #f4f6f9 80%, transparent);
  --mono: ui-monospace, "Cascadia Mono", "Consolas", "Menlo", "DejaVu Sans Mono", monospace;
  --type-size: 1.7rem;
}

html[data-bs-theme="dark"] {
  --bg: radial-gradient(1200px 600px at 15% -10%, #12407f 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #0b2d63 0%, transparent 55%), linear-gradient(180deg, #041e42 0%, #020f24 100%);
  --card: linear-gradient(160deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .025));
  --card-border: rgba(197, 204, 214, .24);
  --text: #f3f6fa;
  --muted: #aeb9c8;
  --track: rgba(255, 255, 255, .12);
  --key: linear-gradient(180deg, #1a3a6e, #0c2550);
  --key-text: #e8eef6;
  --pending: #9fb0c6;
  --bs-body-bg: #041e42;
  --bs-body-color: #f3f6fa;
  --bs-secondary-color: #aeb9c8;
  --bs-border-color: rgba(197, 204, 214, .24);
  --bs-link-color-rgb: 169, 209, 255;
  --bs-link-hover-color-rgb: 255, 255, 255;
}

html[data-bs-theme="light"] {
  --bg: linear-gradient(180deg, #e9edf3 0%, #f8fafc 45%, #e3e8ef 100%);
  --card: linear-gradient(160deg, #ffffff, #f3f5f8);
  --card-border: #c2cad5;
  --text: #041e42;
  --muted: #4a5a70;
  --track: #d7dde6;
  --key: linear-gradient(180deg, #ffffff, #dde2e9);
  --key-text: #041e42;
  --pending: #5d6c82;
  --ok: #0a7d3f;
  --bad: #c81e33;
  --ice: #12407f;
  --bs-body-bg: #eef1f5;
  --bs-body-color: #041e42;
  --bs-secondary-color: #4a5a70;
  --bs-link-color-rgb: 18, 64, 127;
}

html, body { min-height: 100%; }
body { background: var(--bg) fixed; color: var(--text); font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1 0 auto; outline: none; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: .01em; }
a { text-underline-offset: 3px; }
.tt-skip { position: absolute; left: 8px; top: 8px; z-index: 2000; background: #fff; color: #041e42; padding: 10px 16px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--ice); outline-offset: 2px; }
.text-body-secondary { color: var(--muted) !important; }

/* ---------- Navigation and footer ---------- */
.tt-nav { background: linear-gradient(180deg, #06275a 0%, #041e42 60%, #03183a 100%); box-shadow: 0 2px 18px rgba(0, 0, 0, .45); border-bottom: 1px solid rgba(197, 204, 214, .35); }
.tt-nav::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--chrome-line); opacity: .85; }
.tt-logo { height: 40px; width: auto; }
.tt-brand-text { font-weight: 800; letter-spacing: .06em; font-size: 1.05rem; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: 0 0 18px rgba(169, 209, 255, .25); white-space: nowrap; }
.tt-nav .nav-link { color: #dbe3ee; font-weight: 600; border-radius: 8px; padding-inline: .8rem !important; }
.tt-nav .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.tt-nav .nav-link.active { color: #041e42; background: var(--chrome); }
.tt-guest-chip { font-size: .8rem; padding: .2rem .6rem; border-radius: 999px; border: 1px dashed #8d98a8; color: #dbe3ee; }
.tt-footer { margin-top: 2rem; padding: 1rem 0; font-size: .95rem; color: var(--muted); border-top: 1px solid var(--card-border); }
.tt-footer a { color: inherit; }

/* ---------- Building blocks ---------- */
.tt-card { background: var(--card); border: 1px solid var(--card-border); border-radius: 16px; box-shadow: 0 10px 30px rgba(2, 15, 36, .28); position: relative; }
html[data-bs-theme="dark"] .tt-card::before { content: ""; position: absolute; left: 18px; right: 18px; top: -1px; height: 1px; background: var(--chrome-line); opacity: .7; }
.tt-page-title { font-size: clamp(1.6rem, 2.6vw, 2.2rem); margin-bottom: 1rem; }
.tt-kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 700; color: var(--muted); }
.btn-chrome { background: var(--chrome); color: #041e42 !important; border: 1px solid #8d98a8; font-weight: 700; box-shadow: inset 0 1px 0 #fff, 0 2px 8px rgba(2, 15, 36, .35); text-shadow: 0 1px 0 rgba(255, 255, 255, .7); }
.btn-chrome:hover, .btn-chrome:focus-visible { filter: brightness(1.07); box-shadow: inset 0 1px 0 #fff, 0 0 0 3px rgba(169, 209, 255, .35), 0 4px 16px rgba(169, 209, 255, .3); }
.btn-chrome:active { filter: brightness(.94); }
html[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: #e3e9f1; --bs-btn-border-color: #8d98a8; --bs-btn-hover-bg: rgba(197, 204, 214, .2); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #c5ccd6; --bs-btn-active-bg: rgba(197, 204, 214, .3); --bs-btn-active-color: #fff; --bs-btn-disabled-color: #8d98a8; }
html[data-bs-theme="dark"] .form-control, html[data-bs-theme="dark"] .form-select { background-color: rgba(2, 15, 36, .55); border-color: #8d98a8; color: #f3f6fa; }
html[data-bs-theme="dark"] .form-control::placeholder { color: #9fb0c6; }
html[data-bs-theme="dark"] .dropdown-menu, html[data-bs-theme="dark"] .offcanvas { --bs-dropdown-bg: #06224c; --bs-offcanvas-bg: #041e42; --bs-dropdown-link-hover-bg: rgba(197, 204, 214, .15); }
.btn-navy { background: linear-gradient(180deg, #12407f, #0b2d63); color: #fff !important; border: 1px solid #5f7fb0; font-weight: 600; }
.btn-navy:hover { filter: brightness(1.15); }
.tt-auth-card { max-width: 520px; }
.tt-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.tt-switch { padding-block: .45rem; }
.tt-switch .form-check-input { width: 2.6em; height: 1.35em; margin-right: .6em; cursor: pointer; }
.tt-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 1090; display: flex; flex-direction: column; gap: 8px; max-width: min(92vw, 380px); }
.tt-toast { background: #06275a; color: #fff; border: 1px solid #8d98a8; border-radius: 12px; padding: .7rem 1rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); animation: tt-rise .25s ease-out; }
.tt-toast.err { border-color: var(--bad); }
.tt-seg .btn { font-weight: 600; }
.tt-seg .btn-check:checked + .btn { background: var(--chrome); color: #041e42; border-color: #8d98a8; }
.tt-table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--card-border); --bs-table-striped-bg: rgba(128, 150, 180, .08); --bs-table-striped-color: var(--text); --bs-table-hover-bg: rgba(128, 150, 180, .14); --bs-table-hover-color: var(--text); }
.tt-table thead th { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
.tt-me { outline: 2px solid var(--ice); outline-offset: -2px; font-weight: 700; }

/* ---------- Progress bars ---------- */
.tt-bar { height: 12px; background: var(--track); border-radius: 999px; overflow: hidden; }
.tt-bar > span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #8d98a8, #f4f6f9 55%, #a9d1ff); box-shadow: 0 0 12px rgba(169, 209, 255, .55); transition: width .9s cubic-bezier(.2, .8, .2, 1); }
html[data-bs-theme="light"] .tt-bar > span { background: linear-gradient(90deg, #041e42, #12407f 60%, #5f7fb0); box-shadow: none; }
.tt-bar.done > span { background: linear-gradient(90deg, #1fa862, #3ddc84); }

/* ---------- Dashboard ---------- */
.tt-hero { padding: clamp(1.2rem, 3vw, 2.2rem); overflow: hidden; }
.tt-hero h1 { font-size: clamp(1.7rem, 3.6vw, 2.9rem); font-weight: 800; line-height: 1.1; margin-bottom: .4rem; }
.tt-hero h1 .chrome { background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
html[data-bs-theme="light"] .tt-hero h1 .chrome { background: linear-gradient(180deg, #12407f, #041e42); -webkit-background-clip: text; background-clip: text; }
.tt-slogan { font-size: clamp(1rem, 1.6vw, 1.25rem); color: var(--muted); }
.tt-start { font-size: clamp(1.2rem, 2.2vw, 1.7rem); font-weight: 800; letter-spacing: .08em; padding: 1rem 2.4rem; border-radius: 14px; position: relative; }
.tt-start::after { content: ""; position: absolute; inset: -6px; border-radius: 18px; border: 2px solid rgba(169, 209, 255, .6); animation: tt-pulse 2.2s ease-out infinite; pointer-events: none; }
.tt-stat { padding: 1rem 1.1rem; height: 100%; }
.tt-stat-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.tt-stat-value { font-size: clamp(1.6rem, 2.6vw, 2.3rem); font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tt-stat-value small { font-size: .5em; font-weight: 600; color: var(--muted); margin-left: .25em; }
.tt-stat-sub { font-size: .9rem; color: var(--muted); }
.tt-level-name { font-size: 1.5rem; font-weight: 800; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
html[data-bs-theme="light"] .tt-level-name { background: none; color: #041e42; }
.tt-flame { color: var(--flame); }
.tt-chart { position: relative; width: 100%; height: 240px; }
.tt-chart canvas { width: 100%; height: 100%; display: block; }
.tt-challenge { display: flex; gap: .8rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--card-border); }
.tt-challenge:last-child { border-bottom: 0; }
.tt-challenge .tt-bar { height: 8px; margin-top: .35rem; }
.tt-challenge.done .tt-ch-title { text-decoration: line-through; opacity: .75; }
.tt-xp-pill { font-weight: 700; font-size: .8rem; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--card-border); white-space: nowrap; }
.tt-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .7rem; }
.tt-badge { text-align: center; padding: .6rem .3rem; border-radius: 12px; border: 1px solid var(--card-border); background: rgba(128, 150, 180, .06); opacity: .5; font-size: .78rem; line-height: 1.2; cursor: default; }
.tt-badge svg { width: 38px; height: 38px; display: block; margin: 0 auto .3rem; color: var(--silver-2); }
.tt-badge.earned { opacity: 1; border-color: var(--silver); box-shadow: 0 0 14px rgba(169, 209, 255, .2); }
.tt-badge.earned svg { color: var(--ice); filter: drop-shadow(0 0 6px rgba(169, 209, 255, .6)); }
.tt-badge.earned.trophy svg { color: var(--gold); filter: drop-shadow(0 0 6px rgba(242, 193, 78, .6)); }
.tt-empty { color: var(--muted); text-align: center; padding: 1.5rem .5rem; }

/* ---------- Typing area ---------- */
.tt-type { position: relative; border-radius: 14px; border: 1px solid var(--card-border); background: rgba(2, 15, 36, .35); padding: 1.1rem 1.2rem; cursor: text; }
html[data-bs-theme="light"] .tt-type { background: #fff; }
.tt-type.focused { border-color: var(--ice); box-shadow: 0 0 0 3px rgba(169, 209, 255, .22); }
.tt-type-text { font-family: var(--mono); font-size: var(--type-size); line-height: 1.75; max-height: calc(var(--type-size) * 1.75 * 3 + 4px); overflow: hidden; white-space: pre-wrap; word-break: normal; overflow-wrap: break-word; user-select: none; -webkit-user-select: none; }
.tt-type-text.tall { max-height: calc(var(--type-size) * 1.75 * 5 + 4px); }
.tt-type-text .c { color: var(--pending); border-radius: 3px; position: relative; }
.tt-type-text .c.ok { color: var(--ok); }
.tt-type-text .c.bad { color: #fff; background: var(--bad); }
.tt-type-text .c.fixed { color: var(--gold); }
.tt-type-text .c.cur { color: var(--text); background: rgba(169, 209, 255, .28); box-shadow: inset 0 -3px 0 var(--ice); animation: tt-blink 1.1s steps(2, start) infinite; }
.tt-type-text .c.cur.miss { background: var(--bad); color: #fff; animation: tt-shake .18s linear; }
.tt-type-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; resize: none; cursor: text; font-size: 16px; caret-color: transparent; }
.tt-type-blur { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; text-align: center; background: rgba(2, 15, 36, .78); color: #fff; border-radius: 14px; font-weight: 700; font-size: 1.15rem; padding: 1rem; pointer-events: none; }
.tt-type.blurred .tt-type-blur { display: flex; }
.tt-live { display: flex; flex-wrap: wrap; gap: .6rem; }
.tt-live-item { flex: 1 1 110px; padding: .55rem .8rem; border-radius: 12px; border: 1px solid var(--card-border); background: rgba(128, 150, 180, .07); }
.tt-live-item b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tt-live-item span { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }

/* ---------- On-screen keyboard and hands ---------- */
html.easy .tt-kb { --u: clamp(18px, 4.5vw, 52px); }
.tt-kb { --u: clamp(18px, 4.9vw, 52px); display: inline-flex; flex-direction: column; gap: calc(var(--u) * .1); padding: calc(var(--u) * .22); border-radius: 14px; background: linear-gradient(180deg, rgba(197, 204, 214, .22), rgba(141, 152, 168, .1)); border: 1px solid var(--card-border); user-select: none; max-width: 100%; }
.tt-kb-row { display: flex; gap: calc(var(--u) * .1); }
.tt-key { width: calc(var(--u) * var(--w, 1)); height: var(--u); flex: 0 0 auto; border-radius: calc(var(--u) * .16); background: var(--key); color: var(--key-text); border: 1px solid rgba(141, 152, 168, .55); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(var(--u) * .34); font-weight: 700; line-height: 1; position: relative; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25); }
.tt-key small { font-size: .72em; opacity: .7; font-weight: 600; margin-bottom: 2px; }
.tt-key.wide { font-size: calc(var(--u) * .24); font-weight: 600; }
.tt-key.bump::after { content: ""; position: absolute; bottom: 14%; width: 26%; height: 2px; background: currentColor; opacity: .7; border-radius: 2px; }
.tt-key::before { content: ""; position: absolute; left: 12%; right: 12%; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--fc, transparent); opacity: .9; }
.tt-key.zone { background: color-mix(in srgb, var(--fc) 32%, transparent), var(--key); }
.f-l5 { --fc: #e879a6; } .f-l4 { --fc: #f2a65a; } .f-l3 { --fc: #f2d15a; } .f-l2 { --fc: #7bd88f; }
.f-r2 { --fc: #5ac8d8; } .f-r3 { --fc: #6ea8ff; } .f-r4 { --fc: #a78bfa; } .f-r5 { --fc: #e58bf0; } .f-t { --fc: #c5ccd6; }
.tt-key.next { background: var(--chrome); color: #041e42; border-color: #fff; box-shadow: 0 0 0 3px rgba(169, 209, 255, .65), 0 0 22px rgba(169, 209, 255, .85); transform: translateY(-1px); z-index: 1; }
.tt-key.next small { opacity: .9; }
.tt-key.down { background: var(--ok); color: #041e42; }
.tt-key.wrong { background: var(--bad); color: #fff; }
.tt-kb-hint { min-height: 1.6em; font-weight: 600; margin-top: .5rem; }
.tt-kb-wrap { text-align: center; overflow-x: auto; }
.tt-hands { width: min(100%, 560px); height: auto; display: block; margin: .6rem auto 0; }
.tt-hands .palm { fill: rgba(197, 204, 214, .18); stroke: var(--silver-2); stroke-width: 2; }
.tt-hands .finger { fill: rgba(197, 204, 214, .28); stroke: var(--silver-2); stroke-width: 2; transition: fill .15s; }
.tt-hands .finger.next { fill: var(--fc, #a9d1ff); stroke: #fff; filter: drop-shadow(0 0 8px var(--fc, #a9d1ff)); }
.tt-hands text { fill: var(--muted); font-size: 13px; font-weight: 700; text-anchor: middle; }
.tt-illus { width: min(100%, 520px); height: auto; display: block; margin: 0 auto; }
.tt-illus .ln { stroke: var(--silver); stroke-width: 4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tt-illus .fl { fill: rgba(197, 204, 214, .2); stroke: var(--silver); stroke-width: 3; }
.tt-illus text { fill: var(--text); font-size: 14px; font-weight: 600; }
.tt-illus .tip { stroke: var(--ice); stroke-width: 2; stroke-dasharray: 4 4; fill: none; }

/* ---------- Lessons ---------- */
.tt-unit { padding: 1.1rem 1.2rem; }
.tt-unit h2 { font-size: 1.2rem; margin: 0; }
.tt-lesson-row { display: flex; align-items: center; gap: .8rem; padding: .65rem .7rem; border-radius: 10px; color: inherit; text-decoration: none; border: 1px solid transparent; }
.tt-lesson-row:hover, .tt-lesson-row:focus-visible { background: rgba(128, 150, 180, .14); border-color: var(--card-border); color: inherit; }
.tt-lesson-row .num { width: 2.1rem; height: 2.1rem; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; font-weight: 800; border: 2px solid var(--silver-2); font-size: .9rem; }
.tt-lesson-row.done .num { background: var(--ok); border-color: var(--ok); color: #041e42; }
.tt-lesson-row.up .num { background: var(--chrome); color: #041e42; border-color: #fff; box-shadow: 0 0 12px rgba(169, 209, 255, .7); }
.tt-lesson-row .ttl { flex: 1 1 auto; font-weight: 600; }
.tt-stars { color: var(--gold); letter-spacing: 2px; white-space: nowrap; font-size: 1.05rem; }
.tt-stars .off { color: var(--silver-2); opacity: .45; }
.tt-steps { display: flex; gap: .4rem; list-style: none; padding: 0; margin: 0 0 1rem; flex-wrap: wrap; }
.tt-steps li { flex: 1 1 120px; padding: .5rem .7rem; border-radius: 10px; border: 1px solid var(--card-border); font-weight: 700; font-size: .9rem; color: var(--muted); text-align: center; }
.tt-steps li.active { background: var(--chrome); color: #041e42; border-color: #fff; }
.tt-steps li.done { color: var(--ok); border-color: var(--ok); }
.tt-instructions { font-size: 1.12rem; line-height: 1.65; white-space: pre-line; }

/* ---------- Games ---------- */
.tt-game-card { padding: 1.2rem; height: 100%; display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s; }
.tt-game-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(2, 15, 36, .45), 0 0 0 1px var(--silver); }
.tt-game-art { width: 100%; aspect-ratio: 16 / 7; border-radius: 12px; margin-bottom: .9rem; background: linear-gradient(160deg, #0b2d63, #020f24); border: 1px solid var(--card-border); display: block; }
.tt-stage { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--card-border); background: #020f24; }
.tt-stage canvas { display: block; width: 100%; height: auto; }
.tt-stage:fullscreen { border-radius: 0; border: 0; display: flex; flex-direction: column; justify-content: center; background: #020f24; padding: 1vh 2vw; overflow: auto; }
.tt-stage:fullscreen canvas { max-height: 62vh; width: auto; max-width: 100%; margin: 0 auto; }
.tt-stage:fullscreen .tt-stage-under { max-width: 1100px; width: 100%; margin: 0 auto; }
.tt-stage-under { padding: .8rem; color: #f3f6fa; }
.tt-stage .tt-type { background: rgba(255, 255, 255, .05); border-color: rgba(197, 204, 214, .3); }
.tt-stage .tt-type-text .c { color: #9fb0c6; }
.tt-stage .tt-type-text .c.ok { color: #3ddc84; }
.tt-stage .tt-type-text .c.cur { color: #fff; }
.tt-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .8rem; background: rgba(2, 15, 36, .82); color: #fff; padding: 1rem; z-index: 5; }
.tt-overlay[hidden] { display: none; }
.tt-overlay h2 { font-size: clamp(1.4rem, 3.4vw, 2.4rem); font-weight: 800; margin: 0; }
.tt-overlay p { max-width: 560px; margin: 0; }
.tt-count { font-size: clamp(4rem, 14vw, 9rem); font-weight: 900; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }
.tt-hud { display: flex; flex-wrap: wrap; gap: .5rem; padding: .6rem .8rem; background: linear-gradient(180deg, #06275a, #041e42); color: #fff; border-bottom: 1px solid rgba(197, 204, 214, .3); font-weight: 700; }
.tt-hud div { flex: 1 1 90px; }
.tt-hud span { display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: #aeb9c8; }
.tt-hud b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.tt-wordline { font-family: var(--mono); font-size: clamp(1.6rem, 4vw, 2.6rem); text-align: center; letter-spacing: .06em; min-height: 1.4em; }
.tt-wordline .done { color: #3ddc84; } .tt-wordline .bad { color: #fff; background: #ff5c6c; border-radius: 4px; } .tt-wordline .rest { color: #dbe3ee; }
.tt-catch { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; border: 0; resize: none; font-size: 16px; z-index: 2; cursor: default; }

/* ---------- Results ---------- */
.tt-results { position: fixed; inset: 0; z-index: 1080; background: rgba(2, 15, 36, .86); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 4vh 12px; }
.tt-results-card { width: min(100%, 760px); padding: clamp(1.1rem, 3vw, 2rem); background: linear-gradient(160deg, #0d336e, #041e42 55%, #03183a); color: #f3f6fa; border: 1px solid #c5ccd6; border-radius: 18px; box-shadow: 0 24px 80px rgba(0, 0, 0, .6); animation: tt-rise .3s ease-out; }
.tt-results-card h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 800; }
.tt-res-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; margin: 1rem 0; }
.tt-res-grid > div { border: 1px solid rgba(197, 204, 214, .3); border-radius: 12px; padding: .6rem .7rem; background: rgba(255, 255, 255, .05); }
.tt-res-grid b { display: block; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tt-res-grid .big b { font-size: 2.3rem; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tt-res-grid span { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #aeb9c8; font-weight: 700; }
.tt-coach-msg { border-left: 4px solid #a9d1ff; background: rgba(169, 209, 255, .1); padding: .7rem .9rem; border-radius: 0 10px 10px 0; font-size: 1.08rem; }
.tt-xp-list { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .95rem; }
.tt-xp-list li { display: flex; justify-content: space-between; padding: .2rem 0; border-bottom: 1px dashed rgba(197, 204, 214, .25); }
.tt-levelup { text-align: center; padding: 1rem; margin-bottom: 1rem; border-radius: 14px; border: 1px solid #f2c14e; background: radial-gradient(circle at 50% 0%, rgba(242, 193, 78, .3), transparent 70%); animation: tt-pop .6s cubic-bezier(.2, 1.4, .4, 1); }
.tt-levelup .name { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 900; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tt-earned { display: flex; gap: .7rem; align-items: center; padding: .5rem .7rem; border: 1px solid rgba(197, 204, 214, .3); border-radius: 12px; margin-top: .5rem; animation: tt-pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.tt-earned svg { width: 34px; height: 34px; color: #a9d1ff; flex: 0 0 auto; }
.tt-earned.t-trophy svg { color: #f2c14e; }
.tt-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 1085; }

/* ---------- Animation ---------- */
@keyframes tt-blink { 50% { background: rgba(169, 209, 255, .08); } }
@keyframes tt-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes tt-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes tt-pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
@keyframes tt-pulse { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.12, 1.35); } }
html.noanim *, html.noanim *::before, html.noanim *::after { animation: none !important; transition: none !important; }
/* Motion is controlled by the site's own Settings switch (html.noanim) and by Easy Mode. */

/* ---------- Easy Mode: bigger, calmer, higher contrast, no competition ---------- */
html.easy { font-size: 120%; --type-size: 2.3rem; }
html.easy[data-bs-theme="dark"] { --bg: #020f24; --text: #ffffff; --muted: #e3e9f1; --card: #06224c; --card-border: #c5ccd6; --pending: #e3e9f1; --ok: #5cf0a0; }
html.easy[data-bs-theme="light"] { --bg: #ffffff; --text: #000b1f; --muted: #1d2c44; --card: #ffffff; --card-border: #041e42; --pending: #1d2c44; }
html.easy .tt-card { border-width: 2px; box-shadow: none; }
html.easy .btn { padding: .75rem 1.3rem; font-size: 1.1rem; border-width: 2px; }
html.easy .btn-sm { font-size: 1rem; padding: .55rem 1rem; }
html.easy .tt-competitive, html.easy .tt-timer, html.easy .tt-speed { display: none !important; }
html.easy .tt-nav .nav-link { font-size: 1.05rem; padding-block: .7rem !important; }
html.easy .tt-start::after { display: none; }
html.easy .tt-type-text .c.cur { animation: none; background: #ffe066; color: #000b1f; box-shadow: none; }
html.easy .tt-key.next { box-shadow: 0 0 0 4px #ffe066; }
html.easy .tt-lesson-row { padding-block: .9rem; font-size: 1.05rem; }
html.easy *, html.easy *::before, html.easy *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }

/* ---------- Print: progress reports and certificates ---------- */
.tt-print-only { display: none; }
.tt-cert { background: #fff; color: #041e42; border: 10px double #041e42; outline: 3px solid #8d98a8; outline-offset: -22px; padding: 56px 40px; text-align: center; max-width: 980px; margin: 0 auto; border-radius: 4px; }
.tt-cert h1 { font-family: Georgia, "Times New Roman", serif; font-size: 2.6rem; letter-spacing: .04em; }
.tt-cert .who { font-family: Georgia, "Times New Roman", serif; font-size: 2.4rem; font-weight: 700; border-bottom: 2px solid #8d98a8; display: inline-block; padding: 0 2rem .2rem; margin: .6rem 0 1rem; }
.tt-cert .lvl { font-size: 1.6rem; font-weight: 800; }
.tt-cert img { height: 70px; background: #041e42; padding: 8px 14px; border-radius: 8px; }
.tt-report { background: #fff; color: #041e42; padding: 28px; border-radius: 10px; max-width: 980px; margin: 0 auto; }
.tt-report h1, .tt-report h2 { color: #041e42; }
.tt-report table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.tt-report th, .tt-report td { border: 1px solid #8d98a8; padding: 6px 10px; text-align: left; font-size: .95rem; }
.tt-report th { background: #e9edf3; }
@media print {
  @page { margin: 12mm; }
  body { background: #fff !important; color: #000 !important; }
  .tt-nav, .tt-footer, .mgi-pb, .no-print, .tt-toasts, .offcanvas, .tt-flash { display: none !important; }
  .tt-print-only { display: block; }
  main { padding: 0 !important; max-width: none !important; }
  .tt-report, .tt-cert { box-shadow: none; max-width: none; }
  .tt-cert { -webkit-print-color-adjust: exact; print-color-adjust: exact; page-break-inside: avoid; }
  html { font-size: 100% !important; }
}

@media (max-width: 575.98px) {
  :root { --type-size: 1.3rem; }
  .tt-logo { height: 32px; }
  .tt-start { width: 100%; }
}

/* ==========================================================================
   FUN LAYER: bright colors, emojis, bounce. Navy and chrome stay as the base.
   Everything here calms down in Easy Mode and when animations are switched off.
   ========================================================================== */
:root { --pink: #ff4fa3; --orange: #ff8a1f; --yellow: #ffd23f; --lime: #3ddc84; --teal: #22d3ee; --sky: #4f8cff; --purple: #a78bfa;
  --rainbow: linear-gradient(90deg, #ffd23f, #ff8a1f, #ff4fa3, #a78bfa, #4f8cff, #22d3ee, #3ddc84, #ffd23f); }
.tt-e { font-style: normal; display: inline-block; margin-right: .3em; }
.tt-fun-text { background: var(--rainbow); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: tt-rainbow 8s linear infinite; }
.tt-brand-text { background: var(--rainbow); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: tt-rainbow 10s linear infinite; text-shadow: none; }
.tt-nav::after { background: var(--rainbow); background-size: 300% 100%; height: 3px; opacity: 1; animation: tt-rainbow 12s linear infinite; }
.tt-nav .nav-link:hover { transform: translateY(-2px); }
.tt-nav .nav-link { transition: transform .15s; white-space: nowrap; }
@media (min-width: 992px) and (max-width: 1299.98px) { .tt-nav .nav-link { padding-inline: .45rem !important; font-size: .92rem; } .tt-brand-text { display: none; } }

/* The big button */
.tt-start { background: var(--rainbow); background-size: 300% 100%; animation: tt-rainbow 5s linear infinite; border: 3px solid #fff; color: #041e42 !important; text-shadow: 0 1px 0 rgba(255, 255, 255, .6); box-shadow: 0 8px 26px rgba(255, 79, 163, .45), 0 0 0 4px rgba(255, 210, 63, .25); transition: transform .15s; }
.tt-start:hover, .tt-start:focus-visible { transform: scale(1.06) rotate(-1deg); filter: none; }
.tt-start::after { border-color: var(--yellow); }

/* Hero with color and floating emojis */
.tt-hero { background: radial-gradient(420px 260px at 92% 8%, rgba(255, 79, 163, .35), transparent 70%), radial-gradient(380px 240px at 70% 100%, rgba(34, 211, 238, .28), transparent 70%), radial-gradient(300px 200px at 0% 100%, rgba(255, 210, 63, .2), transparent 70%), var(--card); }
.tt-floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: 16px; }
.tt-floaters span { position: absolute; font-size: clamp(1.6rem, 3.4vw, 2.8rem); animation: tt-bob 4s ease-in-out infinite; opacity: .95; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .35)); }
.tt-floaters span:nth-child(1) { right: 6%; top: 10%; }
.tt-floaters span:nth-child(2) { right: 22%; top: 22%; animation-delay: -1s; font-size: clamp(1.2rem, 2.4vw, 2rem); }
.tt-floaters span:nth-child(3) { right: 9%; top: 48%; animation-delay: -2s; }
.tt-floaters span:nth-child(4) { right: 27%; bottom: 10%; animation-delay: -3s; font-size: clamp(1.2rem, 2.4vw, 2rem); }
.tt-floaters span:nth-child(5) { right: 4%; bottom: 8%; animation-delay: -1.6s; }
.tt-hero > :not(.tt-floaters) { position: relative; z-index: 1; }

/* Cards and tiles get a color each */
.tt-stat { border-top: 5px solid var(--tc, var(--sky)); transition: transform .15s; overflow: hidden; }
.tt-stat:hover { transform: translateY(-4px) rotate(-.5deg); }
.tt-stat-emoji { position: absolute; right: 10px; top: 8px; font-size: 1.7rem; }
.tt-stat-value { color: var(--tc, inherit); }
html[data-bs-theme="light"] .tt-stat-value { color: inherit; }
#ttStats > div:nth-child(1) { --tc: var(--sky); } #ttStats > div:nth-child(2) { --tc: var(--yellow); } #ttStats > div:nth-child(3) { --tc: var(--teal); } #ttStats > div:nth-child(4) { --tc: var(--lime); }
#ttStats > div:nth-child(5) { --tc: var(--purple); } #ttStats > div:nth-child(6) { --tc: var(--pink); } #ttStats > div:nth-child(7) { --tc: var(--orange); } #ttStats > div:nth-child(8) { --tc: var(--teal); }
.tt-bar > span, html[data-bs-theme="light"] .tt-bar > span { background: var(--rainbow); background-size: 200% 100%; box-shadow: 0 0 12px rgba(255, 138, 31, .5); }
.tt-bar.done > span { background: linear-gradient(90deg, #1fa862, #3ddc84, #ffd23f); }
.tt-xp-pill { background: linear-gradient(90deg, var(--yellow), var(--orange)); color: #041e42; border: 0; }
.tt-level-name { background: linear-gradient(90deg, var(--yellow), var(--orange), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
html[data-bs-theme="light"] .tt-level-name { background: linear-gradient(90deg, #c2410c, #be185d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tt-challenge.done .tt-ch-title::before { content: "\2705  "; }

/* Badges: every earned badge glows in its own color */
.tt-badge { transition: transform .15s; }
.tt-badge.earned { opacity: 1; background: linear-gradient(160deg, color-mix(in srgb, var(--bc, #4f8cff) 35%, transparent), transparent); border-color: var(--bc, var(--sky)); box-shadow: 0 0 16px color-mix(in srgb, var(--bc, #4f8cff) 45%, transparent); }
.tt-badge.earned svg { color: var(--bc, var(--sky)); filter: drop-shadow(0 0 6px var(--bc, var(--sky))); }
.tt-badge.earned:hover { transform: scale(1.1) rotate(-3deg); }
.tt-badge:nth-child(7n+1) { --bc: var(--yellow); } .tt-badge:nth-child(7n+2) { --bc: var(--pink); } .tt-badge:nth-child(7n+3) { --bc: var(--teal); } .tt-badge:nth-child(7n+4) { --bc: var(--lime); }
.tt-badge:nth-child(7n+5) { --bc: var(--orange); } .tt-badge:nth-child(7n+6) { --bc: var(--purple); } .tt-badge:nth-child(7n) { --bc: var(--sky); }
.tt-badge.earned.trophy { --bc: var(--yellow); }

/* Lessons and games */
.row > div:nth-child(6n+1) > .tt-unit, .row > div:nth-child(6n+1) > .tt-game-card { --uc: var(--pink); } .row > div:nth-child(6n+2) > .tt-unit, .row > div:nth-child(6n+2) > .tt-game-card { --uc: var(--yellow); }
.row > div:nth-child(6n+3) > .tt-unit, .row > div:nth-child(6n+3) > .tt-game-card { --uc: var(--teal); } .row > div:nth-child(6n+4) > .tt-unit, .row > div:nth-child(6n+4) > .tt-game-card { --uc: var(--lime); }
.row > div:nth-child(6n+5) > .tt-unit, .row > div:nth-child(6n+5) > .tt-game-card { --uc: var(--orange); } .row > div:nth-child(6n) > .tt-unit, .row > div:nth-child(6n) > .tt-game-card { --uc: var(--purple); }
.tt-unit { border-left: 6px solid var(--uc, var(--sky)); }
.tt-unit h2 .tt-e { font-size: 1.5rem; }
.tt-lesson-row.up { background: linear-gradient(90deg, color-mix(in srgb, var(--uc, #4f8cff) 30%, transparent), transparent); border-color: var(--uc, var(--sky)); }
.tt-lesson-row.up .num { background: var(--rainbow); border-color: #fff; animation: tt-wiggle 1.6s ease-in-out infinite; }
.tt-lesson-row.done .num { background: linear-gradient(135deg, #3ddc84, #22d3ee); border-color: transparent; }
.tt-game-card { border-top: 6px solid var(--uc, var(--sky)); }
.tt-game-card:hover { transform: translateY(-6px) rotate(-.6deg); box-shadow: 0 18px 40px rgba(2, 15, 36, .5), 0 0 0 2px var(--uc, var(--sky)); }
.tt-game-card h2 .tt-e { font-size: 1.6rem; }
.tt-steps li.active { background: var(--rainbow); background-size: 300% 100%; animation: tt-rainbow 6s linear infinite; }
.tt-key.next { background: linear-gradient(180deg, #fff3b0, #ffd23f); box-shadow: 0 0 0 3px rgba(255, 210, 63, .7), 0 0 24px rgba(255, 138, 31, .9); animation: tt-keypulse .9s ease-in-out infinite; }
.tt-type.focused { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(34, 211, 238, .3), 0 0 30px rgba(79, 140, 255, .25); }
.tt-live-item:nth-child(1) { border-bottom: 4px solid var(--sky); } .tt-live-item:nth-child(2) { border-bottom: 4px solid var(--lime); } .tt-live-item:nth-child(3) { border-bottom: 4px solid var(--pink); } .tt-live-item:nth-child(4) { border-bottom: 4px solid var(--yellow); }

/* Combo meter and cheers while typing */
.tt-combo { display: inline-flex; align-items: center; gap: .35rem; font-weight: 900; padding: .3rem .9rem; border-radius: 999px; color: #041e42; background: linear-gradient(90deg, var(--yellow), var(--orange)); box-shadow: 0 4px 14px rgba(255, 138, 31, .5); font-variant-numeric: tabular-nums; }
.tt-combo.hot { background: linear-gradient(90deg, var(--orange), var(--pink)); color: #fff; }
.tt-combo.mega { background: var(--rainbow); background-size: 300% 100%; animation: tt-rainbow 2s linear infinite; }
.tt-combo.pop { animation: tt-pop .25s cubic-bezier(.2, 1.6, .4, 1); }
.tt-cheer { position: absolute; left: 50%; top: 30%; z-index: 6; pointer-events: none; font-weight: 900; font-size: clamp(1.6rem, 5vw, 3rem); white-space: nowrap; color: #fff; text-shadow: 0 3px 0 #041e42, 0 0 22px var(--pink); animation: tt-cheer 1.3s ease-out forwards; }

/* Results: a real celebration */
.tt-results-card { border: 0; background: linear-gradient(#0a2a5c, #041e42) padding-box, var(--rainbow) border-box; border: 4px solid transparent; }
.tt-grade { font-size: clamp(3rem, 9vw, 5rem); line-height: 1; display: inline-block; animation: tt-grade .9s cubic-bezier(.2, 1.5, .4, 1); }
.tt-cheerline { font-size: 1.25rem; font-weight: 800; color: var(--yellow); }
.tt-res-grid > div:nth-child(5n+1) { border-color: var(--yellow); } .tt-res-grid > div:nth-child(5n+2) { border-color: var(--teal); } .tt-res-grid > div:nth-child(5n+3) { border-color: var(--pink); } .tt-res-grid > div:nth-child(5n+4) { border-color: var(--lime); } .tt-res-grid > div:nth-child(5n) { border-color: var(--purple); }
.tt-res-grid .big b { background: linear-gradient(90deg, var(--yellow), var(--orange), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tt-results .tt-stars { font-size: 2rem; }
.tt-results .tt-stars span:not(.off) { display: inline-block; animation: tt-grade .6s cubic-bezier(.2, 1.6, .4, 1) backwards; }
.tt-results .tt-stars span:nth-child(2) { animation-delay: .2s; } .tt-results .tt-stars span:nth-child(3) { animation-delay: .4s; }
.tt-coach-msg { border-left-color: var(--teal); background: rgba(34, 211, 238, .12); }
.tt-toast { border: 2px solid var(--yellow); }
.tt-count { background: var(--rainbow); -webkit-background-clip: text; background-clip: text; color: transparent; animation: tt-pop .5s cubic-bezier(.2, 1.6, .4, 1); }
.tt-hud b { color: var(--yellow); }
.tt-hud div:nth-child(2) b { color: var(--teal); } .tt-hud div:nth-child(3) b { color: var(--lime); } .tt-hud div:nth-child(4) b { color: #ff9ecb; }

@keyframes tt-rainbow { to { background-position: 300% 0; } }
@keyframes tt-bob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-14px) rotate(8deg); } }
@keyframes tt-wiggle { 0%, 100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.12); } }
@keyframes tt-keypulse { 50% { transform: translateY(-3px) scale(1.08); } }
@keyframes tt-cheer { 0% { opacity: 0; transform: translate(-50%, 20px) scale(.5) rotate(-6deg); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.15) rotate(3deg); } 100% { opacity: 0; transform: translate(-50%, -70px) scale(1) rotate(0); } }
@keyframes tt-grade { 0% { transform: scale(0) rotate(-40deg); } 100% { transform: none; } }

/* Easy Mode keeps the colors and emojis but drops the motion and keeps contrast high */
html.easy .tt-start { animation: none; background: var(--yellow); border-color: #041e42; }
html.easy .tt-floaters, html.easy .tt-cheer { display: none; }
html.easy .tt-key.next { background: #ffe066; animation: none; }
html.easy .tt-fun-text, html.easy .tt-brand-text { animation: none; }
html.easy[data-bs-theme="light"] .tt-fun-text { background: none; color: #041e42; }
@media print { .tt-floaters { display: none; } }
