html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5I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I2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* ===================================================================
   OutskirtsUi component library — GDD §7.4 palette/typography via the
   --osk-* custom properties (design-assets/.../outskirts-tokens.css).
   Components own presentation only; every value carries a visible label
   (§7.7) and state pairs colour with a text/shape cue (never colour-only).
   Added by phase-8 p08-b01-t01.
   =================================================================== */

.osk-app {
    background: var(--osk-bg);
    color: var(--osk-text);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Screen-reader-only label helper (paired text cue for icon/shape marks). */
.ui-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- DialBar --- */
.ui-dial { display: flex; flex-direction: column; gap: var(--osk-space-1);
    padding: var(--osk-space-2); background: var(--osk-surface);
    border: 1px solid var(--osk-border); border-radius: var(--osk-radius-md); }
.ui-dial-head { display: flex; justify-content: space-between; gap: var(--osk-space-2); }
.ui-dial-label { color: var(--osk-text-muted); }
.ui-dial-value { color: var(--osk-text-strong); font-variant-numeric: tabular-nums; }
.ui-dial-track { position: relative; height: 8px; background: var(--osk-surface-sunken);
    border-radius: var(--osk-radius-pill); overflow: hidden; }
.ui-dial-fill { height: 100%; background: var(--osk-primary);
    transition: width var(--osk-motion-base) var(--osk-ease-out); }
.ui-dial-tick { position: absolute; top: -2px; width: 2px; height: 12px;
    background: var(--osk-text-faint); }
.ui-dial--warn .ui-dial-fill { background: var(--osk-warning); }
.ui-dial--alert .ui-dial-fill { background: var(--osk-warning); }
.ui-dial--horde .ui-dial-fill { background: var(--osk-danger); }
.ui-dial--warn .ui-dial-value { color: var(--osk-warning-strong); }
.ui-dial--alert .ui-dial-value { color: var(--osk-warning-strong); }
.ui-dial--horde .ui-dial-value { color: var(--osk-danger-text); }
/* §7.7 noise band: "calm" is the baseline (no elevated styling); alert/horde escalate.
   Never color-only — the band word also appears in the dial label text. */

/* --- LabeledStat --- */
.ui-stat { display: inline-flex; gap: var(--osk-space-2); align-items: baseline; }
.ui-stat-label { color: var(--osk-text-muted); }
.ui-stat-value { color: var(--osk-text-strong); font-variant-numeric: tabular-nums; }
.ui-stat-hint { color: var(--osk-text-faint); font-size: .85em; }

/* --- BannerCard --- */
.ui-banner { padding: var(--osk-space-3); background: var(--osk-surface-raised);
    border: 1px solid var(--osk-border); border-left: 3px solid var(--osk-info);
    border-radius: var(--osk-radius-md); }
.ui-banner--incident { border-left-color: var(--osk-warning); }
.ui-banner--challenge { border-left-color: var(--osk-secondary); }
.ui-banner-title { color: var(--osk-text-strong); margin: 0 0 var(--osk-space-1); }
.ui-banner-summary { color: var(--osk-text); margin: 0; }
.ui-banner-preview { color: var(--osk-text-faint); margin: var(--osk-space-1) 0 0; }

/* --- SlotGrid / BackpackGrid --- */
.ui-slotgrid-head { display: flex; justify-content: space-between; }
.ui-slotgrid-label { color: var(--osk-text-muted); }
.ui-slotgrid-count { color: var(--osk-text-strong); font-variant-numeric: tabular-nums; }
.ui-slotgrid-cells { display: flex; flex-wrap: wrap; gap: var(--osk-space-1); }
.ui-slot { min-width: 44px; min-height: 44px; display: flex; align-items: center;
    justify-content: center; border: 1px solid var(--osk-border);
    border-radius: var(--osk-radius-sm); background: var(--osk-surface); }
.ui-slot--empty { border-style: dashed; color: var(--osk-text-faint); }
.ui-slot--filled { border-color: var(--osk-border-strong); color: var(--osk-text); }
.ui-slot--over { border-color: var(--osk-danger); border-style: dashed; }

/* --- ModalShell --- */
.ui-modal-scrim { position: fixed; inset: 0; background: rgba(14,12,10,.7);
    display: flex; align-items: center; justify-content: center; z-index: 1000; }
.ui-modal { background: var(--osk-surface-overlay); color: var(--osk-text);
    border: 1px solid var(--osk-border-strong); border-radius: var(--osk-radius-lg);
    box-shadow: var(--osk-elevation-2); max-width: min(640px, 92vw); padding: var(--osk-space-4); }
.ui-modal-head { display: flex; align-items: center; gap: var(--osk-space-3); }
.ui-modal-title { flex: 1; color: var(--osk-text-strong); margin: 0; }
.ui-modal-paused { color: var(--osk-warning); }

/* --- RecipeCard --- */
.ui-recipe { padding: var(--osk-space-3); background: var(--osk-surface);
    border: 1px solid var(--osk-border); border-radius: var(--osk-radius-md); }
.ui-recipe--ready { border-color: var(--osk-success); }
.ui-recipe--blocked { opacity: .9; border-style: dashed; }
.ui-recipe-head, .ui-node-head { display: flex; gap: var(--osk-space-2); align-items: baseline; }
.ui-recipe-name { color: var(--osk-text-strong); margin: 0; }
.ui-recipe-station { color: var(--osk-text-muted); }
.ui-recipe-costs, .ui-node-mats { list-style: none; padding: 0; margin: var(--osk-space-2) 0; }
.ui-recipe-cost, .ui-node-mat { display: flex; gap: var(--osk-space-2); }
.ui-recipe-cost--met .ui-recipe-cost-mark, .ui-node-mat--met .ui-node-mat-mark { color: var(--osk-success); }
.ui-recipe-cost--short .ui-recipe-cost-mark, .ui-node-mat--short .ui-node-mat-mark { color: var(--osk-danger-text); }
.ui-recipe-savings { color: var(--osk-success); }
.ui-recipe-reason, .ui-node-lock { color: var(--osk-text-faint); }

/* --- BlueprintNode --- */
.ui-node { padding: var(--osk-space-3); background: var(--osk-surface);
    border: 1px solid var(--osk-border); border-radius: var(--osk-radius-md); }
.ui-node--ready { border-color: var(--osk-success); }
.ui-node--short { border-color: var(--osk-danger-text); border-style: dashed; }
.ui-node--pinned { border-color: var(--osk-primary); }
.ui-node--locked { opacity: .85; }
.ui-node-name { color: var(--osk-text-strong); margin: 0; }
.ui-node-tier, .ui-node-kind { color: var(--osk-text-muted); }
.ui-node-zone { color: var(--osk-text-faint); }

/* Shared interactive affordances. */
.ui-recipe-craft, .ui-node-pin, .ui-node-build {
    background: var(--osk-primary); color: var(--osk-text-strong);
    border: 1px solid var(--osk-primary-pressed); border-radius: var(--osk-radius-md);
    padding: var(--osk-space-1) var(--osk-space-3); cursor: pointer; }
.ui-recipe-craft:disabled, .ui-node-build:disabled {
    background: var(--osk-state-disabled); color: var(--osk-text-faint);
    border-color: var(--osk-border); cursor: not-allowed; }
.ui-recipe-craft:focus-visible, .ui-node-pin:focus-visible, .ui-node-build:focus-visible,
.ui-modal-close:focus-visible { outline: none; box-shadow: var(--osk-focus-ring-shadow); }

/* --- Run HUD --- */
.hud { display: flex; flex-direction: column; gap: var(--osk-space-2);
    padding: var(--osk-space-3); background: var(--osk-surface); color: var(--osk-text);
    border-radius: var(--osk-radius-lg); }
.hud-dials, .hud-state { display: flex; flex-wrap: wrap; gap: var(--osk-space-4); }
.hud-status { color: var(--osk-warning); }

/* §7.2.1 / US-044 contextual verb-prompt band — server-projected noise what-ifs, top of the HUD.
   Band colour mirrors the server flag; the band word is always present in the text (never colour-only). */
.hud-verbs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap;
    gap: var(--osk-space-3); font-variant-numeric: tabular-nums; }
