/* Cursor Insert India - Typing Tutor
 * Look: friendly indigo + saffron, rounded "keycap" shapes, Baloo 2 headings, Hind text.
 * Every colour is a token so light and dark themes both work.
 */
:root {
  --brand: #4338ca;
  --brand-dark: color-mix(in srgb, var(--brand) 72%, #000);
  --brand-soft: color-mix(in srgb, var(--brand) 12%, #fff);
  --accent: #f59e0b;
  --accent-soft: #fff4dc;
  --link: var(--brand);
  --strong: var(--brand);
  --bg: #f4f5fb;
  --card: #ffffff;
  --card-2: #f8f9fd;
  --text: #1b1f33;
  --muted: #646b85;
  --line: #e3e5ef;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --pending: #a3a9bd;
  --cur-bg: #fde68a;
  --key-bg: #ffffff;
  --key-edge: #b9bed0;
  --kb-bg: #e4e6f0;
  --input-bg: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 24, 51, .06), 0 6px 20px rgba(20, 24, 51, .06);
  --head-font: "Baloo 2", "Nirmala UI", system-ui, sans-serif;
  --ui-font: "Hind", system-ui, -apple-system, "Segoe UI", Roboto, "Nirmala UI", "Noto Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-soft: color-mix(in srgb, var(--brand) 22%, #12152a); --link: #a5b4fc; --strong: #a5b4fc;
    --accent-soft: #3a2c10;
    --bg: #0f1222; --card: #181c30; --card-2: #1e2339; --text: #e8eaf4; --muted: #9ba2bb; --line: #2b3150;
    --ok: #4ade80; --ok-bg: #14321f; --bad: #fca5a5; --bad-bg: #3b1a1a; --pending: #5f6683; --cur-bg: #6b5410;
    --key-bg: #252a44; --key-edge: #11142a; --kb-bg: #141831; --input-bg: #12162a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand-soft: color-mix(in srgb, var(--brand) 22%, #12152a); --link: #a5b4fc; --strong: #a5b4fc;
  --accent-soft: #3a2c10;
  --bg: #0f1222; --card: #181c30; --card-2: #1e2339; --text: #e8eaf4; --muted: #9ba2bb; --line: #2b3150;
  --ok: #4ade80; --ok-bg: #14321f; --bad: #fca5a5; --bad-bg: #3b1a1a; --pending: #5f6683; --cur-bg: #6b5410;
  --key-bg: #252a44; --key-edge: #11142a; --kb-bg: #141831; --input-bg: #12162a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--ui-font); background: var(--bg); color: var(--text); line-height: 1.6; font-size: 16.5px; }
a { color: var(--link); }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--head-font); line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; font-weight: 700; }
h1 { font-size: 2.05rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[id] { scroll-margin-top: 84px; } /* keep anchored sections clear of the sticky header */

.container { max-width: 1160px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
main.container { padding-top: 24px; padding-bottom: 56px; }

/* header */
.site-header { background: var(--brand-dark); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 12px rgba(0, 0, 0, .15); }
.site-header .container { display: flex; align-items: center; gap: 14px; min-height: 64px; flex-wrap: wrap; }
.brand { color: #fff !important; text-decoration: none; font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; font-family: var(--head-font); }
.brand .logo { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: #1b1f33; display: grid; place-items: center; font-size: 1.2rem; box-shadow: 0 3px 0 #b45309; }
.brand small { display: block; font-weight: 500; font-size: .74rem; opacity: .8; font-family: var(--ui-font); margin-top: -4px; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a { color: #e0e3ff !important; text-decoration: none; padding: 8px 11px; border-radius: 9px; font-size: .96rem; font-weight: 500; }
.nav a:hover, .nav a.active { background: rgba(255, 255, 255, .14); color: #fff !important; }
.nav .ui-lang { border: 1px solid rgba(255, 255, 255, .35); }
.nav .xp-chip { background: var(--accent); color: #1b1f33 !important; font-weight: 700; padding: 6px 10px; }
.nav .xp-chip:hover { background: #fbbf24; }
.theme-btn { background: none; border: 1px solid rgba(255, 255, 255, .35); color: #fff; border-radius: 9px; padding: 6px 9px; font-size: 1rem; cursor: pointer; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid rgba(255, 255, 255, .4); color: #fff; border-radius: 9px; padding: 6px 11px; font-size: 1.1rem; }
@media (max-width: 960px) {
  .nav-toggle { display: block; }
  .nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
  .nav.open { display: flex; }
}

.site-footer { border-top: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: .92rem; }
.site-footer .container { padding-block: 22px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* generic UI */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; border: 1px solid var(--line); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid > * { min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.mt { margin-top: 18px; }
.right { text-align: right; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--text) !important; padding: 9px 16px; border-radius: 10px; font: 600 .95rem/1.3 var(--ui-font); cursor: pointer; text-decoration: none; transition: transform .08s, box-shadow .15s, border-color .15s; }
.btn:hover { border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff !important; box-shadow: 0 3px 0 var(--brand-dark); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #1b1f33 !important; box-shadow: 0 3px 0 #b45309; }
.btn.danger { color: var(--bad) !important; border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.sm { padding: 5px 10px; font-size: .85rem; }
.btn.lg { padding: 12px 22px; font-size: 1.05rem; }

form .row { margin-bottom: 14px; }
label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .93rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--input-bg); color: var(--text);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: auto; }

.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.alert.success { background: var(--ok-bg); color: var(--ok); }
.alert.error { background: var(--bad-bg); color: var(--bad); }
.alert.info { background: var(--brand-soft); color: var(--text); }

table.data { width: 100%; border-collapse: collapse; font-size: .94rem; }
table.data th, table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { background: var(--card-2); font-weight: 600; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; background: var(--brand-soft); color: var(--text); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

/* hero (used on inner pages) */
.hero { background: linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff; border-radius: 18px; padding: 32px 28px; margin-bottom: 24px; position: relative; overflow: hidden; }
.hero h1, .hero h2 { color: #fff; }
.hero p { font-size: 1.08rem; opacity: .93; max-width: 720px; }
.hero .btn { margin-right: 8px; margin-top: 8px; }
.hero .btn:not(.primary):not(.accent) { background: transparent; color: #fff !important; border-color: rgba(255, 255, 255, .5); }
.hero .btn.primary { background: var(--accent); border-color: var(--accent); color: #1b1f33 !important; box-shadow: 0 3px 0 #b45309; }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-box b { display: block; font: 700 1.7rem/1.2 var(--head-font); color: var(--strong); font-variant-numeric: tabular-nums; }
.stat-box span { color: var(--muted); font-size: .9rem; }

/* language cards */
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.lang-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--text) !important; transition: transform .12s, border-color .12s, box-shadow .12s; border-bottom: 4px solid var(--line); }
.lang-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.lang-card .native { font-size: 1.4rem; font-weight: 600; display: block; color: var(--text); }
.lang-card .en { font-size: .86rem; color: var(--muted); }

/* lessons */
.lesson-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.lesson-list li a { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--text) !important; }
.lesson-list li a:hover { border-color: var(--brand); }
.lesson-list .num { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft); color: var(--text); display: grid; place-items: center; font-weight: 700; flex: none; box-shadow: 0 3px 0 var(--line); }
.lesson-list .done .num { background: var(--ok); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--ok) 60%, #000); }
.lesson-list .meta { font-size: .82rem; color: var(--muted); }

/* certificate (always light, it is a printed document) */
.cert { background: #fff; color: #1b1f33; max-width: 900px; margin: 0 auto; padding: 48px; border: 12px double #312e81; text-align: center; position: relative; }
.cert h1 { font-size: 2.4rem; color: #312e81; letter-spacing: .02em; }
.cert .name { font-size: 2rem; font-weight: 700; border-bottom: 2px solid var(--accent); display: inline-block; padding: 0 24px 4px; margin: 10px 0 18px; }
.cert .figs { display: flex; justify-content: center; gap: 36px; margin: 22px 0; flex-wrap: wrap; }
.cert .figs b { display: block; font-size: 1.6rem; color: #4338ca; }
.cert .foot { display: flex; justify-content: space-between; margin-top: 40px; font-size: .9rem; gap: 20px; flex-wrap: wrap; }
.cert .sign { border-top: 1px solid #374151; padding-top: 6px; min-width: 200px; }
.cert .muted { color: #555b70; }
.cert .foot { align-items: flex-end; }
.cert-qr { width: 96px; height: 96px; }
.cert-logo { display: block; max-height: 90px; max-width: 220px; margin: 0 auto 8px; }
.sign-wrap { text-align: center; }
.cert-sign { display: block; max-height: 60px; max-width: 200px; margin: 0 auto 2px; }
.share-box { display: grid; gap: 12px; }
.live-race .race-head { margin-bottom: 12px; }
.live-race .game-stage { position: relative; }
.race-results { display: grid; gap: 6px; max-width: 480px; }
.mini-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--card-2); }
.faq { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; color: var(--muted); }
.seo-links { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .92rem; }
.bar-chart { width: 100%; height: auto; display: block; }
.bar-chart .grid { stroke: var(--line); }
.bar-chart .lbl { fill: var(--muted); font: 11px var(--ui-font); }
.bar-chart.c1 .bar { fill: var(--brand); }
.bar-chart.c2 .bar { fill: var(--accent); }
.bar-chart.c3 .bar { fill: #10b981; }
.report-table td, .report-table th { font-size: .88rem; }
.notice { border-left: 5px solid var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.notice b { display: block; }
.notice span { font-size: .8rem; color: var(--muted); }
.hw-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hw-item:last-child { border-bottom: 0; }
@media print {
  .admin-nav, .no-print { display: none !important; }
  .admin-wrap { display: block; }
  .card { box-shadow: none; border: 0; }
}
.share-card { width: 100%; max-width: 420px; height: auto; border-radius: 16px; box-shadow: var(--shadow); }
.cert-qr img, .cert-qr canvas { width: 96px !important; height: 96px !important; }
@media print {
  .site-header, .site-footer, .no-print, .reward-stack { display: none !important; }
  body { background: #fff; }
  main.container { padding: 0; }
  .cert { border-width: 10px; }
}

/* ---------------- typing area ---------------- */
.tt { --tt-font: inherit; }
.tt-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.tt-stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; box-shadow: var(--shadow); }
.tt-stat b { display: block; font: 700 1.65rem/1.2 var(--head-font); color: var(--text); font-variant-numeric: tabular-nums; }
.tt-stat span { font-size: .8rem; color: var(--muted); }

.tt-box { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); cursor: text; }
.tt-text { font-family: var(--tt-font), "Nirmala UI", "Noto Sans", sans-serif; font-size: 1.6rem; line-height: 2.2; padding: 18px 22px; height: 11.5em; overflow-y: auto; word-wrap: break-word; color: var(--pending); user-select: none; }
.tt-text[dir=rtl] { line-height: 2.6; font-size: 1.6rem; }
.tt-text .c { border-radius: 3px; }
.tt-text .c.ok, .tt-text .c.done { color: var(--text); }
.tt-text .c.bad { color: var(--bad); background: var(--bad-bg); }
.tt-text .c.sp.bad { background: color-mix(in srgb, var(--bad) 45%, transparent); }
.tt-text .c.cur { background: var(--cur-bg); color: var(--text); box-shadow: 0 2px 0 var(--accent); }
.tt.done .tt-text .c.cur { background: none; box-shadow: none; }
.tt-input { position: absolute; opacity: 0; left: 0; top: 0; width: 1px; height: 1px; border: 0; padding: 0; resize: none; }
.tt-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--card) 82%, transparent); border-radius: var(--radius); font-weight: 600; font-size: 1.15rem; color: var(--text); text-align: center; padding: 16px; }
.tt-overlay::before { content: "⌨"; display: block; font-size: 2rem; margin-bottom: 4px; }
.tt-overlay.hide { display: none; }

.tt-typed-wrap { margin-top: 12px; }
.tt-label { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.tt-typed { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); min-height: 5.5em; max-height: 9em; overflow-y: auto; padding: 12px 16px; font-family: var(--tt-font), "Nirmala UI", sans-serif; font-size: 1.35rem; line-height: 1.9; white-space: pre-wrap; word-wrap: break-word; }

.tt-info { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; min-height: 28px; }
.tt-pill { font-size: .83rem; background: var(--brand-soft); color: var(--text); border-radius: 99px; padding: 4px 11px; }
.tt-pill.warn { background: var(--accent-soft); color: var(--text); }
.tt-finger { font-weight: 600; color: var(--text); margin-left: auto; }

.tt-kb { background: var(--kb-bg); padding: 12px; border-radius: var(--radius); user-select: none; overflow-x: auto; }
.tt-row { display: flex; gap: 5px; margin-bottom: 6px; justify-content: center; min-width: 640px; }
.tt-key { position: relative; width: 50px; height: 50px; border-radius: 9px; background: var(--key-bg); color: var(--text); box-shadow: 0 3px 0 var(--key-edge); flex: none; font-family: var(--tt-font), "Nirmala UI", sans-serif; transition: transform .05s; border-bottom: 4px solid transparent; }
.tt-key .k-s { position: absolute; top: 3px; left: 6px; font-size: .8rem; color: var(--muted); }
.tt-key .k-n { position: absolute; bottom: 5px; right: 7px; font-size: 1.15rem; }
.tt-kb.shift-on .tt-key .k-s { color: var(--text); font-weight: 700; font-size: .95rem; }
.tt-kb.shift-on .tt-key .k-n { color: var(--muted); font-size: .85rem; }
.tt-key.wide { width: 84px; font-family: var(--ui-font); }
.tt-key.wide .k-n { left: 8px; right: auto; font-size: .78rem; color: var(--muted); }
.tt-key.Backspace { width: 76px; }
.tt-key.Tab { width: 72px; }
.tt-key.CapsLock { width: 88px; }
.tt-key.Enter { width: 92px; }
.tt-key.ShiftLeft { width: 115px; }
.tt-key.ShiftRight { width: 118px; }
.tt-key.space { width: 340px; }
.tt-key.space .k-n { left: 50%; transform: translateX(-50%); right: auto; font-size: .8rem; color: var(--muted); }
.tt-key.press { transform: translateY(3px); box-shadow: none; }
.tt-key.next { background: var(--accent); color: #1b1f33; box-shadow: 0 3px 0 #b45309, 0 0 0 3px rgba(245, 158, 11, .35); }
.tt-key.next .k-n, .tt-key.next .k-s { color: #1b1f33; }
/* finger colours */
.tt-key.f-lp, .tt-key.f-rp { border-bottom-color: #f472b6; }
.tt-key.f-lr, .tt-key.f-rr { border-bottom-color: #a78bfa; }
.tt-key.f-lm, .tt-key.f-rm { border-bottom-color: #60a5fa; }
.tt-key.f-li, .tt-key.f-ri { border-bottom-color: #34d399; }
.tt-key.f-th { border-bottom-color: #fbbf24; }

.tt-result { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-top: 16px; }
.tt-res-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tt-res { background: var(--card-2); border-radius: 12px; padding: 12px; text-align: center; }
.tt-res b { display: block; font: 700 1.45rem/1.2 var(--head-font); }
.tt-res.big b { font-size: 2.2rem; color: var(--strong); }
.tt-res span { font-size: .82rem; color: var(--muted); }
.tt-msg { padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.tt-msg.good { background: var(--ok-bg); color: var(--ok); }
.tt-msg.bad { background: var(--accent-soft); color: var(--text); }
.tt-review { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 1.05rem; }
.tt-review th, .tt-review td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; font-family: var(--tt-font), "Nirmala UI", sans-serif; }
.tt-review td.bad { color: var(--bad); }
.tt-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tt-graph-wrap { margin: 4px 0 14px; }
.tt-graph { width: 100%; height: auto; display: block; background: var(--card-2); border-radius: 12px; }
.tt-graph .grid { stroke: var(--line); stroke-width: 1; }
.tt-graph .lbl { fill: var(--muted); font: 11px var(--ui-font); }
.tt-graph .line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; }
.tt-graph .area { fill: color-mix(in srgb, var(--brand) 14%, transparent); stroke: none; }
.tt-graph .err { fill: #ef4444; }
.tt-graph .end { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
/* keyboard chart */
.chart-kb .tt-key { width: 60px; height: 60px; }
.chart-kb .tt-key .k-n { font-size: 1.45rem; }
.chart-kb .tt-key .k-s { font-size: 1rem; }
.chart-kb .tt-key.wide { width: 96px; }
.chart-kb .tt-key.space { width: 380px; }
.chart-kb .tt-row { min-width: 760px; }
.finger-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
.finger-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }
@media print {
  .chart-card { box-shadow: none; border: 0; }
  .chart-kb { background: #fff; overflow: visible; }
  .chart-kb .tt-key { background: #fff; color: #000; box-shadow: none; border-top: 1px solid #555; border-left: 1px solid #555; border-right: 1px solid #555; border-bottom-width: 6px; }
  .chart-kb .tt-row { min-width: 0; }
}
.heat-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 10px; }
.heat-legend .sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); vertical-align: -2px; }
/* hands picture: the finger to use lights up */
.tt-hands { display: flex; justify-content: center; margin-top: 8px; overflow-x: auto; }
.tt-hands svg { max-width: 100%; height: auto; }
.tt-hands .palm { fill: var(--card-2); stroke: var(--line); stroke-width: 2; }
.tt-hands .fg { stroke: var(--line); stroke-width: 2; fill: var(--card); transition: transform .12s, fill .12s; }
.tt-hands .f-lp, .tt-hands .f-rp { fill: #fbcfe8; } .tt-hands .f-lr, .tt-hands .f-rr { fill: #ddd6fe; }
.tt-hands .f-lm, .tt-hands .f-rm { fill: #bfdbfe; } .tt-hands .f-li, .tt-hands .f-ri { fill: #a7f3d0; } .tt-hands .f-th { fill: #fde68a; }
.tt-hands .fg.on { fill: var(--accent); stroke: #b45309; transform: translateY(-6px); }
@media (max-width: 760px) and (pointer: coarse) { .tt-hands { display: none; } }
.tt-save { color: var(--muted); }

@media (max-width: 640px) {
  .tt-stats { grid-template-columns: repeat(2, 1fr); }
  .tt-text { font-size: 1.25rem; padding: 14px; }
  .hero { padding: 24px 18px; }
  .cert { padding: 22px; }
  h1 { font-size: 1.65rem; }
}

/* admin */
.admin-wrap { display: grid; grid-template-columns: 210px 1fr; gap: 20px; }
.admin-wrap > * { min-width: 0; }
.admin-nav { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; align-self: start; }
.admin-nav a { display: block; padding: 9px 12px; border-radius: 9px; text-decoration: none; color: var(--text) !important; }
.admin-nav a.active, .admin-nav a:hover { background: var(--brand-soft); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.filters > div { min-width: 150px; }
.inline-form { display: inline; }
@media (max-width: 860px) { .admin-wrap { grid-template-columns: 1fr; } }

.spark { width: 100%; height: 120px; }
.spark path { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.spark .area { fill: color-mix(in srgb, var(--brand) 12%, transparent); stroke: none; }
.spark circle { fill: var(--brand); }

/* ---------------- games ---------------- */
.game { position: relative; --tt-font: inherit; }
.game-hud { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 10px; }
.game-stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; text-align: center; box-shadow: var(--shadow); }
.game-stat b { display: block; font: 700 1.35rem/1.3 var(--head-font); font-variant-numeric: tabular-nums; min-height: 1.6rem; }
.game-stat span { font-size: .78rem; color: var(--muted); }
.game-stage { position: relative; height: 440px; border-radius: 18px; overflow: hidden; cursor: text; user-select: none; }
.game-typed { margin-top: 10px; background: var(--card); color: var(--text); border: 2px solid var(--brand); border-radius: 12px; padding: 10px 16px; font: 600 1.5rem/1.4 var(--tt-font), "Nirmala UI", sans-serif; min-height: 3rem; text-align: center; }
.game-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15, 18, 34, .5); border-radius: 18px; z-index: 5; padding: 16px; }
.game-card { background: var(--card); color: var(--text); border-radius: 18px; padding: 24px; max-width: 440px; width: 100%; text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.game-card h2 { font-size: 1.7rem; }
.game-card p { color: var(--muted); }
.game-sum { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
.game-sum b { font-size: 1.2rem; }
.game-stage.hurt { animation: hurt .35s; }
@keyframes hurt { 0%, 100% { box-shadow: inset 0 0 0 0 transparent; } 40% { box-shadow: inset 0 0 0 6px rgba(239, 68, 68, .75); } }
.rain .game-stage { background: linear-gradient(180deg, #0b1437 0%, #1e3a8a 70%, #14532d 70%, #166534 100%); }
.rain .game-stage::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 40px, transparent 40px 80px); pointer-events: none; }
.drop { position: absolute; top: 0; padding: 6px 12px; border-radius: 10px; background: rgba(255, 255, 255, .96); color: #0f172a; font: 600 1.35rem/1.3 var(--tt-font), "Nirmala UI", sans-serif; box-shadow: 0 6px 16px rgba(0, 0, 0, .3); white-space: nowrap; will-change: transform; transition: background .15s; }
.drop.match { background: #fde68a; outline: 3px solid #f59e0b; }
.drop.pop { animation: pop .25s forwards; }
.drop.miss { background: #fecaca; animation: fade .3s forwards; }
@keyframes pop { to { transform: scale(1.6); opacity: 0; } }
@keyframes fade { to { opacity: 0; } }
.balloon .game-stage { background: linear-gradient(180deg, #7dd3fc 0%, #bae6fd 60%, #dcfce7 100%); }
.balloon-b { position: absolute; top: 0; width: 62px; height: 76px; border-radius: 50% 50% 48% 48%; background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.65), transparent 32%), var(--c); display: grid; place-items: center; box-shadow: inset -6px -8px 0 rgba(0,0,0,.12); will-change: transform; }
.balloon-b::after { content: ""; position: absolute; top: 100%; left: 50%; width: 1px; height: 34px; background: rgba(15, 23, 42, .45); }
.balloon-b span { color: #fff; font: 700 1.6rem/1 var(--tt-font), "Nirmala UI", sans-serif; text-shadow: 0 2px 4px rgba(0,0,0,.35); }
.balloon-b.pop { animation: pop .26s forwards; }
.race .game-stage { height: auto; background: #1f2937; padding: 14px; display: grid; gap: 14px; cursor: text; }
.track { display: grid; gap: 8px; }
.lane { position: relative; height: 54px; background: repeating-linear-gradient(90deg, #374151 0 30px, #4b5563 30px 60px); border-radius: 10px; overflow: hidden; }
.lane.you { outline: 3px solid #60a5fa; }
.lane-name { position: absolute; left: 10px; top: 4px; font-size: .75rem; color: #e5e7eb; z-index: 1; }
.lane .flag { position: absolute; right: 8px; top: 12px; font-size: 1.4rem; }
.car { position: absolute; left: 10px; bottom: 6px; transition: transform .2s linear; }
.race-text { background: #fff; border-radius: 12px; padding: 14px 18px; font: 1.45rem/2 var(--tt-font), "Nirmala UI", sans-serif; color: #9ca3af; }
.race-text .c.ok { color: #111827; }
.race-text .c.bad { color: #b91c1c; background: #fee2e2; }
.race-text .c.cur { background: #fde68a; color: #111827; }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font: 800 5rem/1 var(--head-font); color: #fff; text-shadow: 0 6px 20px rgba(0,0,0,.5); z-index: 4; pointer-events: none; }
.games-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.game-tile { display: grid; gap: 8px; border-radius: 18px; padding: 20px; color: #fff !important; text-decoration: none; min-height: 190px; align-content: end; box-shadow: var(--shadow); transition: transform .15s; }
.game-tile:hover { transform: translateY(-3px); }
.game-tile .ico { font-size: 2.6rem; line-height: 1; }
.game-tile h3 { margin: 0; font-size: 1.45rem; color: #fff; }
.game-tile p { margin: 0; opacity: .92; font-size: .95rem; }
.game-tile.rain { background: linear-gradient(160deg, #1e3a8a, #0b1437); }
.game-tile.balloon { background: linear-gradient(160deg, #ec4899, #f59e0b); }
.game-tile.race { background: linear-gradient(160deg, #111827, #dc2626); }
.game-tile.live { background: linear-gradient(160deg, #065f46, #10b981); }
.game-tile.contest { background: linear-gradient(160deg, #7c2d12, #f59e0b); }
@media (max-width: 640px) { .game-stage { height: 380px; } .drop { font-size: 1.1rem; } }

/* ---------------- rewards ---------------- */
.reward-stack { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 10px; z-index: 50; max-width: min(360px, calc(100vw - 32px)); }
.reward-toast { display: flex; gap: 12px; align-items: center; background: var(--card); color: var(--text); border: 1px solid var(--line); border-left: 6px solid var(--brand); border-radius: 14px; padding: 12px 16px; box-shadow: 0 12px 30px rgba(0, 0, 0, .2); animation: slideIn .35s ease-out; }
.reward-toast.xp { border-left-color: var(--accent); }
.reward-toast.level { border-left-color: #8b5cf6; }
.reward-toast.streak { border-left-color: #ef4444; }
.reward-toast.badge { border-left-color: var(--ok); }
.reward-toast.out { animation: slideOut .5s forwards; }
.reward-toast b { display: block; font-family: var(--head-font); font-size: 1.1rem; }
.reward-toast span { color: var(--muted); font-size: .88rem; }
.reward-ico { font-size: 1.8rem; line-height: 1; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
@keyframes slideOut { to { transform: translateX(40px); opacity: 0; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 2s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); } }

/* XP + badges on the dashboard */
.xp-card { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; }
.xp-level { width: 74px; height: 74px; border-radius: 18px; background: linear-gradient(135deg, var(--brand), #7c3aed); color: #fff; display: grid; place-items: center; text-align: center; font: 700 1.9rem/1 var(--head-font); box-shadow: 0 4px 0 var(--brand-dark); }
.xp-level small { display: block; font: 600 .68rem/1 var(--ui-font); opacity: .85; margin-top: 4px; }
.xp-bar { height: 14px; background: var(--card-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #f97316); border-radius: 99px; }
.streak-box { text-align: center; padding: 8px 14px; border-radius: 14px; background: var(--accent-soft); }
.streak-box b { display: block; font: 700 1.8rem/1 var(--head-font); }
.badge-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; background: var(--card-2); }
.badge-item .bi { font-size: 2rem; line-height: 1.2; }
.badge-item b { display: block; font-size: .95rem; }
.badge-item span { font-size: .78rem; color: var(--muted); }
.badge-item.locked { opacity: .55; }
.badge-item.locked .bi { filter: grayscale(1); }
@media (max-width: 640px) { .xp-card { grid-template-columns: auto 1fr; } .streak-box { grid-column: 1 / -1; } }

/* ---------------- home page ---------------- */
.home-hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 28px; align-items: center; background: linear-gradient(135deg, var(--brand-dark), var(--brand) 60%, #7c3aed); color: #fff; border-radius: 24px; padding: 40px 36px; margin-bottom: 28px; position: relative; overflow: hidden; }
.home-hero > * { min-width: 0; }
.home-hero h1 { font-size: 2.6rem; color: #fff; margin-bottom: .3em; }
.home-hero h1 span { color: var(--accent); }
.home-hero p { font-size: 1.12rem; opacity: .94; max-width: 560px; }
.home-hero .btn { margin: 8px 8px 0 0; }
.home-hero .btn.ghost { background: rgba(255, 255, 255, .12); color: #fff !important; border-color: rgba(255, 255, 255, .4); }
.hero-langs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.hero-langs span { background: rgba(255, 255, 255, .14); border-radius: 99px; padding: 3px 10px; font-size: .92rem; }
.demo-board { background: rgba(10, 12, 30, .35); border: 1px solid rgba(255, 255, 255, .18); border-radius: 18px; padding: 18px; backdrop-filter: blur(6px); }
.demo-line { background: #fff; color: #9aa1b9; border-radius: 12px; padding: 14px 16px; font: 500 1.45rem/1.6 "Hind", "Nirmala UI", sans-serif; min-height: 3.4em; }
.demo-line .t { color: #1b1f33; }
.demo-line .cur { background: #fde68a; color: #1b1f33; border-radius: 3px; }
.demo-meta { display: flex; justify-content: space-between; color: #e0e3ff; font-size: .9rem; margin-top: 10px; }
.demo-keys { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin-top: 12px; }
.demo-keys i { height: 30px; border-radius: 7px; background: rgba(255, 255, 255, .9); box-shadow: 0 3px 0 rgba(0, 0, 0, .25); font: 600 .9rem/30px "Hind", "Nirmala UI", sans-serif; color: #1b1f33; text-align: center; font-style: normal; }
.demo-keys i.on { background: var(--accent); }
.section-title { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin: 34px 0 14px; }
.section-title h2 { margin: 0; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); text-decoration: none; color: var(--text) !important; display: grid; gap: 6px; align-content: start; transition: transform .12s, border-color .12s; }
a.feature:hover { transform: translateY(-2px); border-color: var(--brand); }
.feature .fi { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; background: var(--brand-soft); }
.feature h3 { margin: 4px 0 0; }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; counter-reset: step; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; position: relative; }
.step::before { counter-increment: step; content: counter(step); width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #1b1f33; font: 700 1.1rem/34px var(--head-font); text-align: center; display: block; margin-bottom: 8px; box-shadow: 0 3px 0 #b45309; }
.step h3 { margin-bottom: 4px; }
.step p { margin: 0; color: var(--muted); font-size: .94rem; }
.exam-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.exam-strip span { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; font-weight: 600; }
.cta-band { margin-top: 34px; background: linear-gradient(135deg, #f59e0b, #f97316); color: #1b1f33; border-radius: 22px; padding: 28px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.cta-band h2 { margin: 0; color: #1b1f33; }
.cta-band .btn.primary { background: #1b1f33; border-color: #1b1f33; box-shadow: 0 3px 0 #000; }
.mini-board { display: grid; gap: 6px; }
.mini-board div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--card-2); }
@media (max-width: 860px) {
  .home-hero { grid-template-columns: 1fr; padding: 28px 20px; }
  .home-hero h1 { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; }
}

/* phones have their own on-screen keyboard: hide the picture of a PC keyboard */
@media (max-width: 760px) and (pointer: coarse) {
  .tt-kb { display: none; }
}
