/* Responsive refinements for compact phones, tablets, and touch input. */
.site-shell,.main-column,main,#mainContent,.realm-home-bottom,.quest-list,.map-list{min-width:0}
.quest-row,.quest-name,.arena-header>div,.character-header>div{min-width:0}
.arena-health>div:first-child strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.arena-health>div:first-child span{flex:none}
.arena-auto-next{color:#6d4ab1;font-size:12px;font-weight:1000;white-space:nowrap}
.arena-chapter-summary{margin:0 0 12px;color:#60429f;font-size:13px;font-weight:900;line-height:1.4;overflow-wrap:anywhere}
.arena-mode-tabs{display:flex;flex-wrap:wrap;gap:10px;margin:18px 0}
.arena-mode-tabs button{min-height:48px;padding:10px 18px;border:2px solid #e5d9f5;border-radius:16px;background:#fff;color:#5b4691;font:inherit;font-weight:900;cursor:pointer;box-shadow:0 4px 0 #e5d9f5}
.arena-mode-tabs button.active{border-color:#815ad6;background:#5e3b9d;color:#fff;box-shadow:0 4px 0 #d0b8ee}
.arena-mode-tabs button:focus-visible,.arena-practice-grid button:focus-visible{outline:3px solid #f5b83b;outline-offset:3px}
.arena-practice-picker{padding:22px;border:1px solid #e5d9f5;border-radius:22px;background:#fff;box-shadow:0 8px 24px #3423620b}
.arena-practice-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-top:18px}
.arena-practice-grid button{display:flex;flex-direction:column;align-items:flex-start;min-width:0;min-height:154px;padding:16px;border:2px solid #e6dbf6;border-radius:17px;background:linear-gradient(150deg,#fff,#f8f3ff);color:#372b5e;text-align:left;font:inherit;cursor:pointer;box-shadow:0 4px 0 #e6dbf6;transition:transform .2s,box-shadow .2s}
.arena-practice-grid button:hover:not(:disabled){transform:translateY(-3px);box-shadow:0 7px 0 #d5bff1}
.arena-practice-grid button>span{font-size:27px;line-height:1}
.arena-practice-grid button strong{margin-top:8px;font-size:16px;line-height:1.3}
.arena-practice-grid button small{margin-top:4px;color:#877ba6;line-height:1.4}
.arena-practice-grid button b{margin-top:auto;padding-top:10px;color:#7549b3;font-size:13px}
.arena-practice-grid button:disabled{opacity:.6;cursor:default}
.arena-practice-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:14px 0;padding:12px 16px;border-radius:16px;background:#f6edff;color:#513389;font-weight:900}
.arena-practice-toolbar button{min-height:44px}
.arena-change-skill{margin-top:12px;min-height:44px}
.realm-grade-tabs button,.grade-tab{min-height:44px}
@media(max-width:800px){
  .arena-practice-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .realm-home-bottom{grid-template-columns:minmax(0,1fr)}
  .realm-grade-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .mobile-nav{height:calc(66px + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom)}
  main{padding-bottom:calc(92px + env(safe-area-inset-bottom))}
  .site-footer{padding-bottom:calc(88px + env(safe-area-inset-bottom))}
  .arena-stage-button{min-width:44px;height:44px}
  .arena-chapter{min-height:44px}
}
@media(max-width:600px){
  .arena-practice-grid{grid-template-columns:minmax(0,1fr)}
  .arena-practice-grid button{min-height:126px}
  .arena-practice-toolbar{flex-wrap:wrap}
  .realm-grade-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .quest-list,.map-list{grid-template-columns:minmax(0,1fr);width:100%}
  .quest-row{width:100%;max-width:100%;min-width:0}
  .quest-name{flex:1 1 0;min-width:0}
  .mobile-brand{font-size:clamp(14px,4.5vw,19px);white-space:nowrap}
  .mobile-nav button{min-width:44px;min-height:44px}
  .arena-stage-caption{flex-wrap:wrap;gap:4px 12px}
  .arena-stage-caption strong,.arena-stage-caption span{white-space:nowrap}
  .arena-stage-button{min-width:44px;height:44px;flex:none}
  .arena-chapter{min-height:44px}
  .battle-close,.close-button{width:44px;height:44px;min-width:44px}
  .character-filters button,.character-motion-controls button{min-height:42px}
}
@media(max-width:480px){
  .arena-chapters{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));overflow:visible}
  .arena-chapter{min-width:0;padding:6px 2px;font-size:10px}
  .arena-stage-list{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));overflow:visible}
  .arena-stage-button{width:100%;min-width:0}
  .arena-header{display:block}
  .arena-header h1{font-size:clamp(24px,7vw,30px)}
  .arena-grade-switch{margin-top:12px;justify-content:space-around}
  .arena-grade-switch button{min-width:42px;height:42px}
  .arena-health>div:first-child{font-size:9px;gap:2px}
  .arena-combatants{inset:16px 3% 10px}
  .realm-page-heading h1{overflow-wrap:anywhere}
}
@media(max-width:360px){
  .topbar{padding-inline:12px}
  main{padding-inline:14px}
  .realm-hero{padding:21px;min-height:425px}
  .realm-hero h1{font-size:35px}
  .realm-section-head{gap:6px}
  .realm-section-head h2{font-size:22px}
  .realm-all{white-space:normal;text-align:right}
  .realm-grade{padding:11px;min-height:135px}
  .quest-row{padding:9px 7px}
  .quest-symbol{width:27px}
  .quest-arrow{font-size:18px}
  .arena-stage-wrap{padding:9px}
  .arena-battlefield{height:250px}
  .arena-health{padding:4px 3px}
  .arena-health>div:first-child{font-size:8px}
  .character-header{flex-wrap:wrap}
  .battle-question{padding:14px}
  .answer-button{min-height:50px}
}
@media(max-width:320px){
  .mobile-nav span{font-size:8px;white-space:nowrap}
  .mobile-nav button{font-size:20px}
}
@media(max-height:500px) and (max-width:900px){
  .quiz-overlay{padding:6px}
  .battle-box,.quiz-box{max-height:calc(100dvh - 12px)}
  .battle-stage{height:115px}
  .battle-stage .fighter-sprite img,.battle-stage .monster-fighter .fighter-sprite img{height:76px;width:76px}
}
.sidebar{overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.18) transparent}
.sidebar>*{flex-shrink:0}
.sidebar-grades{margin-bottom:16px}
.sidebar-bottom{padding:16px 16px 20px}
.sidebar-bottom strong{display:block;position:relative;z-index:1;margin-top:6px}
@media(max-height:820px){
  .sidebar{padding:18px 16px 16px}
  .nav-label{margin:22px 14px 8px}
  .grade-label{margin-top:18px}
  .nav-item{padding:9px 13px}
  .grade-item{padding:7px 13px}
  .sidebar-grades{margin-bottom:14px}
  .sidebar-bottom{padding:14px 14px 16px}
  .sparkle{font-size:22px}
}

/* Mobile-wide hardening across all 5 views (280px–1024px) */
html,body{overflow-x:clip;-webkit-text-size-adjust:100%}
button,a{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
img,canvas,svg{max-width:100%}
.exam-page,.exam-mode-card,.exam-question-card,.exam-navigator,.exam-result-hero,.exam-result-copy,.exam-history-row,.exam-review-item,.exam-topic-stat,.character-layout,.character-gallery,.character-detail,.character-tile,.evolution-form,.evolution-form-copy,.character-move,.arena-end>div:nth-child(2){min-width:0}
.exam-question-card h2,.exam-review-question,.exam-review-explain,.exam-mode-scope,.exam-history-row strong,.arena-question h2{overflow-wrap:anywhere}

@media(max-width:800px){
  .topbar{padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right))}
  main{padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right))}
  .site-footer{padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right))}
  .mobile-nav{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-items:center;padding:4px max(4px,env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px,env(safe-area-inset-left))}
  .mobile-nav button{width:100%;min-width:0;min-height:48px;padding:4px 2px;gap:2px;font-size:clamp(18px,5vw,22px)}
  .mobile-nav span{font-size:clamp(9px,2.5vw,11px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
}
@media(max-width:600px){
  .topbar{gap:8px}
  .mobile-brand{min-width:0;overflow:hidden;text-overflow:ellipsis}
  .realm-top-level{white-space:nowrap;flex:none}
  .exam-topbar-actions{width:100%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .exam-clock{min-width:0;width:100%}
  .exam-progress-pill{text-align:center;display:flex;align-items:center;justify-content:center}
  .exam-topbar-actions button{min-height:44px;width:100%}
  .exam-result-copy{min-width:0;width:100%}
  .exam-result-actions{width:100%}
  .exam-result-actions button{flex:1 1 130px;min-height:46px}
  .exam-nav-buttons button{flex:1 1 120px;min-height:46px}
  .exam-mode-foot{flex-direction:column;align-items:stretch}
  .exam-mode-foot .realm-main-button{width:100%;min-height:46px}
  .exam-history-row{flex-wrap:wrap}
  .arena-end>div:nth-child(2){min-width:0}
  .arena-end-buttons{width:100%;flex-wrap:wrap}
  .arena-end-buttons button{flex:1 1 120px;min-height:44px}
}
@media(max-width:480px){
  .arena-answers{grid-template-columns:1fr}
  .realm-medals{grid-template-columns:repeat(2,minmax(0,1fr))}
  .realm-hero-actions{flex-wrap:wrap}
  .realm-hero-actions button{min-height:44px}
}
@media(max-width:360px){
  .character-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .arena-skills{grid-template-columns:1fr}
  .exam-number-grid{gap:5px}
  .exam-num-btn{min-width:0;min-height:40px;padding:0;font-size:12px}
  .exam-option{min-height:50px;padding:9px 10px;font-size:14px;gap:9px}
  .exam-topbar-actions{gap:6px}
  .exam-clock{font-size:16px;padding:6px 8px}
}
