/* LogisPlan UI: one top bar, a Plan page (figures + what to set up) and a Mon logis page (the RV
   preset and the player's differences). Square-ish, dense, game icons first. Loaded after style.css. */
@font-face { font-family: 'Bricolage'; src: url(vendor/fonts/bricolage-grotesque-latin-wght-normal.woff2) format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url(vendor/fonts/figtree-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url(vendor/fonts/figtree-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url(vendor/fonts/figtree-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url(vendor/fonts/figtree-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }

body, body.light {
    --bg: #e8edf2; --surface: #fff; --surface-2: #f4f6f9; --text: #16202e; --text-muted: #5f6d80;
    --border: #d3dbe5; --line2: #e6ebf1; --accent: #2d6be0; --accent-soft: #e3ecfc; --on-accent: #fff;
    --navy: #1b2a44; --navy2: #263a5c; --cta: #ffb938; --on-cta: #2b1c00;
    --success: #2d8656; --ok-soft: #e1f1e8; --warning: #b86a12; --warn-soft: #fbeedd; --error: #c0392b;
    --radius: 3px; --r: 3px;
    --font-body: 'Figtree', system-ui, sans-serif; --font-mono: 'Figtree', system-ui, sans-serif; --font-display: 'Bricolage', 'Figtree', sans-serif;
}
body.dark {
    --bg: #0f1520; --surface: #172131; --surface-2: #1d2a3d; --text: #e7edf5; --text-muted: #98a6ba;
    --border: #2c3b52; --line2: #243247; --accent: #6d9ff5; --accent-soft: #20324f; --on-accent: #0f1520;
    --navy: #0b111b; --navy2: #1a2638; --success: #5cc08a; --ok-soft: #173427; --warning: #f0a54a; --warn-soft: #3a2a15; --error: #ef6b68;
}
html { scroll-padding-top: 70px; }
body { max-width: none; margin: 0; padding: 0; font: 14px/1.45 var(--font-body); background: var(--bg); color: var(--text); font-variant-numeric: tabular-nums; }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
[hidden], .view-hidden { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.2px; }
.card h2, .logis-card h2, .recipes-section h2 { font-size: 16px; font-weight: 700; margin: 0 0 10px; border: 0; padding: 0; }
.card h3 { font-size: 14px; font-weight: 700; }
.hint, .hint.small { font-size: 12px; line-height: 1.5; color: var(--text-muted); }
img.glyph { filter: none; }
.glyph-dark { width: 16px; height: 16px; object-fit: contain; filter: invert(1) brightness(.35); }
body.dark .glyph-dark { filter: none; opacity: .8; }

/* --- Top bar ----------------------------------------------------------------------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; flex-direction: row; align-items: stretch; min-height: 56px; background: var(--navy); color: #fff; padding-left: 20px; margin: 0; border: 0; gap: 0; }
.topbar .brand { display: flex; align-items: center; padding-right: 20px; font: 750 20px/1 var(--font-display); letter-spacing: -.4px; color: #fff; text-decoration: none; }
.topbar .brand span { color: #8fb3ff; }
.page-tabs { display: flex; border-left: 1px solid #ffffff1f; }
.page-tabs button { display: flex; align-items: center; gap: 7px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: none; color: #b9c6d9; font-weight: 700; font-size: 14px; }
.page-tabs button[aria-pressed='true'] { color: #fff; border-bottom-color: var(--cta); background: #ffffff0d; }
.page-tabs img { width: 20px; height: 20px; object-fit: contain; }
.diff-badge { font: 700 11px var(--font-body); background: var(--cta); color: var(--on-cta); padding: 0 5px; border-radius: 2px; }
.tb { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-left: 1px solid #ffffff1f; }
.tb label[for] { color: #9fb0c9; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin: 0; }
.rv-stepper { display: flex; align-items: stretch; border: 1px solid #ffffff2e; border-radius: var(--r); overflow: hidden; height: 34px; }
.rv-stepper button { width: 28px; border: 0; background: var(--navy2); color: #b9c6d9; font-weight: 700; }
.rv-stepper button:hover { color: #fff; }
.rv-stepper select, #home-level { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: #fff; font: 750 17px var(--font-display); padding: 0 10px; min-height: 0; width: auto; text-align: center; border-radius: 0; }
#home-level option { color: #16202e; font-size: 14px; }
.seg { display: flex; border: 1px solid #ffffff2e; border-radius: var(--r); overflow: hidden; }
.seg label { display: flex; align-items: center; padding: 6px 11px; color: #b9c6d9; font-weight: 600; font-size: 13px; cursor: pointer; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: #fff; color: var(--navy); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--cta); outline-offset: -2px; }
.goal-chips { display: flex; align-items: center; gap: 7px; background: #ffffff10; border: 1px solid #ffffff40; border-radius: 20px; padding: 3px 11px 3px 4px; color: #fff; font: 600 12.5px var(--font-body); cursor: pointer; }
.goal-chips:hover, .goal-chips[aria-expanded='true'] { border-color: #ffffff99; background: #ffffff1f; }
/* The objectives, stacked in their order: gold, silver, bronze rings. */
.goal-stack { display: inline-flex; }
.goal-coin { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: #243548; border: 2px solid #5b6b80; }
.goal-coin + .goal-coin { margin-left: -8px; }
.goal-coin img, .goal-coin .game-icon { width: 17px; height: 17px; object-fit: contain; }
.goal-coin.rank-1 { border-color: #ffd166; position: relative; z-index: 3; }
.goal-coin.rank-2 { border-color: #cfd8e3; position: relative; z-index: 2; }
.goal-coin.rank-3 { border-color: #d39a6a; position: relative; z-index: 1; }
.goal-chips.empty .goal-stack { display: none; }
.goal-chips.empty { padding-left: 11px; border-style: dashed; }
.goal { display: inline-flex; align-items: center; gap: 4px; border: 1px solid #ffffff2e; border-radius: 2px; padding: 2px 7px 2px 3px; font-weight: 600; font-size: 12px; white-space: nowrap; }
.goal .o { font: 750 11px var(--font-display); color: #8fb3ff; width: 11px; text-align: center; }
.goal img, .goal .game-icon { width: 20px; height: 20px; object-fit: contain; }
.goal.off { opacity: .5; border-style: dashed; }
.goal-chips .then { font-size: 11px; color: #9fb0c9; }
.goal-chips .caret { font-size: 10px; color: #9fb0c9; margin-left: 2px; }
.topbar .grow { flex: 1; }
.tb-tools { display: flex; align-items: center; gap: 2px; padding: 0 10px; border-left: 1px solid #ffffff1f; }
.tb-tools .tool { background: none; border: 0; color: #c9d4e4; font-weight: 600; font-size: 13px; padding: 6px 8px; border-radius: 2px; }
.tb-tools .tool:hover { background: #ffffff14; color: #fff; }
.topbar #game-language { background: var(--navy2); color: #fff; border: 1px solid #ffffff2e; border-radius: var(--r); padding: 4px 6px; font-weight: 700; font-size: 12px; margin-right: 4px; max-width: none; }
.topbar .optimize-btn { position: static; margin: 0; width: auto; min-height: 0; border: 0; border-radius: 0; box-shadow: none; background: var(--cta); color: var(--on-cta); font: 750 16px var(--font-display); padding: 0 26px; opacity: 1; transform: none; }
.topbar .optimize-btn:hover:not(:disabled) { filter: brightness(1.06); }
.topbar .optimize-btn:disabled { filter: saturate(.4); opacity: 1; }
/* Progress floats over the page under the top bar: showing it moves nothing. */
.progress-bar-container { position: fixed; top: 56px; left: 0; right: 0; z-index: 35; height: 3px; margin: 0; border-radius: 0; background: var(--line2); }
.progress-bar-fill { background: var(--accent); border-radius: 0; }
.progress-caption { position: fixed; top: 66px; left: 50%; transform: translateX(-50%); z-index: 35; max-width: calc(100vw - 32px); margin: 0; padding: 5px 14px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface); box-shadow: 0 6px 20px #0b111b26; font-size: 12px; color: var(--text-muted); pointer-events: none; }
.progress-caption.behind-loading { visibility: hidden; }
/* Calculating: the building site in a floating card (showPlanLoading in app.js), the current plan dimmed. */
.plan-loading { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 36; display: grid; justify-items: center; gap: 6px;
    width: min(480px, calc(100vw - 32px)); padding: 4px 22px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
    box-shadow: 0 16px 48px #0b111b33; text-align: center; }
.plan-loading[hidden] { display: none; }
.plan-loading strong { font: 800 18px var(--font-display); color: var(--text); }
.plan-loading small { color: var(--text-muted); font-size: 13px; }
.plan-dimmed { opacity: .45; pointer-events: none; transition: opacity .2s; }

/* Objectives popover */
.goals-pop { position: fixed; z-index: 40; width: min(460px, calc(100vw - 16px)); max-height: calc(100vh - 80px); overflow: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r); box-shadow: 0 12px 40px #0b111b40; }
.goals-pop-inner { padding: 14px 16px; }
.goals-pop .priority-list { margin: 8px 0; }
/* An objective's icon in its rank's ring, the rank on it (see `renderPriorities`). */
.priority-coin { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: #243548; border: 2px solid #5b6b80; }
.priority-coin img, .priority-coin .game-icon { width: 22px; height: 22px; object-fit: contain; }
.priority-coin b { position: absolute; right: -5px; bottom: -5px; display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; background: #5b6b80; color: #fff; font: 800 10.5px var(--font-display); }
.priority-coin.rank-1 { border-color: #ffd166; } .priority-coin.rank-1 b { background: #ffd166; color: #14212b; }
.priority-coin.rank-2 { border-color: #cfd8e3; } .priority-coin.rank-2 b { background: #cfd8e3; color: #14212b; }
.priority-coin.rank-3 { border-color: #d39a6a; } .priority-coin.rank-3 b { background: #d39a6a; color: #14212b; }
.priority.off .priority-coin { filter: grayscale(1); opacity: .45; }
.priority-name { font-weight: 600; }
#event-seed-budget { margin: 2px 0 4px; font: 700 18px var(--font-display); }
#level-up-cost .chip-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.priority { border-radius: var(--r); }
.chip { border-radius: 2px; }

/* --- Pages ------------------------------------------------------------------------- */
.pages { display: block; max-width: 1560px; margin: 0 auto; padding: 14px 20px 0; }
.page { min-width: 0; }
#studio-stale { border-left: 3px solid var(--warning); background: var(--warn-soft); color: var(--text); padding: 9px 14px; font-size: 13px; margin-bottom: 12px; border-radius: 2px; }
.studio-empty { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 44px 24px; text-align: center; }
.studio-empty h2 { font-size: 22px; margin: 10px 0 6px; }
.studio-empty p { max-width: 520px; margin: 0 auto; color: var(--text-muted); }
/* The start card: UID or RV level, nothing else. */
.start-card { max-width: 560px; margin: 0 auto; display: grid; gap: 14px; }
.start-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.start-row input { flex: 1 1 200px; min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; font: 600 16px var(--font-body); background: var(--surface); color: var(--text); }
.start-row select { padding: 11px 10px; border: 1px solid var(--border); border-radius: 10px; font: 600 14px var(--font-body); background: var(--surface); color: var(--text); }
.start-btn { padding: 12px 24px; border: 0; border-radius: 10px; background: #f5b531; color: #1a1a1a; font: 800 16px var(--font-display); cursor: pointer; }
.start-btn.primary { background: var(--navy, #1a2638); color: #fff; }
.start-btn:disabled { opacity: .6; cursor: wait; }
.start-or { color: var(--text-muted); font-size: 13px; }
.start-rv { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.start-rv button { width: 42px; height: 46px; border: 0; background: var(--surface-2); font: 700 18px var(--font-body); color: var(--text); cursor: pointer; }
.start-rv span { min-width: 72px; text-align: center; font: 700 17px var(--font-display); color: var(--text); }
.start-card p.start-error { margin: -6px auto 0; color: var(--error); font-size: 13px; }
/* A linked account calculating on arrival (planLinkedAccount in app.js). */
.start-loading { display: grid; justify-items: center; gap: 10px; padding: 18px 0; text-align: center; }
.start-loading strong { font: 800 22px var(--font-display); color: var(--text); }
.start-loading small { color: var(--text-muted); font-size: 14px; }
/* The building site while a plan loads (constructionSite in app.js), sized on its own width (cqw):
   three buildings in turn, 8 s each over a 24 s loop (`--n`); each rises floor by floor behind
   its scaffolding, under a crane lowering wood blocks every 4 s, while a porter brings more and a
   builder hammers. The line under it changes every 2 s, a quarter of a building. */
.site { position: relative; width: min(400px, 100%); aspect-ratio: 12 / 5; margin: 16px auto 4px; container-type: inline-size; }
.site i, .site > span, .site span span { display: block; }
.site .game-icon { display: block; width: 100%; height: 100%; }
.site-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 11%; border-radius: 1.5cqw;
    background: linear-gradient(#c8a067, #b08550); box-shadow: inset 0 .5cqw 0 #d9b57e;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
body.dark .site-ground { background: linear-gradient(#5a4630, #47372a); box-shadow: inset 0 .5cqw 0 #6e573b; }
/* A worker: the Aniimo whole, as tall as its box, and its hard hat (placed in SITE_WORKERS). */
.site-aniimo { position: relative; width: max-content; height: 15cqw; }
.site-aniimo img { display: block; height: 100%; width: auto; filter: drop-shadow(0 .5cqw .5cqw #0b111b2e); }
.site-hat { position: absolute; aspect-ratio: 2 / 1; transform: rotate(var(--tilt)); }
.site-hat::before { content: ''; position: absolute; left: 11%; right: 11%; top: 0; height: 78%;
    border-radius: 50% 50% 12% 12% / 95% 95% 12% 12%; background: radial-gradient(circle at 34% 30%, #ffeeb3, #ffc21a 42%, #e29a00); }
.site-hat::after { content: ''; position: absolute; left: 0; right: 0; top: 66%; height: 22%; border-radius: 9cqw; background: #cf8800; }
.site-pile { position: absolute; left: 2cqw; bottom: 7%; display: flex !important; align-items: flex-end; }
.site-pile .game-icon { width: 8.5cqw; height: 8.5cqw; margin-right: -2cqw; }
.site-pile .game-icon:last-child { position: relative; top: -4.5cqw; left: -6.5cqw; margin-right: -6.5cqw; }
/* The crane: a yellow lattice mast and jib, the operator in the cabin, a trolley and its hook. */
.site-crane { position: absolute; z-index: 2; left: 25cqw; bottom: 9%; width: 52cqw; height: 37.5cqw; }
.site-mast { position: absolute; left: 0; bottom: 0; width: 3.4cqw; height: 100%; border: .45cqw solid #e3a21a; border-width: 0 .45cqw;
    background: repeating-linear-gradient(45deg, transparent 0 1.5cqw, #f5b531 1.5cqw 1.95cqw), repeating-linear-gradient(-45deg, transparent 0 1.5cqw, #f5b531 1.5cqw 1.95cqw); }
.site-jib { position: absolute; left: -15cqw; top: 0; width: 67cqw; height: 2.6cqw; border: .45cqw solid #e3a21a; border-width: .45cqw 0;
    background: repeating-linear-gradient(60deg, transparent 0 1.5cqw, #f5b531 1.5cqw 1.95cqw); }
.site-jib::before { content: ''; position: absolute; left: .5cqw; top: 100%; width: 5cqw; height: 3.6cqw; border-radius: .6cqw; background: #7d8a9b; }
/* The cabin, hung on the mast: a wide window shows the crane operator from the waist up. */
.site-cabin { position: absolute; left: -9cqw; top: 2.2cqw; width: 13cqw; height: 10.5cqw; overflow: hidden; border-radius: 1.4cqw 1.4cqw .8cqw .8cqw;
    border: .6cqw solid #e3a21a; border-bottom-width: 1.8cqw; background: linear-gradient(160deg, #e3f4fb 0 30%, #bfe3f2 30% 55%, #a8d6ea 55%); }
.site-cabin .site-aniimo { margin: 0 auto; translate: calc(50% - var(--face-x)) calc(4.4cqw - var(--face-y)); animation: site-bob 1.6s ease-in-out infinite; }
.site-trolley { position: absolute; top: 2.6cqw; left: 12cqw; width: 3.6cqw; height: 1.4cqw; border-radius: .4cqw; background: #4a5566;
    animation: site-trolley 4s ease-in-out infinite; }
.site-cable { position: absolute; left: 50%; top: 100%; width: .35cqw; height: 4cqw; margin-left: -.17cqw; background: #4a5566;
    animation: site-cable 4s ease-in-out infinite; }
.site-load { position: absolute; top: 100%; left: 50%; width: 7.5cqw; height: 7.5cqw; margin-left: -3.75cqw; animation: site-load 4s ease-in-out infinite; }
.site-load::before { content: ''; position: absolute; left: 45%; top: -.6cqw; width: 1cqw; height: 1.2cqw; border: .3cqw solid #4a5566; border-top: 0; border-radius: 0 0 1cqw 1cqw; }
/* The buildings, each in turn. */
.site-lot { position: absolute; z-index: 1; left: 47cqw; bottom: 8%; width: 28cqw; height: 28cqw; }
.site-building { position: absolute; inset: 0; opacity: 0; animation: site-turn 24s linear calc(var(--n) * 8s) infinite; }
.site-ghost { position: absolute; inset: 0; opacity: .2; filter: grayscale(1) brightness(1.15); animation: site-ghost 24s linear calc(var(--n) * 8s) infinite; }
body.dark .site-ghost { filter: grayscale(1) brightness(2.2); }
.site-built { position: absolute; inset: 0; clip-path: inset(100% 0 0 0); animation: site-rise 24s ease-out calc(var(--n) * 8s) infinite; }
.site-scaffold { position: absolute; left: -3%; right: -3%; top: 8%; bottom: 0;
    background: linear-gradient(90deg, #9a6a35 0 3%, transparent 3% 48.5%, #9a6a35 48.5% 51.5%, transparent 51.5% 97%, #9a6a35 97%),
        repeating-linear-gradient(180deg, transparent 0 21%, #c38d4c 21% 25%);
    opacity: .85; animation: site-scaffold 24s linear calc(var(--n) * 8s) infinite; }
.site-sparkle { position: absolute; width: 4cqw; height: 4cqw; background: #ffd34d; opacity: 0;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    animation: site-sparkle 24s ease-out calc(var(--n) * 8s) infinite; }
.site-sparkle:nth-of-type(2) { left: 6%; top: 12%; }
.site-sparkle:nth-of-type(3) { right: 4%; top: 2%; width: 5cqw; height: 5cqw; animation-delay: calc(var(--n) * 8s + .15s); }
.site-sparkle:nth-of-type(4) { right: 22%; top: -8%; width: 3cqw; height: 3cqw; animation-delay: calc(var(--n) * 8s + .3s); }
/* The porter: to the building with a block on the hat, back for another. */
.site-porter { position: absolute; z-index: 3; left: 7cqw; bottom: 8%; animation: site-porter 8s linear infinite; }
.site-walk { position: relative; animation: site-hop .5s ease-in-out infinite; }
.site-carry { position: absolute; z-index: 1; left: 50%; bottom: 92%; width: 8cqw; height: 8cqw; margin-left: -4cqw; animation: site-carry 8s linear infinite; }
/* The builder, hammering at the building's side. */
.site-builder { position: absolute; z-index: 3; left: 77cqw; bottom: 8%; animation: site-nod .6s ease-in-out infinite; }
.site-hammer { position: absolute; z-index: 2; left: -2.4cqw; top: 34%; width: 1.1cqw; height: 6.5cqw; border-radius: .5cqw; background: #8a5a2b;
    transform-origin: 50% 100%; animation: site-swing .6s ease-in infinite; }
.site-hammer::before { content: ''; position: absolute; left: -1.6cqw; top: -.6cqw; width: 4.3cqw; height: 2cqw; border-radius: .5cqw; background: #6f7c8d; box-shadow: inset 0 .5cqw 0 #9aa6b5; }
.site-spark { position: absolute; left: -4.8cqw; top: 30%; width: 4cqw; height: 4cqw; opacity: 0;
    background: radial-gradient(circle, #fff6c4 0 18%, transparent 20%), conic-gradient(from 0deg, #ffd34d 0 8%, transparent 8% 25%, #ffd34d 25% 33%, transparent 33% 50%, #ffd34d 50% 58%, transparent 58% 75%, #ffd34d 75% 83%, transparent 83%);
    border-radius: 50%; animation: site-spark .6s ease-out infinite; }
.site-cone { position: absolute; left: 92cqw; bottom: 8%; width: 6cqw; height: 7cqw;
    background: linear-gradient(transparent 38%, #fff 38% 52%, transparent 52%), #ff7a1a; clip-path: polygon(38% 0, 62% 0, 100% 88%, 100% 100%, 0 100%, 0 88%); }
.site-steps { display: grid !important; }
.site-steps > span { grid-area: 1 / 1; opacity: 0; color: var(--text-muted); font-size: 13px; animation: site-step 8s ease-in-out calc(var(--i) * 2s) infinite; }
@keyframes site-turn { 0%, 32.5% { opacity: 1; } 33.3%, 100% { opacity: 0; } }
@keyframes site-rise {
    0%, 3% { clip-path: inset(100% 0 0 0); transform: scale(1); }
    7%, 9.5% { clip-path: inset(72% 0 0 0); }
    13.5%, 16% { clip-path: inset(47% 0 0 0); }
    20%, 22% { clip-path: inset(22% 0 0 0); }
    25% { clip-path: inset(0 0 0 0); transform: scale(1); }
    26.5% { transform: scale(1.07, .95); }
    28%, 100% { clip-path: inset(0 0 0 0); transform: scale(1); }
}
@keyframes site-ghost { 0%, 24% { opacity: .2; } 26%, 100% { opacity: 0; } }
@keyframes site-scaffold { 0%, 24% { opacity: .85; } 27%, 100% { opacity: 0; } }
@keyframes site-sparkle { 0%, 24.5% { opacity: 0; transform: scale(0) rotate(0); } 26.5% { opacity: 1; transform: scale(1.15) rotate(45deg); } 30%, 100% { opacity: 0; transform: scale(.4) rotate(90deg); } }
@keyframes site-trolley { 0%, 12% { left: 12cqw; } 40%, 72% { left: 33cqw; } 100% { left: 12cqw; } }
@keyframes site-cable { 0%, 40% { height: 4cqw; } 56%, 62% { height: 13cqw; } 74%, 100% { height: 4cqw; } }
@keyframes site-load { 0%, 58% { opacity: 1; transform: scale(1); } 64% { opacity: 0; transform: scale(1.35); } 92% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: scale(1); } }
@keyframes site-porter {
    0% { left: 7cqw; transform: scaleX(1); }
    44%, 50% { left: 34cqw; transform: scaleX(1); }
    51%, 93% { transform: scaleX(-1); }
    94% { left: 7cqw; transform: scaleX(-1); }
    95%, 100% { left: 7cqw; transform: scaleX(1); }
}
@keyframes site-carry { 0%, 46% { opacity: 1; transform: none; } 50% { opacity: 0; transform: translate(40%, 30%) rotate(20deg); } 93% { opacity: 0; transform: none; } 97%, 100% { opacity: 1; transform: none; } }
@keyframes site-hop { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-1.4cqw) rotate(3deg); } }
@keyframes site-bob { 50% { transform: translateY(.5cqw); } }
@keyframes site-nod { 0%, 100% { transform: none; } 55% { transform: translateY(.4cqw) scale(1.03, .97); } }
@keyframes site-swing { 0% { transform: rotate(35deg); } 50% { transform: rotate(-55deg); } 58% { transform: rotate(-48deg); } 100% { transform: rotate(35deg); } }
@keyframes site-spark { 0%, 48% { opacity: 0; transform: scale(.3); } 56% { opacity: 1; transform: scale(1); } 75%, 100% { opacity: 0; transform: scale(1.3); } }
@keyframes site-step { 0% { opacity: 0; transform: translateY(4px); } 5%, 22% { opacity: 1; transform: none; } 25%, 100% { opacity: 0; transform: translateY(-4px); } }
/* Without motion: the first building finished, everyone still, the first line. */
@media (prefers-reduced-motion: reduce) {
    .site *, .site-steps > span { animation: none !important; }
    .site-building:first-child, .site-steps > span:first-child { opacity: 1; }
    .site-built { clip-path: none; }
    .site-ghost, .site-scaffold { opacity: 0; }
    .site-porter { left: 30cqw; }
}
.empty-icons img { width: 56px; height: 56px; object-fit: contain; margin: 0 4px; }
.card { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); box-shadow: none; padding: 14px 16px; margin: 0 0 14px; }
.error-message { border-left: 3px solid var(--error); }

/* KPI band */
.kpis { display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 14px; }
.kpi { flex: 1 1 200px; display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-right: 1px solid var(--line2); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi small { display: block; color: var(--text-muted); font-size: 12px; font-weight: 600; }
.kpi b { display: block; font: 700 26px/1.1 var(--font-display); letter-spacing: -.6px; }
.kpi b sub { font: 600 13px var(--font-body); color: var(--text-muted); vertical-align: baseline; margin-left: 2px; letter-spacing: 0; }
.kpi-ico, .kpi .game-icon.kpi-ico { width: 44px; height: 44px; flex: 0 0 auto; object-fit: contain; }
.kpi-glyph { display: grid; place-items: center; background: var(--navy); border-radius: var(--r); }
.kpi-glyph img { width: 26px; height: 26px; }
.kpi-sub, .kpi-when { display: block; font-size: 12px; color: var(--text-muted); }
.kpi-sub { color: var(--success); font-weight: 700; }
.kpi-when { color: var(--text); font-weight: 600; }
.kpi-limit { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); }
.kpi-limit .game-icon { width: 20px; height: 20px; }
.kpi-level { flex: 1.4 1 260px; background: linear-gradient(90deg, var(--surface), var(--accent-soft)); }
/* RV upgrade under way: the game's orange "Upgrading" banner. */
.kpi-upgrade { background: linear-gradient(90deg, var(--surface), #fdf1dc); }
body.dark .kpi-upgrade { background: linear-gradient(90deg, var(--surface), #3a2a12); }
.upgrade-banner { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 4px; padding: 4px 10px; border-radius: 8px; background: linear-gradient(90deg, #f0a43c, #f6bd57 50%, #f0a43c); color: #fff; font: 700 13px var(--font-body); letter-spacing: .2px; text-shadow: 0 1px 1px rgba(150, 80, 0, .45); white-space: nowrap; }
.upgrade-chevrons { display: inline-flex; gap: 1px; }
.upgrade-chevrons img { height: 13px; width: auto; animation: upgrade-chevron 1.5s ease-in-out infinite; }
.upgrade-chevrons.left img { transform: scaleX(-1); }
/* Each chevron lights up in turn, toward the text, like the game's banner. */
.upgrade-chevrons img:nth-child(1) { animation-delay: 0s; }
.upgrade-chevrons img:nth-child(2) { animation-delay: .25s; }
.upgrade-chevrons img:nth-child(3) { animation-delay: .5s; }
.upgrade-chevrons:not(.left) img:nth-child(1) { animation-delay: .5s; }
.upgrade-chevrons:not(.left) img:nth-child(3) { animation-delay: 0s; }
@keyframes upgrade-chevron { 0%, 100% { opacity: .35; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .upgrade-chevrons img { animation: none; opacity: .8; } }
.kpi-upgrade .upgrade-left { font-variant-numeric: tabular-nums; color: #b45309; }
body.dark .kpi-upgrade .upgrade-left { color: #fbbf24; }

/* Plan layout */
.plan-grid { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 14px; align-items: start; }
.plan-main, .plan-side { min-width: 0; }
.view-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; overflow-x: auto; }
.view-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font-weight: 700; font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.view-tabs button[aria-pressed='true'] { color: var(--text); border-bottom-color: var(--accent); }
.plan-side .card { padding: 12px 14px; }
.plan-side table { font-size: 12px; }
.plan-side th, .plan-side td { padding: 7px 6px; }
.summary-value { font: 700 28px/1.15 var(--font-display); letter-spacing: -.6px; color: var(--text); }
.summary-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: none; letter-spacing: 0; }
.rate-card { border-top: 3px solid var(--accent); }
.studio-goal-empty { color: var(--text-muted); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { font-size: 11px; font-weight: 700; color: var(--text-muted); background: var(--surface-2); padding: 8px 10px; text-transform: none; letter-spacing: 0; border-bottom: 1px solid var(--border); text-align: left; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
tr:hover td { background: var(--surface-2); }
.game-icon { width: 36px; height: 36px; }
.game-entity { gap: .5rem; }
/* A food the shop sells (renderFoodPanel in app.js): its own picture, the size of a game icon. */
.game-entity img.food-shop-img { width: 36px; height: 36px; object-fit: contain; flex: none; }
.facility-plan-table td:first-child .game-icon { width: 40px; height: 40px; }
.facility-category-title { font: 700 12px var(--font-body); text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin: 14px 0 6px; border: 0; padding: 0; }
.recipe { display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.recipe .ing { position: relative; display: inline-flex; }
.recipe .ing .game-icon { width: 30px; height: 30px; }
.recipe .ing i { position: absolute; right: -3px; bottom: -2px; font: 700 10px var(--font-body); font-style: normal; background: var(--surface); color: var(--text-muted); padding: 0 2px; border-radius: 2px; line-height: 1.2; }
.recipe .arrow { color: var(--text-muted); margin: 0 6px 0 4px; }
.recipe .game-entity { font-weight: 700; }
.ability-dot { border-radius: 3px; }
.tag { border-radius: 2px; }
.electric-summary { padding: 10px 14px; margin-bottom: 12px; border: 1px solid #aa872e; border-radius: var(--r); background: #aa872e15; }
.electric-summary p { margin: 4px 0 0; }
.electric-tag { display: inline-block; padding: 2px 7px; border-radius: 2px; color: #795a00; background: #ffe697; font-size: 12px; font-weight: 700; white-space: nowrap; }
/* The map bar: what the map shows, and the parcels owned; flat, on one line. */
.environment-map-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 32px; margin: 4px 0 -12px; padding: 0 0 12px; border: 0; border-bottom: 1px solid var(--line2); border-radius: 0; background: none; }
.map-bar-label { margin-right: 10px; color: var(--text-muted); font: 700 11.5px var(--font-body); text-transform: uppercase; letter-spacing: .05em; }
/* A switch between two choices; the word on the side that's on is the dark one. */
.map-switch { display: flex; align-items: center; gap: 9px; }
.map-switch .side { border: 0; background: none; padding: 0; color: var(--text-muted); font: 600 13px var(--font-body); cursor: pointer; }
.map-switch .side.on { color: var(--text); }
.map-switch .side:hover { color: var(--accent); }
.map-switch .track { position: relative; width: 40px; height: 22px; border: 0; border-radius: 11px; padding: 0; background: var(--accent); cursor: pointer; }
.map-switch .track i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.map-switch .track[aria-checked='true'] i { left: 21px; }
/* What each building makes: one tile per product (see `productionTiles`). */
.production-key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 0 0 10px; color: var(--text-muted); font-size: 12px; }
.production-key span { display: inline-flex; align-items: center; gap: 6px; }
.production-key .production-power { position: static; margin: 0; }
.production-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.production-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 8px; background: var(--surface-2); text-align: center; }
.production-count { position: absolute; top: 6px; left: 6px; display: inline-flex; align-items: center; gap: 2px; font: 800 12px var(--font-display); }
.production-count .game-icon { width: 18px; height: 18px; }
.production-sell { position: absolute; top: 5px; right: 5px; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #1f9d55; color: #fff; font: 800 14px var(--font-display); }
.production-key .production-sell { position: static; width: 18px; height: 18px; font-size: 12px; }
.production-icon { position: relative; display: inline-flex; margin-top: 8px; }
.production-icon .game-icon { width: 46px; height: 46px; }
.production-power { position: absolute; right: -4px; bottom: -2px; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border: 1px solid #fff; background: #2f80ed; color: #fff; font: 700 10px var(--font-body); font-style: normal; }
.production-name { font: 600 12px var(--font-body); line-height: 1.2; min-height: 29px; }
.production-tile small { color: var(--text-muted); font-size: 10.5px; }
.production-tile .skip-row { position: absolute; right: 4px; bottom: 4px; opacity: 0; }
.production-tile:hover .skip-row, .production-tile .skip-row:focus-visible { opacity: 1; }
/* The same production as a text list (switch in the key line; see `productionTiles`). */
.production-view-switch { margin-left: auto; }
.production-views:not(.as-list) .production-list, .production-views.as-list .production-tiles { display: none; }
.production-list { width: 100%; border-collapse: collapse; font-size: 13px; }
.production-list th { text-align: left; font: 700 11px var(--font-body); color: var(--text-muted); text-transform: uppercase; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.production-list td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.production-list td > span, .production-list td > small { vertical-align: middle; }
.production-list .game-icon { width: 24px; height: 24px; vertical-align: middle; margin-right: 6px; }
.production-list .pl-count { width: 1%; font: 800 13px var(--font-display); text-align: right; white-space: nowrap; }
.production-list .pl-item { font-weight: 600; }
.production-list .pl-item small { margin-left: 6px; color: var(--text-muted); font-weight: 400; }
.production-list .production-power { position: static; display: inline-flex; margin-left: 6px; }
.production-list .production-sell { position: static; width: 18px; height: 18px; font-size: 12px; margin-right: 6px; vertical-align: middle; }
.production-list .pl-fate { color: var(--text-muted); }
.production-list .pl-skip { width: 1%; }
.production-list tr .skip-row { opacity: 0; }
.production-list tr:hover .skip-row, .production-list .skip-row:focus-visible { opacity: 1; }
/* The formations' layouts: the map panel's "Formations" view. */
.formation-grid { display: flex; flex-wrap: wrap; gap: 18px 28px; }
.formation-card { margin: 0; }
.formation-card figcaption { margin: 0 0 4px; font: 700 13px var(--font-body); }
/* The power network is often wider than a formation. */
.formation-network .env-diagram > svg { width: 420px; }
/* The full map holds both looks (see `renderWholeEnvironmentMap`): buildings, or what they make. */
.map-frame:not(.shows-products) .map-as-products, .map-frame.shows-products .map-as-buildings { display: none; }
/* The full map: only the parcels in use, on the page's background; zoom buttons in its corner. */
.map-frame { position: relative; }
.map-frame .environment-map-scroll { max-height: none; background: none; border: 0; border-radius: 0; overflow: hidden; }
.map-frame .environment-map { max-height: 75vh; min-width: 0; }
.world-parcel-land { fill: var(--surface-2); }
.map-frame.zoomed .environment-map { cursor: grab; touch-action: none; user-select: none; }
.map-frame.zoomed .environment-map:active { cursor: grabbing; }
.map-zoom { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; border: 1px solid var(--border); background: var(--surface); }
.map-zoom button { width: 30px; height: 30px; border: 0; background: none; color: var(--text); font: 700 16px var(--font-body); cursor: pointer; }
.map-zoom button + button { border-top: 1px solid var(--line2); }
.map-zoom button:hover { color: var(--accent); }
.seed-purchase-item { display: inline-flex; align-items: center; gap: 8px; }
.seed-purchase-item img { width: 36px; height: 36px; object-fit: contain; }
.ready-at { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
#level-up-date:empty, #goal-date:empty { display: none; }
td .ready-at { font-size: 11px; }
#seed-period, #food-days, .rate-unit-select, .input-field input, .input-field select, .skip-add input, #profile-name {
    border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--r); padding: 6px 9px; min-height: 34px; font-size: 13px; }
#seed-period, #food-days { margin: 0 0 8px 6px; }
.priority-retention { flex: 0 0 100%; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); padding-top: 6px; }
.priority-retention input { width: 52px; padding: 4px; }
.priority:has(.priority-retention) { flex-wrap: wrap; }
.tabs { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 3px; gap: 3px; }
.tabs label { border-radius: 2px; font-size: 12px; }
.tabs label:has(input:checked) { background: var(--surface); box-shadow: 0 0 0 1px var(--border); font-weight: 700; }
details > summary { font-size: 12px; font-weight: 600; cursor: pointer; }
.modal-content { border-radius: var(--r); box-shadow: 0 20px 80px #0005; }
.skip-chip, .special-option { border-radius: 2px; }
.skip-add-btn, .btn2 { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 6px 11px; border-radius: var(--r); font-size: 12px; font-weight: 700; }
.skip-add-btn:hover, .btn2:hover { border-color: var(--text-muted); }
.btn2.danger:hover { border-color: var(--error); color: var(--error); }
.primary { border: 0; background: var(--accent); color: var(--on-accent); padding: 9px 16px; border-radius: var(--r); font: 700 14px var(--font-display); }
.primary:hover { filter: brightness(1.08); }

/* --- Mon logis --------------------------------------------------------------------- */
.logis-sub { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 0 12px; min-height: 48px; margin-bottom: 12px; }
.logis-tabs { display: flex; align-self: stretch; overflow-x: auto; }
.logis-tabs button { display: flex; align-items: center; gap: 6px; background: none; border: 0; border-bottom: 2px solid transparent; padding: 0 12px; font-weight: 700; font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.logis-tabs button[aria-pressed='true'] { color: var(--text); border-bottom-color: var(--accent); }
.logis-tabs em { font: 700 11px var(--font-body); font-style: normal; background: var(--warn-soft); color: var(--warning); padding: 0 5px; border-radius: 2px; }
.logis-tabs em:empty { display: none; }
.preset-note { font-size: 12px; color: var(--text-muted); background: var(--accent-soft); padding: 4px 8px; border-radius: 2px; }
.preset-note b { color: var(--accent); }
.logis-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; padding: 8px 0; }
.toggle { display: flex; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.toggle label { padding: 5px 10px; font-size: 12px; font-weight: 700; color: var(--text-muted); cursor: pointer; margin: 0; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle label:has(input:checked) { background: var(--text); color: var(--surface); }
.logis-buildings { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.logis-buildings .col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.logis-empty { grid-column: 1 / -1; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--r); padding: 24px; text-align: center; color: var(--text-muted); }
.cath { display: flex; align-items: center; gap: 7px; font: 700 12px var(--font-body); text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin: 2px 0 6px; }
.cath span { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; }
.cath b { color: var(--warning); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 6px; }
.fc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 5px; padding: 7px 9px 7px 7px; align-items: center; transition: box-shadow .3s; }
.fc > .game-icon { width: 44px; height: 44px; grid-row: 1 / 3; grid-column: 1; }
.fc .nm { grid-column: 2; grid-row: 1; min-width: 0; font-weight: 700; font-size: 13px; line-height: 1.2; }
.fc .nm span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc .nm small { display: block; font-weight: 500; font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc.mod { box-shadow: inset 3px 0 0 var(--warning); border-color: color-mix(in srgb, var(--warning) 35%, var(--border)); }
.fc.mod .nm small { color: var(--warning); font-weight: 700; }
.fc.none { background: var(--surface-2); }
.fc.none > .game-icon { filter: grayscale(1); opacity: .5; }
.fc.none .nm { color: var(--text-muted); }
.fc.locked { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--bg) 6px 12px); }
.fc.locked > .game-icon { filter: grayscale(1); opacity: .35; }
.fc.locked .nm { color: var(--text-muted); }
.fc.flash { box-shadow: 0 0 0 3px var(--accent); }
.step { grid-column: 3; grid-row: 1; display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.step button { width: 26px; height: 26px; border: 0; background: var(--surface-2); color: var(--text-muted); font-weight: 700; }
.step button:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.step button:disabled { opacity: .4; }
.step b { font: 700 15px var(--font-display); min-width: 30px; text-align: center; }
.fc .lv, .mc .lv { grid-column: 2 / 4; display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.lv button { min-width: 23px; height: 22px; padding: 0 4px; border: 1px solid var(--border); border-radius: 2px; background: var(--surface); font: 700 11px var(--font-display); color: var(--text-muted); }
.lv button:hover:not(:disabled) { border-color: var(--text); color: var(--text); }
.lv button.on { background: var(--text); border-color: var(--text); color: var(--surface); }
.lv button.part { background: var(--text-muted); border-color: var(--text-muted); color: var(--surface); }
.lv button.lock { background: repeating-linear-gradient(135deg, var(--surface-2) 0 3px, var(--line2) 3px 6px); color: var(--border); border-color: var(--line2); }
.fc.locked .lv button:not(.lock) { opacity: .5; }
.lv .split { margin-left: auto; border: 0 !important; background: none !important; color: var(--accent) !important; font: 600 11px var(--font-body) !important; }
.lv-none { font-size: 11px; color: var(--text-muted); }
.tier-editor { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; border-top: 1px dashed var(--border); padding-top: 6px; margin-top: 2px; }
.tier-row { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.tier-row input { width: 64px; border: 1px solid var(--border); border-radius: 2px; padding: 3px 6px; background: var(--surface); }
.tier-row select { border: 1px solid var(--border); border-radius: 2px; padding: 3px 6px; background: var(--surface); }
.tier-row button { border: 0; background: none; color: var(--text-muted); }
.tier-add { align-self: flex-start; border: 0; background: none; color: var(--accent); font-size: 12px; font-weight: 600; padding: 2px 0; }
.logis-modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.mc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.mc.mod { box-shadow: inset 3px 0 0 var(--warning); }
.mc.mod small { color: var(--warning); font-weight: 700; }
.mc-head { display: flex; align-items: center; gap: 10px; }
.mc-head .glyph-dark { width: 26px; height: 26px; }
.mc .nm { font-weight: 700; }
.mc .nm small { display: block; font-weight: 500; font-size: 11px; color: var(--text-muted); }
.unlocks { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; min-height: 32px; }
.unlocks .game-icon { width: 30px; height: 30px; }
.unlocks .next { margin-left: 6px; }
.logis-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; }
.logis-panel .electric-settings { border: 0; padding: 0; margin: 0; }
.electric-settings .input-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.recipes-section .skip-count { font: 600 12px var(--font-body); color: var(--text-muted); margin-left: 6px; }
.profile-new { display: flex; gap: 8px; margin: 10px 0 14px; }
.profile-new input { flex: 1; max-width: 320px; }
.profile-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line2); }
.profile-row > div { flex: 1; min-width: 0; }
.profile-row small { display: block; color: var(--text-muted); font-size: 12px; }
.logis-foot { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px -20px 0; padding: 10px 20px; background: var(--surface); border-top: 1px solid var(--border); }
.diffs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1; font-size: 12px; color: var(--text-muted); }
.diffs .diff { display: inline-flex; align-items: center; gap: 4px; border: 0; background: var(--warn-soft); color: var(--warning); font-weight: 700; font-size: 12px; padding: 2px 7px 2px 3px; border-radius: 2px; }
.diffs .diff .game-icon { width: 20px; height: 20px; }

.site-foot { max-width: 1560px; margin: 20px auto 0; padding: 14px 20px 24px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-muted); text-align: right; }
.site-foot a { color: var(--accent); }
.site-foot p { margin: 0; }
.site-foot .site-disclaimer { margin-top: 4px; opacity: 0.85; }
body[data-page='logis'] .site-foot { display: none; }

/* --- Narrow screens ------------------------------------------------------------------ */
@media (max-width: 1180px) {
    .plan-grid { grid-template-columns: minmax(0, 1fr); }
    .logis-buildings { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 980px) {
    .topbar { position: static; flex-wrap: wrap; padding-left: 0; }
    .topbar .brand { order: 1; min-height: 46px; padding-left: 12px; flex: 1 1 0; min-width: 0; width: auto; }
    .tb-tools { order: 2; margin-left: auto; border-left: 0; flex: 0 0 auto; }
    .topbar .grow { display: none; }
    .page-tabs { order: 3; flex: 1 1 100%; border-left: 0; border-top: 1px solid #ffffff1f; }
    .page-tabs button { flex: 1; justify-content: center; min-height: 44px; }
    .tb-rv { order: 4; border-left: 0; padding: 8px 12px; border-top: 1px solid #ffffff1f; }
    .tb-strat { order: 5; padding: 8px 12px; border-top: 1px solid #ffffff1f; flex: 1; }
    .tb-goals { order: 6; flex: 1 1 100%; border-left: 0; border-top: 1px solid #ffffff1f; padding: 8px 12px; overflow-x: auto; }
    .topbar .optimize-btn { order: 7; flex: 1 1 100%; min-height: 46px; }
    .progress-bar-container { top: 0; }
    .progress-caption { top: 10px; }
    .plan-loading { top: 28px; }
    .goals-pop { position: fixed; }
}
@media (max-width: 640px) {
    .pages { padding: 10px 10px 0; }
    .tb-rv label { display: none; }
    .seg { flex: 1; } .seg label { flex: 1; justify-content: center; }
    .kpi { flex: 1 1 100%; border-right: 0; border-bottom: 1px solid var(--line2); }
    .cards { grid-template-columns: minmax(0, 1fr); }
    .logis-sub { padding: 0 8px; }
    .logis-foot { margin: 14px -10px 0; padding: 8px 10px; }
    .logis-foot .diffs { display: none; }
    .logis-foot .primary { flex: 1; }
    .logis-actions { margin-left: 0; flex-wrap: wrap; }
    .plan-side table, .card table { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
.rv-stepper select, #home-level { width: 58px; max-width: 58px; flex: 0 0 auto; }
.seg label, .page-tabs button, .goal-chips { white-space: nowrap; }
html, body { overflow-x: clip; }
.tools-menu { position: relative; }
.tools-menu summary { list-style: none; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; font-weight: 800; border: 1px solid #ffffff2e; border-radius: 50%; }
.tools-menu summary::-webkit-details-marker { display: none; }
.tools-list { position: absolute; right: 0; top: calc(100% + 8px); z-index: 45; display: flex; flex-direction: column; min-width: 190px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: 0 12px 40px #0b111b40; padding: 4px; }
.tools-list .tool { color: var(--text) !important; text-align: left; padding: 8px 10px !important; }
.tools-list .tool:hover { background: var(--surface-2) !important; }
.tb { padding: 0 12px; }
.studio-empty h2, .card h2, .logis-card h2 { border: 0; }
.cost-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; }
.cost-chip img, .cost-chip .game-icon { width: 28px; height: 28px; object-fit: contain; }
.recipe { flex-wrap: nowrap; } .facility-plan-table td[data-label='Producing'] { min-width: 220px; }
/* Icons in settings */
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.card-title h2 { margin: 0; }
.title-ico { width: 40px; height: 40px; object-fit: contain; }
.card-title .glyph-dark.title-ico { width: 24px; height: 24px; }
.switch-line { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.icon-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-top: 10px; }
#level-up-stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 0 40px; }
.icon-field { display: grid; grid-template-columns: 44px 1fr 86px; align-items: center; gap: 10px; border: 1px solid var(--line2); border-radius: var(--r); padding: 6px 8px; background: var(--surface-2); }
.icon-field > img, .icon-field > .game-icon { width: 44px; height: 44px; object-fit: contain; }
.icon-field label { margin: 0; font-size: 13px; font-weight: 700; line-height: 1.2; }
.icon-field label small { display: block; font-weight: 500; font-size: 11px; color: var(--text-muted); }
.icon-field input { width: 100%; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--r); padding: 6px 8px; font: 700 15px var(--font-display); text-align: right; }
/* Mon logis, first view: the recipes and the stock, then links to the detailed settings. */
.logis-essentials { background: var(--surface); border: 1px solid var(--border); padding: 6px 22px; margin-bottom: 14px; }
.ess-sec { padding: 18px 0; border-top: 1px solid var(--line2); }
.ess-sec:first-child { border-top: 0; }
/* The essentials view has no tabs: no empty bar above it. */
.ess-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; font: 700 17px var(--font-display); border: 0; padding: 0; }
.ess-n { color: var(--warning); }
.ess-meta { margin-left: auto; font: 600 12px var(--font-body); color: var(--text-muted); }
.special-grid.special-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 18px; margin: 0; }
.special-grid.special-list .special-option { border: 0; background: none; padding: 5px 6px; border-radius: 2px; }
.special-grid.special-list .special-option:has(input:checked) { background: var(--accent-soft); border: 0; }
.special-list .special-option .game-icon { width: 30px; height: 30px; }
.special-list .special-option small { display: block; color: var(--text-muted); font-size: 11.5px; font-weight: 500; }
.stock-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(150px, 190px); align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line2); }
.stock-row > img, .stock-row > .game-icon { width: 34px; height: 34px; object-fit: contain; }
.stock-row label { margin: 0; font-weight: 700; font-size: 13.5px; }
.stock-row small { display: block; font-weight: 500; font-size: 12px; color: var(--text-muted); }
.stock-track { display: block; height: 3px; max-width: 240px; margin-top: 4px; background: var(--line2); }
.stock-track span { display: block; height: 3px; background: var(--accent); }
.stock-row input { width: 100%; height: 34px; border: 1px solid var(--border); border-radius: 2px; background: var(--surface); color: var(--text); padding: 0 10px; font: 700 15px var(--font-display); text-align: right; font-variant-numeric: tabular-nums; }
.stock-more summary { cursor: pointer; padding: 10px 0 2px; color: var(--accent); font-weight: 600; font-size: 13px; }
/* The invitation under "Mon logis" after the first plan. */
.logis-coach { position: absolute; z-index: 45; display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: #2f80ed; color: #fff; border-radius: 8px; box-shadow: 0 8px 24px #0b111b40; white-space: nowrap; }
.logis-coach::before { content: ''; position: absolute; left: 22px; top: -6px; border: 6px solid transparent; border-top: 0; border-bottom-color: #2f80ed; }
.logis-coach button { background: none; border: 0; color: #fff; cursor: pointer; padding: 0; }
.logis-coach-go { font: 700 13.5px var(--font-body); }
.logis-coach-later { font: 500 12px var(--font-body); opacity: .85; }
.special-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; margin: 8px 0 14px; }
.special-option { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line2); background: var(--surface-2); padding: 5px 8px; cursor: pointer; }
.special-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.special-option .game-icon { width: 36px; height: 36px; }
.special-option span { font-weight: 700; font-size: 13px; line-height: 1.2; }
.special-option small { display: block; font-weight: 500; font-size: 11px; color: var(--text-muted); }
.skip-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px 2px 2px; }
.skip-chip .game-icon { width: 26px; height: 26px; }
.kpi-items { display: flex; flex-wrap: wrap; gap: 10px; margin: 2px 0; }
.kpi-item { display: inline-flex; align-items: center; gap: 4px; }
.kpi-item .game-icon { width: 34px; height: 34px; }
.kpi-item b { font-size: 22px; }
.kpi-exp .kpi-sub { color: var(--text-muted); font-weight: 600; }
.rate-item { display: inline-flex; align-items: center; gap: 4px; margin: 0 8px 2px 0; }
.rate-item .game-icon { width: 24px; height: 24px; }
.mc-head .module-ico { width: 44px; height: 44px; object-fit: contain; }
.icon-field .ability-ico { background-color: #d9a400; border-radius: 50%; width: 40px; height: 40px; }
.plan-notes p { margin: 0 0 8px; font-size: 12px; color: var(--text-muted); } .plan-notes p:empty { display: none; }
.plan-notes p { margin: 0 0 8px; font-size: 12px; color: var(--text-muted); } .plan-notes p:empty { display: none; }


/* Power and sales card (below the food) */
.sales-ico { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; }
.sales-power { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.sales-power > div { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line2); border-radius: var(--r); min-width: 0; }
.sales-power .sales-ico { width: 28px; height: 28px; flex: 0 0 auto; }
.sales-power small { display: block; font-size: 11px; color: var(--text-muted); line-height: 1.2; }
.sales-power b { display: block; font: 700 17px/1.15 var(--font-display); }
.sales-power.single { grid-template-columns: 1fr; }
.sales-power.single > div { gap: 10px 22px; flex-wrap: wrap; }
.sales-details { margin-bottom: 8px; }
.sales-details > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 2px 0; }
.sales-details > summary:hover { color: var(--text); }
.sales-details[open] > summary { margin-bottom: 6px; }
.sales-machines { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; font-size: 12px; }
.sales-machines li { display: flex; align-items: center; gap: 6px; }
.sales-machines .muted { margin-left: auto; }
#sales-card .muted, .sales-table small { color: var(--text-muted); }
#sales-card .hint .sales-ico { margin-right: 4px; }
.sales-table td small { display: block; font-size: 11px; }
.sales-table td:nth-child(n+2), .sales-table th:nth-child(n+2) { text-align: right; white-space: nowrap; }
.sales-table tfoot td { border-top: 1px solid var(--border); font-weight: 700; }
.sales-table tfoot .sales-ico { width: 16px; height: 16px; }
.sales-table td .sales-ico { width: 14px; height: 14px; }
@media (max-width: 520px) { .sales-power { grid-template-columns: 1fr; } }
.sales-machines .game-icon, .sales-machines img { width: 24px; height: 24px; }
.sales-power b { font-size: 15px; white-space: nowrap; }

/* Aniimo team as in-game slots */
.slot-zone h3 { font: 700 12px var(--font-body); text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); margin: 10px 0 6px; }
.slot-zone h3 small { font-weight: 600; opacity: .7; margin-left: 4px; }
.haul-count { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; vertical-align: middle; text-transform: none; color: var(--text); }
.haul-count.short { color: var(--error); }
/* A small "i": its explanation shows on hover, or on tap (focus) on a phone. */
.info-tip { position: relative; display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: 3px; border-radius: 50%; border: 1px solid var(--text-muted); color: var(--text-muted); font: italic 700 10px/1 Georgia, serif; text-transform: none; letter-spacing: 0; vertical-align: 1px; cursor: help; }
.info-tip:hover, .info-tip:focus { color: var(--text); border-color: var(--text); outline: none; }
.info-tip::after { content: attr(data-tip); position: absolute; z-index: 50; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: min(280px, 80vw); padding: 8px 10px; border-radius: 8px; background: var(--navy, #1f3150); color: #fff; font: 400 12px/1.45 var(--font-body); text-align: left; white-space: normal; box-shadow: 0 6px 18px rgba(0,0,0,.2); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .12s; }
.info-tip:hover::after, .info-tip:focus::after { opacity: 1; visibility: visible; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.team-slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); text-align: center; min-width: 0; }
.team-slot:hover { border-color: var(--accent, #3b82f6); }
.skill-glyph { position: relative; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ability); flex: 0 0 auto; }
.skill-glyph .game-icon.skill-glyph-img { width: 78% !important; height: 78% !important; }
.skill-glyph.big { width: 46px; height: 46px; border-radius: 12px; }
.skill-glyph.mini { width: 16px; height: 16px; }
.skill-glyph b { position: absolute; right: -6px; bottom: -6px; min-width: 18px; height: 18px; padding: 0 3px; border-radius: 9px; background: var(--navy, #1f3150); color: #fff; font: 700 11px/18px var(--font-body); border: 2px solid var(--surface); }
.slot-place { display: flex; align-items: center; gap: 3px; max-width: 100%; font-size: 11px; color: var(--text-muted); }
.slot-place > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-place .game-icon.slot-place-img, .slot-place img.slot-place-img { width: 20px !important; height: 20px !important; }
.aniimo-candidates.compact { margin-top: 2px; padding: 1px 6px 1px 2px; gap: 3px; font-size: 11px; border-radius: 10px; color: var(--text-muted); }
.aniimo-candidates.compact .game-icon.portrait-mini { width: 20px !important; height: 20px !important; }

/* In-game style: hexagon portrait of the recommended Aniimo, its abilities underneath */
.hex-slot { padding: 8px 4px 6px; gap: 2px; background: transparent; border-color: transparent; }
.hex-slot:hover { border-color: var(--border); background: var(--surface); }
.hex { position: relative; padding: 0; border: 0; background: none; cursor: pointer; line-height: 0; }
.hex-bg { display: grid; place-items: center; width: 92px; height: 100px; background: color-mix(in srgb, var(--ability) 22%, var(--surface)); clip-path: polygon(50% 0, 97% 25%, 97% 75%, 50% 100%, 3% 75%, 3% 25%); }
.hex-bg.small { width: 64px; height: 70px; }
.hex:hover .hex-bg { background: color-mix(in srgb, var(--ability) 40%, var(--surface)); }
.hex .game-icon.hex-portrait { width: 84px !important; height: 84px !important; }
.hex-bg.small .game-icon.hex-portrait { width: 58px !important; height: 58px !important; }
.hex-nature { position: absolute; left: 2px; top: 10px; }
.hex-nature .nature-badge { width: 22px; height: 22px; margin: 0; border: 2px solid var(--surface); }
.hex-abilities { display: flex; justify-content: center; gap: 7px; margin-top: -14px; padding: 2px 6px; border-radius: 12px; background: var(--surface); position: relative; z-index: 1; }
.hex-abilities .skill-glyph { width: 22px; height: 22px; }
.hex-abilities .skill-glyph b { right: -7px; bottom: -5px; min-width: 15px; height: 15px; font-size: 10px; line-height: 13px; padding: 0 2px; border-width: 1px; }
.hex-abilities .skill-glyph:not(.need) { opacity: .8; }
.hex-abilities .skill-glyph.need { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ability); }
.hex-slot .slot-place { margin-top: 4px; }
.pet-picker { max-width: 820px; }
.pet-picker h2 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.picker-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: inherit; font: inherit; cursor: pointer; }
.picker-card:hover { border-color: var(--success); }
.picker-card.current { border: 2px solid var(--success); background: color-mix(in srgb, var(--success) 10%, var(--surface)); }
.picker-card strong { font-size: 12.5px; }
.picker-card small { font-size: 11px; color: var(--text-muted); }
.picker-card .hex-abilities { margin-top: -10px; }
.picker-rank { position: absolute; top: 4px; left: 6px; font-size: 11px; font-weight: 700; color: var(--text-muted); }
.picker-card:first-child .picker-rank { color: var(--success); }
.nature-badge.common { background: #4f8fe0; }
.nature-badge.rare { background: #e0679a; }
.hex-bg.prismana { background: conic-gradient(from 30deg, #ff9ad5, #ffd36e, #9ff0a8, #7fd3ff, #c7a2ff, #ff9ad5); }

/* Linked Aniimo account */
.account-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid rgba(255,255,255,.25); border-radius: var(--r); background: transparent; color: #fff; font: 600 12px var(--font-body); cursor: pointer; white-space: nowrap; }
.account-chip.linked { background: rgba(255,255,255,.1); }
.account-chip span { opacity: .7; font-weight: 500; }
.account-form { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.account-form input { width: 170px; }
.account-form input, .account-form select, #account-paste { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--text); }
#account-paste { width: 100%; margin: 6px 0; font-family: monospace; font-size: 12px; }
.account-card { display: grid; gap: 8px; }
.account-id small { display: block; color: var(--text-muted); font-size: 12px; }
.account-facts { display: grid; gap: 4px; margin: 0; font-size: 13px; }
.account-facts div { display: grid; grid-template-columns: 90px 1fr; gap: 8px; }
.account-facts dt { color: var(--text-muted); }
.account-facts dd { margin: 0; }
.account-actions { display: flex; gap: 6px; }
.hex-slot.not-owned .hex-bg { filter: grayscale(.8); opacity: .75; }
/* The small "+" hexagon adding a hauler, and the ✕ taking an added one out (renderAniimoSlots). */
.hex-add-slot { justify-content: center; }
.hex-add .hex-bg { background: var(--surface-2); transition: background .15s; }
.hex-add .hex-bg b { font: 700 30px/1 var(--font-display); color: var(--text-muted); }
.hex-add:hover .hex-bg, .hex-add:focus-visible .hex-bg { background: color-mix(in srgb, #5f7fd1 25%, var(--surface)); }
.hex-add:hover .hex-bg b, .hex-add:focus-visible .hex-bg b { color: #5f7fd1; }
.hex-remove { position: absolute; top: 4px; right: 6px; z-index: 2; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
    background: var(--surface-2); color: var(--text-muted); font: 700 11px/20px var(--font-body); cursor: pointer; }
.hex-remove:hover, .hex-remove:focus-visible { background: var(--error); color: #fff; }
.hex-missing { position: absolute; right: 2px; top: 14px; width: 18px; height: 18px; border-radius: 50%; background: var(--danger, #d14343); color: #fff; font: 700 12px/18px var(--font-body); }
/* Climate buildings on the whole map: their name over a white halo, readable on any plot. */
/* Building names on hover over the maps (see installMapTips in app.js). */
.map-tip { position: fixed; z-index: 1000; pointer-events: none; max-width: 280px; padding: 6px 10px 6px 6px; border-radius: 8px;
    display: flex; align-items: center; gap: 8px;
    background: #14212b; color: #fff; font: 600 12px/1.3 var(--font-body); box-shadow: 0 4px 14px rgba(0,0,0,.28); }
.map-tip[hidden] { display: none; }
.map-tip-picture { width: 56px; height: 56px; flex: 0 0 auto; object-fit: contain; }
.environment-map [data-tip], .env-diagram [data-tip] { cursor: help; }
/* The team's Aniimo in the plan table's Aniimo column (see fillRowAniimo in app.js). */
.row-pet { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; background: var(--surface-2); border: 2px solid var(--line2); vertical-align: middle; }
.row-pet.prismana { border-color: #c7a2ff; }
.row-pet .game-icon.row-pet-img { width: 30px !important; height: 30px !important; }
.row-job { display: inline-flex; align-items: flex-end; gap: 0; margin-right: 6px; }
.row-job .skill-glyph.mini { margin-left: -8px; }
.row-job .skill-glyph.mini b { right: -7px; bottom: -5px; min-width: 14px; height: 14px; font-size: 9px; line-height: 12px; padding: 0 2px; border-width: 1px; }
.hex-conflict { position: absolute; right: -2px; bottom: 8px; width: 26px; height: 26px; border-radius: 50%; background: #d9480f; color: #fff; font: 800 15px/26px var(--font-body); cursor: help; box-shadow: 0 0 0 2px #fff, 0 2px 8px #d9480f80; }
/* A job clash: the hexagon ringed in orange, and the list above the slots (renderAniimoSlots). */
.team-slot.has-conflict .hex { filter: drop-shadow(3px 0 0 #d9480f) drop-shadow(-3px 0 0 #d9480f) drop-shadow(0 3px 0 #d9480f) drop-shadow(0 -3px 0 #d9480f); }
.team-conflicts { margin: 0 0 14px; padding: 12px 14px; border: 2px solid #d9480f; border-radius: 10px; background: #fff4ed; color: #7c2d12; }
.team-conflicts > strong { font-size: 15px; }
.team-conflicts p { margin: 4px 0 6px; font-size: 13px; }
.team-conflicts ul { margin: 0; padding-left: 18px; font-size: 13px; display: grid; gap: 3px; }
body.dark .team-conflicts { background: #3b1d0f; color: #fed7aa; }
@media (max-width: 700px) { .account-chip span { display: none; } }
.account-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }

/* Orders (Commandes): the card on the plan and the list to pick them from (app.js). */
.order-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.order-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line2); }
.order-item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.order-item .game-icon { width: 32px; height: 32px; }
.order-item small { display: block; color: var(--text-muted); font-size: 12px; }
.order-time { font-weight: 700; white-space: nowrap; font-size: 13px; }
.order-off { color: var(--text-muted); font-weight: 600; font-size: 12px; }
.order-remove { border: 0; background: none; color: var(--text-muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.order-remove:hover { color: var(--error); }
.order-ready { margin: 8px 0 2px; font-size: 15px; }
.order-changes summary { cursor: pointer; font-weight: 700; font-size: 13px; margin: 6px 0; }
.order-changes ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.order-action { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 4px; font-size: 13px; }
.order-arrow { color: var(--text-muted); font-weight: 800; }
.order-times { margin-left: auto; font-weight: 800; }
.order-tag { padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.order-tag.start { background: #dcfce7; color: #166534; }
.order-tag.pause { background: #fde7d9; color: #9a3412; }
.order-paused { margin: 6px 0 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.order-paused .order-action { justify-content: space-between; }
.order-was { color: var(--text-muted); font-size: 12px; text-align: right; }
.order-recipe { display: inline-flex; align-items: center; gap: 4px; }
.order-recipe .game-icon { width: 22px; height: 22px; }
.order-need { margin: 4px 0 2px; padding: 6px 9px; border-left: 3px solid #d9480f; border-radius: 6px; background: #fff4ed; color: #7c2d12; font-size: 12.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
body.dark .order-need { background: #3b1d0f; color: #fed7aa; }
.order-need small { opacity: .8; }
.order-pet { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }
.order-pet .order-pet-img { width: 22px; height: 22px; border-radius: 50%; }
.order-need-count { margin-left: 6px; color: #c2410c; font-weight: 800; }
body.dark .order-need-count { color: #fdba74; }
.orders-picker { width: min(640px, calc(100vw - 32px)); }
/* Every order of the game (see `openAllOrders`): cards like the game's, coloured by quality. */
.orders-all-btn { margin-left: 8px; width: 22px; height: 22px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text-muted); font: 700 13px var(--font-body); vertical-align: 3px; cursor: pointer; }
.orders-all-btn:hover { border-color: var(--accent); color: var(--accent); }
.orders-all { width: min(1180px, calc(100vw - 32px)); }
.orders-all h2 small, .oc-shop h3 small { color: var(--text-muted); font-weight: 600; font-size: .7em; }
.oc-bar { position: sticky; top: -1.5rem; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin: 0 -1.5rem 14px; padding: 10px 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line2); }
.oc-bar .orders-search { flex: 1 1 220px; margin: 0; }
.oc-mine { display: inline-flex; align-items: center; gap: 6px; font: 600 13px var(--font-body); }
.oc-urgency { display: flex; }
.oc-urgency button { height: 32px; padding: 0 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 13px var(--font-body); cursor: pointer; }
.oc-urgency button + button { border-left: 0; }
.oc-urgency button[aria-pressed='true'] { background: #e84f9a; border-color: #e84f9a; color: #fff; }
.oc-urgency button[data-urgency='1'][aria-pressed='true'] { background: var(--accent); border-color: var(--accent); }
.oc-shop { position: relative; margin: 0 0 20px; padding: 12px; border-radius: 14px; background: #1b2a3a; overflow: hidden; }
.oc-shop::before { content: ''; position: absolute; inset: 0; background: var(--pattern) 0 0 / 240px auto repeat; opacity: .14; pointer-events: none; }
.oc-shop[hidden], .oc[hidden] { display: none; }
.oc-shop h3 { position: relative; margin: 0 0 10px; color: #fff; font: 800 16px var(--font-display); letter-spacing: .04em; text-transform: uppercase; }
.oc-grid { position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.oc { --q: #6fbf73; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 8px 10px; border-radius: 12px; border-top: 5px solid var(--q); background: linear-gradient(180deg, #f4f6fa 0%, #f4f6fa 55%, color-mix(in srgb, var(--q) 28%, #f4f6fa) 100%); color: #1d2b3a; text-align: center; }
.oc.q2 { --q: #4f8fe0; } .oc.q3 { --q: #9a6be0; } .oc.q4 { --q: #ec9a3c; }
.oc.q5 { --q: #e05cc0; border-image: linear-gradient(90deg, #f25f5c, #ffd166, #6fbf73, #4f8fe0, #9a6be0) 1; }
.oc:not(.now) { opacity: .62; }
.oc-stars { color: #ffc93c; font-size: 14px; letter-spacing: 1px; text-shadow: 0 1px 0 #b98a14; }
.oc-item { position: relative; display: inline-flex; }
.oc-item .game-icon { width: 52px; height: 52px; }
.oc-item b { position: absolute; right: -14px; bottom: -2px; padding: 1px 6px; border-radius: 10px; background: #2c3a4a; color: #fff; font: 700 11px var(--font-display); }
.oc-noicon { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; color: #8a97a6; font: 700 22px var(--font-display); }
.oc-name { font: 700 12.5px var(--font-body); line-height: 1.2; min-height: 30px; display: flex; align-items: center; }
.oc-meta { color: #5d6b7b; font: 600 11px var(--font-body); }
.oc-urgent { align-self: stretch; margin: 2px -8px 0; padding: 2px 0; background: #e84f9a; color: #fff; font: 700 11.5px var(--font-body); }
.oc-rewards { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 4px; }
.oc-reward { position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 8px; background: #2c3a4a; }
.oc-reward img, .oc-reward .game-icon { width: 28px; height: 28px; object-fit: contain; margin-top: -8px; }
.oc-reward b { position: absolute; right: 3px; bottom: 1px; color: #fff; font: 700 10.5px var(--font-display); text-shadow: 0 1px 1px #000; }
.oc-reward.boosted b { color: #ffd166; }
.orders-search { width: 100%; box-sizing: border-box; margin: 6px 0 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font: 600 14px var(--font-body); background: var(--surface); color: var(--text); }
.orders-products { display: grid; gap: 2px; }
.orders-product { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--line2); }
.orders-product[hidden] { display: none; }
.orders-product .game-icon { width: 32px; height: 32px; }
.orders-name { font-weight: 600; font-size: 14px; }
.orders-name small { display: block; color: var(--text-muted); font-size: 12px; font-weight: 500; }
.orders-counts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.orders-count { min-width: 44px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: 700 13px var(--font-body); cursor: pointer; }
.orders-count:hover { border-color: #f5b531; }
.orders-count.picked { background: #f5b531; border-color: #f5b531; color: #1a1a1a; }

/* First visit to the team: the first slot glows, with a bubble saying Aniimo can be picked
   (showTeamCoach in app.js); gone after the first click. */
@keyframes coach-glow { 0%, 100% { filter: drop-shadow(0 0 3px #f5b531); } 50% { filter: drop-shadow(0 0 12px #f5b531) drop-shadow(0 0 4px #f5b531); } }
.team-slot.coach { position: relative; z-index: 3; }
.team-slot.coach .hex { animation: coach-glow 1.6s ease-in-out infinite; }
.coach-bubble { position: absolute; left: calc(100% + 4px); top: 30px; width: 170px; padding: 9px 12px; border: 0; border-radius: 10px; background: #1a2638; color: #fff; font: 700 13px/1.35 var(--font-body); text-align: left; box-shadow: 0 8px 24px #0b111b40; cursor: pointer; }
.coach-bubble::before { content: ''; position: absolute; left: -7px; top: 18px; border: 7px solid transparent; border-left: 0; border-right-color: #1a2638; }
@media (max-width: 640px) {
    .coach-bubble { left: 0; top: calc(100% + 6px); }
    .coach-bubble::before { left: 24px; top: -7px; border: 7px solid transparent; border-top: 0; border-bottom-color: #1a2638; }
}
@media (prefers-reduced-motion: reduce) { .team-slot.coach .hex { animation: none; filter: drop-shadow(0 0 8px #f5b531); } }

/* The note about frequent updates, at every visit (see `updateNotice` in shell.js). */
.update-notice { position: fixed; left: 50%; bottom: 18px; z-index: 60; display: flex; align-items: center; gap: 12px; max-width: min(560px, calc(100vw - 32px)); padding: 10px 12px 10px 16px; transform: translateX(-50%); border-radius: var(--r); background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: 0 6px 24px #0003; font-size: 13px; line-height: 1.4; animation: update-notice-in .3s ease-out; transition: opacity .3s, transform .3s; }
.update-notice.leaving { opacity: 0; transform: translate(-50%, 10px); }
.update-notice button { flex: none; border: 0; background: none; color: var(--text-muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }
@keyframes update-notice-in { from { opacity: 0; transform: translate(-50%, 10px); } }
