/* Whiteout Survival Companion — unified Frozen Tundra tool UI v2
   This stylesheet deliberately changes structure/geometry as well as color.
   The Companion hub stylesheet is loaded before this file; this extends its exact
   navigation/light-dark language to the individual calculators. */

body.frozen-tool-page{
  --tool-deep:#04111c;
  --tool-deep-2:#082334;
  --tool-deep-3:#0c3146;
  --tool-ice:#7ee9ff;
  --tool-ice-2:#37bfe5;
  --tool-ice-soft:#d8f3ff;
  --tool-text:#f4fbff;
  --tool-muted:#9fc2d0;
  --tool-line:rgba(158,235,255,.30);
  --tool-line-strong:rgba(188,244,255,.58);
  --tool-panel:rgba(6,25,39,.90);
  --tool-panel-2:rgba(9,42,59,.86);
  --tool-panel-soft:rgba(12,49,68,.62);
  --tool-shadow:0 22px 64px rgba(1,12,21,.38);
  min-width:0!important;
  margin:0!important;
  color:var(--tool-text)!important;
  background:#04111c!important;
  overflow-x:hidden!important;
}
body.frozen-tool-page *{box-sizing:border-box}
body.frozen-tool-page button,
body.frozen-tool-page input,
body.frozen-tool-page select,
body.frozen-tool-page textarea{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}

/* Keep each tool's own art visible, as on the Companion hubs. */
body.frozen-tool-page .bg-media{
  opacity:.78!important;
  filter:saturate(1.0) brightness(.82) contrast(1.03)!important;
  transform:scale(1.01);
}
body.frozen-tool-page .bg-overlay{
  background:radial-gradient(circle at 48% 10%,rgba(98,224,255,.10),transparent 34%),linear-gradient(180deg,rgba(1,10,18,.08),rgba(2,14,24,.25) 55%,rgba(1,9,16,.62))!important;
  backdrop-filter:none!important;
}
body.frozen-tool-page::before,
body.frozen-tool-page::after{animation:none!important}
.tool-frost-atmosphere{position:fixed;inset:0;z-index:-1;pointer-events:none;opacity:.78;background:radial-gradient(circle at 14% 18%,rgba(93,241,255,.11),transparent 20%),radial-gradient(circle at 82% 18%,rgba(98,255,210,.07),transparent 24%),repeating-linear-gradient(112deg,rgba(255,255,255,.011) 0 1px,transparent 1px 44px)}

/* ========== EXACT COMPANION NAVIGATION LANGUAGE ========== */
.tool-global-shell{width:min(1510px,calc(100vw - 54px));margin:28px auto 0;position:relative;z-index:1000}
body.frozen-tool-page .tool-companion-topbar{margin-bottom:22px!important}
body.frozen-tool-page .tool-companion-topbar .theme-toggle{position:static!important;inset:auto!important;transform:none!important;margin:0!important;min-width:92px!important;min-height:42px!important;width:auto!important;height:42px!important;border-radius:0!important}
body.frozen-tool-page .tool-companion-topbar .theme-toggle:hover{transform:translateY(-1px)!important}
body.frozen-tool-page .tool-companion-topbar .theme-toggle:active{transform:none!important}

/* old per-tool navigation/theme controls are removed from the visual hierarchy */
body.frozen-tool-page :is(.top-nav,.top-center-nav,.hub-nav-container,.hero-top,.chief-hero-topline,.page-side-rail,.theme-toggle-wrap,.floating-theme-toggle){display:none!important}
body.frozen-tool-page #troopTrainingThemeToggle{display:none!important}

