:root {
    --ink: #241c3b; --ink-soft: #6f6a86; --line: rgba(36,28,59,.10);
    --bg: #f7f5ff; --card: #fff;
    --brand: #6d4df6; --brand-2: #a48bff;
    --good: #2fa96b; --bad: #e0484d; --gold: #ffb020;
    --grad: linear-gradient(135deg, var(--brand-2), var(--brand));
    --shadow: 0 12px 34px -14px rgba(36,28,59,.4);
    --shadow-sm: 0 4px 14px -6px rgba(36,28,59,.28);
    --r: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Nunito', system-ui, sans-serif; background: var(--bg); color: var(--ink); }
.d-none { display: none !important; }
.th, .ex-th, .lw-th, .dc-thai, .wd-thai, .bt-th, .wp-th, .bld-chip, .eo-main.thai { font-family: 'Noto Sans Thai', 'Nunito', sans-serif; }

/* ---------- horná lišta ---------- */
.tk-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px;
    padding: 10px 16px; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.tk-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 18px; }
.tk-logo { width: 34px; height: 34px; border-radius: 11px; background: var(--grad); color: #fff;
    display: grid; place-items: center; font-family: 'Noto Sans Thai', sans-serif; font-size: 19px; }
.tk-brand b { color: var(--brand); }
.tk-stats { display: flex; gap: 8px; margin-left: auto; }
.tk-stat { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 14px;
    background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; }
.tk-stat.streak i { color: #ff7a29; } .tk-stat.xp i { color: var(--gold); } .tk-stat.hearts i { color: var(--bad); }
.tk-nav { display: flex; align-items: center; gap: 4px; }
.tk-nav a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink-soft);
    font-weight: 800; font-size: 14px; padding: 8px 13px; border-radius: 999px; }
.tk-nav a.on { background: var(--brand); color: #fff; }
.tk-out { border: none; background: none; color: var(--ink-soft); font-size: 17px; padding: 8px 10px; cursor: pointer; }
@media (max-width: 760px) { .tk-nav a span { display: none; } .tk-brand > span:not(.tk-logo) { display: none; } .tk-stat { padding: 5px 9px; } }

.tk-main { max-width: 860px; margin: 0 auto; padding: 22px 16px 70px; }
.tk-back { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); text-decoration: none; font-weight: 700; font-size: 14px; margin-bottom: 14px; }

