:root{--ink:#14224d;--shadow:0 6px 0 rgba(0,0,0,.25)}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;overflow:hidden}
body{font-family:'Rubik','Arial Rounded MT Bold',system-ui,sans-serif;font-weight:800;color:#fff;
  background:radial-gradient(circle at 30% 15%,#3b63d8 0,#1f3a93 45%,#0e1d55 100%);touch-action:none;user-select:none;-webkit-user-select:none}
#app{height:100dvh;position:relative}
.screen{display:none;height:100%;flex-direction:column}.screen.active{display:flex}
#screen-home,#screen-shop,#screen-list{overflow:auto;touch-action:pan-y}
.hidden{display:none!important}
button{font:inherit;color:inherit;border:0;cursor:pointer;background:none}
.coin{display:inline-block;width:1em;height:1em;border-radius:50%;background:radial-gradient(circle at 35% 35%,#ffe98a,#f2b632 60%,#c98a1a);box-shadow:inset 0 0 0 2px #ffd25a,0 1px 0 #a86f12;vertical-align:-.12em}
.bar{display:flex;align-items:center;gap:12px;padding:10px 14px;background:rgba(255,255,255,.12)}
.bar h2{flex:1;margin:0;font-size:22px;text-align:center;font-weight:900}
.icon-btn{width:46px;height:46px;border-radius:14px;background:#fff;color:var(--ink);box-shadow:var(--shadow);font-size:24px;display:grid;place-items:center;text-decoration:none}
.icon-btn:active{transform:translateY(3px)}
.coin-pill{background:#fff;color:var(--ink);border-radius:999px;padding:8px 14px;font-size:18px;box-shadow:var(--shadow);min-width:80px;text-align:center}
.home-top{display:flex;justify-content:space-between;align-items:center;padding:14px}
.home-tools{display:flex;gap:10px}
.lang-switch{display:flex;gap:6px;background:#fff;border-radius:999px;padding:4px;box-shadow:var(--shadow);color:var(--ink)}
.lang-switch button{padding:6px 12px;border-radius:999px;font-size:14px;font-weight:900;opacity:.55}
.lang-switch button.active{background:#3b63d8;color:#fff;opacity:1}
.home-hero{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:0 16px}
.logo{font-size:clamp(34px,8.5vw,68px);margin:0;line-height:1.05;color:#ffe17a;text-shadow:0 4px 0 #b8741a,0 10px 24px rgba(0,0,0,.4);transform:rotate(-2deg)}
.subtitle{font-size:clamp(17px,4vw,24px);margin:10px 0 0;opacity:.95}
.hero{width:min(46vw,200px);margin-top:14px}.hero svg{width:100%;height:auto;filter:drop-shadow(0 12px 12px rgba(0,0,0,.35))}
.home-menu{display:flex;flex-direction:column;gap:12px;padding:16px;max-width:520px;width:100%;margin:0 auto 16px}
.big-btn{display:flex;align-items:center;gap:16px;padding:12px 20px;border-radius:24px;color:#fff;font-size:24px;box-shadow:0 8px 0 rgba(0,0,0,.3);text-align:start}
.big-btn:active{transform:translateY(5px);box-shadow:0 3px 0 rgba(0,0,0,.3)}
.big-btn .ico{font-size:34px;font-weight:900;background:rgba(255,255,255,.25);border-radius:18px;width:60px;height:60px;display:grid;place-items:center;flex:none}
.big-btn span:last-child{display:flex;flex-direction:column}.big-btn small{font-size:14px;opacity:.95;font-weight:700}
.big-btn.green{background:linear-gradient(#7fd65a,#57b43a)}.big-btn.blue{background:linear-gradient(#6aa8ff,#3a6fe0)}.big-btn.pink{background:linear-gradient(#ff8fb1,#f0568a)}
.glyph-grid{flex:1;overflow:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(88px,1fr));gap:12px;padding:16px;align-content:start;direction:rtl}
.glyph-card{aspect-ratio:1;border-radius:22px;background:#fff;color:var(--ink);box-shadow:var(--shadow);display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:44px;font-weight:900;line-height:1}
.glyph-card:active{transform:scale(.95)}
.glyph-card .stars{font-size:13px;letter-spacing:-2px;height:16px}
.glyph-card.done{background:linear-gradient(#fff,#e3ecff)}
/* обведение */
.trace-top{display:flex;align-items:center;justify-content:center;gap:14px;padding:6px 12px}
.status{font-size:clamp(16px,3.6vw,22px);min-width:120px;text-align:center}
.tool{width:50px;height:50px;border-radius:50%;background:#fff;color:var(--ink);font-size:22px;box-shadow:var(--shadow);display:grid;place-items:center}
.tool:active{transform:translateY(3px)}.tool.big{width:58px;height:58px;font-size:26px}.tool.on{background:#ffe17a}
.board-wrap{flex:1;min-height:0;margin:0 12px;display:grid;place-items:center;touch-action:none}
#board{direction:ltr;height:100%;max-width:100%;aspect-ratio:1;display:block;touch-action:none;background:rgba(255,255,255,.08);border-radius:26px;box-shadow:inset 0 0 0 2px rgba(255,255,255,.12)}
#board .glyph{fill:#fff;paint-order:stroke;stroke:#ffffff;stroke-width:5;stroke-linejoin:round;filter:drop-shadow(0 6px 6px rgba(0,0,0,.35))}
#board .guide{fill:none;stroke:#1f3a93;stroke-opacity:.45;stroke-width:2.2;stroke-linecap:round;stroke-dasharray:1 5}
#board .trail{fill:none;stroke-linecap:round;stroke-linejoin:round}
#board .start{animation:pulse 1s ease-in-out infinite;transform-box:fill-box;transform-origin:center}
@keyframes pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.25)}}
#board .demo{fill:none;stroke-linecap:round;stroke-linejoin:round;opacity:.9}
.game-footer{display:flex;gap:14px;justify-content:center;align-items:center;padding:10px 12px 16px}
.toast{position:absolute;left:50%;bottom:96px;transform:translateX(-50%);background:#fff;color:var(--ink);padding:10px 20px;border-radius:22px;font-size:17px;box-shadow:0 8px 20px rgba(0,0,0,.35);z-index:20;text-align:center;width:max-content;max-width:90vw;pointer-events:none}
/* магазин */
.shop{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:14px;padding:18px}
.shop-item{background:#fff;color:var(--ink);border-radius:22px;padding:14px 10px;display:flex;flex-direction:column;align-items:center;gap:8px;box-shadow:var(--shadow)}
.shop-item:active{transform:scale(.96)}.shop-item.selected{outline:4px solid #57b43a}
.swatches{display:flex;gap:4px}.swatches i{width:18px;height:18px;border-radius:50%;display:block}
.shop-item .price{font-size:14px;background:#ffe17a;border-radius:999px;padding:3px 10px}.shop-item.owned .price{background:#d9f2cc}
/* модалка, конфетти, легенда */
.modal{position:fixed;inset:0;background:rgba(5,15,60,.65);display:grid;place-items:center;z-index:100;padding:16px}
.modal-card{background:#fff;color:var(--ink);border-radius:28px;padding:26px 24px;text-align:center;max-width:380px;width:100%;box-shadow:0 20px 50px rgba(0,0,0,.5);animation:pop .3s cubic-bezier(.2,1.4,.4,1);max-height:88dvh;overflow:auto;scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.16) transparent}
.modal-card::-webkit-scrollbar{width:6px}.modal-card::-webkit-scrollbar-track{background:transparent;margin:22px 0}.modal-card::-webkit-scrollbar-thumb{background:rgba(0,0,0,.16);border-radius:999px}
@keyframes pop{from{transform:scale(.4);opacity:0}to{transform:scale(1);opacity:1}}
.modal-emoji{font-size:54px;line-height:1;letter-spacing:2px}.modal-card h2{margin:10px 0 4px;font-size:30px}#modal-text{margin:0 0 18px;font-size:18px;color:#4b5680;line-height:1.35}
.modal-actions{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}
.modal-actions button{padding:12px 22px;border-radius:999px;color:#fff;font-size:18px;font-weight:900;box-shadow:0 5px 0 rgba(0,0,0,.2)}
.modal-actions .primary{background:linear-gradient(#7fd65a,#57b43a)}.modal-actions .secondary{background:#7f8bb8}
#confetti{position:fixed;inset:0;pointer-events:none;overflow:hidden;z-index:90}
.confetti-piece{position:absolute;top:-20px;width:12px;height:18px;border-radius:3px;animation:fall linear forwards}
@keyframes fall{to{transform:translateY(110vh) rotate(720deg);opacity:.8}}
.legend{display:flex;flex-direction:column;gap:12px;text-align:start;margin:4px 0 16px}
.legend-row{display:flex;gap:12px;align-items:center}
.legend-ico{flex:none;min-width:52px;display:flex;gap:4px;align-items:center;justify-content:center}
.legend-txt{font-size:15px;line-height:1.35;font-weight:700}
.legend .tool,.legend .icon-btn{width:36px;height:36px;font-size:18px;box-shadow:0 3px 0 rgba(0,0,0,.2);cursor:default}
.legend .icon-btn{border-radius:10px}
.big-letter{font-size:28px;font-weight:900;color:var(--ink)}
