/* Phone controls are a separate, viewport-bound battlefield. Desktop stays unchanged. */
.detail-head .detail-tower-portrait{display:block;width:80px;height:87px;flex:none;object-fit:contain;border-radius:9px;background:radial-gradient(ellipse at 50% 65%,#63715b38,transparent 70%)}
.detail-head .detail-title{flex:1;min-width:0;align-self:center}
.detail-head .detail-title .level-badge{display:inline-block;margin-top:7px}
.wave-roster{display:block;margin-top:7px;color:#b5c5b6;font-size:11px;line-height:1.65;font-weight:400}
#mobileDock,#mobileTools,#mobileSpeed,#mobileBackdrop,#mobileOverview,#mobileAuto,.mobile-sheet-header{display:none}

@media (max-width:700px), (max-width:1024px) and (max-height:600px){
  body.td-mobile{height:100vh;height:100dvh;min-height:0;overflow:hidden;overscroll-behavior:none;-webkit-text-size-adjust:100%}
  body.td-mobile .game-shell{width:100%;max-width:none;height:100vh;height:100dvh;min-height:0;margin:0;padding:env(safe-area-inset-top,0px) max(8px,env(safe-area-inset-right,0px)) env(safe-area-inset-bottom,0px) max(8px,env(safe-area-inset-left,0px));display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:48px 52px minmax(0,1fr);gap:0;overflow:hidden}
  body.td-mobile .topbar{height:48px;min-height:0;gap:8px;padding:0;border-bottom:1px solid #53644d3d;overflow:hidden}
  body.td-mobile .brand{flex:1;min-width:0;gap:0}
  body.td-mobile .roha-logo{width:190px;max-width:100%;height:auto;max-height:45px;object-fit:contain;object-position:left center}
  body.td-mobile .header-actions{flex:none;gap:4px}
  body.td-mobile .header-actions>#languageBtn,body.td-mobile .header-actions>#worldsBtn,body.td-mobile .header-actions>#soundBtn,body.td-mobile .header-actions>#fullscreenBtn{display:none}
  body.td-mobile .header-actions #menuBtn{min-width:64px;min-height:44px;padding:0 8px;font-size:14px;line-height:1.2;color:#d1d9c5}
  body.td-mobile .header-actions #helpBtn{display:grid;place-items:center;min-width:44px;width:44px;height:44px;padding:0;font-size:0}
  body.td-mobile .header-actions #helpBtn kbd{display:grid;place-items:center;width:28px;height:28px;margin:0;padding:0;font-size:17px;color:#c6d8bd;border-color:#6d806b60;border-radius:50%}
  body.td-mobile .campaign-bar{height:52px;min-height:0;gap:7px;padding:3px 0 5px;margin:0;justify-content:space-between}
  body.td-mobile .campaign-label{display:none!important}
  body.td-mobile .resources{flex:1;min-width:0;gap:clamp(6px,2vw,14px);justify-content:space-between;padding-right:3px}
  body.td-mobile .resource{min-width:0;gap:4px;align-items:center}
  body.td-mobile .resource-icon,body.td-mobile .wave-glyph{font-size:22px;flex:none}
  body.td-mobile .resource small{font-size:9px;letter-spacing:.45px;line-height:1.1;margin-bottom:3px;white-space:nowrap;color:#9dad9e}
  body.td-mobile .resource strong{font-size:17px;line-height:1.1;white-space:nowrap;letter-spacing:-.2px}
  body.td-mobile .resource em{font-size:11px;margin-left:1px;color:#8ba295}
  body.td-mobile .play-controls{flex:none;gap:4px;min-width:0}
  body.td-mobile .speed-buttons{display:none}
  body.td-mobile #pauseBtn,body.td-mobile #mobileSpeed{display:grid;place-items:center;min-width:44px;width:44px;height:44px;padding:0;border:1px solid #53664d80;border-radius:6px;background:linear-gradient(135deg,#26372f,#18282b);font-size:16px;font-weight:700;line-height:1;color:#d5e1c4;touch-action:manipulation}
  body.td-mobile .battle-layout{display:block;min-width:0;min-height:0;height:100%;margin:0;overflow:hidden}
  body.td-mobile .battle-column{position:relative;display:flex;flex-direction:column;gap:5px;width:100%;height:100%;min-width:0;min-height:0;margin:0;overflow:hidden}
  body.td-mobile .map-frame{position:relative;flex:1 1 0;min-height:150px;height:auto;width:100%;aspect-ratio:auto;max-height:none;margin:0;border-radius:8px;border-color:#62745580;background:radial-gradient(ellipse at 50% 50%,#263e33,#0c1a1c);box-shadow:inset 0 0 40px #06121155}
  body.td-mobile #battlefield{width:100%;height:100%;display:block;touch-action:none;user-select:none;-webkit-user-select:none}
  body.td-mobile .map-vignette{box-shadow:inset 0 0 30px #071d2633}
  body.td-mobile .map-heading{left:12px;top:10px;max-width:calc(100% - 125px);padding:0;pointer-events:none}
  body.td-mobile #mobileOverview{position:absolute;top:9px;right:9px;z-index:6;display:block;width:104px;height:64px;min-width:104px;min-height:64px;padding:0;margin:0;overflow:hidden;border:1px solid #b1ca8b99;border-radius:5px;background:#10271ef2;box-shadow:0 3px 12px #0007;touch-action:none;-webkit-tap-highlight-color:transparent}
  body.td-mobile #mobileMiniMap{display:block;width:100%;height:100%;margin:0;pointer-events:none;touch-action:none}
  body.td-mobile #mobileOverview:focus-visible{outline:2px solid #e3d29a;outline-offset:3px}
  body.td-mobile #mobileOverview:active{transform:none}
  body.td-mobile .map-chapter{font-size:9px;letter-spacing:1px;line-height:1.3;color:#c2d4a6}
  body.td-mobile .map-heading h1{font-size:clamp(15px,4vw,20px);line-height:1.2;letter-spacing:-.4px;margin:4px 0}
  body.td-mobile .map-heading p{font-size:11px;line-height:1.3;color:#a7b8a4;max-width:100%}
  body.td-mobile .map-status{top:auto;bottom:9px;right:9px;max-width:52%;padding:5px 8px;font-size:10px;line-height:1.3;border-color:#cad9b520;background:#0d1d1ae0}
  body.td-mobile .map-hint{left:8px;bottom:8px;right:auto;padding:5px 8px;gap:5px;max-width:54%;font-size:11px;line-height:1.3;background:#11211df0;border-color:#70856650}
  body.td-mobile .hint-spark{font-size:20px;flex:none}
  body.td-mobile .wave-banner strong{font-size:24px}
  body.td-mobile .wave-banner span{font-size:12px;letter-spacing:.5px;margin-top:6px}
  body.td-mobile .wave-brief{flex:0 0 48px;min-height:48px;height:48px;gap:8px;padding:4px 8px;margin:0;border-radius:6px;background:#1a2829;border-color:#53634d60;overflow:hidden}
  body.td-mobile .next-emblem{width:35px;height:38px;flex:none}
  body.td-mobile .next-emblem canvas{width:35px;height:38px}
  body.td-mobile .next-info .eyebrow{font-size:9px;letter-spacing:.6px;line-height:1.1}
  body.td-mobile .next-info strong{font-size:14px;line-height:1.2;margin:3px 0 0}
  body.td-mobile .next-info>span:last-child{display:none}
  body.td-mobile .wave-progress{width:55px}
  body.td-mobile .wave-progress>div:first-child{font-size:9px;letter-spacing:0;flex-direction:column;gap:2px;align-items:flex-end}
  body.td-mobile .wave-progress b{font-size:12px}
  body.td-mobile .progress-track{margin-top:6px}
  body.td-mobile #waveInfoBtn{display:grid;place-items:center;min-width:44px;min-height:44px;margin:0;padding:0 4px;font-size:12px;color:#c0d2b5}
  body.td-mobile .chapter-track,body.td-mobile .map-footer,body.td-mobile .site-footer,body.td-mobile .accessible-pads{display:none}

  body.td-mobile #mobileTools{display:flex;flex:0 0 44px;align-items:center;gap:4px;min-width:0;height:44px;padding:0;margin:0}
  body.td-mobile #mobileTools button{display:grid;place-items:center;flex:none;min-height:44px;min-width:44px;padding:0 7px;background:#1b2b29;border:1px solid #4d634760;border-radius:6px;font-size:15px;line-height:1.1;color:#c9d7bd;touch-action:manipulation}
  body.td-mobile #mobileZoomOut,body.td-mobile #mobileZoomIn{font-size:23px!important;width:44px}
  body.td-mobile #mobileZoomReset{font-size:12px!important;width:48px;font-variant-numeric:tabular-nums}
  body.td-mobile #mobileSelection{flex:1;min-width:0;font-size:12px;line-height:1.3;color:#a7bca2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-left:3px}
  body.td-mobile #mobileTools #mobileDetails{min-width:64px;max-width:108px;white-space:normal;font-size:12px;background:#2c3a2b;color:#d6e3bf;border-color:#70865180}
  body.td-mobile #mobileTools #mobileCancel{width:44px;min-width:44px;max-width:44px;font-size:25px;line-height:1;padding:0;color:#f0c2a6;border-color:#bc80647a;background:#48342ef0}
  body.td-mobile #mobileDock{display:grid;flex:0 0 64px;grid-template-columns:minmax(0,.9fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1.25fr);gap:5px;align-items:stretch;min-height:64px;height:64px;padding:0 0 5px;margin:0;background:#10191b;z-index:12}
  body.td-mobile #mobileDock .spell-bar{display:contents;position:static;inset:auto;width:auto;padding:0;margin:0}
  body.td-mobile #mobileDock button{min-width:0;width:100%;min-height:48px;height:100%;padding:6px 3px;border-radius:7px;line-height:1.2;touch-action:manipulation}
  body.td-mobile #mobileBuild{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:3px;background:linear-gradient(135deg,#34432c,#243328);border:1px solid #8ba96388;color:#d8e7c2;font-size:13px;font-weight:700}
  body.td-mobile #mobileBuild small{display:block;color:#e4bd73;font-size:12px;font-weight:500}
  body.td-mobile #mobileBuild.selected,body.td-mobile #mobileBuild[aria-pressed=true]{border-color:#dce8ac;background:#435832;box-shadow:inset 0 0 0 1px #c3d89566}
  body.td-mobile #mobileDock .spell{display:flex;align-items:center;justify-content:center;gap:5px;background:#1d2b2b;text-align:left;border-color:#6e7d5b80}
  body.td-mobile #mobileDock .spell.selected{border-color:#e4bd73;background:#41432b;box-shadow:inset 0 0 0 1px #e4bd7333}
  body.td-mobile #mobileDock .spell-icon{width:22px;height:27px;flex:none;background:none}
  body.td-mobile #mobileDock .spell-icon svg{width:22px;height:25px}
  body.td-mobile #mobileDock .spell b{display:block;font-size:12px;line-height:1.2;font-weight:700}
  body.td-mobile #mobileDock .spell small{display:block;font-size:11px;line-height:1.2;margin-top:4px;color:#a6bca7}
  body.td-mobile #mobileDock kbd{display:none}
  body.td-mobile #mobileDock #startBtn{display:flex;align-items:center;justify-content:center;gap:4px;padding:6px;font-size:12px;line-height:1.25;margin:0;text-align:center;background:linear-gradient(135deg,#c0d994,#a4c779);color:#273824;border-color:#d1e4ab}
  body.td-mobile #mobileDock #startBtn .start-symbol{font-size:20px;flex:none}
  body.td-mobile #mobileDock #startBtn:disabled{background:#2d4033;border-color:#536a49;color:#aec4a2}
  body.td-mobile .wave-quote{position:absolute;left:8px;right:8px;bottom:166px;z-index:16;max-height:126px;display:flex;align-items:center;gap:7px;margin:0;padding:10px 4px 10px 11px;border-radius:7px;background:#14251bf5;border-color:#6b7b50;box-shadow:0 5px 28px #0006;backdrop-filter:blur(8px)}
  body.td-mobile .wave-quote .quote-mark{display:none}
  body.td-mobile .wave-quote .eyebrow{font-size:9px;letter-spacing:.6px;line-height:1.2}
  body.td-mobile .wave-quote p{font-size:13px;line-height:1.5;max-height:80px;overflow-y:auto;overscroll-behavior:contain;margin-top:4px}
  body.td-mobile .wave-quote button{width:44px;height:44px;min-width:44px;font-size:26px}
  body.td-mobile .toast{bottom:calc(122px + env(safe-area-inset-bottom,0px));width:max-content;max-width:calc(100vw - 36px);padding:10px 14px;font-size:13px;line-height:1.4;z-index:10030}

  body.td-mobile #mobileBackdrop{position:fixed;inset:0;z-index:119;background:#020b09a6;backdrop-filter:blur(3px);touch-action:none}
  body.td-mobile.mobile-sheet-open #mobileBackdrop{display:block}
  body.td-mobile .arsenal{position:fixed;left:max(8px,env(safe-area-inset-left,0px));right:max(8px,env(safe-area-inset-right,0px));bottom:0;top:auto;z-index:120;display:none;grid-template-columns:none;max-height:65vh;max-height:65dvh;width:auto;min-width:0;margin:0;padding:0 16px max(18px,env(safe-area-inset-bottom,0px));border:1px solid #78855e;border-bottom:0;border-radius:18px 18px 0 0;background:linear-gradient(155deg,#25372c,#152426 75%);box-shadow:0 -15px 65px #0007;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
  body.td-mobile.mobile-sheet-open .arsenal,body.td-mobile .arsenal.mobile-sheet-open{display:block}
  body.td-mobile .arsenal .arsenal-heading,body.td-mobile .arsenal .tower-grid,body.td-mobile .arsenal .wave-launch{display:none}
  body.td-mobile .mobile-sheet-header{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;min-height:54px;gap:14px;margin:0 -16px;padding:5px 9px 5px 16px;background:#21342cf5;border-bottom:1px solid #82916655;backdrop-filter:blur(10px);font-size:15px;font-weight:600;color:#d4dfbd}
  body.td-mobile .mobile-sheet-header b{display:block}
  body.td-mobile .mobile-sheet-header small{display:block;font-size:12px;font-weight:400;line-height:1.35;margin-top:3px;color:#a7bca2}
  body.td-mobile #mobileSheetClose{display:grid;place-items:center;width:44px;height:44px;min-width:44px;font-size:26px;font-weight:400;color:#cedcbb;border:1px solid #71825966;border-radius:7px;background:#15251e66}
  body.td-mobile .arsenal .tower-detail{display:block;min-height:0;width:100%;margin:0;padding:16px 0 0;border:0}
  body.td-mobile .arsenal .tower-detail:has(.detail-head){display:flex;flex-direction:column}
  body.td-mobile .tower-detail .detail-head{order:0}
  body.td-mobile .tower-detail .detail-role{order:1}
  body.td-mobile .tower-detail .stats-grid{order:2}
  body.td-mobile .tower-detail .detail-actions{order:3}
  body.td-mobile .tower-detail .ultimate-button{order:4;margin-top:10px}
  body.td-mobile .tower-detail .theme-current{order:5}
  body.td-mobile .tower-detail .targeting{order:6;margin-top:14px}
  body.td-mobile .tower-detail .skill-summary{order:7}
  body.td-mobile .tower-detail .detail-links{order:8}
  body.td-mobile .detail-head{gap:12px;align-items:flex-start}
  body.td-mobile .detail-head h3{font-size:18px;line-height:1.4}
  body.td-mobile .level-badge{font-size:12px;line-height:1.3;padding:6px 8px;flex:none}
  body.td-mobile .detail-role,body.td-mobile .skill-summary{font-size:14px;line-height:1.65}
  body.td-mobile .detail-role{margin-top:8px}
  body.td-mobile .theme-current{padding:10px 12px;margin-top:12px;line-height:1.55}
  body.td-mobile .theme-current b,body.td-mobile .theme-current span{font-size:13px;line-height:1.5}
  body.td-mobile .stats-grid{gap:10px;margin:15px 0;padding:12px 10px;border:1px solid #69815a3d;background:#10251c55;border-radius:6px}
  body.td-mobile .stat-value{font-size:20px}
  body.td-mobile .stat-label{font-size:10px;letter-spacing:.8px}
  body.td-mobile .targeting>span{font-size:11px;letter-spacing:.6px}
  body.td-mobile .targeting-buttons{gap:7px;margin-top:8px}
  body.td-mobile .targeting-buttons button{min-height:44px;font-size:14px;padding:8px 10px}
  body.td-mobile .skill-summary{margin:14px 0}
  body.td-mobile .detail-actions{display:flex;gap:8px;flex-wrap:nowrap;margin-top:14px}
  body.td-mobile .upgrade-button,body.td-mobile .build-button,body.td-mobile .sell-button{min-height:48px;font-size:14px;padding:12px 14px;border-radius:7px;line-height:1.25}
  body.td-mobile .sell-button{flex:0 1 auto}
  body.td-mobile .detail-links{display:flex;gap:12px;flex-wrap:wrap;margin-top:8px}
  body.td-mobile .skills-button{min-height:44px;font-size:14px;padding:12px 0;line-height:1.4;text-underline-offset:4px}
  body.td-mobile .ultimate-button{min-height:64px;padding:13px 15px;border-radius:7px;gap:7px}
  body.td-mobile .ultimate-button span{font-size:16px}
  body.td-mobile .ultimate-button b{font-size:13px}
  body.td-mobile .detail-empty p{font-size:14px}
  body.td-mobile .detail-empty .detail-kicker{font-size:15px}
  body.td-mobile .detail-empty small{font-size:12px}
  body.td-mobile .pause-overlay{padding:15px}
  body.td-mobile .pause-overlay>span{font-size:32px}
  body.td-mobile .pause-overlay h2{font-size:18px;margin:10px 0 16px}
  body.td-mobile #resumeBtn{min-height:46px;min-width:140px;font-size:15px}

  body.td-mobile #codexModal{width:calc(100vw - 16px);max-width:none;max-height:calc(100vh - 20px);max-height:calc(100dvh - 20px);padding:14px 16px 20px;border-radius:12px;margin:auto;overscroll-behavior:contain}
  body.td-mobile #codexModal .modal-top{position:sticky;top:-14px;z-index:3;margin:-1px -2px 14px;padding:3px 0;background:#16231ff5;backdrop-filter:blur(10px)}
  body.td-mobile #codexModal .modal-top .eyebrow{font-size:10px;letter-spacing:1.1px}
  body.td-mobile #codexModal .close-dialog{min-width:44px;min-height:44px;font-size:28px;border:1px solid #68805955;border-radius:6px;background:#26372a}
  body.td-mobile #codexModal .modal-title{font-size:21px;line-height:1.4;margin-bottom:12px}
  body.td-mobile #codexModal .modal-intro{font-size:14px;line-height:1.65;margin-bottom:18px}
  body.td-mobile #codexModal .modal-footnote,body.td-mobile #codexModal .theme-confirm>small{font-size:12px;line-height:1.65}
  body.td-mobile #codexModal .world-grid,body.td-mobile #codexModal .theme-choice-grid,body.td-mobile #codexModal .help-grid,body.td-mobile #codexModal .difficulty-grid{grid-template-columns:1fr;gap:10px}
  body.td-mobile #codexModal .world-card{padding:15px}
  body.td-mobile #codexModal .world-card h3{font-size:17px;line-height:1.35}
  body.td-mobile #codexModal .world-card p,body.td-mobile #codexModal .world-boss{font-size:14px;line-height:1.5}
  body.td-mobile #codexModal .world-card small{font-size:11px}
  body.td-mobile #codexModal .path-choice-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  body.td-mobile #codexModal .path-choice{padding:12px 9px;gap:7px}
  body.td-mobile #codexModal .path-choice canvas{width:70px;height:86px}
  body.td-mobile #codexModal .path-choice strong{font-size:17px;line-height:1.25}
  body.td-mobile #codexModal .path-choice b,body.td-mobile #codexModal .path-choice span{font-size:12px;line-height:1.55}
  body.td-mobile #codexModal .path-choice small{font-size:13px;padding-top:4px}
  body.td-mobile #codexModal .theme-choice{padding:12px;gap:12px;min-width:0}
  body.td-mobile #codexModal .theme-mini{width:70px;height:88px;flex:none}
  body.td-mobile #codexModal .theme-choice-copy strong{font-size:16px;line-height:1.3}
  body.td-mobile #codexModal .theme-choice-copy b,body.td-mobile #codexModal .theme-choice-copy span{font-size:14px;line-height:1.5}
  body.td-mobile #codexModal .theme-choice-copy small{font-size:12px;line-height:1.45}
  body.td-mobile #codexModal .theme-confirm{position:sticky;bottom:-20px;z-index:2;display:flex;flex-direction:column;gap:10px;margin:15px -16px -20px;padding:14px 16px 16px;background:#17291ff5;border-top:1px solid #8c9a6680;box-shadow:0 -8px 28px #0004;backdrop-filter:blur(12px)}
  body.td-mobile #codexModal .theme-confirm h3{font-size:17px;line-height:1.35}
  body.td-mobile #codexModal .theme-confirm p{font-size:13px;line-height:1.5;margin-top:5px}
  body.td-mobile #codexModal #themeChoiceSkill{display:none}
  body.td-mobile #codexModal .theme-confirm>small{display:none}
  body.td-mobile #codexModal .primary,body.td-mobile #codexModal .quiet,body.td-mobile #codexModal .back-button{min-height:44px;font-size:14px;line-height:1.3}
  body.td-mobile #codexModal #confirmTheme{width:100%;min-height:48px}
  body.td-mobile #codexModal .modal-actions{flex-wrap:wrap;gap:10px}
  body.td-mobile #codexModal .modal-actions button{flex:1 1 150px;padding:12px;white-space:normal}
  body.td-mobile #codexModal .skill-row{padding:14px}
  body.td-mobile #codexModal .skill-row small{font-size:11px}
  body.td-mobile #codexModal .skill-row h3,body.td-mobile #codexModal .help-item h3{font-size:16px}
  body.td-mobile #codexModal .skill-row p,body.td-mobile #codexModal .help-item p{font-size:14px;line-height:1.7}
  body.td-mobile #codexModal .branch-step{gap:8px;padding:12px 8px}
  body.td-mobile #codexModal .branch-step>canvas{width:55px;height:66px}
  body.td-mobile #codexModal .branch-step>span{width:25px;height:25px;font-size:12px}
  body.td-mobile #codexModal .branch-step h3{font-size:15px;line-height:1.35}
  body.td-mobile #codexModal .branch-step p{font-size:12px;line-height:1.5}
  body.td-mobile #codexModal .branch-step b{font-size:13px}
  body.td-mobile #codexModal .wave-table{font-size:12px;table-layout:fixed}
  body.td-mobile #codexModal .wave-table th{font-size:10px;letter-spacing:0}
  body.td-mobile #codexModal .wave-table td,body.td-mobile #codexModal .wave-table th{padding:8px 4px;overflow-wrap:anywhere}
  body.td-mobile #codexModal .wave-table th:nth-child(1){width:15%}
  body.td-mobile #codexModal .wave-table th:nth-child(2){width:49%}
  body.td-mobile #codexModal .wave-table th:nth-child(3){width:20%}
  body.td-mobile #codexModal .wave-table th:nth-child(4){width:16%}
  body.td-mobile #codexModal .wave-enemy-cell{gap:5px;align-items:center}
  body.td-mobile #codexModal .codex-creature{width:31px;height:40px}
  body.td-mobile #codexModal .boss-row .codex-creature{width:38px;height:48px}
  body.td-mobile .roha-home .home-utilities{flex-wrap:wrap;min-width:0;justify-content:flex-end;gap:8px}
  body.td-mobile .roha-home .home-utilities button{min-height:44px;line-height:1.35;font-size:14px}
  body.td-mobile .roha-home #mobileAuto{display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:44px;max-width:100%;padding:10px 13px;border:1px solid #6e7a5f70;border-radius:5px;background:#23342a80;color:#c2cfb8;font-size:14px;line-height:1.35;white-space:normal;touch-action:manipulation}
  body.td-mobile .roha-home #mobileAuto::before{content:'';display:block;flex:none;width:28px;height:16px;border:1px solid #8ba47766;border-radius:10px;background:radial-gradient(circle at 7px 7px,#a5b295 4px,transparent 4.5px),#25372b}
  body.td-mobile .roha-home #mobileAuto[aria-pressed=true]{border-color:#9dbb7388;background:#40533180;color:#e0eacc}
  body.td-mobile .roha-home #mobileAuto[aria-pressed=true]::before{background:radial-gradient(circle at 19px 7px,#e1efc4 4px,transparent 4.5px),#6e8e4c}
}

@media (max-width:1024px) and (max-height:600px) and (orientation:landscape){
  body.td-mobile .game-shell{grid-template-columns:minmax(0,.86fr) minmax(370px,1.14fr);grid-template-rows:52px minmax(0,1fr);column-gap:12px;padding-top:env(safe-area-inset-top,0px);padding-bottom:max(5px,env(safe-area-inset-bottom,0px))}
  body.td-mobile .topbar{grid-column:1;grid-row:1;height:52px;border-bottom:0}
  body.td-mobile .roha-logo{width:175px;max-height:46px}
  body.td-mobile .campaign-bar{grid-column:2;grid-row:1;height:52px;gap:8px}
  body.td-mobile .resources{gap:12px;justify-content:space-around}
  body.td-mobile .battle-layout{grid-column:1/-1;grid-row:2}
  body.td-mobile .battle-column{display:grid;grid-template-columns:minmax(0,1fr) 178px;grid-template-rows:49px minmax(88px,1fr) 119px;gap:5px 7px}
  body.td-mobile .map-frame{grid-column:1;grid-row:1/4;min-height:0;height:100%;width:100%;flex:none;border-radius:7px}
  body.td-mobile .map-heading{top:8px;left:10px;max-width:calc(100% - 125px)}
  body.td-mobile .map-heading h1{font-size:16px;margin:3px 0}
  body.td-mobile .map-heading p{display:none}
  body.td-mobile .map-status{font-size:10px;bottom:7px;right:7px;padding:4px 6px}
  body.td-mobile .map-hint{bottom:7px;left:7px;font-size:11px;max-width:57%}
  body.td-mobile .wave-brief{grid-column:2;grid-row:1;height:49px;min-height:0;padding:4px 5px;gap:5px;margin:0}
  body.td-mobile .next-emblem{width:28px;height:34px}
  body.td-mobile .next-emblem canvas{width:28px;height:34px}
  body.td-mobile .next-info .eyebrow{font-size:8px;letter-spacing:.15px}
  body.td-mobile .next-info strong{font-size:12px;margin-top:3px}
  body.td-mobile .wave-progress{display:none}
  body.td-mobile #waveInfoBtn{min-width:44px;width:44px;font-size:10px;padding:0}
  body.td-mobile #mobileTools{grid-column:2;grid-row:2;display:grid;grid-template-columns:44px minmax(44px,1fr) 44px;grid-template-rows:44px 44px;gap:4px;align-content:start;height:auto;min-height:0;padding:0}
  body.td-mobile #mobileTools button{width:100%;min-width:0}
  body.td-mobile #mobileZoomOut{grid-column:1;grid-row:1}
  body.td-mobile #mobileZoomReset{grid-column:2;grid-row:1}
  body.td-mobile #mobileZoomIn{grid-column:3;grid-row:1}
  body.td-mobile #mobileSelection{grid-column:1/3;grid-row:2;align-self:center;white-space:normal;font-size:12px;line-height:1.35;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;padding-left:2px}
  body.td-mobile #mobileTools #mobileDetails{grid-column:3;grid-row:2;min-width:0;max-width:none;padding:3px;font-size:10px}
  body.td-mobile #mobileTools #mobileCancel{grid-column:3;grid-row:2;width:44px;min-width:44px;max-width:44px;padding:0;font-size:25px;justify-self:end}
  body.td-mobile #mobileDock{grid-column:2;grid-row:3;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:56px 56px;height:119px;min-height:0;gap:5px;padding:0 0 2px}
  body.td-mobile #mobileBuild{grid-column:1;grid-row:1}
  body.td-mobile #mobileDock #meteorBtn{grid-column:2;grid-row:1}
  body.td-mobile #mobileDock #blizzardBtn{grid-column:1;grid-row:2}
  body.td-mobile #mobileDock #startBtn{grid-column:2;grid-row:2}
  body.td-mobile .wave-quote{left:8px;right:193px;bottom:8px;max-height:115px;padding:9px 3px 9px 10px}
  body.td-mobile .wave-quote p{max-height:74px;font-size:13px}
  body.td-mobile .toast{bottom:17px;left:calc((100% - 185px)/2);max-width:calc(100vw - 220px);font-size:12px}
  body.td-mobile .arsenal{left:auto;right:max(8px,env(safe-area-inset-right,0px));top:8px;bottom:8px;width:min(390px,58vw);max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);border:1px solid #78855e;border-radius:14px;padding-bottom:16px}
  body.td-mobile #codexModal{width:min(900px,calc(100vw - 24px));max-height:calc(100dvh - 16px);padding:12px 18px 18px}
  body.td-mobile #codexModal .modal-top{top:-12px;margin-bottom:10px}
  body.td-mobile #codexModal .modal-title{font-size:19px;margin-bottom:8px}
  body.td-mobile #codexModal .modal-intro{font-size:13px;margin-bottom:14px}
  body.td-mobile #codexModal .path-choice-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
  body.td-mobile #codexModal .world-grid,body.td-mobile #codexModal .theme-choice-grid,body.td-mobile #codexModal .difficulty-grid,body.td-mobile #codexModal .help-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  body.td-mobile #codexModal .theme-confirm{margin-right:-18px;margin-left:-18px;padding:11px 18px 13px;flex-direction:row;align-items:center;gap:14px}
  body.td-mobile #codexModal .theme-confirm>div{flex:1;min-width:0}
  body.td-mobile #codexModal .theme-confirm h3{font-size:15px}
  body.td-mobile #codexModal .theme-confirm #confirmTheme{width:180px;flex:none}
}

@media (max-width:360px){
  body.td-mobile .roha-logo{width:165px}
  body.td-mobile .resource-icon,body.td-mobile .wave-glyph{display:none}
  body.td-mobile .resources{gap:6px;justify-content:space-around}
  body.td-mobile .resource strong{font-size:16px}
  body.td-mobile #mobileDock{gap:4px}
  body.td-mobile #mobileDock .spell-icon{display:none}
  body.td-mobile #mobileDock #startBtn .start-symbol{display:none}
  body.td-mobile #mobileSelection{font-size:11px}
}

@media (max-width:700px){
  body.td-mobile .roha-home .home-top{gap:16px}
  body.td-mobile .roha-home .home-utilities{position:static;inset:auto;align-self:stretch;display:flex;flex-wrap:wrap;justify-content:flex-start;gap:8px;width:100%;max-width:100%}
  body.td-mobile .roha-home .home-copy{padding-top:26px}
}

@media (max-height:360px) and (orientation:landscape){
  body.td-mobile .game-shell{grid-template-rows:48px minmax(0,1fr)}
  body.td-mobile .topbar,body.td-mobile .campaign-bar{height:48px}
  body.td-mobile .battle-column{grid-template-rows:44px minmax(88px,1fr) 105px;gap:4px 6px}
  body.td-mobile .wave-brief{height:44px}
  body.td-mobile #mobileDock{grid-template-rows:50px 50px;height:105px;gap:4px;padding:0 0 1px}
  body.td-mobile .map-heading h1{font-size:14px}
  body.td-mobile .map-chapter{font-size:8px}
}

@media (prefers-reduced-motion:reduce){
  body.td-mobile #mobileDock button,body.td-mobile #mobileTools button,body.td-mobile .arsenal{transition:none}
}

/* Browser chrome can leave less than 320px in landscape. Keep battle actions reachable. */
@media (max-width:1024px) and (max-height:320px) and (orientation:landscape){
  body.td-mobile .battle-column{grid-template-rows:minmax(88px,1fr) 105px}
  body.td-mobile .map-frame{grid-row:1/3}
  body.td-mobile .wave-brief{display:none}
  body.td-mobile #mobileTools{grid-row:1}
  body.td-mobile #mobileDock{grid-row:2}
  body.td-mobile .map-heading{top:6px}
  body.td-mobile .map-heading h1{font-size:13px}
}