/* ---------- úvodný blok ---------- */
.tk-hero { background: var(--grad); color: #fff; border-radius: 24px; padding: 26px 24px; margin-bottom: 24px; box-shadow: var(--shadow); }
.tk-hero h1 { font-size: 26px; font-weight: 900; margin: 0 0 6px; }
.tk-hero p { margin: 0; opacity: .92; font-weight: 600; }
.tk-hero.small { padding: 20px 22px; }
.tk-hero-stats { display: flex; gap: 10px; margin-top: 18px; }
.tk-hero-stats div { flex: 1; background: rgba(255,255,255,.16); border-radius: 14px; padding: 10px; text-align: center; }
.tk-hero-stats b { display: block; font-size: 21px; font-weight: 900; }
.tk-hero-stats span { font-size: 11.5px; opacity: .9; font-weight: 700; }

/* ---------- okruhy a cesta lekcií ---------- */
.tk-unit { margin-bottom: 28px; }
.tk-unit-head { display: flex; align-items: center; gap: 13px; margin-bottom: 12px; }
.tk-unit-ico { width: 46px; height: 46px; border-radius: 14px; background: var(--u); display: grid; place-items: center; font-size: 23px; }
.tk-unit-head h2 { font-size: 19px; font-weight: 900; margin: 0; }
.tk-unit-head p { margin: 0; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.tk-path { display: grid; gap: 9px; }
.tk-node { display: flex; align-items: center; gap: 13px; background: var(--card); border: 1px solid var(--line);
    border-radius: var(--r); padding: 13px 15px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm);
    transition: transform .15s ease, border-color .15s ease; }
.tk-node:hover { transform: translateY(-2px); border-color: var(--u); color: var(--ink); }
.tk-node-dot { width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
    background: rgba(36,28,59,.07); font-weight: 900; color: var(--ink-soft); }
.tk-node.done .tk-node-dot { background: var(--good); color: #fff; }
.tk-node.started .tk-node-dot { background: var(--gold); color: #fff; }
.tk-node-body { flex: 1 1 auto; min-width: 0; }
.tk-node-body b { display: block; font-size: 15.5px; font-weight: 800; }
.tk-node-body small { color: var(--ink-soft); font-weight: 600; }
.tk-node > .bi-chevron-right { color: var(--ink-soft); }

/* ---------- lekcia ---------- */
.lesson-page { background: #fff; }
.tk-lesson { max-width: 720px; margin: 0 auto; padding: 14px 16px 200px; }
.ls-top { display: flex; align-items: center; gap: 12px; padding: 6px 0 18px; }
.ls-quit { color: var(--ink-soft); font-size: 18px; text-decoration: none; }
.ls-progress { flex: 1; height: 12px; background: rgba(36,28,59,.09); border-radius: 999px; overflow: hidden; }
.ls-progress div { height: 100%; width: 0; background: var(--grad); border-radius: 999px; transition: width .3s ease; }
.ls-hearts i { color: var(--bad); font-size: 14px; margin-left: 2px; }
.ls-hearts i.off { color: rgba(36,28,59,.15); }

.lsi-card { text-align: center; }
.lsi-ico { font-size: 42px; }
.lsi-card h2 { font-size: 24px; font-weight: 900; margin: 8px 0; }
.lsi-card p { color: var(--ink-soft); font-weight: 600; max-width: 520px; margin: 0 auto 20px; }
.lsi-words { display: grid; gap: 8px; margin-bottom: 22px; }
.lsi-word { display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: baseline;
    background: var(--bg); border-radius: 12px; padding: 10px 14px; text-align: left; }
.lsi-word .th { font-size: 19px; font-weight: 700; }
.lsi-word .tr { color: var(--brand); font-weight: 800; font-size: 13px; }
.lsi-word .sk { font-weight: 700; }
.lsi-word .lit { color: var(--ink-soft); font-size: 12px; font-weight: 600; }
@media (max-width: 560px) { .lsi-word { grid-template-columns: 1fr; gap: 2px; } }

.ex-kind { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 900; color: var(--brand); }
.ex-prompt { font-size: 21px; font-weight: 900; margin: 6px 0 20px; line-height: 1.3; }
.ex-big { text-align: center; background: var(--bg); border-radius: var(--r); padding: 22px; margin-bottom: 20px; }
.ex-th { display: block; font-size: 40px; font-weight: 700; }
.ex-tr { display: block; color: var(--brand); font-weight: 800; margin-top: 4px; }
.ex-say, .wd-say { border: none; background: rgba(109,77,246,.12); color: var(--brand); border-radius: 999px;
    padding: 7px 14px; font-weight: 800; cursor: pointer; margin-top: 10px; font-size: 14px; }
.ex-say.sm { padding: 4px 10px; margin: 0; font-size: 12px; }
.ex-listen { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; padding: 30px;
    background: var(--bg); border: 2px dashed rgba(109,77,246,.35); border-radius: var(--r); margin-bottom: 20px;
    color: var(--brand); font-weight: 800; cursor: pointer; }
.ex-listen i { font-size: 34px; }
.ex-options { display: grid; gap: 10px; }
.ex-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: #fff;
    border: 2px solid var(--line); border-radius: 14px; padding: 14px 16px; text-align: left; cursor: pointer;
    font: inherit; transition: all .13s ease; }
.ex-opt:hover:not(:disabled) { border-color: var(--brand-2); transform: translateY(-1px); }
.ex-opt:disabled { cursor: default; }
.eo-main { font-size: 17px; font-weight: 800; }
.eo-main.thai { font-size: 22px; font-weight: 700; }
.eo-sub { color: var(--brand); font-size: 12.5px; font-weight: 800; }
.ex-opt.ok { border-color: var(--good); background: rgba(47,169,107,.10); }
.ex-opt.bad { border-color: var(--bad); background: rgba(224,72,77,.10); }

/* skladanie slova */
.bld-slot { min-height: 74px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: center;
    background: var(--bg); border: 2px dashed rgba(36,28,59,.16); border-radius: var(--r); padding: 14px; margin-bottom: 18px; }
.bld-slot.ok { border-color: var(--good); background: rgba(47,169,107,.10); }
.bld-slot.bad { border-color: var(--bad); background: rgba(224,72,77,.10); }
.bld-hint { color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.bld-chip { font-size: 26px; font-weight: 700; }
.bld-tiles { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.bld-tile { background: #fff; border: 2px solid var(--line); border-radius: 13px; padding: 10px 15px; cursor: pointer; font: inherit; }
.bld-tile.used { opacity: .28; pointer-events: none; }
.bt-th { display: block; font-size: 22px; font-weight: 700; }
.bt-tr { display: block; color: var(--brand); font-size: 11.5px; font-weight: 800; }
.bld-undo { margin: 16px auto 0; display: block; }

/* pätička s vyhodnotením */
.ls-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 16px max(16px, env(safe-area-inset-left)) max(18px, env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); background: #fff; }
.ls-foot.good { background: #eefaf3; border-color: rgba(47,169,107,.3); }
.ls-foot.wrong { background: #fdf0f0; border-color: rgba(224,72,77,.3); }
.lsf-msg { flex: 1 1 300px; min-width: 0; }
.lsm-head { font-weight: 900; font-size: 16px; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ls-foot.good .lsm-head { color: var(--good); } .ls-foot.wrong .lsm-head { color: var(--bad); }
.lsm-word { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.lw-th { font-size: 22px; font-weight: 700; } .lw-tr { color: var(--brand); font-weight: 800; font-size: 13px; }
.lw-sk { font-weight: 700; }
.lsm-parts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.lp-part { background: rgba(109,77,246,.10); border-radius: 11px; padding: 6px 11px; display: inline-flex; align-items: baseline; gap: 7px; }
.lp-part b { font-family: 'Noto Sans Thai', sans-serif; font-size: 17px; }
.lp-part em { font-style: normal; color: var(--brand); font-weight: 800; font-size: 11.5px; }
.lp-part span { font-weight: 700; font-size: 13px; }
.lp-plus { color: var(--ink-soft); font-weight: 900; }
.lsm-lit { margin-top: 7px; font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.lsm-note { margin-top: 8px; font-size: 13px; font-weight: 600; color: #7a5b00; background: rgba(255,176,32,.14); border-radius: 10px; padding: 8px 11px; }

.tk-btn { border: none; border-radius: 14px; padding: 14px 26px; font: inherit; font-weight: 900; font-size: 15px;
    cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
.tk-btn.primary { background: var(--grad); color: #fff; box-shadow: 0 8px 20px -8px rgba(109,77,246,.8); }
.tk-btn.ghost { background: #fff; border: 2px solid var(--line); color: var(--ink-soft); }
.w-100 { width: 100%; }

.ls-done { text-align: center; padding-top: 30px; }
.lsd-ico { font-size: 56px; }
.lsd-card h2 { font-size: 26px; font-weight: 900; margin: 10px 0 6px; }
.lsd-card p { color: var(--ink-soft); font-weight: 600; }
.lsd-nums { display: flex; gap: 10px; margin: 20px 0; }
.lsd-nums div { flex: 1; background: var(--bg); border-radius: 14px; padding: 14px; }
.lsd-nums b { display: block; font-size: 24px; font-weight: 900; color: var(--brand); }
.lsd-nums span { font-size: 12px; color: var(--ink-soft); font-weight: 700; }

/* ---------- slovník ---------- */
.dict-search { position: relative; margin-top: 16px; }
.dict-search i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); }
.dict-search input { width: 100%; border: none; border-radius: 13px; padding: 13px 42px; font: inherit; font-weight: 700; }
.ds-clear { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); }
.dict-count { color: var(--ink-soft); font-weight: 700; font-size: 13px; margin-bottom: 12px; }
.dict-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.dict-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 15px 16px;
    text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .15s ease; }
.dict-card:hover { transform: translateY(-3px); color: var(--ink); }
.dict-card.compound { border-color: rgba(109,77,246,.35); }
.dc-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.dc-thai { font-size: 23px; font-weight: 700; }
.dc-tr { color: var(--brand); font-weight: 800; font-size: 13px; }
.dc-mean { font-weight: 800; margin-top: 2px; }
.dc-parts { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line); }
.dc-part { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.dc-part b { font-family: 'Noto Sans Thai', sans-serif; font-size: 14px; color: var(--ink); }
.dc-parts .bi-plus { color: var(--brand); font-size: 11px; }

/* ---------- detail slova ---------- */
.wd-card { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 26px 24px; box-shadow: var(--shadow-sm); }
.wd-main { text-align: center; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.wd-thai { font-size: 52px; font-weight: 700; line-height: 1.2; }
.wd-tr { color: var(--brand); font-weight: 800; font-size: 17px; }
.wd-mean { font-size: 21px; font-weight: 800; margin-top: 6px; }
.wd-pos { display: inline-block; background: var(--bg); color: var(--ink-soft); font-size: 12px; font-weight: 800; padding: 3px 11px; border-radius: 999px; margin-top: 8px; }
.wd-block { margin-top: 24px; }
.wd-block h3 { font-size: 15px; font-weight: 900; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.wd-block h3 i { color: var(--brand); }
.wd-literal { color: var(--ink-soft); font-weight: 600; font-size: 13.5px; margin-bottom: 12px; }
.wd-parts { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.wd-part { flex: 1 1 130px; background: var(--bg); border-radius: 15px; padding: 14px; text-align: center; }
.wd-part.result { background: rgba(109,77,246,.12); border: 2px solid rgba(109,77,246,.3); }
.wp-th { font-size: 26px; font-weight: 700; }
.wp-tr { color: var(--brand); font-weight: 800; font-size: 12.5px; }
.wp-mean { font-weight: 800; font-size: 14px; margin-top: 3px; }
.wp-link { display: inline-block; margin-top: 7px; font-size: 11.5px; font-weight: 800; color: var(--brand); text-decoration: none; }
.wd-plus, .wd-eq { align-self: center; font-size: 22px; font-weight: 900; color: var(--ink-soft); }
.wd-note { margin-top: 20px; background: rgba(255,176,32,.14); color: #7a5b00; border-radius: 13px; padding: 13px 15px; font-weight: 600; font-size: 14px; }
.wd-used { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 9px; }
.wd-used-item { background: var(--bg); border-radius: 13px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.wd-used-item b { display: block; font-family: 'Noto Sans Thai', sans-serif; font-size: 19px; }
.wd-used-item span { font-weight: 700; font-size: 13.5px; }
.wd-used-item small { display: block; color: var(--ink-soft); font-size: 11.5px; font-weight: 600; }
.wd-lessons { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.wd-lessons a { color: var(--brand); text-decoration: none; }
.tk-empty { grid-column: 1/-1; text-align: center; color: var(--ink-soft); font-weight: 700; padding: 40px; }

/* ---------- prihlásenie ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--grad); }
.auth-card { background: #fff; border-radius: 24px; padding: 34px 30px; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 25px; font-weight: 900; text-align: center; margin: 0 0 6px; }
.auth-card .sub { text-align: center; color: var(--ink-soft); font-weight: 600; margin-bottom: 22px; }
.auth-logo { width: 58px; height: 58px; border-radius: 18px; background: var(--grad); color: #fff; display: grid; place-items: center;
    font-family: 'Noto Sans Thai', sans-serif; font-size: 30px; margin: 0 auto 14px; }
.auth-card label { font-weight: 800; font-size: 13px; margin-bottom: 5px; display: block; }
.auth-card .form-control { border-radius: 12px; padding: 12px 14px; font-weight: 600; border: 2px solid var(--line); }
.auth-card .form-control:focus { border-color: var(--brand); box-shadow: none; }
.auth-alt { text-align: center; margin-top: 18px; font-weight: 700; font-size: 14px; color: var(--ink-soft); }
.auth-alt a { color: var(--brand); text-decoration: none; }

/* ---------- generovanie nových tém ---------- */
.gen-box { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 20px 22px; margin-bottom: 26px; box-shadow: var(--shadow-sm); }
.gen-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.gen-head h2 { font-size: 18px; font-weight: 900; margin: 0; display: flex; align-items: center; gap: 8px; }
.gen-head h2 i { color: var(--brand); }
.gen-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 13.5px; font-weight: 600; }
.gen-head .tk-btn { margin-left: auto; padding: 12px 20px; font-size: 14px; }
.gen-head .tk-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.gen-warn { margin-top: 14px; background: rgba(255,176,32,.14); color: #7a5b00; border-radius: 12px; padding: 11px 14px; font-size: 13px; font-weight: 700; display: flex; gap: 8px; align-items: center; }
.gen-ideas { display: grid; gap: 10px; margin-top: 16px; }
.gen-idea { display: flex; align-items: flex-start; gap: 13px; background: var(--bg); border-radius: 15px; padding: 14px 16px; }
.gen-idea.working { opacity: .6; }
.gi-ico { font-size: 26px; flex: 0 0 auto; }
.gi-body { flex: 1 1 auto; min-width: 0; }
.gi-body b { display: block; font-size: 15.5px; font-weight: 900; }
.gi-body span { display: block; font-weight: 600; font-size: 13.5px; color: var(--ink); }
.gi-body small { display: block; color: var(--ink-soft); font-size: 12px; font-weight: 600; margin-top: 4px; }
.gi-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.tk-btn.sm { padding: 9px 15px; font-size: 13px; border-radius: 11px; }
.gi-x { border: none; background: none; color: var(--ink-soft); font-size: 13px; cursor: pointer; padding: 8px; }
.gi-x:hover { color: var(--bad); }
.tk-aigen { display: inline-flex; align-items: center; gap: 5px; background: rgba(109,77,246,.12); color: var(--brand);
    font-size: 11px; font-weight: 900; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px; }
@media (max-width: 600px) { .gen-head .tk-btn { margin-left: 0; width: 100%; } .gen-idea { flex-wrap: wrap; } .gi-actions { width: 100%; } .gi-actions .tk-btn { flex: 1; } }

/* ---------- úrovne a zámky ---------- */
.tk-unit.lvl-locked { opacity: .62; }
.tk-unit.lvl-locked .tk-unit-ico { background: rgba(36,28,59,.10); }
.tk-unit-txt { flex: 1 1 auto; min-width: 0; }
.tk-lvl { font-size: 10.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; color: var(--brand); }
.tk-unit.lvl-locked .tk-lvl { color: var(--ink-soft); }
.tk-unit-badge { flex: 0 0 auto; background: rgba(47,169,107,.14); color: var(--good);
    font-size: 11.5px; font-weight: 900; padding: 5px 11px; border-radius: 999px; }
.tk-node.locked { opacity: .55; cursor: default; box-shadow: none; }
.tk-node.locked .tk-node-dot { background: rgba(36,28,59,.08); color: var(--ink-soft); font-size: 13px; }
.tk-more { text-align: center; color: var(--ink-soft); font-weight: 700; font-size: 13px;
    padding: 6px 0 26px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.tk-flash { background: rgba(255,176,32,.16); color: #7a5b00; border-radius: 13px; padding: 12px 15px;
    font-weight: 700; font-size: 13.5px; margin-bottom: 20px; display: flex; align-items: center; gap: 9px; }

/* ---------- vlastná téma ---------- */
.gen-form { display: flex; gap: 9px; margin-top: 16px; flex-wrap: wrap; }
.gen-form input { flex: 1 1 240px; min-width: 0; border: 2px solid var(--line); border-radius: 13px;
    padding: 13px 15px; font: inherit; font-weight: 600; }
.gen-form input:focus { outline: none; border-color: var(--brand); }
.gen-form .tk-btn { padding: 13px 20px; font-size: 14px; }
.gen-form input:disabled { opacity: .6; }
.gen-or { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.gen-or::before, .gen-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.gen-mine { display: grid; gap: 9px; margin-top: 16px; }
