/* ICP blue edition. Loaded after legacy styles; artwork and game canvases retain
   their own colors. Shared tokens also cover dynamically created dialogs. */
body.blue-edition {
  --blue-bg: #060b16;
  --blue-panel: #0b1426;
  --blue-raised: #111e35;
  --blue-hover: #192c49;
  --blue-accent: #3e8cff;
  --blue-cyan: #7dd8ff;
  --blue-text: #f5f8ff;
  --blue-muted: #9caccc;
  --blue-border: #243653;
  --blue-font: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --ocean: var(--blue-bg);
  --cream: var(--blue-text);
  --ink: var(--blue-text);
  --gold: var(--blue-cyan);
  --teal: var(--blue-accent);
  --muted: var(--blue-muted);
  --line: var(--blue-border);
  --border: var(--blue-border);
  --paper: var(--blue-bg);
  --surface: var(--blue-panel);
  --panel: #0b1426f5;
  --danger: #ffadae;
  --serif: var(--blue-font);
  color-scheme: dark;
  background: radial-gradient(ellipse at 85% 0, #18346b38, transparent 48%), var(--blue-bg);
  color: var(--blue-text);
  font-family: var(--blue-font);
  -webkit-font-smoothing: antialiased;
}
body.blue-edition :is(h1, h2, h3, h4) {
  font-family: var(--blue-font);
  font-weight: 750;
  color: var(--blue-text);
  letter-spacing: -.035em;
}
body.blue-edition h1 em { color: var(--blue-cyan); font-weight: inherit; font-style: normal; }
body.blue-edition :is(button, input, select, textarea) { font-family: var(--blue-font); }
body.blue-edition button { min-width: 44px; min-height: 44px; border-radius: 8px; }
body.blue-edition :is(button, a, input, select, textarea) {
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}
body.blue-edition :is(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--blue-cyan);
  outline-offset: 4px;
}
body.blue-edition input:not([type=checkbox]):not([type=range]),
body.blue-edition :is(select, textarea) {
  color: var(--blue-text);
  background: var(--blue-bg);
  border-color: #395171;
  border-radius: 8px;
  min-height: 44px;
}
body.blue-edition :is(input, textarea)::placeholder { color: #91a3c2; opacity: 1; }
body.blue-edition :is(input, progress) { accent-color: var(--blue-accent); }
body.blue-edition a { text-underline-offset: 4px; }
body.blue-edition :is(.wordmark, .brand) { color: var(--blue-text); font-family: var(--blue-font); }
body.blue-edition :is(.wordmark small, .brand small, .brand-sub, .back-link, footer, .lede, .fine) { color: var(--blue-muted); }
body.blue-edition :is(.mark, .brand-mark) {
  color: var(--blue-cyan);
  border-color: #3e8cff66;
  background: #142746;
  font-family: var(--blue-font);
  font-weight: 800;
  border-radius: 9px;
}
body.blue-edition :is(.eyebrow, .profile-header > span, .text-button, .profile-return, .profile-card a, .fine a) { color: var(--blue-cyan); }
body.blue-edition :is(.masthead, .profile-header, footer) { border-color: var(--blue-border); }
body.blue-edition .skip-link { background: var(--blue-raised); color: var(--blue-text); }

/* Shared navigation and common action states. */
body.blue-edition .horizon-nav {
  background: #080f20f5;
  border-color: var(--blue-border);
  box-shadow: 0 -12px 40px #02061130;
}
body.blue-edition .horizon-nav :is(a, button) { color: #b8c7e1; min-height: 44px; }
body.blue-edition .horizon-nav :is(a, button):hover { background: var(--blue-hover); color: var(--blue-text); }
body.blue-edition .horizon-nav [aria-current=page] { background: #173765; color: var(--blue-cyan); box-shadow: inset 0 2px var(--blue-accent); }
body.blue-edition :is(.primary, .account-primary, .pwa-button),
body.blue-edition.profile-page button:not(.secondary),
body.blue-edition :is(.dialog-actions, .world-buttons, .empty-worlds, .modal-buttons) button {
  color: #05142c;
  background: var(--blue-accent);
  border-color: var(--blue-accent);
  font-weight: 750;
  min-height: 44px;
}
body.blue-edition :is(.primary, .account-primary, .pwa-button):hover:not(:disabled),
body.blue-edition.profile-page button:not(.secondary):hover:not(:disabled),
body.blue-edition :is(.dialog-actions, .world-buttons, .empty-worlds, .modal-buttons) button:hover:not(:disabled) {
  color: #05142c;
  background: #76b4ff;
  border-color: #76b4ff;
  box-shadow: 0 4px 22px #3e8cff28;
}
body.blue-edition :is(.secondary, .account-secondary, .pwa-button-secondary, .account-open),
body.blue-edition.profile-page button.secondary,
body.blue-edition :is(.dialog-actions, .world-buttons, .modal-buttons) button.secondary {
  background: var(--blue-raised);
  color: var(--blue-text);
  border: 1px solid #345075;
}
body.blue-edition :is(.secondary, .account-secondary, .pwa-button-secondary, .account-open):hover:not(:disabled),
body.blue-edition.profile-page button.secondary:hover:not(:disabled),
body.blue-edition :is(.dialog-actions, .world-buttons, .modal-buttons) button.secondary:hover:not(:disabled) {
  color: var(--blue-text);
  background: var(--blue-hover);
  border-color: var(--blue-accent);
}
body.blue-edition :is(.text-button, .account-text-button) { background: transparent; color: var(--blue-cyan); }
body.blue-edition :is(.text-button, .account-text-button):hover { background: #3e8cff12; color: var(--blue-text); }
body.blue-edition button:disabled { opacity: .65; cursor: not-allowed; box-shadow: none; }
body.blue-edition fieldset:disabled input { opacity: .65; }

/* Shop: blue chrome around the original collectible artwork. */
body.blue-edition .hero-tags { color: #becde4; }
body.blue-edition :is(.hero-landscape > span, .section-heading > span, .product-price span) { color: var(--blue-muted); }
body.blue-edition :is(.account-strip, .history-row, .receipt-row) { background: var(--blue-panel); border-color: var(--blue-border); border-radius: 12px; }
body.blue-edition .identity-dot { background: var(--blue-cyan); box-shadow: 0 0 12px #7dd8ff55; }
body.blue-edition .shop-tabs { border-color: var(--blue-border); }
body.blue-edition .shop-tabs button { color: var(--blue-muted); border-radius: 0; }
body.blue-edition .shop-tabs button[aria-selected=true] { color: var(--blue-cyan); border-color: var(--blue-accent); }
body.blue-edition .shop-tabs button:hover { color: var(--blue-text); }
body.blue-edition .product-card {
  background: linear-gradient(145deg, #14233c, #0b1426 78%);
  border-color: var(--blue-border);
  border-radius: 16px;
  box-shadow: 0 12px 32px #02061120;
  transition: border-color .2s ease, box-shadow .2s ease;
}
body.blue-edition .product-card:hover { border-color: #426896; box-shadow: 0 16px 36px #02061160; }
body.blue-edition .product-card.is-owned { border-top-color: var(--blue-cyan); }
body.blue-edition .product-content h3 { font-size: 23px; }
body.blue-edition :is(.badge, .owned-label, .status-pill, .privacy-badge) {
  color: #b6dcff;
  background: #132c4c;
  border-color: #315478;
  border-radius: 6px;
}
body.blue-edition .badge.gold { color: #c3d9ff; background: #1c2d50; }
body.blue-edition .product-price strong { font-weight: 750; }
body.blue-edition .track-filters button { color: var(--blue-muted); background: var(--blue-panel); border-color: var(--blue-border); }
body.blue-edition .track-filters button[aria-pressed=true] { color: var(--blue-cyan); background: #163256; border-color: #3e8cff88; }
body.blue-edition :is(.character-art, .banner-art) { background: radial-gradient(ellipse, #3e8cff1c, transparent 70%); }
body.blue-edition .invoice { background: var(--blue-panel); border-color: #3e8cff80; border-radius: 16px; box-shadow: 0 18px 50px #02061150; }
body.blue-edition :is(.invoice-summary, .reconcile-form, .shop-promise, .empty-state) { border-color: var(--blue-border); }
body.blue-edition dd strong { font-weight: 750; }

/* Account and reward readiness. */
body.blue-edition .profile-card { background: linear-gradient(125deg, #12213b, #0b1426 75%); border-color: var(--blue-border); box-shadow: 0 16px 50px #02061122; }
body.blue-edition .profile-card p { color: #bac8df; }
body.blue-edition .profile-card .fine { color: var(--blue-muted); }
body.blue-edition .principal { background: #060e1c; border-color: var(--blue-border); }
body.blue-edition .profile-stats strong { color: var(--blue-cyan); font-family: var(--blue-font); font-weight: 750; }
body.blue-edition :is(.readiness-list > div, .profile-card details) { border-color: var(--blue-border); }
body.blue-edition .profile-card summary { color: var(--blue-cyan); }

/* Private analytics: keep every unknown/empty metric honest and legible. */
body.blue-edition .sidebar { background: #091121; color: var(--blue-text); border-right: 1px solid var(--blue-border); }
body.blue-edition :is(.nav-label, .sidebar-note, .sidebar-note p) { color: var(--blue-muted); }
body.blue-edition .section-nav button { color: #b6c7e1; }
body.blue-edition .section-nav button > span { color: #7ea9e9; }
body.blue-edition .section-nav button:hover { background: var(--blue-raised); }
body.blue-edition .section-nav button[aria-current] { color: var(--blue-text); background: #142c50; box-shadow: inset 3px 0 var(--blue-accent); }
body.blue-edition .section-nav small { color: var(--blue-muted); border-color: #3b5073; }
body.blue-edition .status-dot,
body.blue-edition .metric-label::before { background: var(--blue-cyan); }
body.blue-edition :is(.panel, .metric-card, .access-state, .reward-step) { background: var(--blue-panel); border-color: var(--blue-border); }
body.blue-edition .metric-value { font-family: var(--blue-font); color: var(--blue-text); }
body.blue-edition .chart-bar { background: linear-gradient(0deg, #2466d7, #7dd8ff); }
body.blue-edition .chart-column:nth-child(3n) .chart-bar { background: linear-gradient(0deg, #2453ae, #4b9bff); }
body.blue-edition :is(.data-list li, td) { border-color: var(--blue-border); }
body.blue-edition th { background: #0f1c32; }
body.blue-edition tbody tr:hover { background: #14243e; }
body.blue-edition .notice { background: #102442; border-color: #2d4b75; border-left-color: var(--blue-accent); color: #b6cdeb; }
body.blue-edition .notice.gold { background: #1b223e; border-color: #394b79; color: #c7d3f2; }
body.blue-edition .principal-button { color: var(--blue-cyan); }
body.blue-edition .access-icon { background: #122b4d; color: var(--blue-cyan); border-color: #335b88; }
body.blue-edition .reward-step > span { color: var(--blue-cyan); }

/* Account, install and saved-world dialogs are also inserted at runtime. */
body.blue-edition :is(dialog, .account-dialog, .pwa-dialog) {
  background: linear-gradient(145deg, #111e35, #0b1426 70%);
  color: var(--blue-text);
  border-color: #345075;
  border-top-color: var(--blue-accent);
  border-radius: 16px;
  box-shadow: 0 30px 120px #000a;
}
body.blue-edition dialog::backdrop { background: #020714d9; backdrop-filter: blur(8px); }
body.blue-edition :is(dialog p, dialog label, .account-dialog p, .account-dialog label) { color: #b7c7e0; }
body.blue-edition :is(dialog .eyebrow, .account-panel h3, .world-meta) { color: var(--blue-cyan); }
body.blue-edition :is(.dialog-close, .account-dialog-close, .pwa-close, #close-modal) { color: var(--blue-muted); min-width: 44px; min-height: 44px; border-radius: 8px; }
body.blue-edition :is(.dialog-close, .account-dialog-close, .pwa-close, #close-modal):hover { background: var(--blue-hover); color: var(--blue-text); }
body.blue-edition :is(.account-panel, .pwa-panel, .world-card) { background: var(--blue-panel); border-color: var(--blue-border); border-radius: 12px; }
body.blue-edition .world-card.active { border-color: #3e8cff88; }
body.blue-edition :is(.world-stats, .world-stats small, .world-card time, .account-panel p) { color: var(--blue-muted); }
body.blue-edition .account-modes { background: var(--blue-bg); border-radius: 8px; }
body.blue-edition .account-modes button { color: var(--blue-muted); }
body.blue-edition .account-modes button[aria-pressed=true] { background: #18365c; color: var(--blue-cyan); border-color: #325787; }
body.blue-edition :is(.account-benefits, .account-recovery-code) { background: #0a1528; color: #bfd8ff; border-color: #2d466c; }
body.blue-edition :is(.account-panel .account-mode-note, .account-dialog .account-small, .account-dialog .account-field-help, .account-check small) { color: var(--blue-muted); }
body.blue-edition .account-dialog .account-feedback { color: #aed7ff; }
body.blue-edition :is(.pwa-panel, .pwa-dialog) { --pwa-ink: var(--blue-text); --pwa-muted: var(--blue-muted); --pwa-gold: var(--blue-cyan); --pwa-bg: var(--blue-panel); font-family: var(--blue-font); }
body.blue-edition .pwa-panel p.pwa-update { color: var(--blue-cyan); }
body.blue-edition .pwa-dialog .pwa-note { border-color: var(--blue-border); }

/* Game chrome only: never recolor or filter the world/preview canvases. */
body.blue-edition.horizon-game { background: var(--blue-bg); }
body.blue-edition.horizon-game :is(.topbar, .story-panel, .map-button, .zoom-tools, .minimap-wrap, .population-pill, .time-controls, .city-label, .build-panel, .build-panel.folded, .raid-status),
body.blue-edition.horizon-game :is(#battle-bar, #toast, #era-celebration, #skip-bridge) {
  background: #0b1426f2;
  color: var(--blue-text);
  border-color: #345075;
  box-shadow: 0 6px 24px #02061130;
}
body.blue-edition.horizon-game .brand-mark { background: var(--blue-accent); color: #05142c; }
body.blue-edition.horizon-game :is(.resource-icon, .resource:nth-child(2) .resource-icon, .resource:nth-child(3) .resource-icon, .resource:nth-child(4) .resource-icon) { color: var(--blue-cyan); }
body.blue-edition.horizon-game :is(.resource strong, .population-pill b, .city-label button) { font-family: var(--blue-font); color: var(--blue-text); }
body.blue-edition.horizon-game :is(.resource small, .resource .rate, .city-label > span:last-child, .guide p, .milestone-heading, .goal-line small, .story-foot, .minimap-wrap span, .time-controls > span, .build-footer, .building-card small, .building-effect, #dock-summary, .folded #dock-summary, #battle-bar > small) { color: var(--blue-muted); }
body.blue-edition.horizon-game :is(.city-rule, .goal-progress span) { background: var(--blue-accent); }
body.blue-edition.horizon-game .city-label { text-shadow: none; }
body.blue-edition.horizon-game :is(.chapter-top, .era-checklist, .build-header) { background: #10203a; border-color: var(--blue-border); color: #bdcde7; }
body.blue-edition.horizon-game :is(.story-body h2, .guide strong, .era-checklist-heading strong, .battle-heading strong, .era-checklist-item > small, .people-icon, .ember, #era-date) { color: var(--blue-cyan); }
body.blue-edition.horizon-game .ember { filter: drop-shadow(0 0 8px #3e8cff55); }
body.blue-edition.horizon-game :is(.guide strong span, .era-checklist-heading span, .era-checklist > small) { color: var(--blue-muted); }
body.blue-edition.horizon-game :is(.goal, .catalog-tools, .zoom-tools button + button) { border-color: var(--blue-border); }
body.blue-edition.horizon-game .goal:hover { background: #3e8cff12; }
body.blue-edition.horizon-game .goal-progress { background: #243653; }
body.blue-edition.horizon-game :is(.era-badge > span, .goal-check, .checklist-mark) { background: #152b4b; border-color: #3c5a82; color: var(--blue-cyan); }
body.blue-edition.horizon-game :is(.goal.done .goal-check, .era-checklist-item.done .checklist-mark) { background: var(--blue-cyan); border-color: var(--blue-cyan); color: #05142c; }
body.blue-edition.horizon-game :is(.era-checklist-item, .era-checklist-item.done) { color: #c2d3ec; }
body.blue-edition.horizon-game :is(.icon-button, #road-shortcut, #rotate-tool, .folded #road-shortcut, .battle-commands button, .battle-heading button) { background: #172a46; color: var(--blue-text); border-color: #345075; }
body.blue-edition.horizon-game :is(.map-button, .icon-button, .zoom-tools button, .edit-tools button, .battle-commands button):hover:not(:disabled) { background: #1b3559; color: var(--blue-text); border-color: var(--blue-accent); }
body.blue-edition.horizon-game :is(#islands-button, #military-button, #voyage-status) { color: var(--blue-cyan); border-color: #3e8cff70; }
body.blue-edition.horizon-game #island-count { background: #203a60; color: #bddbff; }
body.blue-edition.horizon-game :is(.advance, #build-toggle, .time-controls button.active, .battle-commands button.active, #military-attack, #military-command[aria-pressed=true]) { background: var(--blue-accent); color: #05142c; font-weight: 750; }
body.blue-edition.horizon-game .advance:disabled { background: #1b2d47; color: #a4b6d3; }
body.blue-edition.horizon-game :is(.time-controls button, .category-tabs button, .edit-tools button, .folded .edit-tools button) { color: #aebfdb; }
body.blue-edition.horizon-game .category-tabs button.active { color: var(--blue-cyan); }
body.blue-edition.horizon-game .category-tabs button.active::after { background: var(--blue-accent); }
body.blue-edition.horizon-game :is(.edit-tools button.active, .folded .edit-tools button.active) { background: #22436d; color: var(--blue-cyan); }
body.blue-edition.horizon-game .building-card { background: #13223b; color: var(--blue-text); border-color: #2c4163; }
body.blue-edition.horizon-game .building-card:hover { background: #1a3152; border-color: #5689cd; }
body.blue-edition.horizon-game .building-card.selected { background: #193860; border-color: var(--blue-accent); }
body.blue-edition.horizon-game .building-card.unaffordable small { color: #ffc294; }
body.blue-edition.horizon-game :is(.loading, .desktop-transition) { background: #060b16f5; color: var(--blue-text); }
body.blue-edition.horizon-game :is(.loading h2, .loading-flame, .desktop-transition b) { color: var(--blue-cyan); }
body.blue-edition.horizon-game :is(.loading p, .desktop-transition p, #era-celebration span) { color: var(--blue-muted); }
body.blue-edition.horizon-game .loading button { background: var(--blue-accent); color: #05142c; }
body.blue-edition.horizon-game :is(.icon-button, .zoom-tools button, .time-controls button, #story-toggle, #military-close, #military-info) { min-width: 44px; min-height: 44px; }
body.blue-edition.horizon-game #military-close { flex-basis: 44px; }
body.blue-edition.horizon-game .chapter-top { min-height: 44px; }

/* Game dialogs: workers, construction, islands, missions and audio. */
body.blue-edition :is(.timeline-number, .workforce-summary, .worker-stepper button, .admin-toggle button, .construction-status, .military-summary, .recruit-grid article, .travel-summary, .voyage-row, .island-card) { background: var(--blue-raised); color: var(--blue-text); border-color: #345075; }
body.blue-edition :is(.timeline-item, .stat-row, .worker-row, .worker-stepper, .admin-toggle, .admin-mission, .mission-objectives > div, .military-raid-plan, .mission-visual) { border-color: var(--blue-border); }
body.blue-edition :is(.timeline-item small, .workforce-summary span, .worker-label small, .admin-toggle small, .mission-clock small, .mission-objectives span, .recruit-grid small, .military-summary span, .military-destination small, .military-tactics, .military-raid-plan, .voyage-row span) { color: var(--blue-muted); }
body.blue-edition :is(.sound-controls label, .sound-controls output, .island-copy h3, .voyage-row strong) { color: var(--blue-text); }
body.blue-edition :is(.mission-clock, .recruit-grid strong, .military-summary strong, .military-raid-plan b, .recruit-grid .troop-role, .travel-summary b, .island-copy small) { color: var(--blue-cyan); }
body.blue-edition :is(.timeline-item.current .timeline-number, .admin-toggle button[aria-checked=true], .admin-era button, .admin-grid button, .recruit-grid button, .island-copy button, .voyage-row button) { color: #05142c; background: var(--blue-accent); }
body.blue-edition .recruit-grid button.secondary { background: #203a60; color: var(--blue-text); }
body.blue-edition .island-copy button:disabled { background: #23344c; color: #b5c5df; }
body.blue-edition .island-copy p { color: var(--blue-muted) !important; }
body.blue-edition :is(.sound-controls input, .voyage-row progress, .mission-progress, .construction-status progress, .account-dialog .account-check input) { accent-color: var(--blue-accent); }
body.blue-edition .cinema-caption { color: var(--blue-cyan); background: #060b16e6; }

/* Semantic alerts stay distinct from interactive blue accents. */
body.blue-edition :is(.shop-status.error, .status-line.error, .dialog-status.error, #home-status.error, .account-dialog .account-error) { color: #ffadae; }
body.blue-edition .danger { color: #ffadae !important; }
body.blue-edition .conflict-banner { color: #ffd2a1 !important; }
body.blue-edition .dialog-actions button.danger { background: #542936; border-color: #9d4c61; color: #ffd5dc !important; }
body.blue-edition .dialog-actions button.danger:hover { background: #73364a; }
body.blue-edition.horizon-game #street-status { color: #c2d3ec; border-color: var(--blue-border); }
body.blue-edition.horizon-game #street-status.warning { color: #ffd2a1; }
body.blue-edition.horizon-game .raid-status.danger { background: #472638ef; border-color: #a95870; color: #ffd5dc !important; }

@media (max-width: 760px) {
  body.blue-edition .section-nav button[aria-current] { box-shadow: inset 0 -2px var(--blue-accent); }
  body.blue-edition .profile-main h1 { font-size: clamp(40px, 10vw, 64px); }
  body.blue-edition .product-card:has(.character-art) h3,
  body.blue-edition .product-card:has(.banner-art) h3 { font-size: 20px; }
  body.blue-edition :is(input, select, textarea) { font-size: 16px; }
  body.blue-edition.horizon-game .build-header { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  body.blue-edition *, body.blue-edition *::before, body.blue-edition *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Keep scrolling category labels at their natural width on phones. */
body.blue-edition :is(.section-nav, .shop-tabs) > button { flex: 0 0 auto; }
:root:has(body.blue-edition) { color-scheme: dark; background: #060b16; }
