:root{color-scheme:dark;--bg:#111329;--panel:#1d203c;--line:#353958;--ink:#f8f8ff;--muted:#b9bdd5;--yellow:#ffe36b;--pink:#ff759c;--mint:#7babea;font-family:system-ui,'Hiragino Kaku Gothic ProN','Yu Gothic',Meiryo,sans-serif;font-size:16px}
*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 80% 0,#302657 0,transparent 48%),var(--bg);color:var(--ink);min-height:100vh}button,input{font:inherit}button{cursor:pointer;border:0;color:inherit;background:var(--panel);border-radius:12px;padding:.85rem 1.2rem;font-weight:800;transition:transform .15s,background .15s,box-shadow .15s}button:hover{transform:translateY(-2px);background:#333659}button:active{transform:translateY(1px)}button:disabled{opacity:.55;cursor:wait;transform:none}button:focus-visible,input:focus-visible,summary:focus-visible{outline:3px solid var(--yellow);outline-offset:4px}h1,h2,h3,p{margin-top:0}h1{font-size:clamp(1.75rem,4.5vw,3rem);line-height:1.4;letter-spacing:.02em}h2{font-size:1.4rem}p{line-height:1.9}.muted{color:var(--muted)}.eyebrow{font-size:.8rem;font-weight:800;letter-spacing:.14em;color:var(--yellow);margin-bottom:.65rem}.topbar{height:86px;display:flex;align-items:center;justify-content:space-between;max-width:1220px;margin:auto;padding:0 30px;border-bottom:1px solid #ffffff13}.brand{background:transparent!important;display:flex;align-items:center;gap:12px;padding:0;text-align:left}.brand>b{font-size:2.15rem;color:var(--yellow);font-style:italic;letter-spacing:-.14em;padding-right:6px}.brand span{font-size:.78rem;line-height:1.5}.brand strong{font-size:1rem}.top-actions{display:flex;align-items:center;gap:15px;font-size:.85rem}.small{font-size:.85rem;padding:.6rem .9rem;border:1px solid var(--line)}#app{max-width:1160px;margin:auto;padding:28px 24px 112px}.bottom-nav{position:fixed;z-index:15;bottom:16px;left:50%;transform:translateX(-50%);display:flex;gap:6px;background:#22243df5;backdrop-filter:blur(14px);border:1px solid #464962;padding:7px;border-radius:22px;box-shadow:0 12px 50px #0008}.bottom-nav button{min-width:115px;background:transparent;display:flex;gap:8px;justify-content:center;align-items:center;color:#b9bdd5}.bottom-nav button.active{background:var(--yellow);color:#222239}.primary{background:var(--yellow);color:#292138;box-shadow:0 4px 0 #ae843a}.primary:hover{background:#ffe998}.secondary{border:1px solid var(--line)}.pink-button{background:#f377a0;color:#201c38}.section-head{display:flex;align-items:center;justify-content:space-between;gap:15px;margin:30px 0 16px}.section-head h2{margin:0}.section-head span{font-size:.85rem;color:var(--muted)}.welcome{display:grid;grid-template-columns:1fr 1fr;gap:30px;align-items:center;min-height:270px;position:relative}.welcome-copy{padding:14px 0}.welcome h1{margin-bottom:12px}.welcome h1 em{font-style:normal;color:var(--yellow)}.welcome p{color:var(--muted);font-size:.92rem;margin-bottom:18px}.hero-cards{height:280px;position:relative;isolation:isolate}.hero-cards:before{content:'';position:absolute;inset:20% 5%;background:#e95e9c;filter:blur(85px);opacity:.24;z-index:-1}.hero-cards .full-card{position:absolute;width:152px;height:226px;object-fit:cover;border-radius:10px;border:2px solid #fff5;box-shadow:0 15px 35px #0009;top:23px;left:calc(50% - 76px);transform:rotate(var(--rot)) translateX(var(--move));transition:transform .5s}.hero-cards .full-card:nth-child(1){--rot:-17deg;--move:-108px}.hero-cards .full-card:nth-child(2){--rot:0deg;--move:0px;z-index:2;top:5px;width:170px;height:253px;left:calc(50% - 85px)}.hero-cards .full-card:nth-child(3){--rot:17deg;--move:108px}.hero-tag{position:absolute;bottom:0;left:50%;transform:translateX(-50%) rotate(-3deg);white-space:nowrap;background:var(--yellow);color:#21223d;font-size:.9rem;font-weight:900;padding:6px 20px;border-radius:6px;z-index:3}.status-strip{display:flex;gap:22px;padding:16px 20px;margin:10px 0 24px;background:#ffffff06;border:1px solid var(--line);border-radius:14px;flex-wrap:wrap}.status-strip span{font-size:.84rem;color:var(--muted)}.status-strip b{color:var(--ink);margin-left:6px}.mode-tabs{display:flex;gap:8px}.mode-tabs button{background:#ffffff05;border:1px solid var(--line);color:var(--muted);padding:.8rem 1.3rem}.mode-tabs button[aria-pressed=true]{background:var(--yellow);color:#232239;border-color:var(--yellow)}.order-control{display:flex;align-items:center;gap:8px;font-size:.85rem;flex-wrap:wrap;margin:18px 0}.order-control button{font-size:.85rem;padding:.5rem .9rem;background:transparent;border:1px solid var(--line)}.order-control button[aria-pressed=true]{border-color:var(--mint);color:var(--mint);background:#7babea10}.dan-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.stage-card{position:relative;text-align:left;overflow:hidden;min-height:154px;padding:20px;border:1px solid var(--line);background:#20223f;isolation:isolate}.stage-card:after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,#191c35 15%,#191c35c0 45%,transparent 100%);z-index:-1}.stage-card .art-window{position:absolute;right:0;top:0;width:59%;height:100%;z-index:-2;opacity:.85}.art-window{overflow:hidden;position:relative;background:#272942}.art-window img{display:block;width:100%;height:auto;position:absolute;top:50%;transform:translateY(-45%);min-height:100%;object-fit:cover}.stage-number{font-size:2.6rem;line-height:1.1;color:var(--accent,var(--yellow));font-weight:900}.stage-number small{font-size:1rem;color:var(--ink);margin-left:6px}.stage-card .stage-caption{display:block;font-size:.8rem;color:#d8daec;margin:7px 0 15px}.stars{color:var(--yellow);letter-spacing:.2em;font-size:.9rem}.stars .off{color:#666a84}.stage-go{position:absolute;right:14px;bottom:13px;border-radius:50%;background:var(--yellow);color:#1b2035;padding:6px 11px;font-size:.85rem}.level-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.level-grid .stage-number{font-size:1.35rem}.level-grid .stage-card{min-height:170px}.random-panel{display:grid;grid-template-columns:1.1fr .9fr;background:var(--panel);border:1px solid var(--line);border-radius:18px;overflow:hidden;min-height:240px}.random-panel>div:first-child{padding:30px}.random-art{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:16px}.random-art .art-window{border-radius:12px;min-height:90px}.challenge-banner{margin-top:28px;display:grid;grid-template-columns:1fr auto;align-items:center;gap:20px;border:1px solid #79613e;background:linear-gradient(110deg,#363048,#30202e);border-radius:18px;padding:25px;position:relative;overflow:hidden}.challenge-banner h2{margin-bottom:6px}.challenge-banner p{color:#d2c8d4;font-size:.88rem;margin:0}.challenge-banner .eyebrow{margin-bottom:7px}.best-pill{font-variant-numeric:tabular-nums;color:var(--yellow);font-size:.9rem;margin-top:10px}.battle-header{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:20px}.battle-header h2{margin:0;font-size:1.1rem}.timer{font-size:1.5rem;font-weight:900;font-variant-numeric:tabular-nums;color:var(--yellow)}.timer.danger{color:var(--pink)}.arena{display:grid;grid-template-columns:1fr 140px 1fr;align-items:center;gap:16px;max-width:790px;margin:0 auto;position:relative}.fighter{text-align:center;min-width:0}.fighter .fighter-art{height:245px;max-width:215px;margin:0 auto;border:2px solid #ffffff36;border-radius:17px;box-shadow:0 15px 40px #0005;overflow:hidden;transform:rotate(-3deg)}.fighter.enemy .fighter-art{transform:rotate(3deg)}.fighter-art img{width:100%;height:100%;object-fit:cover;object-position:50% 38%}.fighter h3{font-size:.92rem;margin:13px 0 6px}.fighter-label{color:var(--muted);font-size:.75rem;margin:5px 0}.vs{text-align:center;font-size:2.8rem;font-style:italic;font-weight:900;color:var(--yellow);text-shadow:3px 3px #cd5173}.vs small{font-size:.8rem;display:block;font-style:normal;letter-spacing:0;color:var(--muted);text-shadow:none;margin-top:10px}.hp-track{height:9px;background:#ffffff18;border-radius:10px;overflow:hidden;max-width:215px;margin:auto}.hp-track>div{height:100%;background:var(--pink);transition:width .4s}.fighter.player .hp-track>div{background:var(--mint)}.question-zone{text-align:center;max-width:600px;margin:24px auto 0;padding:22px 26px;background:#1e213e;border:1px solid #434565;border-radius:20px;box-shadow:0 18px 50px #0002}.question-top{display:flex;justify-content:space-between;align-items:center;font-size:.83rem;color:var(--muted)}.combo{color:var(--yellow);font-weight:900}.equation{display:flex;justify-content:center;align-items:center;gap:14px;font-size:clamp(2rem,5vw,3.25rem);font-weight:900;margin:18px 0}.answer-input{width:115px;text-align:center;border:2px solid var(--yellow);background:#10132d;color:var(--yellow);border-radius:12px;font-size:inherit;font-weight:900;padding:6px;min-height:70px;caret-color:var(--yellow)}.answer-input::placeholder{color:#817954}.battle-message{min-height:30px;color:var(--mint);font-size:.94rem;margin:8px 0}.keypad{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;max-width:360px;margin:16px auto 0}.keypad button{background:#343853;font-size:1.3rem;padding:10px;box-shadow:0 3px 0 #13162d}.keypad button.confirm{background:var(--yellow);color:#242239;font-size:1rem}.keypad button.erase{font-size:.9rem}.hint-button{font-size:.83rem;margin-top:15px;background:none;text-decoration:underline;text-underline-offset:5px;color:var(--muted);padding:.4rem}.hint-box{background:#11152c;border:1px solid #464863;border-radius:12px;padding:16px;margin-top:15px}.hint-groups{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin-bottom:12px}.hint-group{border:1px solid #727d8c;background:#212e3e;color:var(--mint);padding:6px 8px;border-radius:6px;max-width:95px;line-height:1.4;word-break:break-all}.hint-box p{font-size:.9rem;margin:0}.hit{animation:hit .4s}.attack{animation:attack .4s}.special{animation:special .5s}.battle-flash{position:fixed;inset:0;z-index:30;pointer-events:none;display:grid;place-items:center;background:#17132977;animation:flash .8s forwards}.battle-flash strong{font-size:clamp(2rem,8vw,5rem);transform:rotate(-8deg);font-weight:900;color:var(--yellow);text-shadow:5px 5px #aa3263,-2px -2px #20223e;background:#171329e8;padding:15px 35px;border:2px solid #ffe36b77}.result{text-align:center;max-width:800px;margin:auto}.result h1{margin:8px 0 12px}.result-stars{font-size:2.7rem;letter-spacing:.12em;color:var(--yellow)}.result-data{display:flex;justify-content:center;gap:35px;margin:25px 0;flex-wrap:wrap}.result-data b{display:block;font-size:1.8rem;color:var(--yellow)}.result-data span{font-size:.85rem;color:var(--muted)}.reward-panel{border:1px solid #725e39;border-radius:18px;background:radial-gradient(ellipse at center,#54425a,#211f3b 75%);padding:24px;margin:24px auto;max-width:490px}.reward-panel img{width:155px;border-radius:8px;box-shadow:0 8px 35px #0008;animation:reveal .6s}.reward-panel h3{color:var(--yellow);margin:0 0 14px}.result-actions{display:flex;justify-content:center;gap:10px;flex-wrap:wrap}.review-list{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}.review-list span{background:#292c47;border:1px solid var(--line);padding:9px 15px;border-radius:8px}.collection-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:18px 14px}.collect-card{padding:0;background:transparent;text-align:left;position:relative}.collect-card:hover{background:transparent}.collect-card img{width:100%;aspect-ratio:1456/2156;object-fit:cover;border:2px solid #ffffff33;border-radius:9px;box-shadow:0 9px 15px #0003}.collect-card .locked{filter:grayscale(1);opacity:.27}.collect-card strong{display:block;font-size:.8rem;margin:7px 0 5px}.collect-card small{font-size:.75rem;color:var(--muted)}.collect-card .selected-mark{position:absolute;top:7px;left:7px;background:var(--yellow);padding:4px 7px;color:#21223e;border-radius:6px;font-size:.75rem;font-weight:900}.collection-progress{height:8px;border-radius:5px;overflow:hidden;background:#ffffff14;margin:15px 0 25px}.collection-progress>div{height:100%;background:var(--yellow)}.record-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin:20px 0}.record{padding:22px;border:1px solid var(--line);border-radius:15px;background:var(--panel)}.record strong{display:block;font-size:2rem;color:var(--yellow)}.record span{font-size:.87rem;color:var(--muted)}.record-table{width:100%;border-collapse:collapse;text-align:left;font-size:.9rem}.record-table th,.record-table td{padding:15px 12px;border-bottom:1px solid var(--line)}.help-panel{max-width:750px;margin:auto}.help-panel article{background:var(--panel);border:1px solid var(--line);padding:24px;border-radius:15px;margin:16px 0}.help-panel p{margin:0;color:#d6d9ea}.help-panel h3{color:var(--yellow)}dialog{border:1px solid #5a5c7f;border-radius:22px;background:#20223e;color:var(--ink);padding:28px;max-width:470px;width:calc(100% - 32px);max-height:90dvh;box-shadow:0 30px 100px #0009}dialog::backdrop{background:#090b22bb;backdrop-filter:blur(6px)}dialog h2{padding-right:20px}.dialog-close{position:absolute;right:10px;top:10px;background:transparent;padding:7px 12px}.auth-tabs{display:flex;gap:6px;margin:12px 0 20px}.auth-tabs button{flex:1;border:1px solid var(--line)}.auth-tabs .active{border-color:var(--yellow);color:var(--yellow)}form label{display:block;margin:14px 0;font-size:.9rem;font-weight:700}form input{display:block;width:100%;margin-top:8px;padding:12px;background:#12152b;border:1px solid #545671;border-radius:10px;color:white}form .primary{width:100%;margin-top:10px}.form-note{font-size:.8rem;line-height:1.8;color:var(--muted)}.form-error{color:#ff9cbd;font-size:.88rem;min-height:26px}.detail-art{display:block;width:200px;border-radius:9px;margin:12px auto 18px}.loading{text-align:center;padding:100px 20px;color:var(--muted)}#toast{position:fixed;bottom:100px;left:50%;transform:translateX(-50%);z-index:100;max-width:calc(100% - 32px);background:#f8f7ff;color:#20223e;border-radius:12px;padding:12px 20px;font-size:.88rem;box-shadow:0 10px 30px #0006;opacity:0;pointer-events:none;transition:opacity .2s}#toast.show{opacity:1}.save-state{font-size:.88rem;color:var(--muted);margin:20px 0}.save-error{color:#ff9cbd}.back-row{display:flex;gap:10px;align-items:center;margin-bottom:20px}.back-row h1{font-size:1.75rem;margin:0}.login-nudge{font-size:.82rem;color:var(--muted);margin:20px 0 0}.login-nudge button{padding:0;background:none;color:var(--yellow);text-decoration:underline;font-size:inherit}.battle-mode .bottom-nav{display:none}.battle-mode #app{padding-bottom:24px}.battle-mode .topbar{height:68px}
@keyframes hit{20%,60%{transform:translateX(10px) rotate(5deg);filter:brightness(1.7)}40%,80%{transform:translateX(-8px)}}@keyframes attack{50%{transform:translateX(22px) rotate(4deg) scale(1.07)}}@keyframes special{50%{filter:brightness(1.8);transform:scale(1.025)}}@keyframes flash{0%{opacity:0}20%,70%{opacity:1}100%{opacity:0}}@keyframes reveal{from{transform:rotateY(90deg) scale(.7);opacity:0}to{transform:rotateY(0) scale(1);opacity:1}}
@media(min-width:900px){.battle-mode .arena{display:flex;justify-content:space-between;position:absolute;top:190px;left:50%;right:auto;width:calc(100% - 64px);max-width:1120px;transform:translateX(-50%);pointer-events:none;gap:0}.battle-mode .fighter{width:clamp(170px,21vw,250px)}.battle-mode .arena .vs{position:absolute;top:60px;left:50%;transform:translateX(-50%);display:none}.battle-mode .question-zone{width:420px;margin-top:35px;position:relative}.battle-mode .fighter-art{height:315px;max-width:240px}.battle-mode .battle-header{max-width:1050px;margin:8px auto 20px}.battle-mode .fighter h3{font-size:1rem}.battle-mode .fighter-label{font-size:.85rem}}
@media(max-width:760px){.topbar{padding:0 18px;height:76px}.top-actions{gap:8px}#player-badge{max-width:80px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#app{padding:18px 16px 105px}.welcome{grid-template-columns:1fr;gap:0}.welcome-copy{padding:0;text-align:center;order:1}.welcome h1{font-size:1.9rem;margin-bottom:8px}.welcome p{margin-bottom:12px}.welcome .eyebrow{display:none}.hero-cards{height:210px;order:0;margin-bottom:5px}.hero-cards .full-card{width:111px;height:165px;left:calc(50% - 55px);top:20px}.hero-cards .full-card:nth-child(1){--move:-87px}.hero-cards .full-card:nth-child(3){--move:87px}.hero-cards .full-card:nth-child(2){width:130px;height:193px;left:calc(50% - 65px);top:0}.hero-tag{font-size:.75rem;padding:4px 13px;bottom:3px}.status-strip{justify-content:center;gap:12px;padding:13px 10px;margin-top:15px}.status-strip span{font-size:.75rem}.mode-tabs{gap:6px}.mode-tabs button{flex:1;padding:.8rem .4rem;font-size:.84rem}.dan-grid{grid-template-columns:repeat(3,1fr);gap:9px}.stage-card{min-height:136px;padding:12px}.stage-number{font-size:2rem}.stage-number small{font-size:.85rem;margin-left:3px}.stage-card .stage-caption{font-size:.7rem;margin-bottom:9px}.stage-card .art-window{width:78%;opacity:.65}.stage-go{display:none}.stars{font-size:.75rem}.section-head{margin-top:23px}.section-head h2{font-size:1.1rem}.section-head span{font-size:.75rem}.level-grid{grid-template-columns:1fr 1fr;gap:10px}.level-grid .stage-number{font-size:1rem}.level-grid .stage-card{min-height:155px}.level-grid .stage-card:last-child{grid-column:span 2}.challenge-banner{padding:20px;grid-template-columns:1fr;gap:15px}.challenge-banner h2{font-size:1.22rem}.challenge-banner button{width:100%}.random-panel{grid-template-columns:1fr}.random-panel>div:first-child{padding:23px}.random-art{display:none}.bottom-nav{bottom:10px;width:calc(100% - 24px);max-width:500px;gap:2px;padding:5px;border-radius:17px}.bottom-nav button{min-width:0;flex:1;flex-direction:column;font-size:1.1rem;gap:2px;padding:8px 3px}.bottom-nav button span{font-size:.72rem}.arena{grid-template-columns:1fr 65px 1fr;gap:8px}.fighter .fighter-art{height:170px;max-width:127px;border-radius:12px}.fighter h3{font-size:.76rem;line-height:1.5;min-height:23px;margin-top:9px}.vs{font-size:1.8rem}.vs small{font-size:.65rem}.fighter-label{font-size:.7rem}.hp-track{height:6px}.battle-header{margin-bottom:14px}.battle-header h2{font-size:.9rem}.battle-header button{font-size:.8rem;padding:.6rem .7rem}.timer{font-size:1.1rem}.question-zone{margin-top:16px;padding:16px 16px 14px}.equation{margin:13px 0;font-size:2.3rem;gap:10px}.answer-input{width:95px;min-height:58px}.keypad{gap:7px;margin-top:10px;max-width:400px}.keypad button{padding:10px;font-size:1.22rem}.battle-message{font-size:.82rem;min-height:25px;margin:3px 0}.question-top{font-size:.75rem}.collection-grid{grid-template-columns:repeat(3,1fr);gap:17px 10px}.collect-card strong{font-size:.72rem}.record-grid{gap:8px}.record{padding:16px 12px}.record strong{font-size:1.3rem}.record span{font-size:.73rem}.record-table{font-size:.8rem}.record-table td,.record-table th{padding:12px 7px}.back-row h1{font-size:1.45rem}.result-data{gap:22px}.result-data b{font-size:1.4rem}.help-panel article{padding:20px}}
@media(max-height:760px) and (max-width:760px){.battle-mode .topbar{height:57px}.battle-mode #app{padding-top:10px}.battle-header{margin-bottom:8px}.fighter .fighter-art{height:130px;max-width:100px}.fighter h3{margin:6px 0 4px;font-size:.7rem}.fighter-label{margin:2px 0}.question-zone{margin-top:10px;padding-top:12px}.equation{margin:9px 0;font-size:2rem}.answer-input{min-height:48px}.keypad button{padding:7px}.keypad{margin-top:8px}.hint-button{margin-top:8px}.battle-message{font-size:.76rem}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* Keep labels readable and show the entire opponent card before a battle. */
.bottom-nav{width:max-content;max-width:calc(100% - 24px)}
.bottom-nav button{flex:0 0 auto;min-width:132px;white-space:nowrap;line-height:1.5}
.bottom-nav button span{white-space:nowrap;flex-shrink:0}
.ready-art{height:auto;min-height:0;margin:12px auto 20px;border-radius:12px;background:transparent;overflow:visible;max-width:100%;text-align:center}
.ready-art img{position:static;display:block;transform:none;min-height:0;width:auto;height:auto;max-width:100%;max-height:min(38dvh,320px);object-fit:contain;margin:auto;border-radius:8px}
.topbar{gap:16px;min-height:86px;height:auto;padding-block:12px}
.brand{flex-shrink:0}.brand strong{white-space:nowrap}
.top-actions{min-width:0;flex-wrap:wrap;justify-content:flex-end}
#account-button{flex-shrink:0;white-space:nowrap}
#player-badge{max-width:160px;overflow-wrap:anywhere}
.section-head{flex-wrap:wrap;row-gap:8px}
.section-head h2{word-break:auto-phrase}
.stage-number,.stage-number small,.stars,.timer,.mode-tabs button,.order-control button,.review-list span{white-space:nowrap}
.stage-card,.record,.collect-card,.welcome-copy{min-width:0}
.stage-caption,.fighter h3,.collect-card strong{word-break:auto-phrase;overflow-wrap:anywhere;line-height:1.65}
.collection-grid{grid-template-columns:repeat(6,minmax(0,1fr))}
#partner-picker{max-width:100%;word-break:auto-phrase;overflow-wrap:anywhere}
.record-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
.record strong{white-space:nowrap;font-variant-numeric:tabular-nums}
.record span{word-break:auto-phrase;overflow-wrap:anywhere}
.battle-header{flex-wrap:wrap;row-gap:10px}.battle-header h2{word-break:auto-phrase}
.question-top{flex-wrap:wrap;gap:8px}
#question{white-space:nowrap}
.equation{gap:clamp(6px,2vw,14px)}
.answer-input{flex-shrink:0;max-width:35%}
.dialog-close{white-space:nowrap}
#modal-content{min-width:0;overflow-wrap:anywhere}
#modal-content h2{word-break:auto-phrase;line-height:1.6}
#modal-content .primary{white-space:normal;word-break:auto-phrase}
.detail-art{max-width:100%;height:auto}
.battle-flash strong{white-space:nowrap;font-size:clamp(1.35rem,6vw,4rem);padding:15px 20px;max-width:90vw}
.result h1,.reward-panel h3,.result h3{word-break:auto-phrase;overflow-wrap:anywhere}
.result-data>div{min-width:0}.result-data b{white-space:nowrap}
.result-actions button{max-width:100%;word-break:auto-phrase}
.record-table{table-layout:fixed}.record-table th,.record-table td{overflow-wrap:anywhere;word-break:auto-phrase}
.record-table th:first-child{width:40%}.record-table td .stars{letter-spacing:0}
@media(max-width:1000px) and (min-width:761px){.collection-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:760px){
 .bottom-nav{width:calc(100% - 24px);max-width:500px}
 .bottom-nav button{flex:1 1 0;min-width:0;padding-inline:3px}
 .topbar{min-height:76px;height:auto}.battle-mode .topbar{height:auto;min-height:57px}
 .top-actions{gap:6px}#player-badge{max-width:72px}
 .section-head{align-items:flex-start;flex-direction:column}
 .collection-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
 .level-grid .stage-number{font-size:clamp(.9rem,3.8vw,1rem)}
 .record-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.record-grid .record:last-child{grid-column:1/-1}
 .battle-header h2{flex:1 1 100%;order:3;text-align:center}
 .stage-caption{font-size:.78rem}
 .record-table th,.record-table td{padding-inline:5px}
 .record-table .stars{font-size:.7rem}
}
@media(max-width:380px){
 .topbar{padding-inline:12px;gap:8px}.brand{gap:8px}.brand strong{font-size:.85rem}.brand>b{font-size:1.9rem}
 #player-badge{font-size:.75rem;max-width:54px}#account-button{font-size:.75rem;padding:.55rem .65rem}
 .dan-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .collection-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .level-grid{grid-template-columns:1fr}.level-grid .stage-card:last-child{grid-column:auto}
 .level-grid .stage-number{font-size:1.1rem}
 .hero-cards .full-card:nth-child(1){--move:-74px}.hero-cards .full-card:nth-child(3){--move:74px}
 .equation{font-size:1.85rem}.answer-input{width:80px}
 .status-strip{align-items:flex-start;flex-direction:column}
}

/* Reading preferences do not restart a game or replace form controls. */
.reading-bar{max-width:1160px;margin:0 auto;padding:12px 24px 0;display:flex;align-items:center;gap:12px;flex-wrap:wrap;font-size:.85rem;color:var(--muted)}
.reading-bar label{font-weight:800;color:var(--ink);white-space:nowrap}
.reading-bar select{font:inherit;font-weight:700;color:var(--ink);background:var(--panel);border:1px solid var(--line);border-radius:9px;padding:8px 28px 8px 12px;max-width:100%;cursor:pointer}
.reading-bar select:focus-visible{outline:3px solid var(--yellow);outline-offset:3px}
.reading-bar>span{font-size:.78rem}
.level-grid .stage-number{white-space:normal;display:block;word-break:auto-phrase;line-height:1.6}
html[data-reading=hiragana] .eyebrow{letter-spacing:.04em}
html[data-reading=hiragana] .collect-card strong,html[data-reading=hiragana] .fighter h3{line-height:1.8;word-break:normal;overflow-wrap:anywhere}
html[data-reading=hiragana] .hero-tag{font-size:.85rem}
html[data-reading=hiragana] .mode-tabs button{letter-spacing:0;padding-inline:.4rem}
.battle-mode #app{position:relative}
@media(min-width:900px){.battle-mode .arena{top:110px;width:calc(100% - 64px)}}
@media(max-width:760px){.reading-bar{padding:10px 16px 0;gap:8px}.reading-bar>span{font-size:.72rem}.mode-tabs button{font-size:.78rem}.battle-header .timer{font-size:1rem}.hero-tag,html[data-reading=hiragana] .hero-tag{font-size:.7rem;padding-inline:10px}.question-top{font-size:.75rem}#account-button{font-size:.75rem}}
@media(max-width:380px){.reading-bar>span{flex:1 1 100%}.brand strong{font-size:.78rem}#account-button{padding-inline:.5rem}.battle-header .timer{font-size:.9rem}}

.modal-reading{display:flex;align-items:center;gap:10px;margin:0 32px 20px 0;font-size:.85rem}.modal-reading select{max-width:100%;min-width:0;background:#22223e;color:#fff;border:1px solid #454568;border-radius:8px;padding:8px;font:inherit}.vs>span{display:block;font-size:clamp(.75rem,2vw,1.1rem)}

.vs small span{display:block;white-space:nowrap}

.battle-times{text-align:right;flex-shrink:0}.battle-times .timer{white-space:nowrap;font-size:clamp(1rem,2.3vw,1.4rem)}.battle-times .remaining-time{font-size:.9rem;margin-top:3px}.battle-times small{display:block;color:var(--muted);font-size:.7rem;margin-top:3px}
/* VI card frames: ink, paper and the original cards' elemental colors. */
:root{--bg:#10161e;--panel:#202935;--line:#475261;--ink:#fff8e8;--muted:#c5ccd4;--yellow:#f4d47c;--mint:#96b7e2;--pink:#ffac95}
body{background:radial-gradient(ellipse at 80% 0,#384659 0,transparent 52%),repeating-linear-gradient(110deg,#ffffff02 0 1px,transparent 1px 7px),var(--bg)}
.topbar{border-bottom:1px solid #ccb87955}.reading-bar select,.modal-reading select{background:#202935;border-color:#6b7583}.welcome{border-bottom:1px solid #d9c08744;padding-bottom:20px}.hero-tag{border:1px solid #796d42;box-shadow:3px 4px 0 #10161e}.hero-cards .full-card{border-color:#ead9a4}
.dan-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;margin-top:20px}.dan-card{min-width:0;padding:9px;background:linear-gradient(140deg,var(--accent),#e5d5ae);border:2px solid #dacb9f;border-radius:13px;box-shadow:0 7px 0 #080b0fcc,inset 0 0 0 2px #26303d;overflow:hidden}.dan-card-art{height:200px;background:#151f2b;border:2px solid #323c4a;border-radius:6px;overflow:hidden}.dan-card-art .art-window{height:100%;background:#131d29}.dan-card-art img{position:static;transform:none;width:100%;height:100%;min-height:0;object-fit:contain}.dan-card-copy{display:flex;justify-content:space-between;gap:8px;align-items:center;color:#17202b;padding:12px 5px 9px}.dan-card h3{margin:0;font-size:2rem;line-height:1.2}.dan-card h3 small{font-size:1rem;margin-left:5px}.dan-card .stars{color:#534119}.dan-card .stars .off{color:#5a6470}.dan-actions{display:grid;grid-template-columns:1fr 1fr;gap:6px}.dan-actions button{min-width:0;white-space:nowrap;background:#212e3f;border:1px solid #0a1420;border-radius:7px;color:#fff9df;font-size:.85rem;padding:12px 4px;box-shadow:0 2px 0 #171f29}.dan-actions button:last-child{background:#f8efd5;color:#252e3a;border-color:#536378}.dan-actions button:hover{background:#445469;color:white}
.challenge-banner{background:linear-gradient(115deg,#3b3f29,#26313f);border:2px solid #c5b57b;box-shadow:inset 0 0 0 4px #151e2a}.rush-banner{background:linear-gradient(120deg,#27384f,#19283c);border-color:#7a97bc}.rush-select{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:16px 0 8px;font-size:.9rem}.rush-select select{font:inherit;color:#202833;background:#f5efd7;border:2px solid #738baa;border-radius:8px;padding:10px;max-width:100%}.rush-record-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}.rush-record-grid>div{background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:14px;display:grid;gap:8px}.rush-record-grid strong{color:var(--yellow);font-size:1.4rem}
.bottom-nav{background:#202a37f5;border-color:#a79b70}.bottom-nav button{color:#d3dae4}.question-zone{background:#1d2735;border:2px solid #a5b485;box-shadow:inset 0 0 0 4px #111a25}.answer-input{background:#101a26}.keypad button{background:#3e4c5e;box-shadow:0 3px 0 #101a27}.fighter .fighter-art{border-color:#e2c885}.stage-card{background:#202935}.stage-card:after{background:linear-gradient(90deg,#151f2b 15%,#151f2bc0 45%,transparent)}.status-strip,dialog{background:#202935;border-color:#657589}.reward-panel{background:radial-gradient(ellipse at center,#596344,#1b2430 75%)}.hint-box{background:#121c28}.record-table th,.record-table td{border-color:#475261}
@media(max-width:760px){.dan-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.dan-card-art{height:170px}.dan-card-copy{flex-wrap:wrap;padding:10px 2px}.dan-card h3{font-size:1.6rem}.dan-card h3 small{font-size:.85rem}.dan-card .stars{font-size:.75rem}.dan-actions{grid-template-columns:1fr}.dan-actions button{font-size:.8rem;padding:10px 4px}.rush-record-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.dan-card{padding:7px}.dan-card-art{height:160px}}
@media(max-width:350px){.dan-card-art{height:138px}.dan-card h3{font-size:1.45rem}}

.rush-shortcut{display:inline-block;color:var(--yellow);font-weight:800;margin:0 0 16px;text-underline-offset:5px}.rush-banner{scroll-margin-top:20px}.battle-order{color:var(--yellow);font-size:.9rem}
/* Additional VI battle disciplines keep the original card borders and artwork. */
.subject-tabs{display:grid;grid-template-columns:1.35fr 1fr 1fr 1fr;gap:10px;margin:4px 0 24px}.subject-tabs button{display:grid;justify-items:center;align-content:center;gap:3px;min-width:0;border:2px solid #718298;background:#232f3e;padding:13px 6px}.subject-tabs b{font-size:1.7rem;line-height:1}.subject-tabs span{white-space:nowrap}.subject-tabs small{font-size:.65rem}.subject-tabs [aria-pressed=true]{background:var(--yellow);color:#202a36;border-color:#fff0bb;box-shadow:0 4px 0 #806638}.arithmetic-intro{color:var(--muted);line-height:1.9}.arithmetic-courses{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr));gap:22px;margin:20px 0 32px}.arithmetic-course{padding:18px;border:3px solid var(--accent);box-shadow:inset 0 0 0 3px #111c2b,0 8px 0 #09121e;background:linear-gradient(140deg,#35455b,#182433);border-radius:16px;min-width:0}.course-heading{display:flex;gap:18px;align-items:center}.course-heading img{width:100px;height:148px;object-fit:contain;border:1px solid #e9dcaa;border-radius:7px;background:#151d28}.course-heading h2{margin:0 0 8px}.course-heading p{font-size:.85rem;margin-bottom:8px}.course-levels{display:grid;gap:10px;margin-top:16px}.course-levels button{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#f2ecd5;color:#202c3b;border:2px solid #b4c58f;font-size:.9rem;text-align:left}.course-levels button>span:first-child{min-width:0;line-height:1.7}.course-levels .stars{white-space:nowrap;color:#7a581d}.course-levels .stars .off{color:#7e836d}.course-levels b{display:inline-block;border:1px solid #47576d;border-radius:50%;width:25px;height:25px;text-align:center;margin-right:5px}.demo-button{margin-top:14px;width:100%;color:var(--yellow)}
.arithmetic-mode .equation{font-size:clamp(1.5rem,4.5vw,2.2rem);gap:8px}.arithmetic-mode #question{white-space:nowrap}.arithmetic-mode .answer-input{width:96px;min-width:0}.guide-toggle{display:flex;gap:6px;margin:15px 0}.guide-toggle button{flex:1;min-width:0;font-size:.75rem;padding:10px 5px;border:1px solid var(--line)}.guide-toggle [aria-pressed=true]{color:#222a35;background:var(--yellow)}.column-guide{text-align:left;min-width:0}.guide-companion{display:flex;gap:12px;align-items:center;border:1px solid #6b7f99;padding:10px;border-radius:10px;background:#26313f}.guide-companion img{width:48px;height:72px;object-fit:contain;border-radius:4px}.guide-companion strong{font-size:.85rem;color:var(--yellow)}.guide-companion p{font-size:.73rem;line-height:1.7;margin:5px 0 0}.column-board{margin:18px auto;max-width:310px;background:#f3edd6;color:#17263a;border:3px solid #657c9b;border-radius:10px;padding:8px 7px;box-shadow:inset 0 0 0 2px #fff8e7}.column-row{display:grid;grid-template-columns:24px repeat(3,minmax(0,1fr));gap:3px}.column-cell{min-width:0;text-align:center;font-size:1.8rem;font-weight:800;line-height:1.8;position:relative;border-radius:5px}.column-cell.active-place{background:#afc7e6;box-shadow:inset 0 0 0 1px #485e7a}.column-labels .column-cell{font-size:.67rem;line-height:1.5;padding:4px 0;background:#e4dcc0}.column-notes .column-cell{font-size:.6rem;line-height:1.4;min-height:30px;padding:5px 0;color:#9a401e}.column-cell s{font-size:.9rem;color:#897f6a;margin-right:4px}.column-cell b{font-size:1.5rem;color:#a23d1c}.column-sign{align-self:center;font-size:1.6rem}.column-answer{border-top:3px solid #354253;margin-top:4px;padding-top:5px}.column-answer .column-cell{color:#163865}.guide-step{background:#162231;border:1px solid #667a94;border-radius:12px;padding:14px;line-height:1.8}.guide-step>p{font-size:.85rem;margin:0 0 12px}.guide-step .guide-step-label{color:var(--yellow);font-size:.75rem;font-weight:800}.guide-step .borrow-note{font-size:.75rem;color:#ffcfaa;border-left:3px solid #d9ae75;padding-left:10px}.step-blocks{display:flex;flex-wrap:wrap;align-items:center;gap:8px;background:#23344b;border-radius:8px;padding:10px;margin-bottom:10px}.step-blocks>div{display:flex;gap:3px;flex-wrap:wrap;max-width:100%;align-items:center}.one-block{font-style:normal;font-size:1rem;color:#ffdf6c;line-height:1.3}.ten-block{display:inline-grid;place-items:center;font-style:normal;background:#efe4aa;border:1px solid #81904c;color:#232d3b;border-radius:3px;font-size:.7rem;min-width:22px;height:30px}.step-blocks>div:nth-of-type(2) .one-block{color:#a6dbff}.blocks-caption{font-size:.73rem!important;color:var(--muted)}.step-input-label{display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:.8rem}.step-input-label input{width:72px;min-width:0;background:#f7f0d8;border:2px solid var(--yellow);border-radius:7px;padding:8px;text-align:center;font:inherit;font-size:1.4rem;color:#17273d}.step-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.step-actions button,.guide-step>button{font-size:.8rem;padding:10px 14px}.guide-error{color:#ffcbae;font-size:.75rem!important;margin-top:12px!important}.guide-example{background:#2e3b4c;border:1px solid #a09a62;border-radius:8px;padding:12px;color:#fff3c9}.guide-total{font-weight:900;font-size:1.25rem!important;text-align:center;color:var(--yellow)}.regroup-view{display:flex;gap:5px;flex-wrap:wrap;justify-content:center;align-items:center;background:#313f52;padding:12px;border-radius:8px;margin:12px 0;font-size:.8rem}.guide-back{display:block;margin:14px auto 0;background:none;text-decoration:underline;color:var(--muted)}.number-blocks{display:flex;gap:4px;flex-wrap:wrap;justify-content:center;margin:10px 0}.number-blocks i{font-style:normal;display:inline-grid;place-items:center;background:#ecd997;color:#233143;border-radius:4px;padding:4px;font-size:.8rem}.number-blocks .unit{background:none;color:#ffe589}.arithmetic-hint>b{color:var(--yellow)}
@media(max-width:760px){.subject-tabs{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.subject-tabs button{grid-template-columns:auto auto;justify-content:center;column-gap:10px;padding:12px 8px}.subject-tabs small{grid-column:1/-1}.subject-tabs span{font-size:.85rem}.column-mode .fighter .fighter-art{height:105px;max-width:75px}.column-mode .fighter h3{font-size:.68rem;min-height:0}.column-mode .arena{grid-template-columns:1fr 65px 1fr}.column-mode .question-zone{padding:12px}.course-heading{gap:12px}.course-heading img{width:78px;height:116px}.course-heading h2{font-size:1.3rem}.course-levels button{font-size:.78rem;padding:12px 8px}.course-levels .stars{font-size:.7rem;letter-spacing:0}.arithmetic-mode .equation{font-size:1.5rem;gap:5px}.arithmetic-mode .answer-input{width:76px}.column-guide .column-cell{font-size:1.5rem}.column-guide .column-labels .column-cell{font-size:.65rem}.column-guide .column-notes .column-cell{font-size:.55rem}}

.foil-tabs{display:flex;gap:10px;margin:20px 0}.foil-tabs button{flex:1;white-space:nowrap;font-size:clamp(12px,3.5vw,18px);padding:14px 8px}.foil-tabs [aria-pressed="true"]{background:#ffe36b;color:#182639;border-color:#fff3a0}.shiny-card{border-color:#d7b65a;background:linear-gradient(125deg,#24364e,#49355c,#285565)}.shiny-reward{border:2px solid #ffe36b;background:linear-gradient(130deg,#1b304b,#493655,#225269);box-shadow:0 0 32px #e7c86533}.shiny-badge{color:#fff09b;font-weight:900;letter-spacing:.12em}.shiny-reward h2{font-size:clamp(18px,5vw,26px);line-height:1.6}.shiny-reward .primary{max-width:100%;white-space:normal}.status-strip small{font-size:12px;color:#fce490}
@media(max-width:600px){.collection-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.collect-card strong{line-height:1.65;overflow-wrap:anywhere;word-break:normal;line-break:strict}}

/* Reading aids and longer translated labels */
ruby{ruby-position:over}rt{font-size:.58em;font-weight:600;line-height:1.1}html[data-reading="furigana"] h1,html[data-reading="furigana"] h2,html[data-reading="furigana"] h3,html[data-reading="furigana"] button,html[data-reading="furigana"] p{line-height:2}html[lang="en"] .dan-actions button,html[lang="es"] .dan-actions button{font-size:12px;padding:10px 4px}html[lang="en"] .bottom-nav span,html[lang="es"] .bottom-nav span{font-size:12px;white-space:nowrap}.reading-bar select{max-width:100%}.reading-bar{flex-wrap:wrap}.stage-number,.stage-caption,.fighter h3,.course-heading h2,.battle-header h2{overflow-wrap:anywhere}html[lang="es"] .subject-tabs button,html[lang="en"] .subject-tabs button{min-width:0}.column-labels .column-cell{font-size:12px;overflow-wrap:normal;word-break:normal}.step-actions,.result-actions{flex-wrap:wrap}.guide-toggle button{white-space:normal}html[lang="es"] .challenge-banner .primary,html[lang="en"] .challenge-banner .primary{white-space:normal}@media(max-width:600px){html[lang="en"] .column-labels .column-cell,html[lang="es"] .column-labels .column-cell{font-size:10px}.top-actions{min-width:0}.top-actions button{white-space:normal;max-width:110px}.welcome h1{font-size:clamp(26px,7vw,40px)}.foil-tabs button{white-space:normal}.battle-header{flex-wrap:wrap}}
@media(max-width:360px){.hero-cards .full-card:nth-child(1){--move:-58px}.hero-cards .full-card:nth-child(3){--move:58px}.hero-tag{max-width:calc(100% - 12px);white-space:normal;text-align:center}}

.play-settings{display:flex;flex-wrap:wrap;gap:12px;padding:14px;margin:16px 0;border:1px solid #b8cf8766;border-radius:14px;background:#182639;}
.play-settings label{display:flex;flex:1 1 220px;min-width:0;flex-direction:column;gap:8px;color:#fff3bb;font-size:.85rem;font-weight:700;}
.play-settings select{width:100%;min-width:0;padding:10px 30px 10px 12px;border:1px solid #819fc6;border-radius:8px;background:#101a28;color:#fff;font:inherit;}

.series-picker{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin:16px 0;font-weight:700}.series-picker select{max-width:100%;min-width:0;background:#101a28;color:#fff;border:1px solid #819fc6;border-radius:8px;padding:10px;font:inherit}.progress-panel,.rank-panel,.journal-panel{margin:28px 0;padding:22px;background:#172537;border:1px solid #cbb45b88;border-radius:18px}.progress-rows{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:16px 0}.progress-rows span{display:flex;flex-direction:column;gap:8px;background:#101a28;padding:12px;border-radius:10px}.card-meta{display:flex;justify-content:center;gap:12px;font-size:.85rem;color:#f2d788;flex-wrap:wrap}.rarity-line{display:block;color:#f2d788;margin:8px 0}.reward-rule{background:#172537;border-radius:12px;padding:12px;line-height:1.8}.bonus-reward{border:2px solid #f2d788}.table-scroll{max-width:100%;overflow-x:auto}.my-rank{background:#9fbd4a33}.rank-panel td{overflow-wrap:anywhere}.rank-panel select{width:100%}details{line-height:1.9}summary{cursor:pointer;font-weight:700}.record-grid{gap:12px}.record-grid .record strong{overflow-wrap:anywhere}.record-grid .record span{line-height:1.6}.journal-panel select{max-width:100%}

.combat-home{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;margin:28px 0}.combat-home>div{padding:24px;border:1px solid #d3b44e;border-radius:18px;background:linear-gradient(130deg,#172e4b,#182331)}.team-select{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.team-select label{min-width:0}.team-select select{max-width:100%;width:100%;padding:10px;background:#121f2f;color:white;border:1px solid #d3b44e}.team-select img{width:100%;height:160px;object-fit:contain;margin:12px 0}.team-select span{display:block;font-size:.8rem}.combat-arena{display:grid;grid-template-columns:1fr 1fr;gap:20px;background:radial-gradient(ellipse,#284263,#101a27);padding:20px;border:1px solid #c3ac63;border-radius:20px}.combat-team{display:flex;align-items:center;gap:8px}.team-card{flex:1;min-width:0;text-align:center;opacity:.65}.team-card.active{opacity:1;filter:drop-shadow(0 0 5px #ffd750)}.team-card.fallen{filter:grayscale(1);opacity:.25}.team-card img{width:100%;max-height:200px;object-fit:contain}.team-card span{display:block;font-size:.65rem}.combat-arena progress{width:100%;accent-color:#71a3e5}.combat-opponent{display:flex;flex-direction:column;align-items:center;gap:6px}.combat-opponent img{height:230px;max-width:100%;object-fit:contain}.combat-status{display:flex;flex-wrap:wrap;justify-content:space-between;gap:10px;margin:12px 0}.combat-mode .question-zone{margin-top:12px}.combat-mode .equation{font-size:2rem}#combat-boss{color:#ffdc64}@media(max-width:600px){.combat-home{grid-template-columns:1fr}.combat-arena{padding:10px;gap:10px}.combat-opponent img{height:170px}.team-card span{display:none}.team-card small{font-size:.6rem}.team-select img{height:125px}.team-select select{font-size:.75rem}.combat-mode .battle-header{gap:8px}.combat-mode .battle-header h2{font-size:1rem}}

.record-links{display:flex;flex-wrap:wrap;gap:10px;margin:20px 0}.record-links a{padding:10px 14px;border:1px solid #d3b44e77;background:#172537;border-radius:999px;color:#f2d788;text-decoration:none}.record-grid{grid-template-columns:repeat(auto-fit,minmax(140px,1fr))}.record-grid .record strong{font-size:1.5rem}.record-table td{min-width:65px}.record-table th{white-space:nowrap}.rank-panel,.progress-panel,.journal-panel{scroll-margin-top:80px}

.combat-settings{margin:8px 0}.combat-settings summary{font-size:.8rem;color:#f2d788}.team-card small{display:block;white-space:nowrap;letter-spacing:-.3px}
@media(max-width:760px){.combat-mode .topbar{min-height:48px;padding-block:6px}.combat-mode .brand b{font-size:24px}.combat-mode .brand span{font-size:10px}.combat-mode .top-actions{display:none}.combat-mode .reading-bar{padding-top:6px;gap:6px;font-size:12px}.combat-mode .reading-bar>span{display:none}.combat-mode .reading-bar select{padding-block:5px}.combat-mode #app{padding-top:8px}.combat-mode .battle-header{margin-bottom:4px;row-gap:4px}.combat-mode .battle-header h2{margin:0}.combat-mode .combat-status{font-size:.8rem;margin:6px 0}.combat-mode .combat-opponent img{height:130px}.combat-mode .combat-opponent{gap:3px;font-size:.8rem}.combat-mode .team-card small{font-size:9px}.combat-mode .question-zone{padding:10px;margin-top:8px}.combat-mode .equation{margin:6px 0;font-size:1.8rem}.combat-mode .answer-input{min-height:48px;height:54px;width:72px}.combat-mode #battle-message{font-size:.8rem;margin:6px 0;min-height:20px}.combat-mode .keypad{gap:6px;margin-top:8px}.combat-mode .keypad button{padding:6px;min-height:42px}.combat-mode .combat-team{gap:6px}}

/* Collection display preferences: keep the complete card visible at every size. */
.collection-toolbar{display:flex;align-items:end;flex-wrap:wrap;gap:16px;margin:20px 0}
.collection-sizes{border:0;padding:0;margin:0;min-width:0;flex:1 1 240px}
.collection-sizes legend,.collection-sort{font-weight:800;font-size:.95rem}
.collection-sizes legend{margin-bottom:8px}
.collection-sizes>div{display:flex;gap:6px}
.collection-sizes button{flex:1;min-width:0;padding:10px 8px;min-height:44px;font-size:.9rem;white-space:nowrap}
.collection-sizes button[aria-pressed=true]{background:var(--yellow);color:#182433;box-shadow:inset 0 -3px 0 #b29432}
.collection-sort{display:flex;flex-direction:column;gap:8px;flex:1 1 220px;min-width:0}
.collection-sort select{width:100%;min-width:0;max-width:100%}
.collection-grid[data-size=large]{grid-template-columns:repeat(4,minmax(0,1fr))}
.collection-grid[data-size=medium]{grid-template-columns:repeat(6,minmax(0,1fr))}
.collection-grid[data-size=small]{grid-template-columns:repeat(10,minmax(0,1fr));gap:10px 6px}
.collection-grid .collect-card img{object-fit:contain;display:block}
.collection-grid[data-size=small] .collect-card strong,.collection-grid[data-size=small] .card-meta{display:none}
.collection-grid[data-size=small] .selected-mark{top:3px;left:3px;width:10px;height:10px;padding:0;border-radius:50%;font-size:0;box-shadow:0 0 0 1px #182433}
.collection-grid[data-size=small] .collect-card img{border-radius:5px;border-width:1px}
@media(max-width:1000px){.collection-grid[data-size=large]{grid-template-columns:repeat(3,minmax(0,1fr))}.collection-grid[data-size=medium]{grid-template-columns:repeat(4,minmax(0,1fr))}.collection-grid[data-size=small]{grid-template-columns:repeat(8,minmax(0,1fr))}}
@media(max-width:600px){.collection-grid[data-size=large]{grid-template-columns:repeat(2,minmax(0,1fr))}.collection-grid[data-size=medium]{grid-template-columns:repeat(3,minmax(0,1fr))}.collection-grid[data-size=small]{grid-template-columns:repeat(5,minmax(0,1fr));gap:8px 4px}.collection-toolbar{gap:12px}.collection-grid[data-size=medium] .card-meta{gap:3px;font-size:.7rem}}

.collection-sort select{min-height:44px;padding:10px 12px;border:1px solid #e8d68b55;border-radius:12px;background:#101d2e;color:#fff;font:inherit}

.advanced-entry{width:100%;margin:12px 0 4px;padding:14px 12px;border:1px solid #e8d68b80;background:linear-gradient(110deg,#17273c,#354254);color:#ffe495;line-height:1.6}.advanced-entry[aria-pressed=true]{box-shadow:inset 0 -3px 0 var(--yellow)}
/* A short, visual route from calculation to game mode. */
.home-hero{min-height:0;padding:22px 28px;margin-bottom:16px;gap:20px;align-items:center}
.home-hero .welcome-copy h1{font-size:2rem;margin:6px 0 12px;line-height:1.25}
.home-hero .welcome-copy>p:not(.eyebrow){display:none}
.home-hero .hero-cards{height:190px;min-height:0}
.home-hero .hero-cards .full-card{max-height:180px;object-fit:contain}
.home-hero .hero-tag{display:none}
.home-options{padding:16px;margin:24px 0 12px;border:1px solid #dbc98244;border-radius:14px;background:#14202f}
.home-options summary{cursor:pointer;color:#f9df8d;font-weight:800;min-height:26px}
.home-record-link{margin:0 0 20px}
.hub-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:22px 0 16px}
.hub-tabs button{display:flex;align-items:center;justify-content:center;gap:16px;min-width:0;padding:12px;border:1px solid #959fac44;background:#172538;color:#dfe4eb;border-radius:18px;font-size:1.1rem}
.hub-tabs img{width:52px;height:76px;object-fit:contain;transform:rotate(-8deg);border-radius:5px}
.hub-tabs button[aria-pressed=true]{border-color:#ffe082;background:linear-gradient(120deg,#3b4c62,#232f3f);box-shadow:inset 0 -4px #f0ca62;color:#ffe495}
.home-panel{padding:24px;border:1px solid #c9b96955;border-radius:22px;background:linear-gradient(145deg,#18273b,#111c2a)}
.home-panel[hidden]{display:none}
.home-panel-heading{margin-bottom:20px}
.home-panel-heading h2{font-size:1.45rem;margin:0 0 8px;color:#ffdf86}
.home-panel-heading p{font-size:.9rem;color:#bec5ce;margin:0;line-height:1.7}
.home-panel .mode-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;padding:6px;background:#0e1824;border-radius:14px}
.home-panel .mode-tabs button{min-width:0;padding:12px 8px;white-space:normal;line-height:1.5;font-size:.9rem;border-radius:10px;min-height:46px;overflow-wrap:anywhere}
.home-panel .mode-tabs button[aria-pressed=true]{background:#f3d67e;color:#152232}
.home-panel .challenge-banner{margin:18px 0;min-width:0}
.home-panel .combat-home{margin:0}
.home-panel .dan-grid{margin-top:18px}
.home-panel .dan-card{min-width:0}
#title-return{margin:0 0 20px 10px}
@media(max-width:760px){.home-hero{padding:14px 16px;display:grid;grid-template-columns:1fr 110px;gap:4px}.home-hero .eyebrow{display:none}.home-hero .welcome-copy h1{font-size:1.3rem}.home-hero .hero-cards{height:120px;min-height:0}.home-hero .hero-cards .full-card{width:67px;height:100px}.home-hero #partner-picker{font-size:.7rem;padding:6px;max-width:100%;overflow-wrap:anywhere}.status-strip{margin-block:12px}.hub-tabs{gap:8px;margin:16px 0 12px}.hub-tabs button{flex-direction:column;gap:8px;padding:10px 4px;font-size:.9rem;line-height:1.4;overflow-wrap:anywhere}.hub-tabs img{height:56px;width:40px}.home-panel{padding:14px 10px;border-radius:16px}.home-panel-heading h2{font-size:1.2rem}.home-panel-heading{margin-bottom:14px}.home-panel .mode-tabs{grid-template-columns:repeat(2,minmax(0,1fr))}.subject-tabs button{padding:10px 4px}.subject-tabs button small{display:none}.section-head{margin-top:20px}.section-head>span{display:none}.home-panel .challenge-banner{padding:18px 12px}.home-panel .combat-home>div{padding:18px 12px}}
/* Opening title: original VI card art, with a readable central title. */
#title-screen{position:fixed;inset:0;width:100vw;max-width:none;height:100dvh;max-height:none;margin:0;padding:0;border:0;border-radius:0;background:#0c1520;color:white;overflow:hidden}
#title-screen::backdrop{background:#0c1520}
.title-collage{position:absolute;inset:-6%;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:16px;align-content:center;transform:rotate(-8deg);pointer-events:none;opacity:.8}
.title-collage img{width:100%;aspect-ratio:1456/2156;object-fit:contain;border-radius:10px;box-shadow:0 12px 30px #0009}
.title-collage img:nth-child(3n){transform:rotate(12deg)}
.title-shade{position:absolute;inset:0;background:radial-gradient(ellipse at center,#08121eed 0%,#0a1420d9 30%,#0a142033 80%),linear-gradient(0deg,#060e18cc,transparent 40%)}
.title-center{position:relative;min-height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:28px 20px;text-align:center;gap:18px}
.title-crest{display:block;color:#ffde7b;font-weight:1000;font-style:italic;font-size:clamp(4rem,12vw,8rem);line-height:1;text-shadow:0 5px 0 #776128,0 0 36px #ffe49566;letter-spacing:-.08em}
.title-center h1{font-size:clamp(1.8rem,5vw,3.8rem);line-height:1.45;margin:0;color:#fff4cc;text-shadow:0 4px 0 #111e2e,0 0 24px #000;font-weight:950}
.title-center h1 span{display:block}
.title-center p{margin:0;color:#e9ecd6;font-weight:700;line-height:1.8}
#title-start{min-width:220px;min-height:58px;font-size:1.2rem;margin-top:12px;border:1px solid #fff1b4;box-shadow:0 5px 0 #93752b,0 0 28px #f5d47b55}
.title-center small{color:#dce2e9}
@media(max-width:600px){.title-collage{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;inset:-8% -12%}.title-collage img{border-radius:6px}.title-center{gap:18px}.title-center h1{font-size:clamp(1.65rem,7vw,2.6rem)}.title-center p{font-size:.9rem}.title-shade{background:radial-gradient(ellipse at center,#08121ef5 0%,#0a1420de 34%,#0a142044 85%)}}
@media(max-height:500px){.title-center{gap:8px;padding:12px}.title-crest{font-size:3rem}.title-center h1{font-size:1.8rem}.title-center p,.title-center small{display:none}#title-start{margin-top:4px;min-height:44px}}
.home-hero .welcome-copy{order:0;text-align:left}
.home-hero .hero-cards{order:1}
.home-panel .rarity-line{color:#59421b;font-weight:800}
@media(max-width:760px){.home-hero .hero-cards{display:flex;align-items:center;justify-content:center;margin:0}.home-hero .hero-cards .full-card:first-child{position:static;transform:rotate(7deg);width:74px;height:110px;max-height:110px}.home-hero .hero-cards .full-card:nth-child(n+2){display:none}.home-hero .welcome-copy h1{font-size:1.35rem}.home-panel .dan-card{display:grid;grid-template-columns:52px minmax(0,1fr);gap:7px;padding:8px}.home-panel .dan-card-art{height:78px}.home-panel .dan-card-copy{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;padding:0;gap:5px}.home-panel .dan-card h3{font-size:1.5rem}.home-panel .dan-card h3 small{display:block;font-size:.7rem;margin:2px 0 0}.home-panel .dan-actions{grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px}.home-panel .dan-actions button{white-space:normal;overflow-wrap:anywhere;font-size:.7rem;padding:7px 3px;min-height:44px;line-height:1.5}.home-panel .dan-grid{gap:12px 8px}.home-panel .dan-card .stars{font-size:.7rem}.home-panel .rarity-line{font-size:.65rem}}
/* Finish collection: visual labels, counts and a clear current selection. */
.finish-gallery{border:1px solid #d8c27e66;border-radius:20px;padding:18px;background:#162539;margin:18px 0}
.finish-gallery h2,.finish-current h2{margin:0 0 8px;font-size:1.3rem;color:#ffe493}
.finish-gallery>p{color:#c7ced7;font-size:.9rem;line-height:1.6}
.finish-options{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.finish-options button{display:flex;align-items:center;gap:10px;text-align:left;padding:10px;min-width:0;border:2px solid #818d9c66;background:#101c2b;border-radius:12px}
.finish-options button[aria-pressed=true]{border-color:#ffdf74;box-shadow:0 0 0 2px #ffdf7433;background:#364150}
.finish-options img{width:48px;height:72px;object-fit:contain;flex-shrink:0}
.finish-options span{min-width:0;display:grid;gap:5px}.finish-options strong{font-size:.85rem;overflow-wrap:anywhere;line-height:1.5}.finish-options small{font-size:.68rem;color:#b5bcc6}.finish-options b{font-size:.85rem;color:#ffe493}
.finish-current{padding:14px 18px;border-left:4px solid #ffdf74;background:#232e3d;border-radius:10px}.finish-current>span{font-size:.8rem;color:#bfc6d0}.finish-current button{margin-top:4px}.finish-preview-art{display:block;width:100%;max-height:60dvh;object-fit:contain}
/* Rankings live beside each battle and in a complete grouped directory. */
.dan-rank{grid-column:1/-1;margin-top:8px;border-top:1px solid #222c3a55;color:#182638;padding-top:8px}.dan-rank summary{cursor:pointer;font-weight:900;font-size:.8rem;padding:6px 0}.dan-card:has(.dan-rank[open]){grid-column:1/-1}.dan-rank-results{background:#14202f;border-radius:12px;padding:12px;color:#f0f5df;margin-top:8px}
.rank-order,.rank-filters{display:flex;gap:6px;flex-wrap:wrap}.rank-order button,.rank-filters button{padding:10px 12px;min-height:44px;font-size:.8rem;border:1px solid #9aab7766}.rank-order button[aria-pressed=true],.rank-filters button[aria-pressed=true]{background:#ffe18b;color:#152539}
.rank-dashboard>p{line-height:1.8}.rank-category{margin:26px 0;border:1px solid #b3bcc755;padding:18px;border-radius:18px;background:#152336}.rank-category[hidden]{display:none}.rank-category h2{font-size:1.2rem;margin:0 0 16px;color:#f8db8b}.rank-board-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.rank-board{border:1px solid #9facbc66;border-radius:12px;background:#0e1826;min-width:0;overflow:hidden}.rank-board summary{cursor:pointer;padding:14px;display:grid;gap:8px}.rank-board summary strong{font-size:.85rem;line-height:1.6}.rank-board summary span,.rank-board summary small{font-size:.72rem;color:#b8c1cc}.rank-board summary b{font-size:1.25rem;color:#ffe493}.rank-board[open]{grid-column:span 2;border-color:#ffdf74}.board-results{padding:12px}.rank-rule{font-size:.78rem;line-height:1.7}.own-rank{padding:12px;border:1px solid #ffd46f;border-radius:10px;background:#2a3748;display:flex;align-items:center;flex-wrap:wrap;gap:10px}.own-rank span,.own-rank small{font-size:.8rem}.own-rank strong{font-size:1.2rem;color:#ffe493}.rank-list{list-style:none;margin:12px 0 0;padding:0}.rank-list li{display:grid;grid-template-columns:28px minmax(0,1fr) auto;gap:8px;align-items:center;padding:12px 8px;border-bottom:1px solid #8c95a033}.rank-list li>span{overflow-wrap:anywhere;font-size:.85rem}.rank-list li>strong{font-size:.9rem;color:#f7e5ad}.rank-place{color:#a4afbd}.rank-list li:nth-child(-n+3) .rank-place{color:#ffdc76;font-size:1.2rem}.rank-list li.is-mine{background:#394a61;border-radius:8px}
/* Personal progress uses consistent colored panels and readable values. */
#record-summary{gap:12px;padding:18px;background:#101c2c;border:1px solid #a9b6c666;border-radius:20px;margin:20px 0}
#record-summary .record{border-radius:14px;background:#1c2c40;border:1px solid #8a9eb8;border-top:5px solid #94b4dd;padding:18px;display:flex;flex-direction:column;gap:10px;min-height:125px}
#record-summary .record:nth-child(2){background:#203d4c;border-color:#87c8df}#record-summary .record:nth-child(3){background:#3f354a;border-color:#c4a0ed}#record-summary .record:nth-child(4){background:#4b3d24;border-color:#edc573}#record-summary .record:nth-child(5){background:#243448;border-color:#95b0d4}#record-summary .record:nth-child(6){background:#4b3042;border-color:#eda6cd}#record-summary .record:nth-child(7){background:#31405a;border-color:#9bb8ef}
#record-summary .record strong{font-size:1.6rem;color:#fff6d6}#record-summary .record span{font-size:.85rem;line-height:1.6;color:#dae1ea}
#personal-bests,#record-journal,#reward-progress>section{border:1px solid #adbcd066;border-top:5px solid #dbc57c;border-radius:18px;padding:20px;margin:24px 0;background:#142337}#personal-bests{border-top-color:#86c9e8}#record-journal{border-top-color:#c7a6e8}
.personal-best-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.personal-best{display:flex;flex-direction:column;gap:10px;padding:16px;background:#1f2f44;border:1px solid #95a8c088;border-left:4px solid #95a8c0;border-radius:12px;min-width:0}.personal-best[data-record-kind=arithmetic]{border-left-color:#c2a6ec;background:#32364b}.personal-best[data-record-kind=rush],.personal-best[data-record-kind=mix]{border-left-color:#86c9e8;background:#203f4a}.personal-best[data-record-kind=adventure]{border-left-color:#ecc26b;background:#423e28}.personal-best span{font-size:.85rem;line-height:1.6}.personal-best strong{font-size:1.4rem;color:#fff0bc}.personal-best small{color:#bbc4d0}#record-journal table{width:100%}#record-journal tbody tr:nth-child(odd){background:#ffffff07}
/* Keep the battle start action visible while the explanation scrolls. */
#modal.start-modal[open]{display:grid;grid-template-rows:minmax(0,1fr) auto;height:min(760px,calc(100vh - 32px));height:min(760px,calc(100dvh - 32px));max-height:calc(100vh - 32px);max-height:calc(100dvh - 32px);overflow:hidden}#modal.start-modal #modal-content{overflow-y:auto;min-height:0;min-width:0;padding-right:5px;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}#modal.start-modal .ready-art img{max-height:min(30dvh,260px)}#modal.start-modal h2{padding-right:26px} .modal-startbar{flex-shrink:0;padding-top:12px;background:#202935;border-top:1px solid #a7b28766}.modal-startbar .primary{width:100%;min-height:52px;margin:0!important}
@media(max-width:900px){.finish-options{grid-template-columns:repeat(2,minmax(0,1fr))}.rank-board-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.personal-best-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.finish-gallery{padding:12px}.finish-options{gap:7px}.finish-options button{padding:7px;gap:7px}.finish-options img{width:38px;height:58px}.finish-options strong{font-size:.75rem}.finish-options small{font-size:.6rem}.rank-category{padding:12px}.rank-board summary{padding:10px}.rank-board[open]{grid-column:1/-1}#record-summary{padding:10px;grid-template-columns:repeat(2,minmax(0,1fr))}#record-summary .record{padding:12px;min-height:110px}#record-summary .record strong{font-size:1.3rem}#personal-bests,#record-journal,#reward-progress>section{padding:14px}.personal-best{padding:12px}.home-hero{padding:6px 8px;grid-template-columns:1fr 70px;margin-bottom:8px}.home-hero .welcome-copy h1{display:none}.home-hero .hero-cards{height:65px}.home-hero .hero-cards .full-card:first-child{width:42px;height:62px}.status-strip{display:none}.section-head{margin:10px 0}.subject-tabs{gap:6px}.subject-tabs button{min-height:40px;padding:7px 4px}.hub-tabs{margin:10px 0;gap:6px}.hub-tabs img{height:38px;width:27px}.hub-tabs button{padding:7px 4px;gap:4px;font-size:.8rem}.home-panel-heading{margin-bottom:8px}.home-panel-heading p{display:none}.home-panel .mode-tabs button{padding:7px 4px;min-height:38px;font-size:.8rem}.home-panel{padding:10px}.home-panel .dan-grid{margin-top:8px}.home-panel #mode-content>.muted{font-size:.75rem;margin:8px 0}#modal{padding:16px}}
.board-leaders{display:grid!important;gap:6px;border-top:1px solid #778ead55;padding-top:8px}.board-leaders>span{display:grid;grid-template-columns:15px minmax(0,1fr) auto;gap:5px;align-items:center;font-size:.7rem!important}.board-leaders b{font-size:.8rem!important}.board-leaders em{font-style:normal;font-size:.7rem;color:#ffe7a6}.board-leaders span span{overflow-wrap:anywhere;font-size:.7rem}.rank-board summary>small{color:#ffde8a;text-decoration:underline}
@media(max-width:600px){.home-hero{display:none}.subject-tabs{grid-template-columns:repeat(4,minmax(0,1fr))}.subject-tabs button{display:flex;flex-direction:column;justify-content:center;gap:3px;font-size:.72rem;padding:8px 2px;min-width:0}.subject-tabs button b{font-size:1.2rem}.subject-tabs button span{font-size:.72rem;white-space:normal;line-height:1.4}.reading-bar>span{display:none}.home-panel #mode-content>.muted{line-height:1.5}.section-head h2{font-size:1.15rem}}
.personal-best-grid>p{grid-column:1/-1;line-height:1.8}.progress-panel .record-grid{grid-template-columns:repeat(2,minmax(0,1fr))}@media(max-width:600px){#record-summary .record:last-child{grid-column:1/-1;min-height:88px;flex-direction:row;align-items:center;justify-content:space-between}}
.journal-list{display:grid;gap:10px}.journal-entry{border:1px solid #b6a3cc77;border-left:4px solid #b6a3cc;padding:14px;border-radius:12px;background:#243a3a}.journal-title{display:flex;align-items:center;gap:12px}.journal-title time{font-size:.8rem;color:#e2c9f1;flex-shrink:0}.journal-title h3{font-size:.95rem;margin:0;line-height:1.6;overflow-wrap:anywhere}.journal-entry dl{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:12px 0 0}.journal-entry dl>div{padding:10px;background:#131e2d;border-radius:8px}.journal-entry dt{font-size:.75rem;color:#c2cad4}.journal-entry dd{margin:6px 0 0;font-size:1.15rem;font-weight:800;color:#fff0be}

.mistake-count{margin:8px 0;padding:7px 12px;border:1px solid #ffba75;border-radius:12px;background:#412e35;color:#ffe0b8;font-weight:800;font-size:.85rem}.mistake-count.danger{border-color:#ff739d;color:#ffb7ce}.mistake-rule{color:#ffcf99;font-weight:800}

.guide-link{text-align:center;margin:12px 16px 96px;font-size:.8rem}.guide-link a{color:var(--gold)}.battle-mode .guide-link{display:none}

.home-main-tabs{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:0 0 18px}.home-main-tabs button{font-size:.85rem;padding:10px 8px;border:1px solid #8e946e;background:#202935;min-width:0}.home-main-tabs [aria-selected="true"]{background:#f6d784;color:#17202b;box-shadow:0 3px #9f8445}.home-language-panel{padding:24px;border:2px solid #9fa779;border-radius:18px;background:#202c3b;max-width:600px;margin:20px auto}.home-language-panel label{display:block;margin:18px 0 8px;font-weight:800}.home-language-panel select{display:block;width:100%;font:inherit;color:var(--ink);background:#151e2a;border:1px solid #929b74;border-radius:12px;padding:14px;margin-bottom:18px}.home-language-panel select:focus-visible{outline:3px solid var(--yellow)}#home-play-panel[hidden],#home-language-panel[hidden]{display:none!important}
/* Input stays inside the available screen; original card art is never cropped. */
.home-learn-link{display:flex;align-items:center;gap:12px;border:1px solid #a7b37c;background:#253447;color:#fff0b6;border-radius:14px;padding:10px 14px;margin-bottom:14px;text-decoration:none;font-weight:800}.home-learn-link img{border-radius:8px}.home-learn-link span span{display:block;font-size:.7rem;color:#c4d1e1}.home-learn-link>b{margin-left:auto}.guide-keypad{display:none}
@media(max-width:900px){
 body.battle-mode{height:100vh;height:100dvh;overflow:hidden;min-height:0}.battle-mode>.topbar{display:none}.battle-mode #app{height:100%;max-width:700px;padding:8px 10px max(8px,env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:5px;min-height:0}.battle-mode .battle-header{margin:0;flex:0 0 auto;gap:6px;min-height:36px}.battle-mode .battle-header h2{font-size:.8rem;line-height:1.3;flex:1;margin:0}.battle-mode .battle-header button{font-size:.7rem;padding:7px 9px}.battle-mode .battle-times{font-size:.7rem}.battle-mode .timer{font-size:.85rem}.battle-mode .arena{flex:1 1 0;min-height:42px;display:grid;grid-template-columns:1fr 50px 1fr;gap:8px;margin:0;overflow:hidden;align-items:center}.battle-mode .fighter{min-height:0}.battle-mode .fighter-art{height:clamp(40px,calc(100dvh - 475px),190px);max-width:130px;margin:auto}.battle-mode .fighter h3{font-size:.65rem;line-height:1.2;min-height:0;margin:3px 0}.battle-mode .fighter-label{display:none}.battle-mode .vs{font-size:.7rem}.battle-mode .vs small{font-size:.6rem}.battle-mode .hp-track{margin:3px auto;height:4px}.battle-mode .question-zone{flex:0 0 auto;width:100%;max-width:560px;margin:0 auto;padding:8px 10px;min-height:0}.battle-mode .question-top{font-size:.65rem;line-height:1.3;margin:4px 0;gap:4px}.battle-mode .mistake-count{font-size:.65rem;padding:2px 7px;margin:3px 0;line-height:1.4}.battle-mode .equation{font-size:1.8rem;line-height:1.2;gap:6px;margin:6px 0}.battle-mode .answer-input{font-size:1.6rem;height:46px;min-height:46px;width:88px;padding:4px}.battle-mode .battle-message,.battle-mode #battle-message{font-size:.7rem;line-height:1.4;min-height:20px;margin:3px 0}.battle-mode .keypad{gap:4px;margin:5px auto 0}.battle-mode .keypad button{height:40px;min-height:40px;padding:3px;font-size:1.1rem}.battle-mode .hint-button{padding:5px;font-size:.7rem;margin-top:6px}.battle-mode .battle-settings{font-size:.65rem;line-height:1.3;margin-bottom:4px}.battle-settings .play-settings{position:absolute;z-index:5;left:10px;right:10px;background:#202c3b;padding:12px;border:1px solid #a5b277;border-radius:12px}.battle-mode .play-settings{margin:0}.battle-mode .play-settings label{font-size:.65rem}.battle-mode .play-settings select{padding:4px;font-size:.65rem}.battle-mode #hint-content:not(:empty){max-height:28dvh;overflow:auto}.battle-mode .hint-box{padding:8px}.battle-mode .combat-settings{position:absolute;top:45px;right:12px;z-index:4;font-size:.65rem;background:#202935}.battle-mode .combat-status{font-size:.65rem;margin:0;line-height:1.3}.battle-mode .combat-arena{flex:1 1 0;min-height:60px;margin:0;overflow:hidden;gap:8px}.battle-mode .combat-opponent img{height:clamp(42px,calc(100dvh - 495px),165px);max-width:100%;object-fit:contain}.battle-mode .combat-team{gap:4px}.battle-mode .team-card{padding:3px}.battle-mode .team-card img{height:clamp(35px,calc(100dvh - 540px),110px);width:100%;object-fit:contain}.battle-mode .team-card span,.battle-mode .team-card small,.battle-mode .combat-opponent strong,.battle-mode .combat-opponent>span{font-size:.55rem;line-height:1.25}.battle-mode .combat-opponent{gap:2px}.battle-mode .combat-opponent>b{font-size:.7rem}.battle-mode .combat-arena progress{height:6px}.battle-mode.column-mode .arena{display:none}.battle-mode.column-mode .question-zone{flex:1 1 0;display:flex;flex-direction:column;min-height:0;overflow:hidden}.battle-mode .guide-toggle{gap:5px;margin:3px 0}.battle-mode .guide-toggle button{font-size:.65rem;padding:5px;line-height:1.4}.battle-mode #column-work{min-height:0;flex:1;overflow:hidden}.battle-mode .column-guide{height:100%;display:flex;flex-direction:column;min-height:0}.battle-mode .guide-companion{display:none}.battle-mode .column-board{padding:4px;margin:3px auto;flex:0 0 auto;width:min(100%,300px)}.battle-mode .column-row{min-height:0;gap:4px}.battle-mode .column-cell{font-size:1.1rem;padding:1px;min-height:0;line-height:1.1}.battle-mode .column-labels .column-cell{font-size:.5rem;line-height:1.1}.battle-mode .column-notes .column-cell{font-size:.5rem;line-height:1.1}.battle-mode .column-sign{font-size:1rem}.battle-mode .column-answer{margin-top:2px;padding-top:3px}.battle-mode .guide-step{flex:1;min-height:0;display:flex;flex-direction:column;gap:3px}.battle-mode .guide-step>p{font-size:.7rem;line-height:1.4;margin:0}.battle-mode .guide-step-label{font-size:.6rem!important}.battle-mode .step-input-label{font-size:.65rem;display:flex;align-items:center;justify-content:center;gap:10px;margin:2px 0}.battle-mode #column-step-answer{font-size:1.2rem;width:72px;height:36px;min-height:36px;padding:3px}.battle-mode .guide-keypad{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;flex-shrink:0}.battle-mode .guide-keypad button{padding:2px;min-height:34px;height:34px;font-size:1rem;line-height:1.2}.battle-mode .step-actions{margin:0;justify-content:flex-end}.battle-mode .step-actions [data-guide-check]{display:none}.battle-mode .step-actions button,.battle-mode .guide-back{font-size:.65rem;padding:3px 8px;margin:0;min-height:24px;line-height:1.3}.battle-mode .guide-back{align-self:center}.battle-mode .guide-step>.primary{font-size:.8rem;min-height:38px;padding:7px;flex-shrink:0}.battle-mode .guide-step .guide-error{font-size:.65rem;min-height:0}.battle-mode .guide-example{font-size:.65rem;line-height:1.3;max-height:55px;overflow:auto}.battle-mode .column-motion{flex:1 1 70px;min-height:40px;max-height:180px;width:100%;overflow:auto}.battle-mode .column-motion .math-motion{padding:4px}.battle-mode .column-motion .motion-heading,.battle-mode .column-motion .motion-equation,.battle-mode .column-motion .motion-caption,.battle-mode .column-motion .motion-controls{display:none}.battle-mode .column-motion .motion-stage{margin:0;gap:4px}.battle-mode .column-motion .motion-bin{padding:2px}.battle-mode .column-motion .motion-bin>strong{font-size:.55rem;min-height:16px}.battle-mode .column-motion .motion-bank{min-height:20px;gap:2px;padding:2px}.battle-mode .column-motion .motion-token{font-size:11px;width:13px;height:15px;flex-basis:13px}.battle-mode .column-motion .motion-bundle{font-size:8px;width:19px;height:20px;flex-basis:19px}.battle-mode .column-motion .motion-place-count{font-size:13px;padding:1px}.battle-mode .regroup-view{margin:5px 0;padding:5px;font-size:.65rem}.battle-mode #answer-motion{max-height:calc(100dvh - 220px);overflow:auto}.battle-mode .motion-next{margin:5px 0;padding:7px}
 dialog::backdrop{backdrop-filter:none!important;-webkit-backdrop-filter:none!important;background:#08151dd9}.bottom-nav{backdrop-filter:none;-webkit-backdrop-filter:none}.hero-cards:before{filter:none}.collect-card{content-visibility:auto;contain-intrinsic-size:auto 200px}.collect-card img{aspect-ratio:2/3}
}
@media(max-height:570px) and (max-width:900px){.battle-mode .arena{min-height:0}.battle-mode .fighter h3,.battle-mode .vs small{display:none}.battle-mode .fighter-art{height:45px}.battle-mode .keypad button{height:34px;min-height:34px}.battle-mode .question-zone{padding:5px 8px}.battle-mode .equation{margin:3px 0}.battle-mode .guide-keypad button{height:28px;min-height:28px}.battle-mode .column-board{margin:0 auto}.battle-mode .column-motion{max-height:70px;min-height:25px}.battle-mode .column-cell{font-size:.9rem}.battle-mode .guide-step>p{font-size:.6rem}.battle-mode .combat-opponent strong,.battle-mode .team-card span{display:none}}
@media(max-height:450px) and (max-width:900px){.battle-mode .arena,.battle-mode .combat-arena{display:none}.battle-mode .combat-status{display:none}.battle-mode .question-zone{margin:auto;flex-shrink:1}.battle-mode .battle-header{min-height:30px}.battle-mode .battle-header button{padding:4px 8px}.battle-mode .question-top{margin:1px 0}.battle-mode .mistake-count{margin:1px 0}.battle-mode .keypad button{height:30px;min-height:30px}.battle-mode .equation{margin:2px 0}.battle-mode .answer-input{height:36px;min-height:36px}.battle-mode .hint-button{padding:2px}.battle-mode.column-mode .column-board{display:none}}

@media(max-width:900px){.battle-mode.answer-motion-mode .arena{display:none}.battle-mode.answer-motion-mode .question-zone{flex:1;display:flex;flex-direction:column;min-height:0;overflow:hidden}.battle-mode.answer-motion-mode #hint-content:not(:empty){max-height:none;flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.battle-mode.answer-motion-mode #answer-motion{flex:1;min-height:0;max-height:none;overflow:auto}.battle-mode.answer-motion-mode .motion-next{flex-shrink:0;min-height:42px}.battle-mode.answer-motion-mode #show-hint{display:none}.battle-mode .column-motion{flex-shrink:1}.battle-mode .step-input-label{flex-shrink:0}.battle-mode .column-guide .step-input-label{margin-top:2px}.battle-mode #hint-content:empty{display:none}}
@media(max-width:600px){.home-panel .mode-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}.home-panel .mode-tabs button{padding:7px 3px;min-height:39px;font-size:clamp(10px,2.6vw,12px);white-space:normal;line-height:1.4}.home-panel #mode-content>.muted{display:none}.home-main-tabs{margin-bottom:12px}.home-learn-link{padding:8px 12px;margin-bottom:10px}.section-head{margin-top:14px}}

.repeat-notice{text-align:center;padding:16px 4px}.repeat-notice h2{font-size:clamp(18px,4.5vw,26px);padding-right:24px;line-height:1.6}.repeat-notice .notice-art{display:block;width:auto;max-width:100%;height:clamp(100px,26dvh,240px);object-fit:contain;margin:12px auto}.repeat-notice p{line-height:1.7}.repeat-notice .dialog-close{position:absolute;right:12px;top:12px;min-width:44px;min-height:44px}.ranking-prize{border:2px solid #ffe27a;border-radius:18px;padding:16px;margin:16px 0}

.repeat-notice .notice-art img{position:static;width:100%;height:100%;object-fit:contain;transform:none;inset:auto}
/* Keep each tablet/desktop hero frame fitted to the original card image. */
@media(min-width:761px){
.home-hero .hero-cards .full-card:nth-child(n){width:auto;height:164px;max-height:none;left:50%;top:18px;transform:translateX(-50%) rotate(var(--rot)) translateX(var(--move))}
.home-hero .hero-cards .full-card:nth-child(1){--move:-88px}
.home-hero .hero-cards .full-card:nth-child(2){height:180px;top:0;--move:0px}
.home-hero .hero-cards .full-card:nth-child(3){--move:88px}
}

.game-introduction{max-width:1112px;margin:0 auto 24px;padding:18px 24px;border:1px solid var(--line);border-radius:16px;color:var(--muted)}.game-introduction h2{font-size:1rem;color:var(--ink)}.game-introduction p{font-size:.85rem}.game-introduction nav{display:flex;flex-wrap:wrap;gap:12px}.game-introduction a{color:var(--yellow);font-size:.85rem}body.battle-mode .game-introduction,body.combat-mode .game-introduction{display:none}@media(max-width:760px){.game-introduction{margin:0 12px 24px;padding:16px}}
/* Respect iOS standalone status bar, notches and home indicator. */
:root{--screen-safe-top:env(safe-area-inset-top,0px);--screen-safe-right:env(safe-area-inset-right,0px);--screen-safe-bottom:env(safe-area-inset-bottom,0px);--screen-safe-left:env(safe-area-inset-left,0px)}
body:not(.battle-mode){padding-top:var(--screen-safe-top);padding-left:var(--screen-safe-left);padding-right:var(--screen-safe-right)}
body:not(.battle-mode) #app{padding-bottom:calc(112px + var(--screen-safe-bottom))}
.bottom-nav{bottom:calc(16px + var(--screen-safe-bottom));max-width:calc(100% - 24px - var(--screen-safe-left) - var(--screen-safe-right))}
@media(max-width:760px){.bottom-nav{bottom:calc(10px + var(--screen-safe-bottom))}}
#modal{top:var(--screen-safe-top);bottom:var(--screen-safe-bottom);max-height:calc(100dvh - var(--screen-safe-top) - var(--screen-safe-bottom) - 24px)}
#modal.start-modal{height:min(760px,calc(100dvh - var(--screen-safe-top) - var(--screen-safe-bottom) - 24px))}
@media(max-width:900px){.battle-mode #app{padding-top:max(8px,var(--screen-safe-top));padding-right:max(10px,var(--screen-safe-right));padding-bottom:max(8px,var(--screen-safe-bottom));padding-left:max(10px,var(--screen-safe-left))}}
@media(min-width:901px){body.battle-mode{padding-top:var(--screen-safe-top);padding-left:var(--screen-safe-left);padding-right:var(--screen-safe-right)}}

.daily-foil{display:flex;align-items:center;gap:10px;padding:12px;margin:0 0 14px;border:1px solid #f5dc80;border-radius:14px;background:linear-gradient(110deg,#333c47,#514329)}.daily-foil>div{flex:1;min-width:0}.daily-foil strong,.daily-foil-ready{color:#ffe494}.daily-foil p{font-size:.8rem;line-height:1.5;margin:4px 0 0}.daily-foil small{font-size:.7rem}.daily-foil button{flex-shrink:0;min-height:44px}#daily-foil-close{padding:6px;min-width:36px}.daily-foil-ready{padding:10px;border:1px solid #f5dc80;border-radius:12px;font-size:.85rem}@media(max-width:480px){.daily-foil{flex-wrap:wrap}.daily-foil>div{flex-basis:calc(100% - 50px)}#daily-foil-close{order:1}#daily-foil-go{order:2;width:100%}}

.daily-foil>img{width:44px;height:66px;object-fit:contain;border-radius:5px;flex-shrink:0}@media(max-width:480px){.daily-foil{display:grid;grid-template-columns:44px minmax(0,1fr) 36px;gap:8px}.daily-foil>div{grid-column:2;min-width:0}.daily-foil strong{font-size:.85rem}#daily-foil-close{grid-column:3;grid-row:1}#daily-foil-go{grid-column:1/-1;grid-row:2}.daily-foil>img{grid-column:1;grid-row:1}}
/* One consistent hierarchy for navigation, choices, and actions. */
:root{--yellow:#f7d985;--muted:#c9d0d9;--line:#687483;--panel:#243245}
body{background:radial-gradient(at top right,#38475b,#111d2c 70%)}
button{word-break:normal;overflow-wrap:normal;line-break:strict;text-wrap:pretty}h2,h3{word-break:normal;overflow-wrap:break-word;text-wrap:pretty}button ruby{white-space:nowrap}button:hover{background:#3a4a60}.primary:hover{background:#ffe5a0}
.home-main-tabs{gap:10px}.home-main-tabs button{min-height:54px;font-size:15px;border-radius:12px}.home-main-tabs button[aria-selected=false]{background:#243f48;border-color:#7ca0a5;color:#edf1f7}
.subject-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.subject-tabs button{min-height:70px;border:2px solid #728093;background:#26364b;line-height:1.5}.subject-tabs button[aria-pressed=true]{background:#ffe29b;color:#16263b;border-color:#fff0bc;box-shadow:0 4px #a88b48}.subject-tabs button>span{white-space:nowrap;font-size:14px}
.hub-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.hub-tabs button{border:1px solid #7d8b9d;min-height:80px;background:#1b2b40;color:#edf3dd;border-radius:14px;overflow-wrap:normal}.hub-tabs button[aria-pressed=true]{background:#37485e;border-color:#f8d87c;color:#ffe69d;box-shadow:inset 0 -4px #f8d87c}.hub-tabs button span{white-space:nowrap}.hub-tabs img{object-fit:contain}
.home-panel{background:#202d3e;border:1px solid #6f7e91;border-radius:18px;padding:20px}.home-panel-heading{padding-bottom:12px;border-bottom:1px solid #63728555}.home-panel-heading h2{color:#ffe39b}.home-panel-heading p{display:block;color:#cfd6e0;line-height:1.6;font-size:.85rem;margin:5px 0 0}
.home-panel .mode-tabs{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;padding:8px;background:#121d2c;border-radius:14px}.home-panel .mode-tabs button{font-size:14px;min-height:54px;padding:10px 8px;border:1px solid #6c7887;background:#2b3849;color:#dde5ef;white-space:normal;overflow-wrap:normal;line-height:1.7}.home-panel .mode-tabs [data-mode=thinking]{order:5;background:#344e5f;border-color:#8baabb}.home-panel .mode-tabs [data-mode=advanced]{order:4}.home-panel .mode-tabs button[aria-pressed=true]{background:#f7dc91;border-color:#ffedba;color:#172537;box-shadow:0 3px #a38746}.home-panel #mode-content>.muted{display:block;line-height:1.7;font-size:.85rem;margin:14px 0}
.dan-card{border-radius:18px}.dan-card .dan-actions{gap:8px}.dan-card .dan-actions button{min-height:48px;line-height:1.5;font-size:14px;overflow-wrap:normal}.dan-rank summary{min-height:44px;display:flex;align-items:center}
.daily-foil{background:linear-gradient(115deg,#344050,#4b4229);border-color:#d9bd71}.home-learn-link{background:#2b3b51;border-color:#a4b57d}.bottom-nav{background:#162437f5;border-color:#9aa477}.bottom-nav button{white-space:nowrap;line-height:1.5}
.result{max-width:900px;margin:auto}.result-data{background:#212e3f;border:1px solid #778597;border-radius:18px;padding:16px}.result>.save-state{margin:14px 0 8px;line-height:1.7;padding:12px;background:#233143;border-radius:12px}.result>.save-state.save-error{background:#633b35;border:1px solid #efaf9b;color:#fff4df}.result>.result-actions{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:12px 0 24px;padding:14px;background:#f1e2b8;border:2px solid #d7bf72;border-radius:16px}.result>.result-actions button{min-height:54px;font-size:16px;line-height:1.6;padding:12px;color:#182639}.result>.result-actions .secondary{background:#d4dde8;border-color:#778495}.result>.result-actions #again{background:#f6cd63;box-shadow:0 3px #a0803d}.result>.result-actions #again[aria-busy=true]{background:#f4dc9f}.result>.result-actions #use-reward{grid-column:1/-1}.result .review-list span{line-height:1.8;padding:14px}.reward-panel{border-color:#adba83}
@media(max-width:760px){.home-panel .mode-tabs{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.home-panel .mode-tabs [data-mode=thinking]{grid-column:1/-1}.home-panel{padding:14px 10px}.home-panel-heading h2{font-size:1.2rem}.hub-tabs button{min-height:82px;font-size:14px;gap:6px}.hub-tabs img{width:32px;height:48px}.home-main-tabs button{font-size:14px;min-height:54px}.subject-tabs{gap:7px}.subject-tabs button{min-height:62px}.subject-tabs button>span{font-size:13px}.result>.result-actions{gap:10px;padding:10px}.result>.result-actions button{font-size:14px;min-height:56px}.result .result-data{gap:8px;padding:12px}.result .result-data b{font-size:1.3rem}.bottom-nav{max-width:calc(100% - 20px - var(--screen-safe-left) - var(--screen-safe-right))}.bottom-nav button{padding:8px 5px;min-width:0;min-height:52px}.home-panel #mode-content>.muted{font-size:13px}}

.subject-tabs button>span{white-space:normal;overflow-wrap:normal;max-width:100%;line-height:1.4}.subject-tabs button{min-width:0}.home-main-tabs button[aria-selected="true"],.home-main-tabs button[aria-selected="true"]:hover{background:#f7d985;color:#172537}.home-main-tabs button[aria-selected="false"]:hover{background:#355762;color:#fff}

.training-ready{display:flex;align-items:center;gap:12px;padding:12px;background:#17263a;border:1px solid #b9aa71;border-radius:12px;margin:12px 0}.training-ready>img{width:64px;height:96px;object-fit:contain;flex-shrink:0}.training-ready p{font-size:.8rem;line-height:1.5;margin:4px 0}.training-result{background:#253549;border:1px solid #bba771;border-radius:16px;padding:16px;margin:16px 0}.training-result>div{display:grid;grid-template-columns:1fr 1fr;gap:12px}.training-result strong{display:block;color:#ffe098;font-size:1.6rem}.training-result small{font-size:.8rem}.training-result p{font-size:.8rem;line-height:1.6}.battle-mode .vs b{display:block;color:#ffe098;font-size:1.2rem}.battle-mode .vs small{font-size:.6rem}.rank-metric{margin:8px 0}.rank-metric button{min-height:44px}
.battle-mode .fighter .fighter-art{width:auto;aspect-ratio:2/3;background:#101b2a}.battle-mode .fighter-art img{object-fit:contain;object-position:center}.battle-mode .vs{font-style:normal;text-shadow:none;line-height:1.3}.battle-mode .vs small{display:block;font-size:.55rem;line-height:1.4;margin-top:3px;color:#d0dae6}.battle-mode .vs>span{font-size:.65rem}

/* Keep controls clear of iPhone system gestures and Safari's changing viewport. */
:root{--visible-screen-height:100dvh;--visible-screen-top:0px;--edge-gap:12px}
@media(pointer:coarse){
 html{scroll-padding-top:calc(var(--screen-safe-top) + 16px);scroll-padding-bottom:calc(var(--screen-safe-bottom) + 128px)}
 body:not(.battle-mode){padding-top:calc(var(--screen-safe-top) + var(--edge-gap));padding-bottom:calc(var(--screen-safe-bottom) + 128px)}
 body:not(.battle-mode) #app{padding-bottom:24px}
 .guide-link{margin-bottom:24px}.guide-link a{display:inline-flex;align-items:center;min-height:44px}
 .bottom-nav{bottom:calc(var(--screen-safe-bottom) + 16px)}
 .topbar button,.dialog-close,.battle-header button{min-height:44px;min-width:44px}
 .topbar{padding-block:12px}.top-actions{min-width:0;flex-wrap:wrap;justify-content:flex-end}
 #modal[open],#modal.start-modal[open]{top:calc(var(--visible-screen-top) + var(--screen-safe-top) + 12px);bottom:auto;margin:0 auto;max-height:calc(var(--visible-screen-height) - var(--screen-safe-top) - var(--screen-safe-bottom) - 24px)}
 #modal.start-modal[open]{height:min(760px,calc(var(--visible-screen-height) - var(--screen-safe-top) - var(--screen-safe-bottom) - 24px))}
 #modal .dialog-close{top:8px;right:8px;z-index:3}
 #title-screen{height:var(--visible-screen-height);overflow-y:auto}
 .title-center{padding:calc(var(--screen-safe-top) + 20px) calc(var(--screen-safe-right) + 20px) calc(var(--screen-safe-bottom) + 24px) calc(var(--screen-safe-left) + 20px)}
}
@media(pointer:coarse) and (max-width:900px){
 body.battle-mode{height:var(--visible-screen-height)}
 .battle-mode #app{padding:calc(var(--screen-safe-top) + 12px) calc(var(--screen-safe-right) + 12px) calc(var(--screen-safe-bottom) + 16px) calc(var(--screen-safe-left) + 12px)}
 .battle-mode .arena{flex-shrink:1;min-height:0}
}
@media(pointer:coarse) and (orientation:portrait){
 html[data-standalone=true]{--screen-safe-top:max(env(safe-area-inset-top,0px),64px);--screen-safe-bottom:max(env(safe-area-inset-bottom,0px),34px)}
}

/* Vivid blue world, with calm high-contrast reading surfaces. */
:root{--panel:#103675;--line:#5ba9f4;--muted:#c6e7ff}
body{background:radial-gradient(ellipse at 85% 0%,#12a9ef 0%,#0868d9 35%,#083a9c 72%,#071f60 100%);background-attachment:fixed}
.topbar{background:#082a65e8;border-bottom-color:#65bfff}
.home-panel{background:#0a306c;border-color:#68b8ff}
.home-main-tabs button[aria-selected=false],.subject-tabs button,.hub-tabs button{background:#134a98;border-color:#76bdff;color:#f2faff}
.home-main-tabs button[aria-selected=false]:hover,.subject-tabs button:hover,.hub-tabs button:hover{background:#1c61bc}
.hub-tabs button[aria-pressed=true]{background:#1560bc}
.home-learn-link{background:linear-gradient(110deg,#075dc4,#117eaa);border-color:#80dfff}
.home-panel .mode-tabs{background:#082454}.home-panel .mode-tabs button{background:#164b94;border-color:#68aef3;color:#f4faff}
.home-panel .mode-tabs [data-mode=thinking]{background:#1758a3;border-color:#8cd8ff}
.home-panel .mode-tabs button[aria-pressed=true]{background:#f7dc91;color:#172537}
.bottom-nav{background:#082654f5;border-color:#8cc9ff}
.battle-mode{background:radial-gradient(ellipse at top,#128ee7,#0753bd 48%,#082b78 100%)}
.battle-mode .question-zone{background:linear-gradient(150deg,#123e80,#0a2556);border-color:#69b9fa}
.thinking-course{background:linear-gradient(140deg,#1857a5,#0c306b)}

body.battle-mode .question-zone{background:linear-gradient(150deg,#123e80,#0a2556);border-color:#69b9fa}
/* Keep long review sentences inside the viewport instead of widening the page. */
#app,.result,.review-list,.review-list>span{min-width:0}
.result{width:100%;max-width:900px}.review-list,.review-list>span{max-width:100%}
.result .review-list>span{white-space:normal;overflow-wrap:anywhere;flex:1 1 100%;text-align:start}
.result .result-data>div{min-width:0}
.home-panel .mode-tabs{grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:1fr}
.home-panel .mode-tabs [data-mode=thinking]{grid-column:auto}
@media(max-width:600px){.home-panel .mode-tabs{grid-template-columns:repeat(2,minmax(0,1fr))}}
.slot-row { display:grid; gap:.35rem; margin-block:.65rem; }
.slot-row label { display:grid; gap:.2rem; font-size:.9rem; }
.slot-row input { width:100%; min-width:0; box-sizing:border-box; }
