:root{--ink:#14213d;--muted:#60708f;--blue:#1747d1;--blue2:#0f3cbe;--cyan:#dff5ff;--yellow:#ffcc3d;--pink:#ff6b85;--mint:#38c89b;--paper:#f7faff;--white:#fff;--line:#dbe5f5;--shadow:0 10px 30px rgba(35,64,120,.12);font-family:ui-rounded,"Avenir Next",Nunito,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--ink)}
    *{box-sizing:border-box} body{margin:0;background:linear-gradient(180deg,#eef7ff 0,#f9fbff 43%,#f3f7ff 100%);min-height:100vh;font-size:17px} button,input{font:inherit} button{touch-action:manipulation;-webkit-tap-highlight-color:transparent} button:focus-visible,input:focus-visible{outline:4px solid #8b5cf6;outline-offset:3px}
    .shell{max-width:1180px;margin:auto;padding:24px clamp(16px,4vw,46px) 48px}.topbar{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-bottom:28px}.brand{display:flex;align-items:center;gap:12px}.brandmark{display:grid;place-items:center;width:54px;height:54px;border-radius:17px;background:var(--blue);color:#fff;font-size:29px;box-shadow:0 8px 18px rgba(23,71,209,.25)}.brand h1{font-size:clamp(1.25rem,2.5vw,1.75rem);margin:0;letter-spacing:-.03em}.brand small{display:block;color:var(--muted);font-size:.86rem;margin-top:2px}.top-actions{display:flex;align-items:center;gap:9px;flex-wrap:wrap;justify-content:flex-end}.teacher,.class-chip{border:2px solid var(--line);background:#fff;border-radius:14px;padding:10px 14px;color:var(--muted);font-weight:850;cursor:pointer;min-height:46px}.class-chip{display:flex;gap:7px;align-items:center;color:var(--ink)}.class-chip strong{color:var(--blue)}.class-chip .total-stars{background:#fff3c7;color:#815f00;border-radius:999px;padding:4px 8px;font-size:.82rem}
    .setup{background:rgba(255,255,255,.86);border:1px solid #fff;border-radius:28px;box-shadow:var(--shadow);padding:clamp(18px,3vw,30px);backdrop-filter:blur(12px)}.setup-row{display:grid;grid-template-columns:1.05fr 1.2fr 1fr;gap:22px;align-items:end}.control-label{font-size:.82rem;font-weight:850;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;margin:0 0 9px 3px}.seg{display:flex;gap:8px;padding:6px;background:#edf3fc;border-radius:18px;min-height:62px}.seg button{flex:1;border:0;border-radius:13px;background:transparent;color:#536681;font-weight:850;min-height:50px;padding:8px 12px;cursor:pointer}.seg button.active{background:#fff;color:var(--blue);box-shadow:0 4px 12px rgba(35,64,120,.12)}.seg.subject button.active{background:var(--blue);color:#fff}.stars button{font-size:22px}.stars button.active{background:#fff3c7;color:#996800}
    .section-head{display:flex;justify-content:space-between;align-items:end;gap:16px;margin:34px 2px 18px}.section-head h2{font-size:clamp(1.55rem,3vw,2.25rem);letter-spacing:-.04em;margin:0}.section-head p{margin:5px 0 0;color:var(--muted)}.badge{white-space:nowrap;background:#e8efff;color:var(--blue);font-weight:850;border-radius:999px;padding:9px 14px;font-size:.9rem}
    .games{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.game-card{position:relative;overflow:hidden;text-align:left;background:#fff;border:2px solid transparent;border-radius:24px;padding:22px;box-shadow:0 7px 22px rgba(35,64,120,.08);min-height:190px;cursor:pointer;transition:transform .18s ease,box-shadow .18s ease}.game-card:hover{transform:translateY(-3px);box-shadow:0 14px 28px rgba(35,64,120,.13)}.game-card .icon{display:grid;place-items:center;width:60px;height:60px;border-radius:19px;font-size:31px;background:var(--tint,#e8efff);margin-bottom:20px}.game-card h3{font-size:1.25rem;margin:0 0 6px}.game-card p{margin:0;color:var(--muted);line-height:1.45}.game-card .play{position:absolute;right:19px;top:19px;border-radius:50%;width:42px;height:42px;background:#f2f6fd;display:grid;place-items:center;color:var(--blue);font-weight:900}.soon{opacity:.66}.soon::after{content:"Bald";position:absolute;right:18px;bottom:18px;background:#eef2f8;color:#6a7890;border-radius:999px;padding:5px 9px;font-size:.75rem;font-weight:900}
    #play{display:none}.playbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:22px}.back,.restart{border:2px solid var(--line);background:#fff;border-radius:15px;min-height:52px;padding:9px 16px;font-weight:850;color:var(--ink);cursor:pointer}.game-title{text-align:center}.game-title strong{display:block;font-size:1.28rem}.game-title span{color:var(--muted);font-size:.9rem}.score{display:flex;align-items:center;gap:8px;background:#fff7d7;padding:10px 14px;border-radius:15px;color:#815f00;font-weight:900}
    .stage{background:#fff;border:1px solid #e7eef9;border-radius:30px;box-shadow:var(--shadow);min-height:560px;padding:clamp(22px,5vw,50px);display:flex;flex-direction:column;align-items:center;justify-content:center}.stage h2{font-size:clamp(1.5rem,4vw,2.2rem);text-align:center;margin:0 0 8px}.instruction{color:var(--muted);text-align:center;margin:0 0 28px;line-height:1.45}.feedback{height:31px;margin:18px 0 0;font-weight:900;text-align:center}.feedback.good{color:#087b58}.feedback.bad{color:#bd3450}
    .memory-grid{width:min(760px,100%);display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.memory{aspect-ratio:1.25;border:0;border-radius:18px;background:var(--blue);color:#fff;font-size:clamp(1rem,3vw,1.45rem);font-weight:900;cursor:pointer;box-shadow:inset 0 -5px 0 rgba(0,0,0,.11);transition:transform .15s}.memory::before{content:"?";font-size:1.6em}.memory.open,.memory.matched{background:#f6f9ff;color:var(--ink);border:2px solid #d9e4f5;box-shadow:none;transform:rotateY(0)}.memory.open::before,.memory.matched::before{content:""}.memory.matched{background:#dff8ee;border-color:#9ce1c8;color:#12634d}.memory:disabled{cursor:default}
    .pyramid{display:flex;flex-direction:column;align-items:center;gap:9px;margin:12px 0 24px}.pyr-row{display:flex;gap:10px}.stone{width:clamp(80px,16vw,132px);height:74px;border:3px solid #dbe6f7;border-radius:15px;background:#f5f8fe;display:grid;place-items:center;font-size:1.5rem;font-weight:950}.stone.missing{border-style:dashed;border-color:#7e9fea;background:#edf3ff;color:var(--blue)}.stone.solved{background:#ddf8ee;border-color:#80d8bc;color:#087b58}.choices{display:flex;flex-wrap:wrap;justify-content:center;gap:12px;max-width:650px}.choice{min-width:96px;min-height:62px;border:2px solid #cfdcf1;border-radius:16px;background:#fff;font-size:1.3rem;font-weight:900;color:var(--ink);cursor:pointer}.choice:hover{border-color:var(--blue);color:var(--blue)}
    .word-picture{font-size:clamp(4rem,12vw,7rem);line-height:1;margin:4px 0 20px}.answer-slots{display:flex;gap:7px;min-height:60px;margin-bottom:20px;flex-wrap:wrap;justify-content:center}.slot{width:46px;height:56px;border-bottom:4px solid #9eb2d2;display:grid;place-items:center;font-size:1.65rem;font-weight:950;color:var(--blue)}.letter-bank{display:flex;justify-content:center;flex-wrap:wrap;gap:10px;max-width:700px}.letter{width:64px;height:64px;border:0;border-radius:16px;background:var(--yellow);box-shadow:inset 0 -5px 0 rgba(143,105,0,.17);font-size:1.6rem;font-weight:950;color:#523d00;cursor:pointer}.letter.used{opacity:.25;box-shadow:none}.word-tools{display:flex;gap:10px;margin-top:22px;flex-wrap:wrap;justify-content:center}.clear-word,.backspace-word{border:0;background:#eef3fb;border-radius:13px;padding:12px 16px;color:var(--muted);font-weight:850;cursor:pointer}.backspace-word{background:#fff3c7;color:#705300}
    .sort-word{font-size:clamp(2rem,6vw,3.2rem);font-weight:950;background:#f2f6ff;border-radius:20px;padding:18px 32px;margin:10px 0 28px}.sort-targets{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;width:min(720px,100%)}.sort-target{border:3px solid var(--line);background:#fff;border-radius:20px;min-height:110px;padding:16px;font-weight:950;cursor:pointer;color:var(--ink)}.sort-target span{display:block;font-size:1.8rem;margin-bottom:6px}.progress{display:flex;gap:6px;margin-top:24px}.dot{width:12px;height:12px;border-radius:50%;background:#d7e1f0}.dot.done{background:var(--mint)}
    .number-task{font-size:clamp(1.35rem,4vw,2rem);font-weight:950;background:#eaf1ff;color:var(--blue);padding:15px 24px;border-radius:18px;margin-bottom:34px}.numberline{position:relative;display:grid;grid-template-columns:repeat(5,1fr);width:min(760px,100%);gap:7px;padding-top:7px}.numberline::before{content:"";position:absolute;left:8%;right:8%;top:23px;height:5px;background:#9bb3df;border-radius:99px}.tick{position:relative;z-index:1;border:0;background:transparent;padding:0 2px;color:var(--ink);font-weight:950;cursor:pointer}.tick::before{content:"";display:block;width:22px;height:22px;background:#fff;border:5px solid var(--blue);border-radius:50%;margin:5px auto 11px;transition:.15s}.tick:hover::before{background:var(--yellow);transform:scale(1.12)}.target-number{display:grid;place-items:center;width:130px;height:130px;border-radius:50%;background:#fff3c7;border:6px solid var(--yellow);font-size:2.6rem;font-weight:950;color:#705300;margin:4px 0 30px}.equations{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;width:min(650px,100%)}.equation{min-height:82px;border:3px solid var(--line);border-radius:19px;background:#fff;font-size:1.45rem;font-weight:950;cursor:pointer;color:var(--ink)}.equation:hover{border-color:var(--blue);color:var(--blue)}
    .syllable-word{font-size:clamp(2.1rem,7vw,3.6rem);font-weight:950;letter-spacing:.03em;margin:8px 0 28px;text-align:center}.syllable-word .syllable-emoji{display:block;font-size:3.5rem;text-align:center;margin-bottom:12px}.syllable-choices{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;width:min(580px,100%)}.syllable{min-height:84px;border:3px solid var(--line);background:#fff;border-radius:19px;font-size:1.7rem;font-weight:950;cursor:pointer}.syllable small{display:block;font-size:.72rem;color:var(--muted);margin-top:2px}.syllable:disabled{cursor:default;opacity:.45}.syllable-solution{display:flex;align-items:start;justify-content:center;gap:.09em;flex-wrap:wrap}.syllable-part{display:inline-flex;flex-direction:column;align-items:stretch;line-height:1}.syllable-part svg{display:block;width:100%;height:19px;margin-top:5px;overflow:visible}.syllable-part path{fill:none;stroke:var(--blue);stroke-width:5;stroke-linecap:round}.next-syllable{margin-top:20px;min-width:160px}.detective-card{width:min(760px,100%);background:#f6f8fc;border-radius:22px;padding:24px;text-align:center;font-size:clamp(1.4rem,4vw,2rem);font-weight:800;line-height:1.55;margin:6px 0 24px}.error-word{color:#bd3450;text-decoration:underline wavy #ff8da0;text-underline-offset:7px}.fixes{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}.fix{min-width:130px;min-height:64px;border:3px solid var(--line);border-radius:17px;background:#fff;font-weight:900;cursor:pointer}.fix:hover{border-color:#bd3450}
    dialog{border:0;padding:0;background:transparent;width:min(680px,calc(100% - 28px));max-width:none}dialog::backdrop{background:rgba(20,33,61,.55);backdrop-filter:blur(4px)}.teacher-panel{background:#fff;border-radius:26px;padding:clamp(20px,4vw,32px);box-shadow:0 24px 70px rgba(10,29,69,.3)}.teacher-head{display:flex;align-items:start;justify-content:space-between;gap:20px;margin-bottom:22px}.teacher-head h2{margin:0 0 5px;font-size:1.7rem}.teacher-head p{margin:0;color:var(--muted);line-height:1.4}.close-dialog{border:0;background:#eef3fb;width:46px;height:46px;border-radius:50%;font-size:1.25rem;font-weight:900;cursor:pointer}.teacher-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.teacher-field label{display:block;font-size:.82rem;text-transform:uppercase;letter-spacing:.07em;font-weight:900;color:var(--muted);margin:0 0 7px 2px}.teacher-field select,.teacher-field input{width:100%;min-height:56px;border:2px solid var(--line);border-radius:14px;background:#fff;padding:8px 12px;color:var(--ink);font-weight:800}.teacher-field.wide{grid-column:1/-1}.teacher-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:24px;flex-wrap:wrap}.teacher-note{margin-top:18px;background:#eef9f5;color:#356557;border-radius:13px;padding:11px 13px;font-size:.88rem}.class-manager{border-bottom:2px solid #edf2fa;padding-bottom:20px;margin-bottom:20px}.class-manager h3{margin:0 0 5px;font-size:1.05rem}.class-manager p{margin:0 0 12px;color:var(--muted);font-size:.9rem}.class-create{display:grid;grid-template-columns:1fr auto;gap:9px}.class-create input{min-width:0;min-height:50px;border:2px solid var(--line);border-radius:13px;padding:9px 12px}.class-create button{min-height:50px}.teacher-classes{display:grid;gap:8px;margin-top:12px}.teacher-class-row{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#f6f9ff;border-radius:13px;padding:9px 11px}.teacher-class-row strong{display:block}.teacher-class-row small{color:var(--muted)}.delete-class{border:0;border-radius:11px;background:#ffe8ed;color:#a92f47;padding:9px 11px;font-weight:900;cursor:pointer}.class-list{display:grid;gap:10px;margin-top:18px}.class-option{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;border:2px solid var(--line);border-radius:18px;background:#fff;padding:16px 18px;text-align:left;cursor:pointer;color:var(--ink)}.class-option:hover{border-color:var(--blue);background:#f6f9ff}.class-option strong{font-size:1.08rem}.class-option span{color:#815f00;background:#fff3c7;padding:6px 9px;border-radius:999px;font-weight:900}.class-empty{background:#f6f9ff;border-radius:16px;padding:16px;text-align:center;color:var(--muted);line-height:1.45}.class-dialog-actions{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin-top:18px}.api-status{min-height:22px;margin-top:9px;color:#bd3450;font-size:.86rem;font-weight:800}.auth-card{background:#f6f9ff;border-radius:18px;padding:18px}.auth-card h3{margin:0 0 5px}.auth-card>p{margin:0 0 15px;color:var(--muted);font-size:.92rem;line-height:1.45}.auth-tabs{display:grid;grid-template-columns:1fr 1fr;gap:7px;background:#e9f0fb;border-radius:13px;padding:5px;margin-bottom:14px}.auth-tabs button{border:0;border-radius:10px;background:transparent;min-height:43px;font-weight:900;color:var(--muted);cursor:pointer}.auth-tabs button.active{background:#fff;color:var(--blue);box-shadow:0 3px 10px rgba(35,64,120,.1)}.auth-form{display:grid;gap:10px}.auth-form label{font-size:.82rem;font-weight:900;color:var(--muted)}.auth-form input{width:100%;min-height:52px;border:2px solid var(--line);border-radius:13px;background:#fff;padding:9px 12px;color:var(--ink);margin-top:5px}.auth-form small{color:var(--muted);line-height:1.35}.auth-form[hidden]{display:none}.auth-form .primary{margin-top:4px}
    .win{animation:pop .38s ease}.result-star{font-size:5rem;animation:pop .45s ease}.result-actions{display:flex;gap:12px;flex-wrap:wrap;justify-content:center;margin-top:22px}.primary{border:0;border-radius:16px;min-height:58px;padding:12px 20px;background:var(--blue);color:#fff;font-weight:900;cursor:pointer}.secondary{border:2px solid var(--line);border-radius:16px;min-height:58px;padding:12px 20px;background:#fff;color:var(--ink);font-weight:900;cursor:pointer}@keyframes pop{50%{transform:scale(1.08)}}
    .touch-mode-card{margin-top:18px;border:2px solid #cfe0ff;background:#f3f7ff;border-radius:18px;padding:16px}.touch-mode-card h3{margin:0 0 5px;font-size:1.05rem}.touch-mode-card p{margin:0;color:var(--muted);font-size:.9rem;line-height:1.45}.touch-mode-start{display:grid;grid-template-columns:1fr auto;gap:10px;align-items:end;margin-top:13px}.touch-mode-start label{font-size:.8rem;font-weight:900;color:var(--muted)}.touch-mode-start input,.touch-pin-input{display:block;width:100%;min-height:54px;border:2px solid var(--line);border-radius:14px;background:#fff;padding:9px 12px;color:var(--ink);font-size:1.15rem;font-weight:900;letter-spacing:.18em;margin-top:5px}.touch-mode-start button{min-height:54px}.touch-mode-status{min-height:20px;margin-top:8px;color:#bd3450;font-size:.84rem;font-weight:850}.touch-exit{position:fixed;right:max(14px,env(safe-area-inset-right));bottom:max(14px,env(safe-area-inset-bottom));z-index:50;width:54px;height:54px;border:2px solid #d7e2f4;border-radius:50%;background:#fff;color:var(--blue);box-shadow:0 8px 24px rgba(20,33,61,.2);font-size:1.35rem;cursor:pointer}.touch-exit[hidden]{display:none}.touch-pin-panel{width:min(460px,100%)}.touch-pin-panel form{display:grid;gap:12px}.touch-pin-panel label{font-size:.86rem;font-weight:900;color:var(--muted)}.touch-pin-panel .teacher-actions{margin-top:8px}.class-chip:disabled{opacity:1;cursor:default}
    body.touch-mode .shell{max-width:1380px}body.touch-mode .teacher{display:none}body.touch-mode .setup{padding:clamp(22px,3vw,34px)}body.touch-mode .seg{min-height:72px}body.touch-mode .seg button{min-height:60px;font-size:1.05rem}body.touch-mode .game-card{min-height:210px;padding:26px}body.touch-mode .game-card h3{font-size:1.4rem}body.touch-mode .game-card p{font-size:1.05rem}body.touch-mode .game-card .icon{width:68px;height:68px;font-size:36px}body.touch-mode .back,body.touch-mode .score{min-height:58px;font-size:1.02rem}body.touch-mode .stage button{touch-action:manipulation}
    .touch-resume{position:fixed;inset:0;z-index:80;display:grid;place-items:center;padding:24px;background:linear-gradient(180deg,rgba(232,242,255,.97),rgba(247,250,255,.98));backdrop-filter:blur(8px)}.touch-resume[hidden]{display:none}.touch-resume-card{width:min(560px,100%);background:#fff;border:2px solid #d7e4f8;border-radius:28px;box-shadow:0 24px 70px rgba(10,29,69,.22);padding:clamp(28px,6vw,48px);text-align:center}.touch-resume-icon{font-size:4.5rem;line-height:1;margin-bottom:18px}.touch-resume-card h2{font-size:clamp(1.7rem,4vw,2.35rem);margin:0 0 10px}.touch-resume-card p{color:var(--muted);line-height:1.5;margin:0 0 24px}.touch-resume-card .primary{width:100%;min-height:72px;font-size:1.15rem}
    @media(max-width:760px){.shell{padding-top:15px}.topbar{margin-bottom:18px;align-items:flex-start}.top-actions{max-width:52%}.teacher,.class-chip{padding:8px 10px;font-size:.82rem}.class-chip{flex-wrap:wrap}.setup-row{grid-template-columns:1fr;gap:14px}.setup{border-radius:22px;padding:16px}.seg{min-height:56px}.seg button{min-height:44px}.games{grid-template-columns:1fr}.game-card{min-height:165px}.section-head{align-items:start}.badge{display:none}.stage{min-height:530px;border-radius:23px;padding:22px 16px}.memory-grid{grid-template-columns:repeat(3,1fr)}.memory{aspect-ratio:1.2}.sort-targets{grid-template-columns:1fr}.sort-target{min-height:78px}.equations{grid-template-columns:1fr}.equation{min-height:66px}.teacher-grid{grid-template-columns:1fr}.teacher-field.wide{grid-column:auto}.class-create{grid-template-columns:1fr}.playbar{align-items:center}.game-title span{display:none}.back,.restart{padding:8px 11px}.score{padding:9px 10px}}
    @media(max-width:420px){.brand small{display:none}.brandmark{width:47px;height:47px}.memory-grid{gap:8px}.stone{width:82px}.letter{width:57px;height:59px}.slot{width:39px}.game-title strong{font-size:1rem}}
    @media(max-width:760px){.touch-mode-start{grid-template-columns:1fr}body.touch-mode .game-card{min-height:180px}body.touch-mode .seg button{min-height:56px}}
    @media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;animation:none!important;transition:none!important}}

.recovery-code{display:block;overflow-wrap:anywhere;padding:18px;border-radius:12px;background:#eef3fb;font-family:monospace;font-size:1.2rem;user-select:all}.auth-tabs{flex-wrap:wrap}.auth-form select{width:100%;min-height:50px;border:2px solid var(--line);border-radius:12px;padding:8px;font:inherit}.auth-tabs button:disabled{opacity:.5;cursor:default}
