:root{color-scheme:light}
.settings-button{display:inline-flex;align-items:center;justify-content:center;flex:0 0 38px;width:38px;height:38px;padding:7px;border:1px solid var(--line);border-radius:9px;background:var(--panel);color:var(--ink);cursor:pointer}
.settings-button svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.settings-button:hover{background:var(--soft)}.settings-button:focus-visible{outline:2px solid var(--blue);outline-offset:3px}
.settings-dialog{width:min(440px,calc(100vw - 24px));max-height:90vh;max-height:90svh;padding:0;border:1px solid var(--line);border-radius:16px;background:var(--card);color:var(--ink);box-shadow:0 24px 70px #051e6540;font-size:18px;overflow:auto}
.settings-dialog::backdrop{background:#04183299}
.settings-dialog-head{display:flex;align-items:center;gap:16px;padding:20px 22px;border-bottom:1px solid var(--line);background:var(--panel)}
.settings-dialog-head h2{margin:0;flex:1;font-size:24px}
.settings-dialog-body{padding:22px}.settings-dialog-body label{display:block;font-weight:650;margin-bottom:9px}
#themeSelect{width:100%;min-height:46px;border:1px solid var(--line);border-radius:8px;padding:10px 12px;background:var(--panel);color:var(--ink);font:inherit}
.settings-version{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px;margin-top:24px;padding-top:18px;border-top:1px solid var(--line);color:var(--muted);font-size:16px}.settings-version strong{color:var(--ink);white-space:nowrap}

html[data-theme=dark]{color-scheme:dark;--bg:#0b1321;--card:#142033;--panel:#1a2a40;--soft:#213651;--line:#344960;--ink:#deebff;--navy:#c7dcff;--muted:#a0b3cd;--danger:#ff979c;--shadow:0 6px 18px #0003;scrollbar-color:#506985 #142033}
html[data-theme=dark] .header{background:linear-gradient(110deg,#16253b,#1b3352)}
html[data-theme=dark] :is(.brand h1,.card h2,.title-icon,.tour-title,.info-dialog h2,.privacy-modal h2,.privacy-modal h3,.info-dialog-body strong){color:#bdd8ff}
html[data-theme=dark] :is(.brand p,.radio-row label,.bonus-table td:first-child,.bonus-category-name,.level-name,.order-group h3,.insertion-group h3,.captain-table td:nth-child(2),.matrix6 td:first-child,.troop-name,.qty){color:#d5e6ff}
html[data-theme=dark] :is(.bonus-table th,.special-row label,.special-row .cap-badge,.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,.level-check,.lab-stack-tab,.footer,.empty){color:#a7bdd8}
html[data-theme=dark] :is(.input-wrap,.number,.mini-input,.cap-level,.cap-star,.lang-select,#themeSelect){background:#0f1b2c;border-color:var(--line);color:var(--ink)}
html[data-theme=dark] .input-wrap input{color:var(--ink)}
html[data-theme=dark] .input-wrap span{color:#abc2df;border-color:var(--line)}
html[data-theme=dark] .input-wrap.readonly{background:#1b2a3c}
html[data-theme=dark] :is(.input-wrap.readonly input,.mini-input:disabled){color:#91a6c1}
html[data-theme=dark] .mini-input:disabled{background:#1b2a3c}
html[data-theme=dark] :is(.input-wrap>.sign-toggle,.bonus-pill){background:#21354e;color:#c9dfff;border-color:var(--line)}
html[data-theme=dark] :is(.specials,.config-actions,.matrix6 .matrix-user-input>span,.captain-scroll,.captain-table th,.captain-table td,.level-row,.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=dark] .input-wrap:focus-within{border-color:#74afff}
html[data-theme=dark] :is(.matrix6 .mini-read,.pct-cell){color:#bed2ed}
html[data-theme=dark] :is(.matrix6 .macro,.captain-table thead){background:#1e3450;color:#c9dfff}
html[data-theme=dark] .captain-table th{color:#c9dfff}
html[data-theme=dark] .captain-table tr.selected{background:#1c3550}
html[data-theme=dark] :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){background:#1c304a;color:#c5dfff;border-color:#496886}
html[data-theme=dark] :is(.captain-accordion-toggle:hover,.header-link:hover,.guide-btn:hover,.config-btn:hover,.lab-reset-order:hover,.info-dialog-x:hover,.copy-order:hover){background:#284361}
html[data-theme=dark] :is(.order-tab.active,.tour-btn.primary){background:linear-gradient(#1b78e3,#075cc4);color:#fff;border-color:#438ce3}
html[data-theme=dark] .lab-banner{background:#1b304d;border-color:#3c5d83;color:#d5e6ff}
html[data-theme=dark] :is(.lab-banner a,.footer-btn,.lab-battle a,.footer strong){color:#93c4ff}
html[data-theme=dark] .lab-banner button{background:#24538a;color:#fff}
html[data-theme=dark] .lab-shell>.lab-mode-tabs{background:var(--card);border-color:var(--line)}
html[data-theme=dark] .lab-mode-tabs .lab-mode-tab{background:transparent;color:#bdd0e9}
html[data-theme=dark] :is(.lab-mode-tabs .lab-mode-tab.active,.lab-stack-tab.active){background:#223e61;border-color:#3e628d;color:#c7e1ff}
html[data-theme=dark] :is(.lab-mode-tabs .lab-mode-tab:hover,.lab-stack-tab:hover){background:#203752;color:#d9eaff}
html[data-theme=dark] .level-check{background:#1b2c43;border-color:var(--line)}
html[data-theme=dark] .metric{background:#17273d;border-color:var(--line)}
html[data-theme=dark] .metric strong{color:#d5e6ff}
html[data-theme=dark] .damage-box{background:linear-gradient(145deg,#1c3c61,#193251)}
html[data-theme=dark] .damage-box .small{color:#99c9ff}html[data-theme=dark] .damage-box strong{color:#e3f0ff}
html[data-theme=dark] :is(.insertion-group,.info-dialog-head){background:var(--panel);border-color:var(--line)}
html[data-theme=dark] :is(.info-dialog,.privacy-modal,.privacy-banner,.tour-card){background:var(--card);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] .tour-card:before{background:var(--card);border-color:var(--line)}
html[data-theme=dark] .tour-step{color:#91c1ff}
html[data-theme=dark] .tour-highlight{box-shadow:0 0 0 4px #4a9dff,0 0 0 10px #0b1321,0 14px 28px #0006!important}
html[data-theme=dark] :is(.lab-pvp-counters,.order-badge,.drag-handle){color:#c4d8f2}
html[data-theme=dark] .order-badge{background:#0e1c2ba6;border-color:#627a9366}
html[data-theme=dark] .order-badges .quantity-copy{background:#0e1c2ba6;border-color:#627a9366;color:#c4d8f2}
html[data-theme=dark] .order-badges .quantity-copy:hover{background:#243d58}
html[data-theme=dark] :is(.order-badges .quantity-copy.is-copied,.copy-order.is-copied,.config-status,.copy-toast){color:#68d9a6}
html[data-theme=dark] :is(.config-status.error,.error,.captain-error){color:#ff979c}
html[data-theme=dark] .order-item.level-1,html[data-theme=dark] .tier-select.level-1,html[data-theme=dark] .tier-edit.level-1{background:#2b3542}
html[data-theme=dark] .order-item.level-2,html[data-theme=dark] .tier-select.level-2,html[data-theme=dark] .tier-edit.level-2{background:#203c2e}
html[data-theme=dark] .order-item.level-3,html[data-theme=dark] .tier-select.level-3,html[data-theme=dark] .tier-edit.level-3{background:#203956}
html[data-theme=dark] .order-item.level-4,html[data-theme=dark] .tier-select.level-4,html[data-theme=dark] .tier-edit.level-4{background:#3b2c4c}
html[data-theme=dark] .order-item.level-5,html[data-theme=dark] .tier-select.level-5,html[data-theme=dark] .tier-edit.level-5{background:#493423}
html[data-theme=dark] .order-item.level-6,html[data-theme=dark] .tier-select.level-6,html[data-theme=dark] .tier-edit.level-6{background:#492a30}
html[data-theme=dark] .order-item.level-7,html[data-theme=dark] .tier-select.level-7,html[data-theme=dark] .tier-edit.level-7{background:#444023}
html[data-theme=dark] .order-item.level-8,html[data-theme=dark] .tier-select.level-8,html[data-theme=dark] .tier-edit.level-8{background:#344150}
html[data-theme=dark] .order-item.level-9,html[data-theme=dark] .tier-select.level-9,html[data-theme=dark] .tier-edit.level-9{background:#294b38}

/* A quieter blue palette shared by both calculator tiers. */
:root{--blue:#4b77b0;--blue2:#3f679f}
:is(.run,.order-tab.active,.tour-btn.primary,.info-dialog-close,.privacy-banner button,.lab-banner button){background:linear-gradient(180deg,#4b77b0,#3f679f);border-color:#3f679f;color:#fff;box-shadow:0 3px 9px #35588820}
:is(.run,.order-tab.active,.tour-btn.primary,.info-dialog-close):hover:not(:disabled){filter:brightness(1.06)}
:is(.header-link,.guide-btn,.config-btn,.order-tab:not(.active),.lab-reset-order,.copy-order,.captain-accordion-toggle){color:#41699e;border-color:#c4d2e4}
.lab-mode-tabs .lab-mode-tab.active{background:#edf2f9;border-color:#c7d5e8;color:#355f98;box-shadow:inset 3px 0 #5682b8}
.lab-stack-tab.active{background:#edf2f9;color:#355f98}
.info{background:#f0f5fb;border:1px solid #9db5d2;color:#41699e;box-shadow:none}
.info:hover{background:#e5edf7;border-color:#6d90bd;box-shadow:none}
.info-icon{width:15px;height:15px}.info-icon path{stroke-width:2.2}
html[data-theme=dark] :is(.run,.order-tab.active,.tour-btn.primary,.info-dialog-close,.privacy-banner button,.lab-banner button){background:linear-gradient(180deg,#4775aa,#365d8d);border-color:#5b82b2;color:#fff}
html[data-theme=dark] .info{background:#20344d;border-color:#5b7a9d;color:#c4dcfa;box-shadow:none}
html[data-theme=dark] .info:hover{background:#294562;border-color:#8aabd0;box-shadow:none}
