:root { font-family: "Segoe UI", Arial, sans-serif; color: #fff3de; background: #122337; font-synthesis: none; color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #ffe38e; outline-offset: 2px; }
h1, h2, p { margin: 0; }
.game-shell {
    width: min(100%, 520px); height: 100vh; height: 100dvh; margin: auto;
    padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    display: flex; flex-direction: column; gap: 4px;
    background: url('../art/backgrounds/warehouse_portrait.png') center / cover no-repeat;
}
.game-shell > * { flex-shrink: 0; }
.game-shell.settings-screen { overflow-y: auto; scrollbar-width: thin; }
.game-masthead { text-shadow: 0 1px 3px #101a2a; }
.game-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.fox-avatar { width: 30px; height: 56px; object-fit: contain; filter: drop-shadow(0 2px 2px #0006); }
.header-center { flex: 1; min-width: 0; height: calc(210px * 235 / 816); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.urgent-order { position: relative; flex-shrink: 0; width: min(100%, 300px); height: 100%; background: url('../art/ui/panels/urgent_order_panel.png') center / 100% 100% no-repeat; color: #653820; text-shadow: none; font-weight: 700; white-space: nowrap; }
.urgent-order-title { position: absolute; top: 4%; left: 9%; right: 35%; height: 27%; padding: 0 4px; display: grid; place-items: center; color: #fff5db; font-size: 13px; line-height: 1; text-shadow: 0 1px 2px #9c291f; }
.urgent-product { position: absolute; left: 6%; top: 36%; width: 17%; height: 57%; }
.urgent-product .product-art { height: 100%; }
.urgent-quantity { position: absolute; left: 25%; top: 43%; width: 22%; text-align: center; font-size: 25px; line-height: 1; }
.urgent-moves { position: absolute; left: 69%; right: 6%; top: 43%; bottom: 13%; padding: 0 3px; display: flex; align-items: center; justify-content: center; gap: 3px; line-height: 1; }
.urgent-moves strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.urgent-moves span { font-size: 11px; }
.game-title { position: relative; flex-shrink: 0; width: min(100%, 210px); min-width: 0; aspect-ratio: 816 / 235; color: #5f3521; text-shadow: none; }
.game-title > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.game-title > div { position: absolute; inset: 29% 16% 10%; transform: translateY(-3px); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.game-title h1 { font-size: 19px; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.icon-button { width: 43px; height: 43px; flex-shrink: 0; padding: 0; background: none; border: 0; border-radius: 11px; }
.game-icon { width: 100%; height: 100%; display: block; object-fit: contain; }
.order-progress { display: flex; align-items: center; gap: 8px; }
.score-badge { width: 90px; aspect-ratio: 298 / 105; flex-shrink: 0; background: url('../art/ui/panels/star_panel.png') center / contain no-repeat; display: grid; place-items: center; padding-left: 25px; padding-right: 7px; color: #633822; text-shadow: none; }
.score-badge strong { font-size: 18px; }
.progress-art { flex: 1; min-width: 0; position: relative; aspect-ratio: 977 / 112; }
.progress-art > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.progress-color { position: absolute; inset: 34% 12% 23% 2.4%; overflow: hidden; border-radius: 20px; clip-path: inset(0 calc(100% - var(--progress)) 0 0); transition: clip-path .2s; }
.progress-color img { position: absolute; width: 140%; height: auto; left: -3%; top: 50%; transform: translateY(-50%); }
.progress-art > strong { position: absolute; inset: 28% 13% 15% 3%; display: grid; place-items: center; font-size: clamp(9px, 2.6vw, 12px); color: #fff8e3; text-shadow: 0 1px 2px #51371e, 0 0 3px #51371e; white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.game-shell > .warehouse {
    flex: 1; min-height: 0;
    display: flex; align-items: center; justify-content: center; padding: 2px;
}
.warehouse-shelves { width: 100%; flex-shrink: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: max-content; align-items: end; gap: 4px; }
.shelf { position: relative; width: 100%; aspect-ratio: var(--shelf-ratio); min-width: 0; filter: drop-shadow(0 3px 3px #2a1c1777); }
.width-1 { grid-column: span 1; --shelf-ratio: 206 / 197; }
.width-2 { grid-column: span 2; --shelf-ratio: 359 / 197; }
.width-3 { grid-column: span 3; --shelf-ratio: 522 / 197; }
.shelf-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.shelf-with-door .shelf-art { object-fit: fill; }
.shelf-closed .shelf-contents { visibility: hidden; }
.shelf-door-state { position: absolute; bottom: 1%; left: 50%; transform: translateX(-50%); padding: 0 2px; border-radius: 3px; background: #192c40ed; color: #ffe8ab; font-size: 8px; line-height: 1.2; white-space: nowrap; }
.shelf-contents { position: absolute; inset: 13% 5% 15%; display: flex; gap: 2px; }
.width-1 .shelf-contents { left: 10%; right: 10%; }
.shelf-position { position: relative; flex: 1; min-width: 0; height: 100%; display: flex; justify-content: center; align-items: end; overflow: hidden; }
.product-button { z-index: 3; width: 100%; min-width: 0; min-height: 0; height: 100%; position: relative; border: 0; background: transparent; padding: 0 2px; display: flex; justify-content: center; align-items: end; border-radius: 5px; transition: transform .12s; animation: reveal .18s ease-out; }
.product-button:active { transform: scale(.94); }
.product-button:disabled { opacity: .8; }
@media (hover: hover) { .product-button:not(:disabled):hover { transform: translateY(-2px); } }
.product-art { display: block; width: 100%; height: 86%; min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 2px 2px #24171066); user-select: none; pointer-events: none; }
.back-product { position: absolute; height: 86%; width: 100%; pointer-events: none; transform-origin: bottom; }
.back-product .product-art { height: 100%; }
.depth-1 { bottom: 11%; transform: translateX(6%) scale(.92); z-index: 2; filter: brightness(.8) saturate(.85); }
.depth-2 { bottom: 22%; transform: translateX(-5%) scale(.82); z-index: 1; filter: brightness(.65) saturate(.7); }
.depth-count { position: absolute; bottom: 0; right: 0; border-radius: 5px; background: #162e41; color: #fff4de; padding: 1px 3px; font-size: 8px; }
.empty-position { color: #d3a77970; font-size: 24px; align-self: center; }
.bottom-panel { padding: 0 1px; }
.tray-panel { color: #fff1d5; }
.tray { position: relative; display: grid; grid-template-columns: repeat(var(--slots), minmax(0, 1fr)); gap: 1%; }
.tray-seven { aspect-ratio: 1028 / 172; padding: 2.2% 2.4% 2.8%; }
.tray-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; object-fit: contain; }
.tray-slot { z-index: 1; min-width: 0; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 1px 2px; }
.tray-slot .product-art { height: 100%; max-height: 100%; object-position: center; }
.slot-placeholder { font-size: 13px; opacity: .35; }
.tray-variable .tray-slot { aspect-ratio: 146 / 172; padding: 13% 6%; background: url('../art/ui/panels/tray_seven_slots.png') left center / 700% 100% no-repeat; }
.occupied { animation: reveal .18s ease-out; }
.bonus-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center; gap: 8px; padding: 5px 10px 0; }
.bonus-button { padding: 0; border: 0; color: #f6e3c9; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; font-size: 9px; text-shadow: 0 1px 2px #231f28; }
.bonus-tile { position: relative; width: min(100%, 54px); aspect-ratio: 1; }
.bonus-tile img { width: 100%; height: 100%; object-fit: contain; opacity: .6; }
.bonus-tile small { position: absolute; right: 0; bottom: 0; display: grid; place-items: center; width: 39%; height: 37%; border-radius: 7px; background: #273a4d; color: #eee0c5; font-size: 7px; text-shadow: none; }
.control-button { min-height: 44px; padding: 9px 14px; color: #f5ead7; background: #315572; border: 1px solid #58758d; border-radius: 11px; font-size: 13px; }
.primary-button { padding: 14px; min-height: 48px; border: 1px solid #ffdc8a; border-radius: 12px; background: #efb44d; color: #443020; font-weight: 700; }
.text-button { padding: 12px 8px; min-height: 44px; border: 0; color: #cad9e4; background: transparent; font-size: 13px; }
.settings-header { padding: 15px 0; text-shadow: 0 1px 3px #122337; }
.settings-header h1 { margin: 5px 0; font-size: 27px; }
.settings-header p { color: #e3d7c5; font-size: 13px; }
.eyebrow { color: #e9be78; font-size: 9px; font-weight: 700; letter-spacing: 1.4px; }
.settings-form { display: flex; flex-direction: column; gap: 18px; background: #172c43eb; padding: 14px; border-radius: 12px; }
.settings-form label { display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: #d3e0ea; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-form input:not([type=checkbox]), .settings-form select { width: 100%; min-height: 46px; padding: 10px; border: 1px solid #6c8597; border-radius: 9px; background: #243e55; color: #fff1d7; }
.settings-form .check-label { flex-direction: row; align-items: center; }
input[type=checkbox] { width: 23px; height: 23px; accent-color: #efb44d; }
.settings-note, .storage-note { font-size: 11px; line-height: 1.5; color: #e0d8c9; }
.storage-note { padding: 3px 6px; background: #172c43dd; border-radius: 5px; }
.visual-preview { margin: 8px 0; padding: 14px; border: 1px solid #65798b; border-radius: 13px; background: #1c3248ed; }
.visual-preview summary { cursor: pointer; min-height: 32px; font-size: 13px; font-weight: 700; color: #f3d39b; }
.visual-preview > p { font-size: 11px; line-height: 1.6; color: #c2d0dc; margin: 8px 0 12px; }
.door-samples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.door-sample { margin: 0; min-width: 0; text-align: center; }
.door-art { display: block; width: 100%; height: auto; }
.door-sample figcaption { margin-top: 8px; font-size: 9px; color: #d7e2eb; overflow-wrap: anywhere; }
.form-error { color: #ffbf9e; padding: 12px; background: #6b352f; border-radius: 9px; font-size: 13px; line-height: 1.5; }
.result-backdrop { position: fixed; inset: 0; padding: 20px; background: #081420d9; display: grid; place-items: center; z-index: 20; overflow-y: auto; }
.result-card { width: min(100%, 370px); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 20px; background: #f9e9cd; color: #573b29; border: 3px solid #d4a467; border-radius: 22px; display: flex; flex-direction: column; gap: 12px; text-align: center; box-shadow: 0 15px 60px #0005; animation: reveal .2s ease-out; }
.result-card > * { flex-shrink: 0; }
.result-card p { font-size: 14px; line-height: 1.5; }
.result-fox { width: 100%; height: min(20dvh, 140px); object-fit: contain; }
.result-card .text-button { color: #795336; }
.loading-message { margin: auto; padding: 15px; border-radius: 12px; background: #172c43db; }
@keyframes reveal { from { opacity: .4; transform: translateY(3px) scale(.96); } to { opacity: 1; transform: none; } }
@media (max-width: 360px), (max-height: 640px) {
    .game-shell { gap: 3px; }
    .bonus-tile { max-width: 44px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; width: 100%; padding: 15px; background: #fff0ce; color: #4b3326; z-index: 100; }
#blazor-error-ui a { color: #1b5478; }
#blazor-error-ui .dismiss { display: none; }
#blazor-error-ui { max-height: 75vh; overflow-y: auto; }
.game-diagnostics { margin-top: 10px; font-size: 12px; }
.game-diagnostics summary { cursor: pointer; font-weight: 700; }
.game-diagnostics-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.game-diagnostics-actions button { padding: 7px 10px; border: 1px solid #795738; border-radius: 6px; background: #fff7e7; color: #4b3326; }
#game-diagnostics-output { max-height: 45vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px; background: #fff7e7; color: #30251e; user-select: text; }
.loading-progress { display: block; width: 100px; height: 100px; margin: 25vh auto 0; }
.loading-progress circle { fill: none; stroke: #e9b46d; stroke-width: 5px; }
.loading-progress-text { text-align: center; margin-top: 20px; }
.loading-progress-text::after { content: var(--blazor-load-percentage-text, "Открываем склад…"); }
