/* Private Lab identity: compass gold, midnight navy and warm ivory. */
:root{--bg:#F7F4EC;--card:#FFFEFA;--panel:#FFFEFA;--soft:#F1EBDF;--line:#DFD8C9;--ink:#17263C;--navy:#17263C;--muted:#647184;--blue:#17263C;--blue2:#243951;--accent:#C99A2E;--accent-ink:#806019;--action:#17263C;--action-ink:#FFFEFA;--active:#F2E8D1;--control:#FFFEFA;--readonly:#F1EBDF;--shadow:0 6px 18px #17263c09;color-scheme:light}
html[data-theme=dark]{--bg:#101925;--card:#1B293B;--panel:#1B293B;--soft:#253347;--line:#3E4B5C;--ink:#F7F4EC;--navy:#F7F4EC;--muted:#B6C0CE;--blue:#D8AD48;--blue2:#C99A2E;--accent:#D8AD48;--accent-ink:#D8AD48;--action:#D8AD48;--action-ink:#17263C;--active:#343126;--control:#152132;--readonly:#253347;--shadow:0 6px 18px #0003;scrollbar-color:#647184 #1B293B;color-scheme:dark}
html[data-theme] .header{background:var(--card);border:1px solid var(--line);box-shadow:var(--shadow)}html[data-theme] .header:after{display:none}
html[data-theme] .brand{gap:12px}html[data-theme] .brand-mark{display:block;width:56px;height:56px;flex:0 0 56px}html[data-theme] .brand-text{min-width:0}
html[data-theme] .brand h1{font-family:Georgia,'Times New Roman',serif;font-size:31px;line-height:1;letter-spacing:1px;color:var(--ink);font-weight:700;margin:0;display:flex;flex-direction:column;gap:5px}
html[data-theme] .brand-wordmark-sub{font-family:Inter,ui-sans-serif,system-ui,sans-serif;font-size:10px;font-weight:600;line-height:1;letter-spacing:4.4px;padding-left:1px}html[data-theme] .brand p{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
html[data-theme] :is(.card h2,.title-icon,.tour-title,.info-dialog h2,.privacy-modal h2,.privacy-modal h3,.info-dialog-body strong,.bonus-category-name,.level-name,.order-group h3,.insertion-group h3,.captain-table td:nth-child(2),.matrix6 td:first-child,.troop-name,.qty,.metric strong){color:var(--ink)}
html[data-theme] :is(.radio-row label,.bonus-table td:first-child,.special-row label,.special-row .cap-badge){color:var(--ink)}
html[data-theme] :is(.bonus-table th,.field label,.matrix6 th,.matrix6 .sub,.captain-accordion-hint,.insertion-hint,.lab-manual-note,.privacy-modal p,.privacy-banner p,.tour-text,.tour-progress,.troop-check,.metric span,.max3,.footer,.empty,.tier-unit-text small){color:var(--muted)}
html[data-theme] :is(.input-wrap,.number,.mini-input,.cap-level,.cap-star,.lang-select,#themeSelect,.troop-number,.troop-range select){background:var(--control);border-color:var(--line);color:var(--ink)}
html[data-theme] :is(.input-wrap input,.troop-number>input[type=number]){color:var(--ink)}html[data-theme] .input-wrap span{color:var(--muted);border-color:var(--line)}
html[data-theme] :is(.input-wrap.readonly,.mini-input:disabled){background:var(--readonly);color:var(--muted)}html[data-theme] .input-wrap.readonly input{color:var(--muted)}
html[data-theme] :is(.input-wrap>.sign-toggle,.bonus-pill){background:var(--soft);color:var(--ink);border-color:var(--line)}
html[data-theme] .input-wrap:focus-within{border-color:var(--accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 18%,transparent)}
html[data-theme] :is(.matrix6 .mini-read,.pct-cell){color:var(--ink)}html[data-theme] :is(.matrix6 .macro,.captain-table thead){background:var(--soft);color:var(--ink)}html[data-theme] .captain-table th{color:var(--ink)}html[data-theme] .captain-table tr.selected{background:var(--active)}
html[data-theme] :is(.specials,.config-actions,.matrix6 .matrix-user-input>span,.captain-scroll,.captain-table th,.captain-table td,.order-group h3,.insertion-group h3,.order-item,.lab-battle,.lab-battle-scenario,.lab-battle th,.lab-battle td,.footer){border-color:var(--line)}
html[data-theme] :is(.captain-accordion-toggle,.header-link,.guide-btn,.config-btn,.order-tab,.lab-reset-order,.copy-order,.info-dialog-x,.privacy-modal .modal-close,.tour-btn,.settings-button){background:var(--panel);color:var(--ink);border-color:var(--line);box-shadow:none}
html[data-theme] :is(.captain-accordion-toggle:hover,.header-link:hover,.guide-btn:hover,.config-btn:hover,.order-tab:hover,.lab-reset-order:hover,.copy-order:hover,.info-dialog-x:hover,.tour-btn:hover,.settings-button:hover){background:var(--soft);color:var(--ink);border-color:var(--accent)}
html[data-theme] :is(.run,.order-tab.active,.tour-btn.primary,.info-dialog-close,.privacy-banner button,.lab-banner button){background:var(--action);border-color:var(--action);color:var(--action-ink);box-shadow:0 3px 9px #17263c15}
html[data-theme] :is(.run,.order-tab.active,.tour-btn.primary,.info-dialog-close):hover:not(:disabled){background:var(--action);color:var(--action-ink);filter:brightness(1.08)}
html[data-theme] .lab-banner{background:var(--soft);border-color:var(--line);border-left:3px solid var(--accent);color:var(--ink)}html[data-theme] :is(.lab-banner a,.footer-btn,.lab-battle a,.footer strong){color:var(--accent-ink)}
html[data-theme] .lab-shell>.lab-mode-tabs{background:var(--card);border-color:var(--line)}html[data-theme] .lab-mode-tabs .lab-mode-tab{background:transparent;color:var(--muted)}
html[data-theme] :is(.lab-mode-tabs .lab-mode-tab.active,.lab-stack-tab.active){background:var(--active);border-color:var(--line);color:var(--ink)}html[data-theme] .lab-mode-tabs .lab-mode-tab.active{box-shadow:inset 3px 0 var(--accent)}
html[data-theme] :is(.lab-mode-tabs .lab-mode-tab:hover,.lab-stack-tab:hover){background:var(--soft);color:var(--ink)}
html[data-theme] .metric{background:var(--soft);border-color:var(--line)}html[data-theme] .damage-box{background:var(--soft);border:1px solid var(--line)}html[data-theme] .damage-box .small{color:var(--accent-ink)}html[data-theme] .damage-box strong{color:var(--ink)}
html[data-theme] :is(.insertion-group,.info-dialog-head){background:var(--panel);border-color:var(--line)}html[data-theme] :is(.info-dialog,.privacy-modal,.privacy-banner,.tour-card){background:var(--card);color:var(--ink);border-color:var(--line)}
html[data-theme] .tour-card:before{background:var(--card);border-color:var(--line)}html[data-theme] .tour-step{color:var(--accent-ink)}html[data-theme] .tour-highlight{box-shadow:0 0 0 4px var(--accent),0 0 0 10px var(--bg),0 14px 28px #17263c30!important}
html[data-theme] :is(.lab-pvp-counters,.order-badge,.drag-handle){color:var(--ink)}html[data-theme] .order-badge{background:var(--card);border-color:var(--line)}html[data-theme] .order-badges .quantity-copy{background:var(--card);border-color:var(--line);color:var(--ink)}html[data-theme] .order-badges .quantity-copy:hover{background:var(--soft);border-color:var(--accent)}
html[data-theme] :is(.order-badges .quantity-copy.is-copied,.copy-order.is-copied){color:#21754C}html[data-theme=dark] :is(.order-badges .quantity-copy.is-copied,.copy-order.is-copied){color:#68D9A6}
html[data-theme] .info{background:var(--soft);border-color:var(--line);color:var(--accent-ink);box-shadow:none}html[data-theme] .info:hover{background:var(--active);border-color:var(--accent);box-shadow:none}
html[data-theme=dark] .header img.brand-mark{filter:brightness(1.13)}
@media(max-width:768px){html[data-theme] .brand-mark{width:46px;height:46px;flex-basis:46px}html[data-theme] .brand{gap:9px}html[data-theme] .brand h1{font-size:27px}html[data-theme] .brand-wordmark-sub{font-size:9px;letter-spacing:3.6px}html[data-theme] .lab-mode-tabs .lab-mode-tab.active{box-shadow:inset 0 -3px var(--accent)}}
@media(max-width:380px){html[data-theme] .brand h1{font-size:24px}html[data-theme] .brand-wordmark-sub{font-size:8px;letter-spacing:3.3px}html[data-theme] .brand-mark{width:42px;height:42px;flex-basis:42px}}
html[data-theme] :is(.lab-attack-grip,.order-item.has-drag .drag-handle,.lab-mode-tab):focus-visible{outline-color:var(--accent)}
@media(max-width:768px){html[data-theme] .header-top .brand h1{font-size:clamp(18px,5vw,25px);letter-spacing:.5px}}

:root{--section-title-bg:#E7E1D5}
html[data-theme=dark]{--section-title-bg:#212F43}

/* Full-width title bands preserve the content's original text alignment. */
html[data-theme] .card{--section-inset:22px}
html[data-theme] .card h2{background:var(--section-title-bg);border:0;border-bottom:1px solid var(--line);border-radius:13px 13px 0 0;padding:var(--section-inset);margin:calc(-1 * var(--section-inset)) calc(-1 * var(--section-inset)) 12px;min-width:0;flex-wrap:wrap}
html[data-theme] .captain-head{display:flow-root}
html[data-theme] .captain-head h2{margin-bottom:0}
@media(max-width:768px){html[data-theme] .card{--section-inset:14px}}

/* Enlarge all help buttons and glyphs by 25%; preserve their existing colors. */
html[data-theme] .info{width:26.125px;height:26.125px}
html[data-theme] .info-icon{width:18.75px;height:18.75px}

/* Desktop keeps its contextual sidebar; mobile separates the two navigation levels. */
.lab-mode-primary{display:contents}.lab-stack-mobile{display:none}
@media(max-width:768px){
 html[data-theme] .lab-shell>.lab-mode-tabs{flex-direction:column;gap:10px;padding:0;border:0;background:transparent;box-shadow:none}
 html[data-theme] .lab-mode-primary,html[data-theme] .lab-stack-mobile{display:flex;flex-direction:column;gap:6px;padding:6px;background:var(--card);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow)}
 html[data-theme] .lab-mode-primary .lab-mode-group{flex:0 0 auto;width:100%}
 html[data-theme] .lab-mode-primary .lab-mode-tab{width:100%}
 html[data-theme] .lab-stack-mobile .lab-stack-menu{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:0;margin:0;border:0}
 html[data-theme] .lab-stack-mobile .lab-stack-tab{min-width:0;min-height:44px;text-align:center}
}

/* Short mode descriptions and the shared gold selection marker. */
html[data-theme] .lab-stack-tab{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:4px;height:auto;overflow-wrap:anywhere}
html[data-theme] .lab-stack-name{font-weight:750}
html[data-theme] .lab-stack-description{display:block;font-size:12px;line-height:1.4;font-weight:400;color:var(--muted)}
html[data-theme] .lab-stack-tab.active{box-shadow:inset 0 -3px var(--accent)}

/* Persistent header, with the wide-screen sidebar starting beneath it. */
html[data-theme] .lab-shell>.header{grid-column:1 / -1;grid-row:1;position:sticky;top:0;z-index:40;align-self:start;display:block;min-height:0;height:auto;padding:12px 18px}
html[data-theme] .lab-shell>.header .header-top{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%}
html[data-theme] .lab-shell>.header .brand{flex:1;min-width:0}
html[data-theme] .lab-shell>.header .header-language{flex:0 0 auto;margin-left:auto}
html[data-theme] .lab-shell>.lab-mode-tabs{grid-row:2 / span 3;top:calc(var(--lab-header-height,84px) + 16px)}
html[data-theme] .lab-shell>.layout>.card{scroll-margin-top:calc(var(--lab-header-height,84px) + 12px)}
@media(max-width:768px){html[data-theme] .lab-shell>.header{padding:10px}html[data-theme] .lab-shell>.lab-mode-tabs{position:static;top:auto}}

/* The subtitle shares the wordmark width at every breakpoint. */
html[data-theme] .lab-shell>.header .brand h1{width:max-content;max-width:100%}
html[data-theme] .lab-shell>.header .brand-wordmark-sub{display:flex;justify-content:space-between;align-self:stretch;width:100%;min-width:0;padding-left:0;letter-spacing:0}
html[data-theme] .lab-shell>.header .brand-wordmark-sub>span{display:block;flex:0 0 auto}

/* Mobile header bleeds to the viewport edges while the calculator keeps its gutter. */
@media(max-width:768px){
 html[data-theme] .lab-shell{padding-top:0}
 html[data-theme] .lab-shell>.header{width:calc(100% + 16px);margin:0 -8px;border-radius:0;border-top:0;border-left:0;border-right:0}
}

.calculation-status{padding:12px 14px;margin:12px 0;border:1px solid var(--line);border-left:3px solid var(--accent);border-radius:8px;background:var(--soft);color:var(--ink);font-size:15px;line-height:1.5}

/* On-demand single-pointer alternatives to dragging insertion rows. */
:is(#orderInsert,#orderAttack) .insertion-move-tools{grid-column:1 / -1;display:flex;gap:8px;padding:8px 0 2px;border-top:1px solid var(--line);margin-top:5px}
:is(#orderInsert,#orderAttack) .insertion-move-tools button{display:inline-flex;align-items:center;justify-content:center;gap:5px;flex:1;min-width:0;min-height:44px;height:auto;padding:8px;border:1px solid var(--line);border-radius:8px;background:var(--control);color:var(--ink);font:inherit;font-size:13px;line-height:1.3;cursor:pointer}
:is(#orderInsert,#orderAttack) .insertion-move-tools button:hover:not(:disabled){background:var(--soft);border-color:var(--accent)}
:is(#orderInsert,#orderAttack) .insertion-move-tools button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
:is(#orderInsert,#orderAttack) .insertion-move-tools button:disabled{opacity:.4;cursor:default}
:is(#orderInsert,#orderAttack) .insertion-move-tools svg{flex:0 0 18px;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
:is(#orderInsert,#orderAttack) .insertion-move-tools .move-down{transform:rotate(180deg)}
#orderInsert .drag-handle{touch-action:pan-y;-webkit-user-select:none;user-select:none}
.insertion-announcement{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@media(max-width:768px),(pointer:coarse){#orderInsert .order-item.has-drag{padding-left:51px;min-height:48px}#orderInsert .order-item.has-drag .drag-handle{left:3px;width:44px;height:44px}}

/* Keep room to anchor the selected troop even at the bottom of the document. */
#orderInsert.insertion-editing{overflow-anchor:none}
#orderInsert .order-item.insertion-selected{outline:2px solid var(--accent);outline-offset:1px}
:root{--info-ring:#B28213}
html[data-theme=dark]{--info-ring:#E2B741}
html[data-theme] .info,html[data-theme] .info:hover{border-width:2px;border-style:solid;border-color:var(--info-ring)}

/* Unboxed insertion groups keep their labels and separators. */
html[data-theme] #orderInsert .insertion-group{padding:0;border:0;border-radius:0;background:transparent}
:is(#orderInsert,#orderAttack) .insertion-move-tools [data-insertion-done]{flex:0 0 auto;align-self:stretch;width:44px;min-width:44px;aspect-ratio:1;padding:8px}
html[data-theme=dark] .info{border-width:1px;border-color:var(--line)}
html[data-theme=dark] .info:hover{border-width:1px;border-color:var(--accent)}
html[data-theme] .card h2{flex-wrap:nowrap}
html[data-theme] .card h2>.info{margin-left:auto}
.order-badges,.copy-order{position:relative}
.copy-feedback{position:absolute;top:calc(100% + 2px);right:0;z-index:5;padding:2px 5px;border-radius:4px;background:var(--card);color:var(--ink);box-shadow:0 1px 4px #0002;font-size:11px;font-weight:600;line-height:1.3;white-space:nowrap;pointer-events:none}
.captain-selection-summary{border-top:1px solid var(--line);margin:0 0 12px;padding-top:12px;color:var(--ink);font-size:15px;line-height:1.5;overflow-wrap:anywhere}

/* Stronger field boundaries, generous hit areas and consistent reorder controls. */
:root{--field-line:#8D948F}
html[data-theme=dark]{--field-line:#8192AA}
html[data-theme] :is(.input-wrap,.number,.mini-input,.cap-level,.cap-star,.troop-number){border-color:var(--field-line)}
html[data-theme] .info:focus-visible{outline:3px solid var(--accent-ink);outline-offset:3px}
html[data-theme] .info::before{content:"";position:absolute;inset:-9px;border-radius:50%}
.order-badges .quantity-copy::before{content:"";position:absolute;inset:-8.5px -7px;border-radius:7px}
.order-badges .quantity-copy{position:relative}
.order-badges{gap:4px}
:is(#orderInsert,#orderAttack) .order-item{touch-action:pan-y;-webkit-touch-callout:none;overflow-anchor:none}
:is(#orderInsert,#orderAttack) .drag-handle{touch-action:pan-y}
:is(#orderInsert,#orderAttack).hold-drag-active{user-select:none;-webkit-user-select:none}
#orderAttack .lab-attack-grip{position:relative;width:24px;height:27px}
#orderAttack .lab-attack-grip::before{content:"";position:absolute;inset:-9px -10px}
#orderAttack .order-item.insertion-selected{outline:2px solid var(--accent);outline-offset:1px}
#orderAttack{overflow-anchor:none}
.privacy-dialog{padding:0;border:1px solid var(--line);border-radius:16px;background:var(--card);color:var(--ink);width:min(760px,calc(100vw - 24px));max-height:85vh;max-height:85svh;overflow:auto}
.privacy-dialog::backdrop{background:#05193794}
.privacy-dialog .privacy-modal{width:100%;max-height:none;margin:0;box-shadow:none}
@media(max-width:768px){#troopOrderHeading>.copy-order{margin-left:auto;margin-right:8px}html[data-theme] #troopOrderHeading>.info{margin-left:0}}

html.privacy-dialog-open{overflow:hidden}

:is(#orderInsert,#orderAttack) .order-item{min-height:48px}

/* Accessible troop descriptions do not reintroduce visible level numbers. */
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip-path:inset(50%)!important;white-space:nowrap!important;border:0!important}

/* Compact damage figure; keep the other labels and metrics unchanged. */
html[data-theme] .damage-box strong{font-size:47.84px}
@media(max-width:760px){html[data-theme] .damage-box strong{font-size:38.64px}}

/* Resource inputs retain their divider above calculation controls. */
#resultsCard .general-inputs{padding-bottom:16px;margin-bottom:16px;border-bottom:1px solid var(--line)}

/* Guided setup is a native near-fullscreen modal; only its body scrolls. */
.guided-launch{display:flex;justify-content:flex-end}.guided-launch #guidedStart{flex:0 1 auto}
.guided-launch[hidden],.guided-dialog[hidden]{display:none!important}
html.guide-modal-open{overflow:hidden}
.guided-dialog{position:fixed;inset:0;box-sizing:border-box;width:calc(100vw - 32px);max-width:none;height:calc(100vh - 32px);height:calc(100dvh - 32px);max-height:none;padding:0;margin:auto;border:1px solid var(--line);border-radius:16px;background:var(--card);color:var(--ink);overflow:hidden;box-shadow:0 24px 80px #0006}
.guided-dialog[open]{display:flex;flex-direction:column}.guided-dialog::backdrop{background:#050c19bf}
.guided-header{position:sticky;top:0;z-index:2;flex:0 0 auto;padding:12px 20px;background:var(--soft);border-bottom:1px solid var(--line)}
.guided-heading-row{display:flex;align-items:center;justify-content:space-between;gap:12px}.guided-actions{display:flex;align-items:center;gap:10px}.guided-help{width:44px;height:44px;display:flex;align-items:center;justify-content:center}.guided-actions .copy-order{width:44px!important;min-height:44px;height:44px;flex:0 0 44px}
.guided-progress{color:var(--accent-ink);font-size:13px;font-weight:700}.guided-header h2{margin:2px 0 6px;font-size:22px;line-height:1.25;color:var(--ink)}.guided-header p{margin:0;font-size:15px;line-height:1.4;color:var(--muted);max-width:1100px}
.guided-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 16px;background:var(--card)}
.guided-body>.card{box-sizing:border-box;width:100%;max-width:1200px;min-width:0;margin:0 auto;padding:22px;border:0;border-radius:0;box-shadow:none}
.guided-body>.card>h2,.guided-body .captain-head,.guided-mode :is(#captainAccordion,#roleAccordion)>summary,.guided-mode :is(#captainAccordionHint,#roleAccordionHint){display:none}
.guided-controls{position:sticky;bottom:0;z-index:2;flex:0 0 auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:12px 20px;border-top:1px solid var(--line);background:var(--card)}
.guided-controls button{min-height:44px;height:auto;white-space:normal;line-height:1.3;padding:10px 12px}.guided-controls button:disabled{opacity:.4;cursor:default}#guidedNext{background:var(--action);color:var(--action-ink);border-color:var(--action)}
#guidedError{color:var(--danger);font-size:15px;line-height:1.4;max-width:1200px;margin:12px auto}#guidedError:empty{display:none}
.guided-confirm{position:fixed;inset:0;margin:auto;max-height:calc(100dvh - 24px);overflow:auto;box-sizing:border-box;width:min(480px,calc(100vw - 24px));padding:24px;border:1px solid var(--line);border-radius:16px;background:var(--card);color:var(--ink);box-shadow:0 16px 60px #0006}.guided-confirm::backdrop{background:#0007}.guided-confirm h2{margin:0 0 12px;font-size:22px;line-height:1.3}.guided-confirm p{font-size:16px;line-height:1.5;color:var(--muted)}.guided-confirm-actions{display:flex;flex-wrap:wrap;gap:10px}.guided-confirm-actions button{min-height:44px;height:auto;padding:10px 12px;white-space:normal}#guidedDiscard{border-color:var(--accent);color:var(--accent-ink)}
:is(.guided-dialog button,.guided-confirm button,#guidedStart):focus-visible{outline:3px solid var(--accent-ink);outline-offset:3px}
@media(max-width:768px){.guided-dialog{width:calc(100vw - 16px);height:calc(100vh - 16px);height:calc(100dvh - 16px);border-radius:12px}.guided-header{padding:8px 12px}.guided-header h2{font-size:19px}.guided-header p{font-size:13px}.guided-body{padding:0}.guided-body>.card{padding:14px}.guided-controls{padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px));gap:8px}.guided-controls button{font-size:13px;padding:8px 6px}.guided-launch button{width:100%}.guided-confirm{padding:18px}.guided-actions{gap:8px}}

.guided-body .captain-scroll{max-height:none;overflow-x:auto;overflow-y:visible}.guided-body .captain-table thead{position:static}

/* Keep guided captain and bonus steps focused; full view retains all controls. */
html[data-theme] #guidedBody #captainsCard .captain-head{display:none}
#guidedBody #captainsCard .captain-selection-summary{border-top:0;padding-top:0}
#guidedBody #captainsCard .captain-table{min-width:0;table-layout:fixed}
#guidedBody #captainsCard .captain-table :is(th,td,col):nth-child(n+5){display:none}
#guidedBody #captainsCard .captain-table col:nth-child(1){width:40px!important}
#guidedBody #captainsCard .captain-table col:nth-child(2){width:auto!important}
#guidedBody #captainsCard .captain-table col:nth-child(3),#guidedBody #captainsCard .captain-table col:nth-child(4){width:80px!important}
#guidedBody #captainsCard :is(.cap-level,.cap-star){box-sizing:border-box;width:100%;max-width:100%;min-width:0}
#guidedBody #bonusCard>.radio-row,#guidedBody #bonusCard>.config-actions,#guidedBody #bonusCard>#configStatus{display:none}
@media(max-width:768px){#guidedBody #captainsCard .captain-table col:nth-child(3),#guidedBody #captainsCard .captain-table col:nth-child(4){width:64px!important}}

/* V5.96: guided bonus entry, role comparison and inputs-only final step. */
.beast-research-hint{display:block;font-size:14px;line-height:1.5;color:var(--muted);margin:10px 0}
#guidedBody .beast-research-hint{display:block}
#roleEntryPanel{display:none}
#guidedBody #roleEntryPanel{display:block}
#guidedBody #roleCard>:is(#roleAccordionHint,#roleAccordion,#calculateDifferences){display:none}
#guidedBody #resultsCard>:not(#generalCard){display:none}
#guidedBody #resultsCard #generalCard{margin:0;padding:0;border:0}
#guidedBody #baseConfigActions{display:none}
.role-entry-row{min-width:0;margin:0 0 16px;padding:12px;border:1px solid var(--line);border-radius:10px}
.role-entry-row legend{font-weight:700;padding:0 5px;color:var(--ink)}
.role-entry-kind{font-size:12px;font-weight:400;color:var(--muted)}
.role-entry-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.role-entry-fields label{min-width:0;font-size:14px;color:var(--muted)}
.role-entry-fields .input-wrap{margin-top:6px}
.role-entry-fields input{width:100%;min-width:0;box-sizing:border-box;font:inherit;font-size:16px}
.role-entry-note{font-size:13px;color:var(--muted);line-height:1.4;margin:0 0 10px}
#calculateDifferences{margin-bottom:12px}
.guided-controls button[hidden]{display:none}
.guided-controls:has(#guidedBack[hidden]){grid-template-columns:1fr}

/* Guided setup: explain exclusions that leave no shared bonus-reference role. */
#guidedRoleWarning{margin:0 0 16px;padding:12px 14px;border:1px solid var(--line);border-left:3px solid var(--accent);border-radius:8px;background:var(--soft);color:var(--ink);font-size:14px;line-height:1.5}
#guidedRoleWarning[hidden]{display:none}

/* A single named-troop bonus table and matching optional role rows. */
#guidedBonusPanel{display:none}#guidedBody #guidedBonusPanel{display:block}
#guidedBody #bonusCard>.bonus-table,#guidedBody #bonusReferenceNote{display:none}
#bonusReferenceNote{font-size:14px;color:var(--muted);line-height:1.5;margin:0 0 12px}#bonusReferenceNote[hidden]{display:none}
#guidedBody .troop-entry-table{width:100%;table-layout:fixed;border-collapse:collapse}
#guidedBody .troop-entry-table th[scope=row]{text-align:left;font-weight:600;padding:10px 8px 10px 0;overflow-wrap:anywhere}
#guidedBody .entry-troop-label{display:flex;align-items:center;gap:8px;min-width:0;font-size:14px;line-height:1.3;color:var(--ink)}
#guidedBody .entry-troop-label small{display:block;font-size:12px;font-weight:400;color:var(--muted);margin-top:3px}
#guidedBody .entry-troop-icons{display:flex;flex-direction:column;justify-content:center;gap:2px;align-items:center;flex:0 0 auto;height:42px}

#guidedBody .troop-entry-table .input-wrap input{box-sizing:border-box;min-width:0;width:100%;font-size:17px;height:42px}
#guidedBody .troop-entry-table col.bonus-value-col{width:22%}
#guidedBody .troop-entry-table .input-wrap{min-width:0}
@media(max-width:768px){#guidedBody .entry-troop-label{gap:5px;font-size:14px}#guidedBody .entry-troop-icons{gap:2px}#guidedBody .troop-entry-table col.bonus-value-col{width:24%}#guidedBody .troop-entry-table th[scope=row]{padding-right:5px}#guidedBody .troop-entry-table .input-wrap>span{display:none}#guidedBody .troop-entry-table .input-wrap input{padding:9px 5px}#guidedBody .entry-troop-label small{font-size:11px}}

.guided-confirm-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.guided-confirm-head h2{margin:0;min-width:0}.guided-confirm-head .info-dialog-x{flex:0 0 44px}

#guidedBody #armySummary{display:none}

/* Troop details retain lighter typography without tier backgrounds. */
#guidedBody .troop-entry-table .entry-troop-detail{font-size:12px;line-height:1.35;font-weight:400;color:var(--muted);text-transform:none}
@media(max-width:768px){#guidedBody .troop-entry-table .entry-troop-detail{font-size:11px}}

/* Normal Bonus entry mirrors the guided troop labels, with the existing input fields. */
#bonusCard>.radio-row[hidden]{display:none!important}
.balanced-row{display:flex;align-items:center;gap:10px;margin:0 0 14px;font-weight:600}
#guidedBody #bonusCard>.balanced-row{display:none}
#bonusCard .normal-bonus-troop{grid-template-columns:20px minmax(0,1fr);gap:8px}
#bonusCard .normal-entry-icons{display:flex;flex-direction:column;gap:2px;width:20px;height:42px;justify-content:center}
#bonusCard .normal-bonus-troop .bonus-category-name{font-size:14px;line-height:1.3}
#bonusCard .normal-entry-detail{display:block;font-size:12px;line-height:1.35;font-weight:400;color:var(--muted);margin-top:3px}
@media(max-width:768px){#bonusCard .normal-entry-detail{font-size:11px}.guided-dialog{top:8px;bottom:auto;margin:0 auto;height:calc(var(--guided-mobile-height,100svh) - 16px);max-height:none}}

/* Let the final fields scroll above an overlapping keyboard without moving the footer. */
.guided-body::after{content:"";display:block;height:var(--guided-keyboard-space,0px);pointer-events:none}

/* Emphasize the guided entry point and the shared maximum level control. */
html[data-theme] #guidedStart{display:inline-flex;align-items:center;justify-content:center;gap:9px;background:var(--card);color:var(--ink);border:1px solid var(--accent);min-height:46px;height:auto;padding:10px 18px;font-size:15px;font-weight:650;line-height:1.35;box-shadow:none}
html[data-theme] #guidedStart:hover:not(:disabled){background:var(--active);border-color:var(--accent-ink)}
html[data-theme] #guidedStart:focus-visible{outline:3px solid var(--accent-ink);outline-offset:3px}
.guided-start-help{width:21px;height:21px;flex:0 0 21px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;color:var(--accent-ink)}
#levels .troop-range{box-sizing:border-box;padding:14px 16px;margin-bottom:20px;border:1px solid var(--accent);border-left:4px solid var(--accent);border-radius:10px;background:var(--active);gap:12px}
#levels .troop-range>label{font-size:17px;font-weight:750;line-height:1.35}
#levels .troop-range .troop-number{height:48px;border:2px solid var(--accent);flex-shrink:0}
#levels .troop-range .troop-number>input{font-size:20px;font-weight:750}
@media(max-width:768px){#levels .troop-range{padding:12px;gap:8px}#levels .troop-range>label{font-size:16px}}

.footer-lab-actions{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:16px;margin-top:14px}.footer-lab-actions a{color:var(--accent-ink)}.footer-lab-actions form{margin:0}.footer-lab-actions button{font:inherit;min-height:44px;padding:8px 16px;color:var(--ink);background:var(--soft);border:1px solid var(--line);border-radius:8px;cursor:pointer}

@media(min-width:769px){.guided-dialog{width:min(800px,calc(100vw - 48px));height:min(820px,calc(100vh - 48px));height:min(820px,calc(100dvh - 48px))}}
html.welcome-open{overflow:hidden}
.welcome-dialog{position:fixed;inset:0;box-sizing:border-box;width:min(640px,calc(100vw - 24px));height:fit-content;max-height:calc(100svh - 32px);padding:0;margin:auto;border:1px solid var(--line);border-radius:16px;background:var(--card);color:var(--ink);box-shadow:0 24px 80px #0005;overflow:hidden}
.welcome-dialog[open]{display:flex;flex-direction:column}.welcome-dialog::backdrop{background:#050c19bf}
.welcome-content{padding:28px;overflow:auto;min-height:0}.welcome-progress{font-size:12px;font-weight:650;color:var(--accent-ink);margin:24px 0 8px}.welcome-dialog h2{font-size:26px;line-height:1.2;margin:0 0 10px}.welcome-dialog #welcomeDescription{font-size:15px;line-height:1.5;color:var(--muted);margin:0 0 22px}
.welcome-choices{display:grid;grid-template-columns:1fr 1fr;gap:12px}.welcome-choice{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:8px;min-width:0;min-height:112px;padding:18px;text-align:left;background:var(--soft);color:var(--ink);border:1px solid var(--line);border-radius:12px;font:inherit;cursor:pointer}.welcome-choice strong{font-size:18px;line-height:1.3}.welcome-choice small{font-size:13px;line-height:1.45;color:var(--muted)}.welcome-choice:hover{border-color:var(--accent);background:var(--active)}.welcome-choice:focus-visible,.welcome-skip:focus-visible{outline:3px solid var(--accent-ink);outline-offset:2px}
.welcome-footer{display:flex;align-items:center;gap:16px;padding:16px 28px;border-top:1px solid var(--line);background:var(--soft);flex:0 0 auto}.welcome-footer #welcomeBack{flex:0 0 auto;padding:8px 14px}.welcome-skip{margin-left:auto;border:0;padding:10px 0;background:transparent;color:var(--muted);font:inherit;font-size:13px;line-height:1.4;text-align:right;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
@media(max-width:768px){.welcome-content{padding:22px 18px}.welcome-dialog h2{font-size:23px}.welcome-choices{grid-template-columns:1fr}.welcome-choice{min-height:90px;padding:16px}.welcome-footer{padding:12px 18px}.welcome-progress{margin-top:20px}}
#welcomeLogo .brand{display:flex;align-items:center;gap:12px}
html[data-theme] #welcomeLogo .brand h1{width:max-content}
html[data-theme] #welcomeLogo .brand-wordmark-sub{display:flex;justify-content:space-between;width:100%;letter-spacing:0;padding-left:0}
@media(max-width:380px){html[data-theme] .lab-shell>.header .brand h1{font-size:20px}html[data-theme] .lab-shell>.header .brand-mark{width:36px;height:36px;flex-basis:36px}.header-language{gap:4px}.header-language .lang-select{width:68px;max-width:68px}}

.balanced-question{font-size:15px;line-height:1.5;color:var(--ink);margin:0 0 10px}
#guidedBody #balancedQuestion{display:none}
#calculationConfigActions [hidden]{display:none!important}

.role-reference-warning{margin:0 0 16px;padding:12px 14px;background:var(--soft);border:1px solid var(--line);border-left:3px solid var(--accent);border-radius:8px;font-size:14px;line-height:1.5}.role-reference-warning p{margin:0 0 10px}.role-reference-warning button{height:auto;min-height:40px;padding:8px 12px}

/* Preserve the single header row on small phones. */
@media(max-width:440px){html[data-theme] .lab-shell>.header .header-top{gap:6px}html[data-theme] .lab-shell>.header .brand{gap:6px}html[data-theme] .lab-shell>.header .brand h1{font-size:19px}html[data-theme] .lab-shell>.header .brand-mark{width:30px;height:30px;flex-basis:30px}.header-language{gap:4px}.header-language .settings-button{width:32px;min-width:32px;height:36px;padding:5px}.header-language .lang-select{width:64px;max-width:64px}}

/* Match the guided setup launch border on role difference controls. */
html[data-theme] :is(#roleAccordionToggle,#calculateDifferences){border:1px solid var(--accent)}
html[data-theme] :is(#roleAccordionToggle,#calculateDifferences):hover:not(:disabled){border-color:var(--accent-ink)}
html[data-theme] :is(#roleAccordionToggle,#calculateDifferences):focus-visible{outline:3px solid var(--accent-ink);outline-offset:3px}
#calculateDifferencesHint{margin:0 0 10px}

.selected-captain-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:baseline;gap:12px;padding:3px 0}.selected-captain-name{font-weight:600}.selected-captain-stars{color:var(--accent-ink);white-space:nowrap}

.lab-mode-status{display:block;font-size:12px;line-height:1.35;font-weight:500;color:var(--muted);margin-top:2px}
