/* Painted spellbook measured against the user's supplied reference. */
dialog{box-sizing:border-box;max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);overflow:auto;overscroll-behavior:contain}
.spellbook-sheet{width:min(84vw,1280px);height:min(86dvh,850px);max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);padding:0;overflow:hidden;border:1px solid #7d6240;border-radius:3px;background:radial-gradient(ellipse at 65% 20%,#3a2c1e66,transparent 55%),linear-gradient(180deg,#1f1a15,#120f0c);box-shadow:inset 0 1px 0 #ffffff12,inset 0 0 0 1px #000,0 0 0 1px #000,0 20px 80px #000b}
.spellbook-sheet::backdrop{background:#100d0a40;backdrop-filter:blur(2px)}
.spellbook-sheet #sheet-content{height:100%;min-height:0}
.spellbook{box-sizing:border-box;height:100%;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto;padding:18px 26px 0;font-family:Barlow,sans-serif;position:relative}
.spellbook::before,.spellbook::after{content:'';position:absolute;width:9px;height:9px;border:1px solid #9a7a4b;transform:rotate(45deg);pointer-events:none;opacity:.8}.spellbook::before{top:7px;left:7px}.spellbook::after{bottom:7px;left:7px}
.spellbook-heading{padding:0 58px 14px 0;margin:0 0 14px;gap:16px;min-width:0;border-color:#93a29f35;min-height:94px}
.spellbook-heading>img{width:96px;height:90px;flex:none;object-fit:contain}
.spellbook-heading h2{font:700 clamp(26px,2.5vw,39px)/1.14 Cinzel,Barlow,serif;color:#eae2d1;white-space:normal}
.spellbook-heading p{font:19px/1.3 Barlow,sans-serif;color:#d2bf9f;margin-top:4px}
.point-count{font:700 25px/1.3 Cinzel,Barlow,serif;gap:7px;color:#d0b175;align-self:center;flex:none;white-space:nowrap}.point-count span{font:inherit}.point-count .gold-star{font-size:27px;margin-right:6px}
.spellbook-sheet .close{right:18px;top:23px;width:42px;height:42px;border-color:var(--mr-bronze);border-radius:2px;font:31px/1 Barlow,sans-serif;background:linear-gradient(180deg,#2a251f,#1c1814);color:var(--mr-parchment)}
.spellbook-layout{min-height:0;grid-template-columns:minmax(0,1fr) minmax(0,1.03fr);gap:26px;overflow:hidden}
.spell-list{min-height:0;padding:0;display:grid;grid-template-rows:repeat(4,minmax(0,1fr));gap:10px;overflow:auto;scrollbar-width:thin}
.spell-row{min-height:98px;padding:11px;grid-template-columns:82px 33px minmax(0,1fr) auto 15px;gap:12px;background:linear-gradient(125deg,#26201aa8,#181410);border-color:#4d4337;border-radius:2px;box-shadow:inset 0 1px 0 #ffffff0a,inset 0 0 18px #0f0c0a66;color:var(--mr-parchment);font-family:Barlow,sans-serif}
.spell-row[aria-pressed=true]{background:linear-gradient(125deg,#3a2f22aa,#211a14);border-color:var(--mr-gold);box-shadow:inset 0 1px 0 #ffe8b81a,inset 3px 0 0 var(--mr-gold)}
.painted-spell{display:block;background-size:200% 200%;background-repeat:no-repeat}
.spell-row-icon{width:82px;height:82px;border:1px solid #7d6240;border-radius:2px;box-shadow:0 0 0 1px #000,inset 0 0 10px #000a;flex:none;filter:saturate(.8) sepia(.12)}
.spell-row-copy>b{font:700 clamp(17px,1.65vw,24px)/1.2 Cinzel,Barlow,serif;overflow-wrap:anywhere}
.spell-row kbd{font:21px/1 Barlow,sans-serif;padding:5px;border-color:#b19a7a;border-radius:5px;background:#191511;color:#dbc9a7}
.spell-row>small{font:13px/1.25 Barlow,sans-serif;max-width:65px;color:#c5b9a3}.spell-row .row-chevron{width:16px;height:23px;color:#c1b8a0}
.rank-pips{margin-top:10px;gap:7px}.rank-pips i{width:12px;height:12px;border-color:#a1aba9;background:#231d17}
.ultimate-row:not([aria-pressed=true]){opacity:.67}
.spell-detail{min-height:0;display:flex;flex-direction:column;padding-left:24px;border-color:#8a9d9930;overflow:hidden}
.spell-detail-scroll{min-height:0;flex:1;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:0 3px 4px 0}
.spell-visual{width:clamp(145px,25dvh,260px);max-width:100%;height:auto;aspect-ratio:1;margin:-8px auto -10px;mask-image:radial-gradient(ellipse at center,#000 43%,#000b 64%,transparent 76%);background-color:transparent}
.spell-detail h3{font:700 clamp(26px,2.6vw,40px)/1.1 Cinzel,Barlow,serif;margin:6px 0 10px;color:#ebe3d2}
.spell-detail .spell-description{font:clamp(16px,1.55vw,22px)/1.3 Barlow,sans-serif;color:#e9e3d6;margin:0 0 12px}
.spell-tags{font:700 16px/1.2 Barlow,sans-serif;padding:5px 11px;border:1px solid #5c4630;border-radius:2px;background:#15110ecc;color:var(--mr-bronze-hi)}
.spell-stats{font:17px/1.3 Barlow,sans-serif;gap:8px;margin:14px 0 6px;color:#ded2b7;align-items:start}.spell-stats b{font:inherit;color:#ebe3d2}.spell-stats small{font:12px/1.3 Barlow,sans-serif;margin-top:3px}.spell-stats>span{position:relative}.spell-stats svg{width:25px;height:25px;vertical-align:middle;margin-right:6px;color:#bdb59e;flex:none}.cooldown-stat{display:flex;align-items:start}
.rank-track{margin:13px 0 6px;padding:0 24px}.rank-track::before{left:34px;right:34px;top:11px;height:4px;background:#48433e}.rank-track li{font:14px/1.2 Barlow,sans-serif;gap:7px}.rank-track i{width:25px;height:25px;border-color:#637370;background:#221c17}.rank-track .next i{border-color:#e5ca84;box-shadow:0 0 12px #d2bc8160}.rank-track .next span{color:#e5ca84;font-weight:700}
.spell-tips{font:12px/1.4 Barlow,sans-serif;color:#c2c6bc;margin:5px 0 0}.spell-tips summary{cursor:pointer;min-height:26px;display:list-item;color:#c3bbad}.spell-detail .upgrade-note,.spell-detail .combo-note{font:13px/1.4 Barlow,sans-serif}
.spell-learn-action{flex:none;padding-top:7px}.spell-detail .primary{font:700 20px/1.2 Cinzel,Barlow,serif;min-height:53px;letter-spacing:0;text-transform:none;background:linear-gradient(180deg,#d6b67b,#a9844d 55%,#8c6c3e);border:1px solid #f0d49a99;border-radius:2px;color:#1b130b;box-shadow:inset 0 1px 0 #fff3cf80,inset 0 -2px 0 #0000004d,0 0 0 1px #000;margin:0}.spell-detail .primary span{margin-right:9px}.spell-detail .primary:disabled{background:#292420;border-color:#787c71;color:#b8b3ab}
.training-feedback{font:12px/1.2 Barlow,sans-serif!important;min-height:14px;margin:4px 0 0!important}
.spellbook-footer{position:static;margin:14px -26px 0;padding:14px 26px;min-height:69px;gap:15px;background:#120f0cd9;border-color:#7d624055;border-radius:0 0 2px 2px}
.spellbook-footer p{display:flex;align-items:center;gap:15px;font:17px/1.3 Barlow,sans-serif;color:#e4dcc7}.spellbook-footer p svg{width:37px;height:37px;flex:none;stroke-width:3;color:#a59874}.spellbook-footer .row-btn{font:700 16px/1.2 Cinzel,Barlow,serif;min-height:44px;min-width:185px;border-radius:2px;border-color:var(--mr-bronze);color:var(--mr-parchment);background:linear-gradient(180deg,#2a251f,#1c1814);flex:none}
/* Real controls, separate from cast targets. */
.ability.trainable::after{content:none}
.ability-upgrade{position:absolute;z-index:4;width:36px;height:36px;padding:0;display:grid;place-items:center;border:2px solid #ebd18f;border-radius:50%;background:linear-gradient(#e5ca8b,#af9459);box-shadow:0 2px 6px #120f0c;color:#1c1916;font:700 27px/1 Barlow,sans-serif;touch-action:manipulation;pointer-events:auto}
.ability-upgrade[hidden]{display:none}.ability-upgrade:focus-visible{outline:3px solid #f1e8d7;outline-offset:3px}.ability-upgrade:hover{filter:brightness(1.15)}
.upgrade-dash{right:-6px;top:43px}.upgrade-surge{left:113px;top:75px}.upgrade-signature{left:39px;bottom:2px}.upgrade-ult{right:-7px;bottom:-6px}
@media(max-width:1000px){.spellbook-sheet{width:94vw}.spellbook{padding-inline:18px}.spellbook-layout{gap:17px}.spell-detail{padding-left:17px}.spell-row{grid-template-columns:62px 27px minmax(0,1fr) auto 13px;gap:8px;padding:9px;min-height:86px}.spell-row-icon{width:62px;height:62px}.spell-row-copy>b{font-size:18px}.spellbook-heading h2{font-size:28px}.point-count{font-size:20px}.spellbook-footer{margin-inline:-18px;padding-inline:18px}.spellbook-footer p{font-size:15px}.spellbook-footer .row-btn{font-size:15px;min-width:160px}}
@media(max-height:650px) and (min-width:701px){.spellbook-sheet{width:94vw;height:calc(100dvh - 20px);max-height:calc(100dvh - 20px)}.spellbook{padding:10px 16px 0}.spellbook-heading{min-height:56px;margin-bottom:8px;padding-bottom:7px;gap:9px}.spellbook-heading>img{width:48px;height:50px}.spellbook-heading h2{font-size:24px}.spellbook-heading p{font-size:14px}.spellbook-sheet .close{top:13px;right:14px;width:32px;height:32px;font-size:24px}.spellbook-layout{gap:15px}.spell-list{gap:6px}.spell-row{min-height:55px;grid-template-columns:43px 24px minmax(0,1fr) auto 12px;padding:6px;gap:8px}.spell-row-icon{width:43px;height:43px}.spell-row-copy>b{font-size:16px}.spell-row kbd{font-size:15px}.rank-pips{margin-top:5px;gap:5px}.rank-pips i{width:8px;height:8px}.spell-visual{width:120px;margin:-10px auto -20px}.spell-detail h3{font-size:25px;margin-bottom:5px}.spell-detail .spell-description{font-size:15px;margin-bottom:7px}.spell-tags{font-size:12px;padding:3px 7px}.spell-stats{font-size:14px;margin-top:8px}.spell-stats svg{height:20px;width:20px}.rank-track{margin-top:8px}.rank-track i{width:18px;height:18px}.rank-track::before{top:8px}.rank-track li{font-size:11px;gap:4px}.spell-detail .primary{min-height:39px;font-size:16px}.spell-learn-action{padding-top:4px}.spell-tips{margin-top:5px}.spellbook-footer{margin:7px -16px 0;padding:8px 16px;min-height:44px}.spellbook-footer p{font-size:12px;gap:8px}.spellbook-footer p svg{height:25px;width:25px}.spellbook-footer .row-btn{min-height:35px;min-width:140px;font-size:13px}.point-count{font-size:18px}.point-count .gold-star{font-size:20px}}
@media(max-width:700px){.spellbook-sheet{width:calc(100vw - 16px);height:calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));max-width:calc(100vw - 16px);max-height:calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));border-radius:3px}.spellbook{padding:12px 12px 0;grid-template-rows:auto minmax(0,1fr) auto}.spellbook-heading{min-height:71px;padding:0 30px 10px 0;margin-bottom:10px;gap:8px;flex-wrap:wrap}.spellbook-heading>img{width:40px;height:48px}.spellbook-heading h2{font-size:22px}.spellbook-heading p{font-size:14px}.point-count{margin:0 0 0 auto;flex-direction:row;font-size:15px;gap:4px}.point-count .gold-star{font-size:18px;margin:0}.point-count span{font-size:inherit}.spellbook-sheet .close{top:12px;right:9px;width:28px;height:28px;font-size:23px}.spellbook-layout{display:block;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}.spell-list{grid-template-columns:1fr 1fr;grid-template-rows:repeat(2,minmax(76px,auto));gap:7px;overflow:visible;padding:2px}.spell-row{grid-template-columns:43px minmax(0,1fr);gap:6px;min-height:76px;padding:7px;border-radius:7px}.spell-row-icon{width:43px;height:48px;grid-row:auto}.spell-row-copy>b{font:700 14px/1.15 Cinzel,Barlow,serif}.spell-row kbd,.spell-row>small,.spell-row .row-chevron{display:none}.rank-pips{margin-top:7px;gap:4px}.rank-pips i{width:7px;height:7px}.spell-detail{display:block;overflow:visible;min-height:0;border:0;border-top:1px solid #93a29f35;margin-top:13px;padding:10px 0 0}.spell-detail-scroll{overflow:visible;padding:0}.spell-visual{width:175px;margin:-9px auto -12px}.spell-detail h3{font-size:29px}.spell-detail .spell-description{font-size:17px;line-height:1.35}.spell-tags{font-size:14px}.spell-stats{font-size:15px;margin-top:12px}.spell-stats svg{width:22px;height:22px}.rank-track{margin:15px 0 9px}.spell-tips{font-size:12px}.spell-learn-action{padding-bottom:7px}.spell-detail .primary{font-size:17px;min-height:46px}.spellbook-footer{margin:10px -12px 0;padding:10px 12px;min-height:59px;gap:8px;border-radius:0 0 2px 2px}.spellbook-footer p{font-size:11px;line-height:1.35;gap:6px}.spellbook-footer p svg{width:23px;height:23px}.spellbook-footer .row-btn{min-width:117px;min-height:38px;font-size:12px;padding:7px}.spellbook::before,.spellbook::after{width:12px;height:12px;left:4px}}
/* On the smallest phones the health bars end before the C skill button. */
@media(max-width:370px){.upgrade-dash{top:37px}.upgrade-surge{left:99px;top:69px}.upgrade-signature{left:33px;bottom:0}.upgrade-ult{right:-4px;bottom:-4px}.abilities{right:12px}#joystick{left:10px;width:88px;height:88px}#thumb{left:21px;top:21px}.health{left:10px;width:128px}}
@media(max-height:520px) and (min-width:600px){.upgrade-surge{left:106px;top:65px}.upgrade-signature{bottom:-5px}.upgrade-ult{right:-6px;bottom:-6px}}
@media(prefers-reduced-motion:reduce){.spellbook *, .ability-upgrade{scroll-behavior:auto;transition:none}}
/* Retire the old four-hero landscape menu grid. */
#menu .intro{display:block}

.training-feedback:empty{display:none}

#auto-status{max-width:205px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:10px}


/* Larger touch targets for training while playing on a phone. */
.ability-upgrade{width:46px;height:46px;font-size:31px;border-width:3px;touch-action:none;box-shadow:0 4px 11px #0009,0 0 0 3px #15120fcc}
.upgrade-dash{right:-11px;top:48px}.upgrade-surge{left:118px;top:80px}.upgrade-signature{left:46px;bottom:-4px}.upgrade-ult{right:-10px;bottom:-9px}
.spell-row{touch-action:manipulation}
@media(max-width:700px){
 .spell-list{gap:9px}
 .spell-row{min-height:82px;padding:10px}
 .spell-learn-action #train-selected{min-height:54px;font-size:16px}
 .spellbook-footer .row-btn{min-height:50px}
 .ability-upgrade{width:44px;height:44px}
 .upgrade-dash{right:-8px;top:45px}.upgrade-surge{left:108px;top:76px}.upgrade-signature{left:41px;bottom:-2px}.upgrade-ult{right:-8px;bottom:-7px}
}


/* Compact direct upgrades remain independent of movement. */
.ability-upgrade{width:34px;height:34px;font-size:23px;border-width:2px;touch-action:manipulation;transition:transform .12s,opacity .12s,filter .12s}
.upgrade-dash{right:-6px;top:35px}.upgrade-surge{left:92px;top:58px}.upgrade-signature{left:28px;bottom:-2px}.upgrade-ult{right:-6px;bottom:-4px}
.spell-row{touch-action:manipulation}
@media(max-width:700px){
 .spell-learn-action #train-selected{min-height:48px}
 .spellbook-footer .row-btn{min-height:46px}
 .ability-upgrade{width:32px;height:32px;font-size:22px}
 .upgrade-dash{right:-5px;top:32px}.upgrade-surge{left:86px;top:54px}.upgrade-signature{left:26px;bottom:-1px}.upgrade-ult{right:-5px;bottom:-3px}
}


/* In-match upgrades now use the full spell icon. Keep legacy plus controls out of the HUD. */
.ability-upgrade{display:none!important}


/* Combat HUD may expose the direct upgrade controls. */
.abilities .ability-upgrade[hidden]{display:none!important}
.abilities .ability-upgrade:not([hidden]){display:grid!important}