/* second synchronized theme control that genuinely follows the viewport */
.tool-side-theme-toggle{
  position:fixed!important;right:18px!important;top:50%!important;bottom:auto!important;left:auto!important;
  transform:translateY(-50%)!important;z-index:100000!important;
  min-height:50px;display:flex;align-items:center;gap:9px;padding:8px 11px 8px 8px;
  border:1px solid rgba(150,225,247,.34);border-radius:0;
  clip-path:polygon(8px 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%,0 8px);
  background:linear-gradient(180deg,rgba(12,54,73,.94),rgba(5,31,46,.96));color:#e9faff;
  box-shadow:0 14px 34px rgba(0,0,0,.31),0 0 22px rgba(69,216,255,.08);backdrop-filter:blur(18px);cursor:pointer;
}
.tool-side-theme-toggle:hover{transform:translateY(-50%) translateX(-3px)!important;border-color:rgba(171,242,255,.72)}
.tool-side-theme-toggle .side-theme-glyph{width:32px;height:32px;display:grid;place-items:center;background:rgba(83,193,224,.13);border:1px solid rgba(152,229,249,.25);clip-path:polygon(6px 0,100% 0,100% calc(100% - 6px),calc(100% - 6px) 100%,0 100%,0 6px)}
.tool-side-theme-toggle .side-theme-copy{display:flex;flex-direction:column;text-align:left;line-height:1.05}.tool-side-theme-toggle .side-theme-copy b{font-size:.70rem}.tool-side-theme-toggle .side-theme-copy small{margin-top:4px;color:#8eb8c8;font-size:.56rem;font-weight:750}

/* all 8 workspaces now line up to the same shell as the main and hub pages */
body.frozen-tool-page :is(.hub-container,.dashboard-container,.page,.shell){
  width:min(1510px,calc(100vw - 54px))!important;max-width:none!important;margin:0 auto 76px!important;padding:0!important;position:relative;z-index:2;
}
body.frozen-tool-page .gear-hub-wrapper{width:100%!important;padding:0!important;gap:20px!important}
body.frozen-tool-page :is(.stock-container,.planner-workbench,.charms-board,.bottom-summary,.bottom-summary-container,.chief-container){width:100%!important;max-width:none!important}

/* ========== TOOL HEROES — same glacier-slab architecture ========== */
body.frozen-tool-page :is(.hero-shell,.chief-hero-shell,.event-hero,.experts-hero,.header-section,.hero,.tool-hero){
  position:relative!important;overflow:hidden!important;margin:0 0 22px!important;
  border:1px solid rgba(155,233,255,.35)!important;border-radius:0!important;
  clip-path:polygon(24px 0,calc(100% - 24px) 0,100% 24px,100% calc(100% - 24px),calc(100% - 24px) 100%,24px 100%,0 calc(100% - 24px),0 24px)!important;
  background:linear-gradient(135deg,rgba(5,28,43,.72),rgba(9,54,73,.55),rgba(7,31,48,.67))!important;
  box-shadow:0 26px 78px rgba(1,12,21,.42),inset 0 1px rgba(255,255,255,.07)!important;
  backdrop-filter:blur(14px) saturate(1.08)!important;
}
body.frozen-tool-page :is(.event-hero,.experts-hero,.header-section,.hero,.tool-hero){height:306px!important;min-height:306px!important}
body.frozen-tool-page :is(.hero-shell,.chief-hero-shell){min-height:306px!important;padding:42px 48px!important}
body.frozen-tool-page :is(.event-hero,.hero){padding:40px 46px!important}
body.frozen-tool-page :is(.hero-shade,.event-hero-overlay,.tool-hero-overlay){background:linear-gradient(90deg,rgba(4,18,29,.93) 0%,rgba(6,31,46,.82) 50%,rgba(5,25,38,.30) 79%,rgba(4,17,28,.42) 100%),linear-gradient(180deg,rgba(75,198,231,.03),rgba(3,14,23,.35))!important}
body.frozen-tool-page :is(.hero-art,.tool-hero-bg,.event-hero-bg){filter:saturate(.98) brightness(.84) contrast(1.02)!important}
body.frozen-tool-page :is(.mini-label,.chief-mini-label,.hero-kicker,.tool-kicker,.event-kicker,.eyebrow,.command-eyebrow){color:#8deaff!important;letter-spacing:.18em!important;text-shadow:none!important;background:transparent!important;border-color:rgba(126,222,246,.35)!important}
body.frozen-tool-page :is(.hero-title,.chief-premium-title,.web-title,.event-copy h1,.hero h1,.tool-hero h1,.experts-hero h1,.header-section h1){
  color:#f7fdff!important;background:none!important;-webkit-background-clip:initial!important;-webkit-text-fill-color:initial!important;filter:none!important;text-shadow:0 3px 22px rgba(0,21,34,.30)!important;font-weight:950!important;letter-spacing:-.045em!important;
}
body.frozen-tool-page :is(.hero-lead,.chief-hero-lead,.event-copy p,.hero-copy p,.tool-hero p,.hero p){color:#c4dde7!important;text-shadow:none!important}
body.frozen-tool-page :is(.feature-grid,.chief-feature-grid){gap:10px!important}
body.frozen-tool-page :is(.feature-card,.chief-feature-card,.hero-pill,.hero-badge){
  border:1px solid rgba(129,221,247,.22)!important;border-radius:0!important;
  clip-path:polygon(8px 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%,0 8px)!important;
  background:rgba(5,29,43,.50)!important;color:#dff8ff!important;box-shadow:none!important;
}

/* ========== MAJOR CRYSTALLINE CONTAINERS ========== */
body.frozen-tool-page :is(
 .stock-container,.planner-workbench,.charms-board,.bottom-summary,.bottom-summary-container,.grand-total-panel,
 .overview-panel,.overview-section>.overview-grid,.goal-panel,.operation-panel,.speed-panel,.totals-panel,
 .presets-panel,.quick-build-custom-panel,.quick-stock-panel,.quick-action-panel,.troops-container,
 .expert-row-card,.expert-totals-panel,.expert-stats-panel,.results-box,.plan-box,.game-dialog,
 .modal,.preset-modal,.gear-modal-content,.cg-qb-settings-modal,.cg-conversion-settings-modal,.cg-smart-modal
){
  position:relative!important;border:1px solid rgba(126,222,246,.28)!important;border-radius:2px!important;
  background:linear-gradient(125deg,rgba(255,255,255,.025),transparent 28%,rgba(84,203,235,.025) 62%,transparent 80%),linear-gradient(145deg,rgba(7,28,43,.94),rgba(8,40,57,.90))!important;
  color:#eaf9ff!important;box-shadow:var(--tool-shadow),inset 0 1px rgba(255,255,255,.055)!important;backdrop-filter:blur(14px) saturate(1.08)!important;
}
/* specific large modules that are not named *-panel */
body.frozen-tool-page :is(.planner-main,.batch-card,.planner-workbench-main,.planner-batch-card,.cost-overview-card,.stats-overview-card,.prep-console,.add-task-area){
  border:1px solid rgba(117,208,233,.22)!important;border-radius:2px!important;background:rgba(5,25,39,.58)!important;color:#eaf9ff!important;box-shadow:none!important;
}

/* Internal cards use the same straight-edged ice plates instead of each page's old rounded language. */
body.frozen-tool-page :is(
 .stock-item,.strategy-btn,.settings-section,.check-card,.priority-box,.mass-select-row,.gain-item,.prep-card,.charm-tile,.slot-subpanel,.grand-total-item,.week-card,.conversion-route,
 .overview-card,.metric,.stat-summary,.prep-control,.expert-option-item,.expert-profile-column,.skill-item-card,.reward-group,.reward-item,
 .field-card,.cost-tile,.help-strip,.recommended-card,.plan-card,.schedule-block,.notice,.notice-stat,
 .speed-card,.agnes-card,.requirements-card,.preset-btn,.svs-prep-card,.building-slot,.cost-box,.controls-box,.resource-strip,.building-picker,
 .total-card,.quick-option-card,.quick-coverage-box,.quick-priority-panel,.quick-stock-card,.quick-status-card,.quick-budget-card,.quick-bottleneck-card,.quick-piece-summary,.gear-row-item,.gear-subtotal-box,.troop-total-box,
 .event-card-top,.event-control-panel,.event-results-panel,.input-mode-pane,.checkbox-container,.result-row,.plan-day-row,.milestone-summary,
 .training-task-card,.loadout-header,.task-controls-grid,.config-pane,.troop-choice,.action-switch,.compact-result-main,.compact-metric,.compact-resource,.resource-total-card,.prep-overview-card,.overview-speed-control,
 .gear-box,.gear-slot-pair,.conversion-status-card,.conversion-master-row,.conversion-summary-card,.conversion-rule-card,.conversion-week-v4,.qb-settings-section,.qb-troop-card,.qb-priority-row
){
  border-radius:2px!important;border-color:rgba(117,208,233,.20)!important;background:linear-gradient(145deg,rgba(7,28,42,.72),rgba(5,24,37,.62))!important;color:#e6f8ff!important;box-shadow:inset 0 1px rgba(255,255,255,.035)!important;
}

/* Angular glacier cuts are the same visual signature used by the main Companion cards. */
body.frozen-tool-page :is(
 .stock-container,.planner-workbench,.charms-board,.bottom-summary,.bottom-summary-container,.grand-total-panel,
 .overview-panel,.goal-panel,.operation-panel,.speed-panel,.totals-panel,.presets-panel,.quick-build-custom-panel,
 .quick-stock-panel,.quick-action-panel,.troops-container,.expert-row-card,.expert-totals-panel,.expert-stats-panel,
 .results-box,.plan-box,.game-dialog,.modal,.preset-modal,.gear-modal-content
){border-radius:0!important;clip-path:polygon(14px 0,calc(100% - 14px) 0,100% 14px,100% calc(100% - 14px),calc(100% - 14px) 100%,14px 100%,0 calc(100% - 14px),0 14px)!important}
body.frozen-tool-page :is(
 .stock-item,.feature-card,.chief-feature-card,.overview-card,.metric,.stat-summary,.field-card,.cost-tile,.speed-card,
 .agnes-card,.requirements-card,.preset-btn,.svs-prep-card,.building-slot,.total-card,.quick-option-card,.quick-stock-card,
 .quick-status-card,.quick-budget-card,.quick-bottleneck-card,.gear-row-item,.gear-subtotal-box,.event-card-top,
 .event-control-panel,.event-results-panel,.input-mode-pane,.checkbox-container,.result-row,.plan-day-row,.training-task-card,
 .loadout-header,.task-controls-grid,.troop-choice,.compact-result-main,.compact-metric,.compact-resource,.gear-box,.gear-slot-pair,
 .qb-settings-section,.qb-troop-card,.qb-priority-row,.charm-tile,.slot-subpanel,.gain-item,.prep-card
){border-radius:0!important;clip-path:polygon(8px 0,calc(100% - 8px) 0,100% 8px,100% calc(100% - 8px),calc(100% - 8px) 100%,8px 100%,0 calc(100% - 8px),0 8px)!important}

/* Headers / labels align across tools. */
body.frozen-tool-page :is(.section-title,.section-heading,.section-head,.panel-heading,.grand-total-head,.stock-heading,.stock-heading-row,.planner-head,.planner-workbench-heading,.bottom-heading,.bottom-summary-heading,.overview-card-head,.planner-batch-head,.batch-head){
  border-color:rgba(112,205,231,.17)!important;
}
body.frozen-tool-page :is(.section-title h2,.section-title h3,.section-heading h2,.section-head h2,.panel-heading h2,.grand-total-title,.stock-title,.planner-head h2,.planner-workbench-heading h2,.bottom-heading h2,.bottom-summary-heading h2,.overview-card-title,.troop-panel-title-wrap strong,.batch-head h3,.planner-batch-head h3){
  color:#edfaff!important;font-weight:950!important;letter-spacing:-.015em!important;
}
body.frozen-tool-page :is(.section-title p,.section-heading p,.section-head p,.panel-heading p,.grand-total-sub,.stock-subtitle,.planner-head p,.planner-workbench-heading p,.bottom-heading p,.bottom-summary-heading p,.overview-card-sub,.muted,.speed-card-copy small,.hero-pill){color:#92b3c1!important}

/* ========== BUTTONS — ONE SHAPE / ONE MATERIAL ========== */
body.frozen-tool-page :is(
 .secondary,.mass-btn,.mass-btn-ghost,.settings-btn,.route-btn,.qb-route-btn,.strategy-btn,.stepper-btn,.adj-btn,.stock-adj-btn,.gear-adj-btn,
 .mode-tab-btn,.opt-btn,.menu-option-btn,.preset-btn,.troop-toggle,.action-choice,.quick-view-tab,.quick-load-all-btn,.quick-batch-buttons button,.cg-btn-secondary,
 .modal-close,.gear-modal-close,.preset-minimize-btn,.inline-link,.ghost-btn,.remove-expert-btn,.remove-gear-btn,.remove-troop-btn,.menu-cancel-btn,
 .preset-open-btn,.camp-toggle,.add-all-remaining-btn,.quick-preview-reset,.detail-reward-link
){
  border-radius:0!important;
  clip-path:polygon(7px 0,100% 0,100% calc(100% - 7px),calc(100% - 7px) 100%,0 100%,0 7px)!important;
  border:1px solid rgba(116,213,239,.31)!important;background:linear-gradient(180deg,rgba(30,80,101,.65),rgba(12,42,59,.82))!important;
  color:#e8faff!important;-webkit-text-fill-color:initial!important;box-shadow:inset 0 1px rgba(255,255,255,.055),0 7px 17px rgba(0,0,0,.14)!important;text-shadow:none!important;transition:transform .16s ease,border-color .16s ease,background .16s ease,filter .16s ease!important;
}
body.frozen-tool-page :is(.secondary,.mass-btn,.mass-btn-ghost,.settings-btn,.route-btn,.qb-route-btn,.strategy-btn,.stepper-btn,.adj-btn,.stock-adj-btn,.gear-adj-btn,.mode-tab-btn,.opt-btn,.menu-option-btn,.preset-btn,.troop-toggle,.action-choice,.quick-view-tab,.quick-load-all-btn,.cg-btn-secondary,.ghost-btn,.camp-toggle):hover{
  transform:translateY(-1px)!important;border-color:rgba(150,236,255,.72)!important;background:linear-gradient(180deg,rgba(47,116,142,.77),rgba(15,57,76,.91))!important;box-shadow:0 0 18px rgba(60,198,233,.12)!important;
}
body.frozen-tool-page :is(
 .primary-btn,.optimize-btn,.quick-build-launch-btn,.quick-primary-build,.add-task-btn,.circle-add-btn,.add-event-main-btn,.preset-launch-btn,
 .cg-btn-primary,.strategy-btn.active,.mode-tab-btn.active,.opt-btn.active,.action-choice.active,.troop-toggle.active,.preset-btn.active,.preset-btn.active-preset
){
  border-radius:0!important;clip-path:polygon(8px 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%,0 8px)!important;
  border:1px solid rgba(171,242,255,.76)!important;background:linear-gradient(135deg,#7be8ff 0%,#39badf 47%,#167fa9 100%)!important;
  color:#042433!important;-webkit-text-fill-color:#042433!important;box-shadow:0 11px 27px rgba(25,138,176,.25),0 0 23px rgba(81,213,244,.14),inset 0 1px rgba(255,255,255,.42)!important;text-shadow:none!important;
}
body.frozen-tool-page :is(.primary-btn,.optimize-btn,.quick-build-launch-btn,.quick-primary-build,.add-task-btn,.circle-add-btn,.add-event-main-btn,.preset-launch-btn,.cg-btn-primary):hover{filter:brightness(1.08)!important;transform:translateY(-2px)!important}
body.frozen-tool-page .circle-add-btn{width:66px!important;height:66px!important;border-radius:0!important;font-size:2rem!important}
body.frozen-tool-page :is(.profile-shine-btn,.profile-gear-load){
  border-radius:0!important;clip-path:polygon(8px 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%,0 8px)!important;
  border:1px solid #ffe07a!important;background:linear-gradient(135deg,#fff0ae,#f7bd36 45%,#fff2b7 61%,#d98e10)!important;color:#352306!important;box-shadow:0 0 17px rgba(252,196,48,.22)!important;
}
body.frozen-tool-page :is(.profile-save-btn,.profile-gear-save){border-radius:0!important;clip-path:polygon(7px 0,100% 0,100% calc(100% - 7px),calc(100% - 7px) 100%,0 100%,0 7px)!important;border:1px solid rgba(116,213,239,.31)!important;background:linear-gradient(180deg,rgba(30,80,101,.65),rgba(12,42,59,.82))!important;color:#e8faff!important}

/* Inputs are also square crystalline controls rather than per-page rounded widgets. */
body.frozen-tool-page :is(input[type="text"],input[type="number"],input[type="email"],input[type="password"],select,textarea,.input-shell,.percent-input,.overview-speed-input,.currency-input-shell,.amount-input-wrap){
  border-radius:0!important;border-color:rgba(116,207,233,.31)!important;background:rgba(5,24,37,.84)!important;color:#eafaff!important;-webkit-text-fill-color:#eafaff!important;box-shadow:inset 0 1px rgba(255,255,255,.035)!important;
}
body.frozen-tool-page :is(input,select,textarea):focus{outline:none!important;border-color:rgba(142,234,255,.76)!important;box-shadow:0 0 0 2px rgba(61,197,230,.09)!important}
body.frozen-tool-page input[type="checkbox"]{accent-color:#35b9dd}

/* Modals/dropdowns use the same frost glass instead of each old page palette. */
body.frozen-tool-page :is(.modal-backdrop,.modal-overlay,.gear-modal-overlay,.game-modal){background:rgba(2,12,20,.75)!important;backdrop-filter:blur(9px)!important}
body.frozen-tool-page :is(.experts-dropdown-list,.popup-menu-box,.popup-menu-options,.building-picker,.gear-tooltip,.tooltip,.expert-tooltip){border-radius:2px!important;border-color:rgba(118,213,239,.30)!important;background:rgba(5,25,39,.97)!important;color:#eafaff!important;box-shadow:0 22px 58px rgba(0,0,0,.40)!important}

/* restrained gold is reserved for high-value totals, like the Companion accents */
body.frozen-tool-page :is(.metric-value,.overview-value,.total-value,.prep-score-value,.prep-score,.gain-item strong,.bottom-summary-item strong,.slot-change-item strong,.grand-total-item strong,.compact-troop-total,.resource-total-title,.speed-total-pill,.total-rss strong,.total-time strong){color:#f4d477!important;text-shadow:none!important}

/* ========== LIGHT MODE — SAME COMPONENTS, SNOW / ICE MATERIAL ========== */
body.frozen-tool-page.light-theme{background:#eaf7fb!important;color:#183b4c!important}
body.frozen-tool-page.light-theme .bg-media{opacity:.55!important;filter:saturate(.92) brightness(.99) contrast(.99)!important}
body.frozen-tool-page.light-theme .bg-overlay{background:linear-gradient(180deg,rgba(239,252,255,.13),rgba(225,246,252,.34) 62%,rgba(221,242,248,.58))!important}
body.frozen-tool-page.light-theme .tool-frost-atmosphere{opacity:.46}
body.frozen-tool-page.light-theme .tool-side-theme-toggle{background:linear-gradient(180deg,rgba(247,254,255,.97),rgba(211,240,248,.94));color:#214f62;border-color:rgba(64,157,188,.30);box-shadow:0 14px 34px rgba(55,116,136,.17)}
body.frozen-tool-page.light-theme .tool-side-theme-toggle .side-theme-glyph{background:rgba(63,166,196,.10);border-color:rgba(64,157,188,.23)}
body.frozen-tool-page.light-theme .tool-side-theme-toggle .side-theme-copy small{color:#6a8a98}

body.frozen-tool-page.light-theme :is(.hero-shell,.chief-hero-shell,.event-hero,.experts-hero,.header-section,.hero,.tool-hero){
  background:linear-gradient(135deg,rgba(232,249,254,.78),rgba(196,236,248,.70),rgba(223,246,252,.74))!important;border-color:rgba(75,164,193,.30)!important;box-shadow:0 22px 58px rgba(45,105,125,.16),inset 0 1px rgba(255,255,255,.74)!important;
}
body.frozen-tool-page.light-theme :is(.hero-shade,.event-hero-overlay,.tool-hero-overlay){background:linear-gradient(90deg,rgba(239,252,255,.94) 0%,rgba(220,244,251,.86) 49%,rgba(224,245,250,.44) 78%,rgba(232,249,253,.60) 100%)!important}
body.frozen-tool-page.light-theme :is(.mini-label,.chief-mini-label,.hero-kicker,.tool-kicker,.event-kicker,.eyebrow,.command-eyebrow){color:#197a9d!important}
body.frozen-tool-page.light-theme :is(.hero-title,.chief-premium-title,.web-title,.event-copy h1,.hero h1,.tool-hero h1,.experts-hero h1,.header-section h1){color:#173c4e!important;text-shadow:none!important}
body.frozen-tool-page.light-theme :is(.hero-lead,.chief-hero-lead,.event-copy p,.hero-copy p,.tool-hero p,.hero p){color:#4c7180!important}
body.frozen-tool-page.light-theme :is(.feature-card,.chief-feature-card,.hero-pill,.hero-badge){background:rgba(247,254,255,.68)!important;color:#214d61!important;border-color:rgba(64,157,188,.22)!important}

body.frozen-tool-page.light-theme :is(
 .stock-container,.planner-workbench,.charms-board,.bottom-summary,.bottom-summary-container,.grand-total-panel,.overview-panel,.overview-section>.overview-grid,.goal-panel,.operation-panel,.speed-panel,.totals-panel,.presets-panel,.quick-build-custom-panel,.quick-stock-panel,.quick-action-panel,.troops-container,.expert-row-card,.expert-totals-panel,.expert-stats-panel,.results-box,.plan-box,.game-dialog,.modal,.preset-modal,.gear-modal-content,.cg-qb-settings-modal,.cg-conversion-settings-modal,.cg-smart-modal,.planner-main,.batch-card,.planner-workbench-main,.planner-batch-card,.cost-overview-card,.stats-overview-card,.prep-console,.add-task-area
){
  border-color:rgba(58,151,180,.24)!important;background:linear-gradient(145deg,rgba(251,254,255,.96),rgba(230,245,250,.94))!important;color:#16384d!important;box-shadow:0 16px 40px rgba(65,105,124,.13),inset 0 1px #fff!important;
}
body.frozen-tool-page.light-theme :is(
 .stock-item,.strategy-btn,.settings-section,.check-card,.priority-box,.mass-select-row,.gain-item,.prep-card,.charm-tile,.slot-subpanel,.grand-total-item,.week-card,.conversion-route,.overview-card,.metric,.stat-summary,.prep-control,.expert-option-item,.expert-profile-column,.skill-item-card,.reward-group,.reward-item,.field-card,.cost-tile,.help-strip,.recommended-card,.plan-card,.schedule-block,.notice,.notice-stat,.speed-card,.agnes-card,.requirements-card,.preset-btn,.svs-prep-card,.building-slot,.cost-box,.controls-box,.resource-strip,.building-picker,.total-card,.quick-option-card,.quick-coverage-box,.quick-priority-panel,.quick-stock-card,.quick-status-card,.quick-budget-card,.quick-bottleneck-card,.quick-piece-summary,.gear-row-item,.gear-subtotal-box,.troop-total-box,.event-card-top,.event-control-panel,.event-results-panel,.input-mode-pane,.checkbox-container,.result-row,.plan-day-row,.milestone-summary,.training-task-card,.loadout-header,.task-controls-grid,.config-pane,.troop-choice,.action-switch,.compact-result-main,.compact-metric,.compact-resource,.resource-total-card,.prep-overview-card,.overview-speed-control,.gear-box,.gear-slot-pair,.conversion-status-card,.conversion-master-row,.conversion-summary-card,.conversion-rule-card,.conversion-week-v4,.qb-settings-section,.qb-troop-card,.qb-priority-row
){background:rgba(255,255,255,.78)!important;border-color:rgba(55,145,174,.20)!important;color:#17394e!important;box-shadow:inset 0 1px #fff!important}
body.frozen-tool-page.light-theme :is(.section-title h2,.section-title h3,.section-heading h2,.section-head h2,.panel-heading h2,.grand-total-title,.stock-title,.planner-head h2,.planner-workbench-heading h2,.bottom-heading h2,.bottom-summary-heading h2,.overview-card-title,.troop-panel-title-wrap strong,.batch-head h3,.planner-batch-head h3){color:#16384d!important}
body.frozen-tool-page.light-theme :is(.section-title p,.section-heading p,.section-head p,.panel-heading p,.grand-total-sub,.stock-subtitle,.planner-head p,.planner-workbench-heading p,.bottom-heading p,.bottom-summary-heading p,.overview-card-sub,.muted,.speed-card-copy small){color:#627f8e!important}
body.frozen-tool-page.light-theme :is(input[type="text"],input[type="number"],input[type="email"],input[type="password"],select,textarea,.input-shell,.percent-input,.overview-speed-input,.currency-input-shell,.amount-input-wrap){background:#fafdff!important;color:#17394e!important;-webkit-text-fill-color:#17394e!important;border-color:rgba(55,145,174,.27)!important}
body.frozen-tool-page.light-theme :is(.secondary,.mass-btn,.mass-btn-ghost,.settings-btn,.route-btn,.qb-route-btn,.strategy-btn,.stepper-btn,.adj-btn,.stock-adj-btn,.gear-adj-btn,.mode-tab-btn,.opt-btn,.menu-option-btn,.preset-btn,.troop-toggle,.action-choice,.quick-view-tab,.quick-load-all-btn,.cg-btn-secondary,.ghost-btn,.camp-toggle,.remove-expert-btn,.remove-gear-btn,.remove-troop-btn,.menu-cancel-btn,.preset-open-btn){background:linear-gradient(180deg,#f9fdff,#e8f5f9)!important;color:#174258!important;border-color:rgba(48,141,170,.27)!important}
body.frozen-tool-page.light-theme :is(.experts-dropdown-list,.popup-menu-box,.popup-menu-options,.building-picker,.gear-tooltip,.tooltip,.expert-tooltip){background:rgba(249,253,255,.98)!important;color:#17394e!important;border-color:rgba(61,151,179,.26)!important}
body.frozen-tool-page.light-theme :is(.metric-value,.overview-value,.total-value,.prep-score-value,.prep-score,.gain-item strong,.bottom-summary-item strong,.slot-change-item strong,.grand-total-item strong,.compact-troop-total,.resource-total-title,.speed-total-pill,.total-rss strong,.total-time strong){color:#7b5a09!important}

/* Keep text generated by old page CSS readable in both themes. */
body.frozen-tool-page:not(.light-theme) :is(label,b,strong,h2,h3,h4,.event-identity-copy h2,.event-panel-label strong,.setting-heading strong,.quick-subhead,.quick-material-summary-title,.totals-title,.building-title){color:#eaf9ff}
body.frozen-tool-page:not(.light-theme) :is(small,.event-control-hint,.input-field-label,.setting-heading small,.promote-label,.slot-status,.expert-option-name){color:#91b2c0}
body.frozen-tool-page.light-theme :is(label,b,strong,h2,h3,h4,.event-identity-copy h2,.event-panel-label strong,.setting-heading strong,.quick-subhead,.quick-material-summary-title,.totals-title,.building-title){color:#17394e!important}
body.frozen-tool-page.light-theme :is(small,.event-control-hint,.input-field-label,.setting-heading small,.promote-label,.slot-status,.expert-option-name){color:#617f8e!important}

/* Preserve deliberate warning / success semantics. */
body.frozen-tool-page .error,body.frozen-tool-page .error-alert{color:#ffd1d6!important;border-color:rgba(255,112,127,.45)!important;background:rgba(112,24,36,.34)!important}
body.frozen-tool-page.light-theme .error,body.frozen-tool-page.light-theme .error-alert{color:#8b2530!important;border-color:#e7afb6!important;background:#fff0f2!important}

@media(max-width:1120px){
  .tool-global-shell,body.frozen-tool-page :is(.hub-container,.dashboard-container,.page,.shell){width:min(100% - 28px,1510px)!important}
  body.frozen-tool-page :is(.hero-shell,.chief-hero-shell){padding:34px 30px!important}
}
@media(max-width:720px){
  .tool-global-shell{width:min(100% - 24px,1510px);margin-top:16px}
  body.frozen-tool-page :is(.hub-container,.dashboard-container,.page,.shell){width:min(100% - 24px,1510px)!important;margin-bottom:58px!important}
  .tool-side-theme-toggle{right:8px!important;top:auto!important;bottom:12px!important;transform:none!important;padding:7px!important}
  .tool-side-theme-toggle:hover{transform:translateX(-2px)!important}.tool-side-theme-toggle .side-theme-copy small{display:none}
  body.frozen-tool-page :is(.event-hero,.experts-hero,.header-section,.hero,.tool-hero){height:auto!important;min-height:270px!important}
  body.frozen-tool-page :is(.hero-shell,.chief-hero-shell,.event-hero,.hero){padding:30px 24px!important}
}


/* =====================================================================
   v3 structural + behavior repair layer
   ===================================================================== */

/* Every hero/header slab occupies the same width as the content below it. */
body.frozen-tool-page :is(.hero-shell,.chief-hero-shell,.event-hero,.experts-hero,.header-section,.hero,.tool-hero){
  width:100%!important;max-width:none!important;
}

/* Hub auth modal and tool modals share the class name modal-backdrop.
   These rules restore the original tool-modal open/closed contract. */
body.tool-building #buildingModal.modal-backdrop,
body.tool-rfc #presetModal.modal-backdrop{display:none!important}
body.tool-building #buildingModal.modal-backdrop.open,
body.tool-rfc #presetModal.modal-backdrop.open{display:flex!important}
body.frozen-tool-page .modal-backdrop[hidden]{display:none!important}

/* Strong, unmistakable selected states. Old page behavior/classes stay intact. */
body.frozen-tool-page :is(
 .strategy-btn.active,.strategy-btn.strategy-last-run,.camp-toggle.active,.troop-choice.active,
 .mode-tab-btn.active,.action-choice.active,.troop-toggle.active,.quick-view-tab.active,
 .preset-btn.active,.preset-btn.active-preset,.totals-tab-btn.active,.total-tab.active
){
  background:linear-gradient(135deg,#9af2ff 0%,#42c7e9 48%,#1986ae 100%)!important;
  border-color:#c6f8ff!important;color:#032d3e!important;-webkit-text-fill-color:#032d3e!important;
  box-shadow:0 0 0 2px rgba(126,231,255,.16),0 8px 22px rgba(15,142,181,.24)!important;
  filter:none!important;
}
body.frozen-tool-page :is(.strategy-btn.active,.strategy-btn.strategy-last-run,.camp-toggle.active,.troop-choice.active,.mode-tab-btn.active,.action-choice.active,.troop-toggle.active,.quick-view-tab.active,.preset-btn.active,.preset-btn.active-preset,.totals-tab-btn.active,.total-tab.active) :is(b,strong,small,span){
  color:inherit!important;-webkit-text-fill-color:inherit!important;
}
body.frozen-tool-page.light-theme :is(
 .strategy-btn.active,.strategy-btn.strategy-last-run,.camp-toggle.active,.troop-choice.active,
 .mode-tab-btn.active,.action-choice.active,.troop-toggle.active,.quick-view-tab.active,
 .preset-btn.active,.preset-btn.active-preset,.totals-tab-btn.active,.total-tab.active
){
  background:linear-gradient(135deg,#087ca4,#0d9fc5 56%,#37bddc)!important;
  border-color:#075f80!important;color:#fff!important;-webkit-text-fill-color:#fff!important;
  box-shadow:0 0 0 2px rgba(14,120,156,.10),0 8px 20px rgba(30,104,130,.18)!important;
}

/* Standard close/remove controls: same footprint, same location, never cut off. */
body.frozen-tool-page :is(.modal-close,.gear-modal-close){
  position:static!important;inset:auto!important;flex:0 0 34px!important;width:34px!important;height:34px!important;
  display:grid!important;place-items:center!important;padding:0!important;border-radius:0!important;
  clip-path:polygon(6px 0,100% 0,100% calc(100% - 6px),calc(100% - 6px) 100%,0 100%,0 6px)!important;
  border:1px solid rgba(255,134,151,.48)!important;background:rgba(72,22,35,.92)!important;color:#ffdce3!important;
  font-size:1rem!important;line-height:1!important;box-shadow:none!important;overflow:visible!important;
}
body.frozen-tool-page :is(.remove-expert-btn,.remove-menu-btn,.remove-slot,.remove-troop-btn){
  position:absolute!important;top:10px!important;right:10px!important;left:auto!important;bottom:auto!important;
  width:32px!important;height:32px!important;display:grid!important;place-items:center!important;padding:0!important;
  border-radius:0!important;clip-path:polygon(6px 0,100% 0,100% calc(100% - 6px),calc(100% - 6px) 100%,0 100%,0 6px)!important;
  border:1px solid rgba(255,134,151,.48)!important;background:rgba(72,22,35,.94)!important;color:#ffdce3!important;
  font-size:1rem!important;line-height:1!important;box-shadow:0 6px 14px rgba(0,0,0,.22)!important;z-index:80!important;transform:none!important;
}
body.frozen-tool-page .remove-gear-btn{
  width:28px!important;height:28px!important;display:grid!important;place-items:center!important;padding:0!important;
  border-radius:0!important;clip-path:polygon(5px 0,100% 0,100% calc(100% - 5px),calc(100% - 5px) 100%,0 100%,0 5px)!important;
  border:1px solid rgba(255,134,151,.48)!important;background:rgba(72,22,35,.94)!important;color:#ffdce3!important;transform:none!important;
}
body.frozen-tool-page.light-theme :is(.modal-close,.gear-modal-close,.remove-expert-btn,.remove-menu-btn,.remove-slot,.remove-troop-btn,.remove-gear-btn){
  background:#fff0f3!important;color:#902f43!important;border-color:#d7909f!important;
}
body.frozen-tool-page :is(.expert-row-card,.training-task-card,.troop-panel){overflow:visible!important}
body.frozen-tool-page :is(.expert-row-card,.training-task-card){padding-top:18px!important;padding-right:52px!important}

/* Shared SvS Prep dock — same position and material on every tool that has it. */
.tool-svs-dock{width:100%;display:flex;justify-content:flex-end;align-items:center;margin:-8px 0 18px;position:relative;z-index:8}
body.frozen-tool-page .tool-svs-card{
  position:relative!important;inset:auto!important;top:auto!important;right:auto!important;bottom:auto!important;left:auto!important;
  transform:none!important;margin:0!important;width:340px!important;max-width:100%!important;min-height:86px!important;height:auto!important;
  border:1px solid rgba(137,226,249,.35)!important;border-radius:0!important;
  clip-path:polygon(10px 0,100% 0,100% calc(100% - 10px),calc(100% - 10px) 100%,0 100%,0 10px)!important;
  background:linear-gradient(145deg,rgba(8,38,54,.96),rgba(5,24,38,.96))!important;color:#eafaff!important;
  box-shadow:0 14px 34px rgba(0,0,0,.25),inset 0 1px rgba(255,255,255,.05)!important;padding:10px 12px!important;opacity:1!important;
}
body.frozen-tool-page .tool-svs-card:is(.prep-score-widget,.prep-compact-card,.prep-card,.prep-overview-card){display:grid!important;grid-template-columns:78px minmax(0,1fr)!important;gap:11px!important;align-items:center!important}
body.frozen-tool-page .tool-svs-card:is(.prep-console,.svs-prep-card){display:grid!important;grid-template-columns:1fr!important;gap:7px!important}
body.frozen-tool-page .tool-svs-card :is(.prep-main-img,.prep-compact-img,.prep-img,.prep-thumb){width:78px!important;height:58px!important;min-height:0!important;object-fit:cover!important;border-radius:0!important;border:1px solid rgba(141,226,248,.32)!important;box-shadow:none!important}
body.frozen-tool-page .tool-svs-card :is(.prep-bar,.valeria-box,.prep-control,.svs-valeria,.svs-speedups){border-radius:0!important;box-shadow:none!important}
body.frozen-tool-page .tool-svs-card :is(.prep-score-value,.prep-compact-score,.prep-score,#svsPrepScore){color:#f4d477!important;font-size:1.18rem!important;text-shadow:none!important}
body.frozen-tool-page .tool-svs-card :is(.prep-score-label,.prep-compact-label,.prep-label,.prep-copy small,.svs-prep-head span){color:#8deaff!important;letter-spacing:.07em!important}
body.frozen-tool-page.light-theme .tool-svs-card{background:linear-gradient(145deg,rgba(252,255,255,.98),rgba(224,244,250,.97))!important;color:#17394e!important;border-color:#87bccc!important;box-shadow:0 12px 28px rgba(66,114,131,.14)!important}
body.frozen-tool-page.light-theme .tool-svs-card :is(.prep-score-label,.prep-compact-label,.prep-label,.prep-copy small,.svs-prep-head span){color:#157a9a!important}
body.frozen-tool-page.light-theme .tool-svs-card :is(.prep-score-value,.prep-compact-score,.prep-score,#svsPrepScore){color:#795600!important}

/* Chief Gear / Chief Charms — keep the board itself clean, not cards inside cards. */
body.tool-chief-gear .gear-slot-pair{
  background:transparent!important;border:0!important;box-shadow:none!important;clip-path:none!important;border-radius:0!important;padding:0!important;overflow:visible!important;
}
body.tool-chief-gear .selection-board-heading,
body.tool-chief-charms .board-heading{display:none!important}
body.tool-chief-gear .grand-total-item,
body.tool-chief-charms .grand-total-item{
  background:transparent!important;border:0!important;border-bottom:1px solid rgba(118,211,237,.17)!important;
  box-shadow:none!important;clip-path:none!important;border-radius:0!important;padding:5px 1px!important;
}
body.tool-chief-gear .grand-total-item:last-of-type,
body.tool-chief-charms .grand-total-item:last-of-type{border-bottom:0!important}
body.tool-chief-charms .gain-item{
  background:transparent!important;border:0!important;border-bottom:1px solid rgba(118,211,237,.16)!important;
  box-shadow:none!important;clip-path:none!important;border-radius:0!important;padding:7px 0!important;
}
body.tool-chief-charms .gain-item:last-child{border-bottom:0!important}
body.tool-chief-charms .charm-tile{overflow:visible!important;clip-path:none!important}
body.tool-chief-charms .charm-step{z-index:40!important}
body.tool-chief-gear .slot-subpanel,
body.tool-chief-charms .slot-subpanel{overflow:visible!important}
body.tool-chief-gear.light-theme .slot-subpanel,
body.tool-chief-charms.light-theme .slot-subpanel{
  background:rgba(249,254,255,.97)!important;border-color:#8fbbcc!important;color:#17394e!important;box-shadow:0 8px 20px rgba(52,100,119,.10)!important;
}
body.tool-chief-gear.light-theme .slot-change-item,
body.tool-chief-charms.light-theme .slot-change-item{background:transparent!important;color:#315a6e!important;border-color:#c2d8e2!important}
body.tool-chief-gear.light-theme .slot-change-item :is(span,strong),
body.tool-chief-charms.light-theme .slot-change-item :is(span,strong){color:#315a6e!important}
body.tool-chief-gear.light-theme .slot-change-item strong,
body.tool-chief-charms.light-theme .slot-change-item strong{color:#765600!important}
body.tool-chief-gear .bottom-summary-container{grid-template-columns:235px minmax(260px,1fr) minmax(260px,1fr)!important}
body.tool-chief-gear .bottom-summary-item,
body.tool-chief-charms .bottom-summary-item{background:transparent!important;border:0!important;box-shadow:none!important}

/* Hero Gear: one clean action hub, no empty wrapper around all troop panels. */
body.tool-hero-gear .hero-gear-action-hub{
  width:100%;margin:0 0 18px;padding:14px;border:1px solid rgba(126,222,246,.28);
  clip-path:polygon(14px 0,calc(100% - 14px) 0,100% 14px,100% calc(100% - 14px),calc(100% - 14px) 100%,14px 100%,0 calc(100% - 14px),0 14px);
  background:linear-gradient(145deg,rgba(7,28,43,.94),rgba(8,40,57,.90));box-shadow:var(--tool-shadow),inset 0 1px rgba(255,255,255,.055);
}
body.tool-hero-gear .quick-build-launcher-section{margin:0!important;padding:0!important;background:transparent!important;border:0!important;box-shadow:none!important;clip-path:none!important}
body.tool-hero-gear .quick-launch-center{display:grid!important;grid-template-columns:minmax(0,1.55fr) minmax(260px,.85fr)!important;gap:10px!important;align-items:stretch!important}
body.tool-hero-gear .quick-build-launch-btn,
body.tool-hero-gear .quick-option-card.quick-customize-legacy{width:100%!important;min-width:0!important;min-height:66px!important;height:auto!important;margin:0!important;padding:10px 14px!important}
body.tool-hero-gear .hero-gear-secondary-actions{display:grid;grid-template-columns:minmax(0,1fr) 250px;gap:10px;margin-top:10px}
body.tool-hero-gear .profile-gear-sync{width:auto!important;margin:0!important;display:grid!important;grid-template-columns:1fr 1fr!important;gap:10px!important}
body.tool-hero-gear .profile-gear-load,body.tool-hero-gear .profile-gear-save{width:100%!important;min-width:0!important;min-height:48px!important;margin:0!important}
body.tool-hero-gear .add-section-bar{margin:0!important;padding:0!important;background:transparent!important;border:0!important;box-shadow:none!important;display:block!important}
body.tool-hero-gear #main-add-troop-btn{width:100%!important;min-width:0!important;height:48px!important;min-height:48px!important;padding:8px 14px!important;display:flex!important;white-space:nowrap!important;font-size:.82rem!important}
body.tool-hero-gear .troops-container{background:transparent!important;border:0!important;box-shadow:none!important;clip-path:none!important;padding:8px 4px 28px!important;min-height:0!important}
body.tool-hero-gear .troops-container:empty{display:none!important}
body.tool-hero-gear .troop-panel{border-radius:0!important;clip-path:polygon(10px 0,calc(100% - 10px) 0,100% 10px,100% calc(100% - 10px),calc(100% - 10px) 100%,10px 100%,0 calc(100% - 10px),0 10px)!important;background:linear-gradient(145deg,rgba(7,28,43,.95),rgba(7,38,54,.93))!important;border-color:rgba(117,208,233,.24)!important}
body.tool-hero-gear.light-theme .hero-gear-action-hub{background:linear-gradient(145deg,rgba(251,254,255,.97),rgba(229,245,250,.95));border-color:rgba(58,151,180,.24);box-shadow:0 16px 40px rgba(65,105,124,.13)}
body.tool-hero-gear.light-theme .troop-panel{background:linear-gradient(145deg,#fbfeff,#eaf6fa)!important;border-color:#9ebfce!important;color:#17394e!important}
body.tool-hero-gear.light-theme .gear-subtotal-box,
body.tool-hero-gear.light-theme .troop-total-box{background:#f8fcfe!important;border-color:#aac7d5!important;color:#315a6e!important}
body.tool-hero-gear.light-theme .gear-subtotal-box div span,
body.tool-hero-gear.light-theme .troop-total-values span{color:#765600!important}

/* Experts: overview starts directly with useful cards; no empty-state card. */
body.tool-experts .overview-section{margin-top:0!important}
body.tool-experts #active-experts-container:empty{display:none!important}
body.tool-experts .add-expert-container{margin:16px auto 20px!important}
body.tool-experts #add-expert-toggle{width:auto!important;min-width:210px!important;height:48px!important;min-height:48px!important;padding:8px 20px!important;font-size:.84rem!important}

/* Training: the Add task control stands on its own; selected troop type is obvious. */
body.tool-troop-training .add-task-area{background:transparent!important;border:0!important;box-shadow:none!important;clip-path:none!important;padding:0!important;margin:15px 0 18px!important}
body.tool-troop-training .add-task-btn{min-width:300px!important}

/* Building / RFC modal internals + picker options remain clickable and visible. */
body.tool-building #buildingModal .modal,
body.tool-rfc #presetModal .preset-modal{overflow:auto!important}
body.tool-building .building-picker{overflow:visible!important}
body.tool-building .pick-building{position:relative;z-index:1}
body.tool-building .pick-building img{display:block;width:100%;height:118px;object-fit:contain}
body.tool-building .total-layout{grid-template-columns:minmax(0,1fr) 235px!important}
body.tool-rfc .camp-toggle-row{position:relative;z-index:2}

/* Event / Expert / Task cards reserve room for the standardized X. */
body.tool-event-currency .expert-row-card,
body.tool-experts .expert-row-card,
body.tool-troop-training .training-task-card{padding-right:54px!important}

/* Complete light-mode readability for lower-level summary rows. */
body.frozen-tool-page.light-theme :is(.gear-subtotal-box,.troop-total-box,.slot-subpanel,.grand-totals-panel,.bottom-summary,.bottom-summary-container){color:#17394e!important}
body.frozen-tool-page.light-theme :is(.gear-subtotal-box,.troop-total-box,.slot-subpanel,.grand-totals-panel) :is(span,small,label){color:#456a7b!important}
body.frozen-tool-page.light-theme :is(.gear-subtotal-box,.troop-total-box,.slot-subpanel,.grand-totals-panel) :is(strong,b){color:#17394e!important}
body.frozen-tool-page.light-theme :is(.grand-total-item,.gain-item){background:transparent!important;box-shadow:none!important}

@media(max-width:900px){
  body.tool-hero-gear .quick-launch-center,body.tool-hero-gear .hero-gear-secondary-actions{grid-template-columns:1fr!important}
  body.tool-hero-gear .profile-gear-sync{grid-template-columns:1fr 1fr!important}
  .tool-svs-dock{justify-content:center}
  body.frozen-tool-page .tool-svs-card{width:min(100%,420px)!important}
  body.tool-chief-gear .bottom-summary-container{grid-template-columns:1fr!important}
  body.tool-building .total-layout{grid-template-columns:1fr!important}
}
@media(max-width:560px){body.tool-hero-gear .profile-gear-sync{grid-template-columns:1fr!important}}


/* =====================================================================
   v4 final interaction / geometry / rendering QA fixes
   ===================================================================== */

/* Hero Gear: the troop list is NOT a wrapper-card. Only each troop panel is. */
body.tool-hero-gear #troops-container{
  background:transparent!important;background-image:none!important;
  border:0!important;border-width:0!important;box-shadow:none!important;
  clip-path:none!important;border-radius:0!important;backdrop-filter:none!important;
  padding:8px 4px 28px!important;min-height:0!important;overflow:visible!important;
}
body.tool-hero-gear #troops-container:empty{display:none!important}
body.tool-hero-gear .quick-launch-center{grid-template-columns:minmax(0,2fr) minmax(280px,1fr)!important}
/* Load / Save / Add form three equal-width actions. */
body.tool-hero-gear .hero-gear-secondary-actions{grid-template-columns:minmax(0,2fr) minmax(0,1fr)!important}
body.tool-hero-gear .profile-gear-sync{grid-template-columns:1fr 1fr!important}
body.tool-hero-gear .profile-gear-load,
body.tool-hero-gear .profile-gear-save,
body.tool-hero-gear #main-add-troop-btn{height:50px!important;min-height:50px!important;font-size:.80rem!important}
body.tool-hero-gear #main-add-troop-btn{justify-content:center!important;gap:8px!important;overflow:visible!important;line-height:1.1!important}

/* Charm +/- controls may deliberately sit on an edge; no ancestor may clip them. */
body.tool-chief-charms :is(.charms-board,.charm-slot-pair,.group-compare,.triad-side,.charm-triangle,.charm-tile){overflow:visible!important}
body.tool-chief-charms :is(.charm-step,.charm-up,.charm-down){z-index:90!important}

/* Exact remove-button footprint per dynamic card type. Page CSS must not win. */
body.tool-event-currency button.remove-expert-btn,
body.tool-experts button.remove-expert-btn,
body.tool-troop-training button.remove-menu-btn,
body.tool-hero-gear button.remove-troop-btn,
body.tool-building button.remove-slot{
  width:32px!important;min-width:32px!important;max-width:32px!important;
  height:32px!important;min-height:32px!important;max-height:32px!important;
  top:10px!important;right:10px!important;left:auto!important;bottom:auto!important;
  margin:0!important;padding:0!important;overflow:visible!important;
  border-radius:0!important;transform:none!important;
}
body.tool-event-currency .expert-row-card,
body.tool-experts .expert-row-card,
body.tool-troop-training .training-task-card,
body.tool-hero-gear .troop-panel{overflow:visible!important}

/* Building picker artwork is always renderable offline. Missing optional art gets
   a deliberate icy pictogram rather than a broken-image box. */
body.tool-building .pick-building-art-shell,
body.tool-building .building-art-shell{
  position:relative;display:grid;place-items:center;width:100%;height:118px;overflow:hidden;
  border:0;background:linear-gradient(145deg,rgba(11,48,66,.54),rgba(5,25,40,.64));
}
body.tool-building .building-art-shell{height:100%;min-height:88px;background:transparent}
body.tool-building .pick-building-img,
body.tool-building .building-art-shell .building-art{
  display:block;width:100%!important;height:100%!important;object-fit:contain!important;position:relative;z-index:2;
}
body.tool-building .building-art-fallback{
  position:absolute;inset:0;z-index:1;display:grid;place-items:center;
  color:#9eeeff;font-size:2.35rem;font-weight:900;text-shadow:0 0 18px rgba(78,220,255,.26);
  background:radial-gradient(circle at 50% 40%,rgba(85,211,241,.11),transparent 58%);
}
body.tool-building .building-art-fallback[hidden]{display:none!important}
body.tool-building.light-theme .pick-building-art-shell,
body.tool-building.light-theme .building-art-shell{background:linear-gradient(145deg,#eef9fd,#dceff7)}
body.tool-building.light-theme .building-art-fallback{color:#147da1;text-shadow:none;background:radial-gradient(circle at 50% 40%,rgba(31,150,190,.09),transparent 60%)}

/* Building and RFC option dialogs: tool state exclusively controls visibility. */
body.tool-building #buildingModal.modal-backdrop:not(.open),
body.tool-rfc #presetModal.modal-backdrop:not(.open){display:none!important;pointer-events:none!important}
body.tool-building #buildingModal.modal-backdrop.open,
body.tool-rfc #presetModal.modal-backdrop.open{display:flex!important;pointer-events:auto!important}

/* Selected items use exactly the same high-contrast material in both themes. */
body.tool-chief-gear .strategy-btn.strategy-last-run,
body.tool-chief-charms .strategy-btn.active,
body.tool-rfc .camp-toggle.active,
body.tool-troop-training .troop-choice.active{
  background:linear-gradient(135deg,#91efff 0%,#38c5e8 53%,#177fa8 100%)!important;
  border-color:#bef6ff!important;color:#022f42!important;-webkit-text-fill-color:#022f42!important;
  box-shadow:0 0 0 2px rgba(107,224,255,.15),0 9px 22px rgba(14,134,173,.22)!important;
}
body.tool-chief-gear.light-theme .strategy-btn.strategy-last-run,
body.tool-chief-charms.light-theme .strategy-btn.active,
body.tool-rfc.light-theme .camp-toggle.active,
body.tool-troop-training.light-theme .troop-choice.active{
  background:linear-gradient(135deg,#087ba3,#0e9fc5 55%,#38bddb)!important;
  border-color:#075d7c!important;color:#fff!important;-webkit-text-fill-color:#fff!important;
  box-shadow:0 0 0 2px rgba(5,95,128,.10),0 8px 20px rgba(41,112,138,.18)!important;
}
body.tool-chief-gear :is(.strategy-btn.strategy-last-run),
body.tool-chief-charms :is(.strategy-btn.active),
body.tool-rfc :is(.camp-toggle.active),
body.tool-troop-training :is(.troop-choice.active){filter:none!important}
body.tool-chief-gear :is(.strategy-btn.strategy-last-run) :is(span,b,strong,small),
body.tool-chief-charms :is(.strategy-btn.active) :is(span,b,strong,small),
body.tool-rfc :is(.camp-toggle.active) :is(span,b,strong,small),
body.tool-troop-training :is(.troop-choice.active) :is(span,b,strong,small){color:inherit!important;-webkit-text-fill-color:inherit!important}

/* Chief Gear / Charms totals are lists, not rectangles inside rectangles. */
body.tool-chief-gear :is(.grand-total-item,.bottom-summary-item),
body.tool-chief-charms :is(.grand-total-item,.gain-item,.bottom-summary-item){
  background:transparent!important;background-image:none!important;box-shadow:none!important;
  border-left:0!important;border-right:0!important;border-top:0!important;border-radius:0!important;clip-path:none!important;
}
body.tool-chief-gear.light-theme :is(.grand-total-item,.bottom-summary-item),
body.tool-chief-charms.light-theme :is(.grand-total-item,.gain-item,.bottom-summary-item){background:transparent!important;background-image:none!important}

/* The small per-piece/per-charm subtotal panels stay readable in icy light mode. */
body.tool-chief-gear.light-theme :is(.slot-subpanel,.slot-summary,.piece-subtotal,.gear-subtotal),
body.tool-chief-charms.light-theme :is(.slot-subpanel,.slot-summary,.charm-subtotal,.group-subtotal){
  background:#f7fcfe!important;background-image:none!important;color:#17394e!important;
  border-color:#98bdcd!important;box-shadow:0 7px 18px rgba(54,102,119,.09)!important;
}
body.tool-chief-gear.light-theme :is(.slot-subpanel,.slot-summary,.piece-subtotal,.gear-subtotal) :is(span,small,label),
body.tool-chief-charms.light-theme :is(.slot-subpanel,.slot-summary,.charm-subtotal,.group-subtotal) :is(span,small,label){color:#486c7d!important}
body.tool-chief-gear.light-theme :is(.slot-subpanel,.slot-summary,.piece-subtotal,.gear-subtotal) :is(b,strong),
body.tool-chief-charms.light-theme :is(.slot-subpanel,.slot-summary,.charm-subtotal,.group-subtotal) :is(b,strong){color:#17394e!important}

/* No shadowed wrapper around the single Training add control. */
body.tool-troop-training .add-task-area{
  background:transparent!important;background-image:none!important;border:0!important;box-shadow:none!important;
  clip-path:none!important;backdrop-filter:none!important;padding:0!important;
}

/* Keep all shared heroes and primary sections exactly aligned. */
body.frozen-tool-page .tool-global-shell,
body.frozen-tool-page :is(.hub-container,.dashboard-container,.page,.shell){max-width:1510px!important}

@media(max-width:900px){
  body.tool-hero-gear .quick-launch-center,
  body.tool-hero-gear .hero-gear-secondary-actions{grid-template-columns:1fr!important}
  body.tool-hero-gear .profile-gear-sync{grid-template-columns:1fr 1fr!important}
}
@media(max-width:560px){body.tool-hero-gear .profile-gear-sync{grid-template-columns:1fr!important}}