.hud-verb { color: var(--osk-text); }
.hud-verb--alert { color: var(--osk-warning-strong); }
.hud-verb--horde { color: var(--osk-danger-text); }

/* --- §7.6 responsive breakpoints: 1366 (target) / 1024 / 768 / 375 (quality gate) --- */
@media (max-width: 768px) {
    .hud-dials, .hud-state { gap: var(--osk-space-2); }
}
@media (max-width: 375px) {
    .ui-slot { min-width: 40px; min-height: 40px; }
    .hud-dials, .hud-state { flex-direction: column; gap: var(--osk-space-1); }
}


/* Phase 8 production-asset scene (visual polish b08-t01). Rendering selects art
   for server-reported state only. The scene composites a three-layer suburb
   background (ground, nature, props) so the player and enemies sit on a coherent
   playable world. Enemy sprites are positioned by their server-reported
   coordinates; the tile layers are deterministic reads of the authoritative
   tile snapshot (no simulation math in the UI). */
.production-run-scene {
    position: relative;
    overflow: hidden;
    border: 2px solid var(--osk-primary, #D85A2C);
    border-radius: 12px;
    background: #151b1a;
    margin: 12px 0;
    aspect-ratio: 16 / 9;
    min-height: 280px;
    width: 100%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.production-run-scene__tile { position: absolute; inset: 0; image-rendering: pixelated; }
.production-run-scene__tile--ground {
    background-image: url('../design-assets/outskirts/art/tiles/suburb/ground/asphalt_cracked.png');
    background-repeat: repeat;
    background-size: 64px;
    background-color: #1a1f1d;
    opacity: 0.95;
}
.production-run-scene__tile--nature {
    background-image: url('../design-assets/outskirts/art/tiles/suburb/nature/grass_tall.png');
    background-repeat: repeat;
    background-size: 48px;
    opacity: 0.55;
    mix-blend-mode: screen;
}
.production-run-scene__tile--props {
    background-image: url('../design-assets/outskirts/art/tiles/suburb/props/hedge.png');
    background-repeat: repeat;
    background-size: 64px;
    opacity: 0.40;
    mix-blend-mode: overlay;
}
.production-run-scene__player-base,
.production-run-scene__player-gear,
.production-run-scene__enemy {
    position: absolute;
    image-rendering: pixelated;
    width: 96px;
    height: 96px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}
.production-run-scene__player-base,
.production-run-scene__player-gear {
    left: 44%;
    bottom: 12%;
    width: 128px;
    height: 128px;
}
.production-run-scene__enemy {
    width: 80px;
    height: 80px;
}
.production-run-scene__enemy.shambler {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)) hue-rotate(-8deg);
}
.production-run-scene__caption {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    margin: 0;
    padding: 8px 12px;
    color: #f5f1e8;
    background: rgba(10, 11, 13, 0.82);
    font-size: 0.85rem;
    border-top: 1px solid var(--osk-primary, #D85A2C);
}

/* Authoritative player-path layout — the /play route is a coherent game scene.
   On wide screens, the HUD floats on the right of the scene; on mobile, the HUD
   stacks below the scene and the End-Run button pins to the viewport bottom so
   it stays visible above the fold. */
.play-shell {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.play-run {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    position: relative;
}
.play-end-run {
    margin-top: 12px;
    padding: 10px 16px;
    background: var(--osk-surface, #1f2429);
    color: var(--osk-text, #f5f1e8);
    border: 1px solid var(--osk-primary, #D85A2C);
    border-radius: 8px;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}
.play-end-run:focus-visible {
    outline: 2px solid var(--osk-primary, #D85A2C);
    outline-offset: 2px;
}

/* Desktop: scene + side-by-side HUD. */
@media (min-width: 900px) {
    .play-run {
        grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
        grid-template-areas: "scene hud" "endrun endrun";
        align-items: start;
    }
    .play-run .production-run-scene { grid-area: scene; }
    .play-run .hud { grid-area: hud; position: sticky; top: 12px; }
    .play-end-run { grid-area: endrun; justify-self: end; }
}

/* Mobile: scene full-width, HUD stacked, End Run pinned to viewport bottom. */
@media (max-width: 899px) {
    .play-run {
        grid-template-columns: 1fr;
        grid-template-areas: "scene" "hud" "endrun";
        padding-bottom: 88px;
    }
    .play-run .production-run-scene { grid-area: scene; aspect-ratio: 4 / 3; }
    .play-run .hud { grid-area: hud; }
    .play-end-run {
        grid-area: endrun;
        position: fixed;
        bottom: 12px;
        left: 12px;
        right: 12px;
        z-index: 50;
        margin-top: 0;
        background: var(--osk-primary, #D85A2C);
        color: #151b1a;
        font-weight: 600;
    }
}

@media (max-width: 375px) {
    .production-run-scene { min-height: 220px; }
    .production-run-scene__player-base,
    .production-run-scene__player-gear { left: 38%; bottom: 14%; width: 96px; height: 96px; }
    .production-run-scene__enemy { width: 64px; height: 64px; }
}

/* ===================================================================
   §7.5 Reduced-motion substitutions.
   All animation/transition → none. Night tint remains (information).
   HUD feedback ≤150ms is already capped; reduced-motion zeroes it.
   =================================================================== */
@media (prefers-reduced-motion: reduce) {
    .ui-dial-fill,
    .ui-modal-scrim,
    .ui-modal,
    .ui-banner,
    .ui-slot,
    .production-run-scene__enemy,
    .production-run-scene__player-base,
    .production-run-scene__player-gear {
        transition: none !important;
        animation: none !important;
    }
}

/* ===================================================================
   §7.7 / WCAG AA — keyboard focus ring.
   Every interactive element gets a visible 2px focus ring using the
   --osk-focus-ring token (Ember 300, contrast ≥ 3:1 against surfaces).
   Never colour-only: the ring is a shape change (outline + offset).
   =================================================================== */
:focus-visible {
    outline: 2px solid var(--osk-focus-ring, #E8895C);
    outline-offset: 2px;
}

/* Screen-reader-only skip link for keyboard navigation (§7.6). */
.osk-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 9999;
    padding: var(--osk-space-2) var(--osk-space-4);
    background: var(--osk-primary, #D85A2C);
    color: var(--osk-bg, #0E0C0A);
    font-weight: 600;
    border-radius: 0 0 var(--osk-radius-md) 0;
}
.osk-skip-link:focus {
    left: 0;
}
