.mode-selector{display:flex;gap:8px;flex-wrap:wrap}.mode-button{display:flex;flex-direction:column;align-items:center;gap:2px;padding:10px 16px;border-radius:12px;border:2px solid #cbd5e1;background:#fff;cursor:pointer;font:inherit;color:#334155;min-width:76px;transition:transform .12s ease,border-color .12s ease,background .12s ease,box-shadow .12s ease}.mode-button:hover{border-color:#94a3b8;transform:translateY(-1px)}.mode-button:focus-visible{outline:3px solid #2563eb;outline-offset:2px}.mode-button--active{border-color:#1e293b;background:#1e293b;color:#fff;box-shadow:0 4px 14px #0f172a40}.mode-symbol{font-size:1.4rem;font-weight:700;line-height:1}.mode-label{font-size:.85rem;font-weight:600}.tower{--cell-size: 38px;--step-rise: 4px;-webkit-user-select:none;user-select:none;filter:drop-shadow(0 12px 30px rgba(15,23,42,.18))}.tower-roof{position:relative;display:flex;flex-direction:column;align-items:center}.tower-roof-peak{width:0;height:0;border-left:28px solid transparent;border-right:28px solid transparent;border-bottom:28px solid #ef4444;filter:drop-shadow(0 -2px 0 rgba(0,0,0,.1))}.tower-roof-peak:after{content:"";position:absolute;top:-10px;left:50%;transform:translate(-50%);width:3px;height:14px;background:#1e293b;border-radius:2px}.tower-roof-base{width:calc(100% - 8px);max-width:560px;height:14px;background:linear-gradient(180deg,#b45309,#92400e);border-radius:6px 6px 0 0;box-shadow:inset 0 2px #ffffff40,inset 0 -3px #00000040}.tower-body{display:grid;grid-template-columns:14px 1fr 14px;gap:0;padding:12px 0;background:linear-gradient(180deg,#e0f2fe,#f8fafc 70%,#fef3c7);border-left:4px solid #78350f;border-right:4px solid #78350f;position:relative}.tower-pillar{background:linear-gradient(180deg,#b45309,#92400e);position:relative}.tower-pillar:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background-image:repeating-linear-gradient(180deg,transparent 0,transparent 28px,rgba(0,0,0,.3) 28px,rgba(0,0,0,.3) 30px)}.tower-pillar--left{box-shadow:inset -2px 0 #00000040}.tower-pillar--right{box-shadow:inset 2px 0 #00000040}.tower-floors{display:flex;flex-direction:column;gap:0;padding:0 8px}.tower-floor{display:grid;grid-template-columns:56px 1fr;gap:8px;align-items:center;padding:3px 0;border-bottom:1px solid rgba(120,53,15,.15)}.tower-floor:last-child{border-bottom:none}.tower-floor-label{font-size:.7rem;color:#78350f;text-align:right;font-variant-numeric:tabular-nums;padding-right:4px;opacity:.7}.tower-floor-cells{display:grid;grid-template-columns:repeat(10,1fr);gap:3px;align-items:end}.tower-ground{margin-top:-2px}.tower-ground-grass{height:12px;background:linear-gradient(180deg,#65a30d,#4d7c0f 70%,#365314);border-radius:0 0 10px 10px;box-shadow:inset 0 2px #ffffff2e,0 6px 14px #0000002e}.tower-cell{position:relative;aspect-ratio:1 / 1;border-radius:5px;background:#cbd5e1;border:2px solid transparent;display:flex;align-items:center;justify-content:center;font-size:.65rem;color:#0f172a4d;padding:0;font-family:inherit;cursor:default;bottom:0;transition:background-color .2s ease,bottom .2s ease,transform .2s ease,box-shadow .2s ease,opacity .2s ease,border-color .2s ease;box-shadow:inset 0 1px #fff6,inset 0 -2px #0000001f}.tower-cell:disabled{cursor:default}.tower-cell--clickable{cursor:pointer}.tower-cell--clickable:hover{transform:scale(1.1);filter:brightness(1.05)}.tower-cell--clickable:focus-visible{outline:3px solid #2563eb;outline-offset:2px;z-index:2}.tower-cell-num{font-variant-numeric:tabular-nums;font-weight:700;pointer-events:none}.tower-cell--empty{background:#cbd5e1}.tower-cell--base{box-shadow:inset 0 2px #ffffff73,inset 0 -3px #00000040,inset 2px 0 #ffffff26,inset -2px 0 #00000026,0 2px 3px #00000026}.tower-cell--added{box-shadow:inset 0 2px #fff9,inset 0 -3px #00000040,inset 2px 0 #fff3,inset -2px 0 #00000026,0 4px 10px #00000038;animation:drop-in .32s cubic-bezier(.34,1.56,.64,1) both}.tower-cell--removed{background:repeating-linear-gradient(45deg,#f1f5f9,#f1f5f9 4px,#e2e8f0 4px,#e2e8f0 8px);border-width:2px;border-style:dashed;color:#0f172a66;opacity:.85;box-shadow:none}.tower-cell--removed .tower-cell-num{text-decoration:line-through}.tower-cell--cursor-add{box-shadow:inset 0 1px #fff6,inset 0 -2px #0000001f,0 0 0 3px #fff,0 0 0 6px #2563eb;animation:pulse-add 1.4s ease-in-out infinite;z-index:1}.tower-cell--cursor-remove{box-shadow:inset 0 1px #fff6,inset 0 -2px #0000001f,0 0 0 3px #fff,0 0 0 6px #dc2626;animation:pulse-remove 1.4s ease-in-out infinite;z-index:1}.tower-cell--target-add{border-color:#2563eb8c;border-style:dashed;border-width:2px;background:#bfdbfe59;animation:target-breathe 1.8s ease-in-out infinite}@keyframes target-breathe{0%,to{border-color:#2563eb8c;background:#bfdbfe59}50%{border-color:#2563ebf2;background:#bfdbfe99}}.tower-cell--group-boundary{margin-left:6px;position:relative}.tower-cell--group-boundary:before{content:"";position:absolute;left:-6px;top:8%;bottom:8%;width:2px;background:#475569;opacity:.4;border-radius:2px}.tower--staircase .tower-cell{bottom:calc(var(--step) * var(--step-rise))}.tower--staircase .tower-floor-cells{padding-top:calc(9 * var(--step-rise))}@keyframes drop-in{0%{transform:translateY(-12px);opacity:0}60%{transform:translateY(2px);opacity:1}to{transform:translateY(0);opacity:1}}@keyframes pulse-add{0%,to{box-shadow:inset 0 1px #fff6,inset 0 -2px #0000001f,0 0 0 3px #fff,0 0 0 6px #2563eb}50%{box-shadow:inset 0 1px #fff6,inset 0 -2px #0000001f,0 0 0 3px #fff,0 0 0 9px #2563eb8c}}@keyframes pulse-remove{0%,to{box-shadow:inset 0 1px #fff6,inset 0 -2px #0000001f,0 0 0 3px #fff,0 0 0 6px #dc2626}50%{box-shadow:inset 0 1px #fff6,inset 0 -2px #0000001f,0 0 0 3px #fff,0 0 0 9px #dc26268c}}@media (max-width: 720px){.tower{--cell-size: 28px;--step-rise: 3px}.tower-floor{grid-template-columns:40px 1fr;gap:6px}.tower-floor-label{font-size:.6rem}.tower-cell{font-size:.5rem;border-radius:4px}.tower-roof-base{max-width:100%}}.problem-panel{display:flex;flex-direction:column;gap:16px;padding:22px;background:#fff;border-radius:14px;box-shadow:0 8px 30px #0f172a14}.problem-equation{display:flex;align-items:center;justify-content:center;gap:10px;font-size:clamp(1.8rem,3.5vw,2.6rem);font-weight:700;font-variant-numeric:tabular-nums;color:#1e293b;letter-spacing:.02em}.problem-operator,.problem-equals{color:#64748b}.problem-result{color:#94a3b8;min-width:1.4em;text-align:center}.problem-result--shown{color:#16a34a;animation:pop .35s ease}.counter{display:flex;flex-direction:column;align-items:center;padding:12px;background:#f8fafc;border-radius:12px}.counter-label{font-size:.8rem;color:#64748b;margin-bottom:4px}.counter-value{font-size:clamp(2.4rem,5vw,3.2rem);font-weight:800;color:#1e293b;font-variant-numeric:tabular-nums;line-height:1}.counter-value--solved{color:#16a34a;animation:pop .4s ease}.step-buttons{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.step-buttons--two{grid-template-columns:repeat(2,1fr)}.step{padding:12px 8px;font-size:1.05rem;font-weight:700;font-variant-numeric:tabular-nums;border-radius:10px;border:2px solid transparent;cursor:pointer;font-family:inherit;transition:background .12s ease,transform .12s ease,box-shadow .12s ease,opacity .12s ease}.step:disabled{cursor:not-allowed;opacity:.4}.step:not(:disabled):hover{transform:translateY(-1px)}.step:focus-visible{outline:3px solid #2563eb;outline-offset:2px}.step--primary{background:#2563eb;color:#fff;box-shadow:0 3px 10px #2563eb4d}.step--primary:not(:disabled):hover{background:#1d4ed8}.step--undo{background:#f1f5f9;color:#475569;border-color:#cbd5e1}.step--undo:not(:disabled):hover{background:#e2e8f0}.hint{margin:0;padding:10px 12px;background:#fef3c7;border-radius:10px;font-size:.9rem;color:#78350f;text-align:center;line-height:1.4}.problem-feedback{min-height:1.6em;text-align:center}.feedback{display:inline-block;padding:6px 14px;border-radius:999px;font-weight:700;font-size:1.05rem}.feedback--correct{background:#dcfce7;color:#166534;animation:pop .4s ease}.feedback--wrong{background:#fee2e2;color:#991b1b;animation:shake .35s ease}@keyframes shake{0%,to{transform:translate(0)}20%,60%{transform:translate(-5px)}40%,80%{transform:translate(5px)}}.problem-actions{display:flex;justify-content:center;gap:10px;flex-wrap:wrap}.action{padding:10px 18px;font:inherit;font-weight:600;border-radius:10px;cursor:pointer;border:2px solid transparent;transition:background .12s ease,transform .12s ease}.action:focus-visible{outline:3px solid #2563eb;outline-offset:2px}.action--primary{background:#16a34a;color:#fff;box-shadow:0 4px 14px #16a34a4d}.action--primary:hover{transform:translateY(-1px);background:#15803d}.action--ghost{background:transparent;color:#475569;border-color:#cbd5e1}.action--ghost:hover{background:#f1f5f9;border-color:#94a3b8}@keyframes pop{0%{transform:scale(.85)}60%{transform:scale(1.1)}to{transform:scale(1)}}.legend{padding:14px 16px;background:#fff;border-radius:12px;box-shadow:0 4px 14px #0f172a0f}.legend-title{font-size:.85rem;font-weight:700;color:#475569;margin-bottom:10px}.legend-decades{display:grid;grid-template-columns:repeat(5,1fr);gap:4px 6px}.legend-decade{display:flex;align-items:center;gap:6px;font-size:.75rem;color:#475569;font-variant-numeric:tabular-nums}.legend-decade-swatch{width:16px;height:16px;border-radius:4px;box-shadow:inset 0 1px #ffffff59,inset 0 -2px #0000002e;flex-shrink:0}.legend-decade-label{white-space:nowrap}.legend-shading{margin-top:12px;display:flex;flex-direction:column;gap:4px}.legend-shading-label{font-size:.7rem;color:#64748b;text-align:center}.legend-shading-row{display:grid;grid-template-columns:repeat(10,1fr);gap:2px}.legend-shading-swatch{height:14px;border-radius:3px;box-shadow:inset 0 1px #ffffff40,inset 0 -1px #00000026}.legend-hint{margin:10px 0 0;font-size:.8rem;color:#64748b}.legend-hint--center{text-align:center}.medal-bar{display:flex;flex-direction:column;gap:8px;padding:12px 14px;background:linear-gradient(180deg,#fffbeb,#fef3c7);border-radius:12px;box-shadow:0 4px 14px #b4530926;border:1px solid #fde68a}.medal-stats{display:flex;flex-direction:column;gap:6px}.medal-stats-row{display:flex;align-items:center;justify-content:space-between;gap:12px}.medal-count{display:inline-flex;align-items:center;gap:4px}.medal-icon{font-size:1.4rem;filter:drop-shadow(0 2px 0 rgba(180,83,9,.3))}.medal-num{font-size:1.4rem;font-weight:800;color:#78350f;font-variant-numeric:tabular-nums}.medal-num--celebrate{animation:medal-pop .6s cubic-bezier(.34,1.56,.64,1) both}.medal-solved{color:#78350f;font-size:.9rem;font-variant-numeric:tabular-nums}.medal-solved strong{font-size:1.1rem;font-weight:700}.medal-progress{position:relative;height:16px;background:#78350f1f;border-radius:10px;overflow:hidden}.medal-progress-fill{height:100%;background:linear-gradient(90deg,#f59e0b,#ef4444);border-radius:10px;transition:width .4s ease;box-shadow:inset 0 1px #ffffff59}.medal-progress-label{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;font-size:.7rem;font-weight:700;color:#78350f;text-shadow:0 1px 0 rgba(255,255,255,.6)}.medal-row{display:flex;flex-wrap:wrap;gap:2px;align-items:center}.medal-chip{font-size:1.1rem;filter:drop-shadow(0 1px 0 rgba(180,83,9,.25))}.medal-chip--new{animation:medal-pop .7s cubic-bezier(.34,1.56,.64,1) both}.medal-chip-overflow{margin-left:6px;padding:1px 6px;background:#78350f;color:#fef3c7;font-size:.75rem;font-weight:700;border-radius:999px}@keyframes medal-pop{0%{transform:scale(.5) rotate(-20deg);opacity:0}60%{transform:scale(1.3) rotate(8deg);opacity:1}to{transform:scale(1) rotate(0);opacity:1}}.custom-form{display:flex;flex-direction:column;gap:12px;padding:16px;background:#fff;border-radius:12px;border:2px dashed #94a3b8;box-shadow:0 4px 14px #0f172a14}.custom-form-title{font-weight:700;color:#1e293b}.custom-form-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:center;font-size:1.4rem;font-weight:700;font-variant-numeric:tabular-nums}.custom-input{width:4ch;padding:6px 8px;font:inherit;text-align:center;border:2px solid #cbd5e1;border-radius:8px;background:#f8fafc}.custom-input:focus{outline:none;border-color:#2563eb;background:#fff}.custom-op-group{display:inline-flex;gap:4px}.custom-op{width:36px;height:36px;font-size:1.2rem;font-weight:700;border-radius:8px;border:2px solid #cbd5e1;background:#fff;color:#475569;cursor:pointer;font-family:inherit;transition:background .12s ease,border-color .12s ease,color .12s ease}.custom-op:hover{border-color:#94a3b8}.custom-op--active{background:#1e293b;border-color:#1e293b;color:#fff}.custom-equals{color:#64748b}.custom-error{padding:8px 12px;background:#fee2e2;color:#991b1b;border-radius:8px;font-size:.9rem;text-align:center}.custom-form-actions{display:flex;gap:8px;justify-content:flex-end}.custom-btn{padding:8px 14px;font:inherit;font-weight:600;border-radius:8px;border:2px solid transparent;cursor:pointer;transition:background .12s ease,transform .12s ease}.custom-btn:focus-visible{outline:3px solid #2563eb;outline-offset:2px}.custom-btn--primary{background:#1e293b;color:#fff}.custom-btn--primary:hover{background:#0f172a;transform:translateY(-1px)}.custom-btn--ghost{background:transparent;color:#475569;border-color:#cbd5e1}.custom-btn--ghost:hover{background:#f1f5f9}.landing{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px 16px;background:radial-gradient(circle at 20% 0%,#bae6fd 0%,transparent 50%),radial-gradient(circle at 80% 100%,#fde68a 0%,transparent 50%),linear-gradient(180deg,#f1f5f9,#e2e8f0)}.landing-card{width:100%;max-width:460px;background:#fff;border-radius:24px;padding:32px 28px;box-shadow:0 30px 60px #0f172a26,0 0 0 1px #0f172a0a;display:flex;flex-direction:column;align-items:center;gap:16px}.landing-icon{margin-top:-4px;filter:drop-shadow(0 6px 14px rgba(15,23,42,.15))}.landing-title{font-size:clamp(1.8rem,5vw,2.4rem);font-weight:800;color:#0f172a;margin:0;letter-spacing:-.02em}.landing-tagline{margin:0;color:#64748b;font-size:1rem;text-align:center;line-height:1.4}.landing-features{list-style:none;margin:8px 0 4px;padding:0;width:100%;display:flex;flex-direction:column;gap:8px}.landing-features li{display:flex;align-items:center;gap:10px;padding:10px 14px;background:#f8fafc;border-radius:12px;color:#334155;font-size:.95rem}.landing-feature-icon{font-size:1.2rem;flex-shrink:0}.landing-form{width:100%;display:flex;flex-direction:column;gap:12px;margin-top:8px}.landing-field{display:flex;flex-direction:column;gap:6px}.landing-field-label{font-size:.9rem;font-weight:600;color:#475569}.landing-input{padding:12px 14px;font:inherit;font-size:1rem;border:2px solid #cbd5e1;border-radius:12px;background:#fff;color:#0f172a;transition:border-color .15s ease,background .15s ease}.landing-input:focus{outline:none;border-color:#2563eb;background:#f8fafc}.landing-error{padding:10px 12px;background:#fee2e2;color:#991b1b;border-radius:10px;font-size:.9rem;text-align:center}.landing-start{margin-top:4px;padding:14px 18px;font:inherit;font-size:1.1rem;font-weight:700;color:#fff;background:linear-gradient(180deg,#2563eb,#1d4ed8);border:none;border-radius:14px;cursor:pointer;box-shadow:0 8px 20px #2563eb59,inset 0 1px #ffffff40;transition:transform .12s ease,box-shadow .12s ease}.landing-start:hover{transform:translateY(-1px);box-shadow:0 10px 22px #2563eb66,inset 0 1px #ffffff40}.landing-start:focus-visible{outline:3px solid #1e40af;outline-offset:3px}.landing-foot{margin:4px 0 0;font-size:.75rem;color:#94a3b8;text-align:center}.app{min-height:100vh;max-width:1200px;margin:0 auto;padding:24px 20px 40px;display:flex;flex-direction:column;gap:20px}.app-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap}.app-header-title{flex:1;min-width:0}.app-header h1{font-size:clamp(1.6rem,3vw,2.2rem);margin:0;color:#0f172a;letter-spacing:-.01em}.app-subtitle{margin:4px 0 0;color:#64748b;font-size:.95rem}.profile-chip{display:inline-flex;align-items:center;gap:8px;padding:6px 12px 6px 14px;font:inherit;font-size:.9rem;color:#0f172a;background:#fff;border:2px solid #cbd5e1;border-radius:999px;cursor:pointer;box-shadow:0 2px 8px #0f172a0f;transition:border-color .12s ease,transform .12s ease,background .12s ease}.profile-chip:hover{border-color:#94a3b8;transform:translateY(-1px)}.profile-chip:focus-visible{outline:3px solid #2563eb;outline-offset:2px}.profile-chip-name{font-weight:700}.profile-chip-age{display:inline-flex;align-items:center;justify-content:center;min-width:26px;height:26px;padding:0 6px;background:#1e293b;color:#fff;border-radius:999px;font-size:.8rem;font-weight:700;font-variant-numeric:tabular-nums}.app-controls{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}.app-controls-right{display:inline-flex;align-items:center;gap:8px;flex-wrap:wrap}.toggle-button{display:inline-flex;align-items:center;gap:6px;padding:8px 12px;font:inherit;font-weight:600;font-size:.9rem;color:#475569;background:#fff;border:2px solid #cbd5e1;border-radius:999px;cursor:pointer;transition:background .12s ease,border-color .12s ease,color .12s ease,transform .12s ease}.toggle-button:hover{border-color:#94a3b8;transform:translateY(-1px)}.toggle-button:focus-visible{outline:3px solid #2563eb;outline-offset:2px}.toggle-button--active{background:#1e293b;border-color:#1e293b;color:#fff}.medal-celebration{position:fixed;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;pointer-events:none;z-index:50;animation:fade-bg 2.4s ease both}.medal-celebration-card{display:flex;align-items:center;gap:16px;padding:20px 28px;background:linear-gradient(180deg,#fffbeb,#fef3c7);border:3px solid #f59e0b;border-radius:20px;box-shadow:0 20px 50px #b453094d;animation:medal-celebrate .7s cubic-bezier(.34,1.56,.64,1) both}.medal-celebration-icon{font-size:3rem;filter:drop-shadow(0 4px 0 rgba(180,83,9,.3));animation:medal-spin 1.2s ease both}.medal-celebration-text{display:flex;flex-direction:column;color:#78350f;font-weight:800;font-size:1.3rem;line-height:1.1}.medal-celebration-text small{font-size:.85rem;font-weight:600;opacity:.8;margin-top:4px}.reset-link{background:none;border:none;color:#94a3b8;font:inherit;font-size:.75rem;text-decoration:underline;cursor:pointer;padding:4px 8px}.reset-link:hover{color:#475569}@keyframes fade-bg{0%{background:#fff0}20%,80%{background:#ffffff59}to{background:#fff0}}@keyframes medal-celebrate{0%{transform:scale(.5) translateY(20px);opacity:0}60%{transform:scale(1.1) translateY(-4px);opacity:1}to{transform:scale(1) translateY(0);opacity:1}}@keyframes medal-spin{0%{transform:rotate(-180deg) scale(.5)}60%{transform:rotate(15deg) scale(1.15)}to{transform:rotate(0) scale(1)}}.app-main{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(280px,1fr);gap:20px;align-items:start}.app-tower-col{min-width:0}.app-side-col{display:flex;flex-direction:column;gap:16px;position:sticky;top:16px}.app-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:.85rem;color:#64748b;padding-top:8px;flex-wrap:wrap}@media (max-width: 900px){.app-main{grid-template-columns:1fr}.app-side-col{position:static}}*,*:before,*:after{box-sizing:border-box}html,body,#root{height:100%}body{margin:0;font-family:Nunito,Segoe UI,system-ui,-apple-system,Helvetica Neue,Arial,sans-serif;background:linear-gradient(180deg,#f1f5f9,#e2e8f0);color:#0f172a;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}button{font-family:inherit}@media (prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms!important;transition-duration:.01ms!important}}
