:root {
  --ink: #19193c;
  --blue: #19193c;
  --cyan: #4bbec8;
  --yellow: #ffd52b;
  --orange: #ff8a24;
  --cream: #afdce6;
  --white: #fff;
  --danger: #ed4c4c;
}

* { box-sizing: border-box; }
.webp-picture { display: contents; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Galano Grotesque", Poppins, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 50% 35%, #102b42 0, #080d20 58%, #030712 100%);
}

.script-warning { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 20px; visibility: hidden; opacity: 0; color: #fff; background: radial-gradient(circle at 50% 20%, #17465a, #19193c 55%, #071521); animation: reveal-script-warning 0s 1.8s forwards; }
.script-warning > div { width: min(620px, 100%); padding: clamp(26px, 6vw, 50px); border: 1px solid #4bbec877; border-radius: 22px; background: #111833f2; box-shadow: 0 26px 80px #0009; text-align: center; }
.script-warning img { display: block; width: min(300px, 82%); height: auto; margin: 0 auto 28px; }
.script-warning h1 { margin: 0 0 17px; font-size: clamp(28px, 6vw, 46px); line-height: 1.06; }
.script-warning p:not(.eyebrow) { margin: 0 auto; max-width: 52ch; color: #d7e9ed; line-height: 1.6; }
.script-warning a { display: inline-flex; margin-top: 24px; padding: 12px 18px; border: 1px solid #4bbec8; border-radius: 10px; color: #fff; background: #4bbec820; font-weight: 850; text-decoration: none; }
.game-js-ready .script-warning { display: none; animation: none; }

button, kbd { font: inherit; }
button { touch-action: manipulation; }

.app { width: min(1480px, 100%); height: 100dvh; margin: auto; padding: 14px; }
.topbar { display: none; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mobile-home { display: none; }
.brand { display: flex; gap: 11px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 112px; height: 46px; padding: 4px; border-radius: 9px; background: var(--ink); box-shadow: 0 8px 22px #19193c22; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 19px; line-height: 1.1; }
.brand small { margin-top: 3px; color: #557078; font-weight: 650; }
.sound-button { width: 44px; height: 44px; border: 1px solid #c8c8c8; border-radius: 50%; color: var(--ink); background: #fff; font-size: 22px; font-weight: 900; cursor: pointer; }

.game-shell { display: grid; grid-template-columns: minmax(0, 1fr) clamp(220px, 19vw, 280px); height: calc(100dvh - 28px); overflow: hidden; border: 0; border-radius: 22px; background: var(--ink); box-shadow: 0 18px 55px #0008; }
.hud { order: 2; display: flex; flex-direction: column; align-items: stretch; min-height: 0; padding: clamp(20px, 3vw, 38px); color: #fff; background: #19193c; }
.hud-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: auto; color: inherit; text-decoration: none; }
.hud-brand img { display: block; width: 100%; max-width: 230px; height: auto; object-fit: contain; }
.hud-brand strong { max-width: 15ch; font-size: 17px; line-height: 1.12; }
.hud-home-link { display: inline-flex; align-items: center; min-height: 34px; padding: 7px 12px; border: 1px solid #4bbec866; border-radius: 999px; color: var(--cream); background: #4bbec812; font-size: 11px; font-weight: 800; letter-spacing: .04em; transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease; }
.hud-brand:hover .hud-home-link, .hud-brand:focus-visible .hud-home-link { color: #fff; border-color: var(--cyan); background: #4bbec82b; transform: translateX(-2px); }
.hud-brand:focus-visible { outline: 2px solid var(--cyan); outline-offset: 5px; border-radius: 10px; }
.hud-item { display: block; padding: 18px 0; border-bottom: 1px solid #ffffff1c; }
.hud-item:nth-child(2), .hud-item:nth-child(3) { justify-content: initial; }
.hud-item span, .hud-help span { display: block; margin-bottom: 5px; color: #afdce6; font-size: 11px; text-transform: uppercase; letter-spacing: .11em; font-weight: 800; }
.hud-item strong { font-size: clamp(20px, 3vw, 28px); font-variant-numeric: tabular-nums; }
#time { display: block; color: #fff; line-height: 1.12; overflow-wrap: anywhere; }
#time b { display: block; font-size: clamp(18px, 1.8vw, 24px); font-weight: 900; }
#time small { display: block; margin-top: 5px; color: #afdce6; font-size: clamp(10px, .95vw, 13px); font-weight: 600; line-height: 1.28; }
.target-detail { display: none; }
#lives { color: var(--yellow); letter-spacing: 3px; font-size: clamp(15px, 2vw, 20px); }
.hud-help { padding-top: 22px; }
.hud-help p { margin: 8px 0; }
.hud-best { margin-top: auto; padding-top: 18px; color: #afdce6; font-size: 12px; }
.hud-best strong { display: block; margin-top: 3px; color: #fff; font-size: 20px; }

.canvas-wrap { order: 1; position: relative; min-width: 0; height: 100%; overflow: hidden; background-color: #19193c; background-image: url('assets/factory-bg-desktop.png'); background-image: image-set(url('assets/factory-bg-desktop.webp') type('image/webp'), url('assets/factory-bg-desktop.png') type('image/png')); background-position: center; background-size: cover; background-repeat: no-repeat; }
.canvas-wrap::before { content: ''; position: absolute; z-index: 0; inset: 0; pointer-events: none; background: #020914; opacity: 0; transition: opacity .14s ease; }
.canvas-wrap.blackout-mode::before { opacity: .72; }
.canvas-wrap::after { content: ''; position: absolute; z-index: 2; right: 0; bottom: 0; left: 0; height: 10px; pointer-events: none; background: linear-gradient(to bottom, transparent, #19193c); }
canvas { position: relative; z-index: 1; display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; transition: filter .14s ease; }
.canvas-wrap.blackout-mode canvas { filter: grayscale(1) brightness(.78) contrast(1.12); }
.overlay { position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; padding: 20px; background: linear-gradient(120deg, rgba(25,25,60,.92), rgba(75,190,200,.42)); transition: opacity .22s, visibility .22s; }
.overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.overlay-card { width: min(620px, 100%); max-height: calc(100% - 20px); padding: clamp(22px, 4vw, 40px); overflow: auto; border-radius: 22px; color: #fff; background: rgba(25,25,60,.94); border: 1px solid #4bbec866; box-shadow: 0 24px 70px #19193c80; backdrop-filter: blur(10px); }
.overlay-card.is-intro { overflow: hidden; }
.overlay-card.is-intro #overlayTitle, .overlay-card.is-intro #overlayText { display: none; }
.overlay-logo { display: block; width: min(330px, 78%); height: auto; margin: 0 0 22px; }
.eyebrow { margin: 0 0 8px; color: #4bbec8; text-transform: uppercase; letter-spacing: .11em; font-size: 12px; font-weight: 900; }
h1 { margin: 0; font-size: clamp(31px, 5vw, 54px); line-height: .98; letter-spacing: -.045em; }
#overlayText { max-width: 52ch; color: #afdce6; line-height: 1.55; }
.leaderboard { margin: 16px 0 20px; padding: 12px 14px; border: 1px solid #4bbec84d; border-radius: 14px; background: #081c32a6; }
.leaderboard-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 7px; }
.leaderboard-head h2 { margin: 0; color: var(--yellow); font-size: 18px; letter-spacing: .04em; }
.leaderboard-open { padding: 3px 0; border: 0; color: var(--cream); background: transparent; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .09em; cursor: pointer; }
.leaderboard-open b { display: inline-block; margin-left: 3px; color: var(--cyan); transition: transform .18s ease; }
.leaderboard-open:hover, .leaderboard-open:focus-visible { color: #fff; }
.leaderboard-open:hover b, .leaderboard-open:focus-visible b { transform: translateX(3px); }
.leaderboard-open:focus-visible { outline: 2px solid var(--yellow); outline-offset: 4px; border-radius: 3px; }
.leaderboard ol { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.leaderboard li { display: grid; grid-template-columns: 24px 48px minmax(70px, 1fr) 72px; align-items: center; min-height: 27px; padding: 2px 7px; border-radius: 7px; color: #dceef1; background: #ffffff08; font-size: 12px; font-variant-numeric: tabular-nums; }
.leaderboard li b { color: var(--cyan); }
.leaderboard li strong { color: #fff; letter-spacing: .13em; }
.leaderboard li span { justify-self: end; color: #fff; font-size: 14px; font-weight: 900; }
.leaderboard li time { justify-self: end; color: #8fb4ba; font-size: 10px; }
.leaderboard-form { margin-top: 10px; padding-top: 10px; border-top: 1px solid #ffffff17; }
.leaderboard-form[hidden] { display: none; }
.leaderboard-form label { display: block; margin-bottom: 7px; color: #fff; font-size: 13px; font-weight: 800; }
.leaderboard-form div { display: flex; gap: 8px; }
.leaderboard-form input { width: 92px; min-height: 40px; padding: 7px 10px; border: 1px solid #4bbec8aa; border-radius: 9px; outline: 0; color: #fff; background: #ffffff0d; font: 900 19px/1 monospace; letter-spacing: .18em; text-align: center; text-transform: uppercase; }
.leaderboard-form input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px #4bbec824; }
.leaderboard-form button { min-height: 40px; padding: 7px 14px; border: 0; border-radius: 9px; color: var(--ink); background: var(--yellow); font-weight: 900; cursor: pointer; }
.leaderboard-form button:disabled { opacity: .55; cursor: wait; }
.leaderboard-form small { display: block; margin-top: 5px; color: #8fb4ba; font-size: 10px; }
.leaderboard-status { min-height: 0; margin: 7px 0 0; color: var(--cream); font-size: 11px; font-weight: 700; }
.leaderboard-status:empty { display: none; }
.game-start-count { margin: 8px 0 0; padding-top: 7px; border-top: 1px solid #ffffff12; color: #82aab0; font-size: 10px; text-align: right; }
.game-start-count strong { color: var(--cream); font-variant-numeric: tabular-nums; }
.competition-status { margin: 8px 0 0; padding: 7px 9px; border: 1px solid #ffd52b55; border-radius: 7px; color: #fff1ad; background: #ffd52b12; font-size: 10px; line-height: 1.35; text-align: center; }
.competition-status[hidden] { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 20px 0 24px; font-size: 14px; font-weight: 750; }
.legend i { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 6px; border-radius: 8px; font-style: normal; color: #19193c; }
.legend .good { background: var(--yellow); }
.legend .bad { background: var(--danger); color: #fff; }
.overlay-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.primary, .secondary { padding: 13px 20px; border-radius: 10px; font-weight: 850; cursor: pointer; }
.primary { border: 0; background: #4bbec8; color: #19193c; font-size: 17px; box-shadow: 0 7px 0 #2b8f99; }
.primary:active { transform: translateY(3px); box-shadow: 0 4px 0 #2b8f99; }
.secondary { border: 1px solid #4bbec866; color: #fff; background: #ffffff0b; }
.secondary:hover { background: #4bbec820; border-color: #4bbec8; }
.controls-hint { margin: 19px 0 0; color: #9dbfc3; font-size: 13px; }
.meta-links { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: #6f9da3; font-size: 10px; }
.privacy-link { margin: 0; padding: 0; border: 0; color: #afdce6; background: transparent; font-size: 11px; text-decoration: underline; cursor: pointer; }
.privacy-link:hover { color: #fff; }
kbd { display: inline-grid; min-width: 24px; height: 24px; place-items: center; padding: 0 5px; border-radius: 6px; color: #fff; background: #ffffff16; border: 1px solid #ffffff2c; }

:where(html, .overlay, .overlay-card, .modal-body) { scrollbar-width: thin; scrollbar-color: var(--cyan) transparent; }
:where(html, .overlay, .overlay-card, .modal-body)::-webkit-scrollbar { width: 10px; height: 10px; }
:where(html, .overlay, .overlay-card, .modal-body)::-webkit-scrollbar-track { margin-block: 8px; border-radius: 999px; background: transparent; }
:where(html, .overlay, .overlay-card, .modal-body)::-webkit-scrollbar-thumb { min-height: 42px; border: 2px solid transparent; border-radius: 999px; background: linear-gradient(180deg, #62d8e2, #258c9b) padding-box; }
:where(html, .overlay, .overlay-card, .modal-body)::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #8aebf2, #35a9b7) padding-box; }

@media (min-width: 801px) {
  .overlay-card.is-result { width: min(700px, 100%); max-height: calc(100% - 32px); padding: 24px 30px 26px; }
  .overlay-card.is-result .overlay-logo { width: min(230px, 46%); margin-bottom: 12px; }
  .overlay-card.is-result .eyebrow { margin-bottom: 5px; }
  .overlay-card.is-result h1 { font-size: clamp(36px, 4vw, 48px); }
  .overlay-card.is-result #overlayText { margin: 11px 0; line-height: 1.4; }
  .overlay-card.is-result .leaderboard { margin: 11px 0 14px; padding: 10px 12px; }
  .overlay-card.is-result .legend, .overlay-card.is-result .controls-hint { display: none; }
}
.toast { position: absolute; z-index: 4; left: 50%; top: 28px; width: max-content; max-width: calc(100% - 110px); translate: -50% -12px; padding: 9px 14px; border-radius: 30px; opacity: 0; color: #fff; background: #19193cee; font-weight: 850; line-height: 1.25; text-align: center; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; translate: -50% 0; }
.pause-button { position: absolute; z-index: 4; top: 18px; right: 18px; width: 46px; height: 46px; padding: 0; border: 1px solid #4bbec8aa; border-radius: 50%; color: #fff; background: linear-gradient(145deg, #123d59ee, #19193cee); box-shadow: 0 8px 22px #00182077, inset 0 1px 0 #ffffff38; cursor: pointer; backdrop-filter: blur(7px); transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.pause-button::before, .pause-button::after { content: ''; position: absolute; top: 13px; width: 5px; height: 18px; border-radius: 2px; background: currentColor; box-shadow: 0 1px 1px #00182055; }
.pause-button::before { left: 15px; }
.pause-button::after { right: 15px; }
.pause-button[hidden] { display: none; }
.pause-button:hover { color: #071f3b; border-color: #83e3ec; background: #55d5e2; box-shadow: 0 10px 26px #00182088, 0 0 0 3px #4bbec82b; transform: translateY(-1px); }
.pause-button:focus-visible { outline: 3px solid #ffd52b; outline-offset: 3px; }
.pause-button:active { transform: translateY(1px) scale(.97); }
.pause-overlay { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; padding: 18px; color: #fff; background: #071f3be8; backdrop-filter: blur(9px); }
.pause-overlay.hidden { display: none; }
.pause-card { width: min(440px, 100%); padding: clamp(26px, 5vw, 42px); border: 1px solid #4bbec866; border-radius: 22px; text-align: center; background: #19193cf5; box-shadow: 0 28px 80px #00182099; }
.pause-card h2 { margin: 4px 0 14px; font-size: clamp(28px, 5vw, 42px); line-height: 1.05; }
.pause-card p { color: #afdce6; font-size: 17px; }
.pause-card p strong { color: #ffd52b; font-size: 24px; font-variant-numeric: tabular-nums; }
.pause-card .primary { margin: 10px 0 19px; }
.pause-card small { display: block; color: #8fb4ba; }

footer { display: none; justify-content: space-between; gap: 20px; padding: 7px 8px 0; color: #5e5e72; font-size: 13px; }

.info-modal { width: min(820px, calc(100% - 24px)); max-height: min(86dvh, 850px); padding: 0; overflow: hidden; border: 1px solid #4bbec866; border-radius: 20px; color: #19193c; background: #fff; box-shadow: 0 30px 90px #19193c66; }
.info-modal::backdrop { background: #19193cbb; backdrop-filter: blur(5px); }
.modal-close { position: absolute; z-index: 2; top: 13px; right: 14px; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid #ffffff44; border-radius: 50%; color: #fff; background: #ffffff12; font-size: 25px; cursor: pointer; }
.modal-head { display: flex; align-items: center; gap: 22px; min-height: 128px; padding: 24px 70px 24px 28px; color: #fff; background: #19193c; }
.modal-head img { width: min(230px, 42%); height: auto; }
.modal-head span { color: #4bbec8; font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .12em; }
.modal-head h2 { margin: 5px 0 0; font-size: clamp(25px, 4vw, 38px); line-height: 1; }
.modal-body { max-height: calc(min(86dvh, 850px) - 128px); padding: 28px; overflow: auto; line-height: 1.55; }
.modal-body h3 { margin: 26px 0 8px; color: #19193c; }
.modal-body ol, .modal-body ul { padding-left: 22px; }
.modal-body li { margin: 7px 0; }
.company-about { font-size: 16px; }
.company-logo { display: block; width: min(290px, 72%); max-height: 105px; margin: 0 auto 26px; object-fit: contain; }
.company-slogan { margin: 24px 0; padding: 17px 20px; border-left: 5px solid #4bbec8; color: #19193c; background: #afdce640; font-size: clamp(19px, 3vw, 25px); font-weight: 850; line-height: 1.25; }
.creator-credit { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 18px; margin: 28px 0 0; padding: 17px 19px; border: 1px solid #4bbec866; border-radius: 13px; background: #f0f8f9; }
.creator-credit span { color: #5e5e72; font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.creator-credit strong { grid-row: 1 / 3; grid-column: 2; color: #167f89; font-size: 25px; }
.creator-credit small { color: #5e5e72; }
.modal-body a { color: #167f89; font-weight: 750; }
.modal-body .secondary { color: #19193c; border-color: #4bbec8; background: #afdce655; }
.info-modal kbd { color: #19193c; background: #e4f2f4; border-color: #b7d9de; box-shadow: 0 2px 0 #8ebbc1; font-weight: 800; }
.first-run-modal { width: min(720px, calc(100% - 24px)); }
.first-run-body { text-align: center; }
.first-run-lead { max-width: 58ch; margin: 0 auto 20px; color: #292947; font-size: 17px; line-height: 1.55; }
.first-run-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 22px; text-align: left; }
.first-run-steps p { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 12px; margin: 0; padding: 15px; border: 1px solid #4bbec866; border-radius: 13px; background: #afdce638; }
.first-run-steps b { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: #19193c; background: var(--yellow); font-size: 18px; }
.first-run-steps span, .first-run-steps small { display: block; }
.first-run-steps strong { color: #167f89; }
.first-run-steps small { margin-top: 4px; color: #5e5e72; line-height: 1.35; }
.first-run-confirm { min-width: 150px; }
.leaderboard-modal { width: min(680px, calc(100% - 24px)); }
.leaderboard-full-body { background: linear-gradient(180deg, #f8fcfc, #eef7f8); }
.leaderboard-full-intro { margin: 0 0 18px; color: #4d5c67; font-size: 13px; }
.leaderboard-full { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; counter-reset: leaderboard; }
.leaderboard-full li { display: grid; grid-template-columns: 32px 64px minmax(70px, 1fr) 84px; align-items: center; min-height: 36px; padding: 5px 11px; border: 1px solid #d7e9ec; border-radius: 9px; color: #31424e; background: #fff; box-shadow: 0 2px 8px #17243b0b; font-size: 13px; font-variant-numeric: tabular-nums; }
.leaderboard-full li:nth-child(-n+3) { border-color: #4bbec866; background: linear-gradient(90deg, #dff5f7, #fff); }
.leaderboard-full li:first-child { border-color: #e5bd20; background: linear-gradient(90deg, #fff3b8, #fff); }
.leaderboard-full li b { color: #168491; }
.leaderboard-full li:first-child b { color: #a17d00; }
.leaderboard-full li strong { color: var(--ink); letter-spacing: .13em; }
.leaderboard-full li span { justify-self: end; color: var(--ink); font-size: 15px; font-weight: 900; }
.leaderboard-full li time { justify-self: end; color: #67838a; font-size: 10px; }
.leaderboard-full li.is-empty { display: block; padding: 24px 14px; color: #67838a; text-align: center; }
.leaderboard-full-total { margin: 17px 0 0; color: #67838a; font-size: 12px; text-align: right; }
.leaderboard-full-total strong { color: #167f89; font-size: 14px; font-variant-numeric: tabular-nums; }
.catalog-hint { position: relative; z-index: 0; border-color: var(--yellow); animation: catalog-button-pulse 1.15s ease-in-out infinite; }
.catalog-hint::after { content: ''; position: absolute; z-index: -1; inset: -5px; border: 2px solid #ffd52bcc; border-radius: 14px; pointer-events: none; animation: catalog-ring-pulse 1.15s ease-out infinite; }
.rule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rule-item { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 13px; min-height: 96px; padding: 11px 16px 11px 10px; border-radius: 12px; background: #afdce64d; }
.rule-item .webp-picture { display: block; width: 72px; height: 72px; }
.rule-grid img { display: block; width: 72px; height: 72px; object-fit: contain; filter: drop-shadow(0 5px 6px #19193c2e); }
.rule-copy { display: grid; min-width: 0; gap: 5px; }
.rule-copy b { color: #167f89; font-size: 15px; line-height: 1.15; }
.rule-copy span { color: #292947; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.legal-note { margin-top: 0; padding: 16px 18px; border-left: 4px solid #4bbec8; background: #afdce640; }
.sign-category { margin-top: 24px; padding: 18px 20px; border: 1px solid #c8c8c8; border-radius: 14px; }
.sign-category h3 { margin-top: 0; }
.sign-category h4 { margin: 16px 0 3px; color: #167f89; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.sign-category > p { margin-top: 4px; color: #5d5d70; }
.sign-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 12px; margin-top: 20px; }
.sign-card { display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 12px 10px 14px; border: 1px solid #e0e6e7; border-radius: 12px; background: #f8faf9; text-align: center; }
.sign-card img { display: block; width: min(112px, 100%); aspect-ratio: 1; object-fit: contain; }
.sign-card strong { margin-top: 9px; font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.sign-category.ban { border-left: 5px solid #e53935; }
.sign-category.warning { border-left: 5px solid #ffd126; }
.sign-category.mandatory { border-left: 5px solid #078bc7; }
.sign-category.fire { border-left: 5px solid #ed332d; }
.sign-category.rescue { border-left: 5px solid #25a34a; }
.sign-category.road { border-left: 5px solid #666; }

@media (max-width: 800px) {
  body { background: var(--ink); }
  .app { width: 100%; height: auto; min-height: 100dvh; padding: 0; background: var(--ink); }
  .topbar { position: relative; z-index: 11; display: flex; min-height: 42px; margin: 0; padding: 4px 42px; background: linear-gradient(180deg, #20204a, var(--ink)); }
  .brand { justify-content: center; width: 100%; }
  .brand > span:not(.brand-mark) { display: none; }
  .brand-mark { width: 88px; height: 31px; padding: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .mobile-home, .sound-button { position: absolute; top: 50%; display: grid; place-items: center; width: 30px; height: 30px; translate: 0 -50%; border: 1px solid #4bbec866; border-radius: 50%; color: #fff; background: #ffffff0b; box-shadow: none; }
  .mobile-home { left: 7px; }
  .mobile-home svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
  .sound-button { right: 7px; font-size: 15px; }
  .game-shell { display: block; height: auto; border: 0; border-radius: 0; box-shadow: none; }
  .hud { display: grid; grid-template-columns: repeat(3, 1fr); min-height: 59px; padding: 7px 12px 6px; row-gap: 2px; }
  .hud-brand, .hud-help, .hud-best { display: none; }
  .hud-item { display: block; padding: 0; border: 0; }
  .hud-time { text-align: center; }
  .hud-item:nth-child(4) { text-align: right; }
  .hud-item span { display: block; margin-bottom: 1px; font-size: 9px; }
  #time small { display: none; }
  .target-detail { display: block; grid-column: 1 / -1; margin: 0; overflow: hidden; color: #afdce6; font-size: clamp(7px, 2vw, 9px); font-weight: 600; line-height: 1.15; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
  .canvas-wrap { aspect-ratio: 3 / 4; height: auto; background-image: url('assets/factory-bg-mobile.png'); background-image: image-set(url('assets/factory-bg-mobile.webp') type('image/webp'), url('assets/factory-bg-mobile.png') type('image/png')); background-position: center; }
  .overlay { position: fixed; inset: 42px 0 0; align-items: start; padding: 12px 10px max(18px, env(safe-area-inset-bottom)); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; background: linear-gradient(155deg, rgba(25,25,60,.98), rgba(8,46,66,.96)); scrollbar-width: none; }
  .overlay::-webkit-scrollbar { display: none; }
  .overlay-card, .overlay-card.is-intro { width: min(620px, 100%); max-height: none; padding: 20px 19px 24px; overflow: visible; }
  .overlay-logo { width: min(280px, 82%); margin: 0 auto 16px; }
  .leaderboard { margin: 12px 0 15px; padding: 10px; }
  .leaderboard li { grid-template-columns: 22px 42px minmax(54px, 1fr) 64px; padding-inline: 5px; }
  .leaderboard-open { font-size: 9px; }
  .game-start-count { text-align: center; }
  .overlay-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .overlay-actions .primary { grid-column: 1 / -1; }
  .controls-hint { display: block; margin-top: 14px; font-size: 12px; line-height: 1.4; }
  .pause-button { top: 12px; right: 12px; width: 42px; height: 42px; }
  .modal-head { display: block; min-height: 0; padding: 20px 56px 18px 20px; }
  .modal-head img { width: 170px; max-width: 70%; margin-bottom: 14px; }
  .modal-body { max-height: calc(90dvh - 145px); padding: 20px; }
  .rule-grid { grid-template-columns: 1fr; }
  .first-run-steps { grid-template-columns: 1fr; }
  .rule-item { grid-template-columns: 64px minmax(0, 1fr); min-height: 82px; padding: 9px 13px 9px 8px; }
  .rule-item .webp-picture { width: 64px; height: 64px; }
  .rule-grid img { width: 64px; height: 64px; }
  .sign-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .sign-card { padding: 9px 7px 11px; }
  .sign-card img { width: min(96px, 100%); }
  .leaderboard-modal .modal-head { display: flex; align-items: center; gap: 13px; }
  .leaderboard-modal .modal-head img { width: 126px; max-width: 46%; margin: 0; }
  .leaderboard-modal .modal-body { max-height: calc(90dvh - 105px); padding: 15px 12px 18px; }
  .leaderboard-full-intro { margin-bottom: 12px; font-size: 11px; }
  .leaderboard-full li { grid-template-columns: 25px 48px minmax(58px, 1fr) 65px; min-height: 34px; padding: 4px 7px; font-size: 11px; }
  .leaderboard-full li span { font-size: 13px; }
  .leaderboard-full li time { font-size: 9px; }
}

@media (min-width: 801px) and (max-height: 620px) {
  .app { padding: 8px; }
  .game-shell { height: calc(100dvh - 16px); border-radius: 16px; }
  .hud { padding: 18px; }
  .hud-brand { margin-bottom: 10px; }
  .hud-item { padding: 10px 0; }
  .hud-help { display: none; }
  .overlay-card.is-intro { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
}

@media (orientation: landscape) and (max-width: 1000px) and (max-height: 600px) {
  html, body { width: 100%; height: 100%; overflow: hidden; background: var(--ink); }
  .app { display: flex; width: 100%; height: 100dvh; min-height: 0; flex-direction: column; padding: 0; overflow: hidden; }
  .topbar { position: relative; z-index: 11; display: flex; flex: 0 0 42px; align-items: center; justify-content: space-between; min-height: 42px; margin: 0; padding: 4px 42px; background: linear-gradient(180deg, #20204a, var(--ink)); }
  .brand { justify-content: center; width: 100%; }
  .brand > span:not(.brand-mark) { display: none; }
  .brand-mark { display: grid; width: 88px; height: 31px; padding: 0; place-items: center; border-radius: 0; background: transparent; box-shadow: none; }
  .mobile-home, .sound-button { position: absolute; top: 50%; display: grid; width: 30px; height: 30px; place-items: center; translate: 0 -50%; border: 1px solid #4bbec866; border-radius: 50%; color: #fff; background: #ffffff0b; box-shadow: none; }
  .mobile-home { left: 7px; }
  .mobile-home svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
  .sound-button { right: 7px; font-size: 15px; }
  .game-shell { display: flex; height: calc(100dvh - 42px); min-height: 0; flex: 1 1 auto; flex-direction: column; overflow: hidden; border: 0; border-radius: 0; background: #080d20; box-shadow: none; }
  .hud { order: 1; display: grid; grid-template-columns: repeat(3, 1fr); flex: 0 0 62px; min-height: 62px; padding: 6px 14px 5px; row-gap: 1px; }
  .hud-brand, .hud-help, .hud-best { display: none; }
  .hud-item { display: block; padding: 0; border: 0; }
  .hud-time { text-align: center; }
  .hud-item:nth-child(4) { text-align: right; }
  .hud-item span { display: block; margin-bottom: 0; font-size: 8px; }
  .hud-item strong { font-size: 19px; }
  #time b { font-size: 19px; }
  #time small { display: none; }
  #lives { font-size: 15px; }
  .target-detail { display: block; grid-column: 1 / -1; margin: 0; overflow: hidden; color: #afdce6; font-size: 8px; font-weight: 600; line-height: 1.1; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
  .canvas-wrap { order: 2; width: 100%; max-width: calc((100dvh - 104px) * 2.15); height: auto; min-height: 0; flex: 1 1 auto; align-self: center; aspect-ratio: auto; background-image: url('assets/factory-bg-desktop.png'); background-image: image-set(url('assets/factory-bg-desktop.webp') type('image/webp'), url('assets/factory-bg-desktop.png') type('image/png')); background-position: center 58%; box-shadow: 0 0 38px #000a; }
  .overlay { position: fixed; inset: 42px 0 0; align-items: start; padding: 10px max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); overflow-x: hidden; overflow-y: auto; }
  .overlay-card, .overlay-card.is-intro { width: min(760px, 100%); max-height: none; padding: 18px 22px 22px; overflow: visible; }
  .overlay-logo { width: min(190px, 42%); margin: 0 auto 10px; }
  .pause-button { top: 8px; right: max(8px, env(safe-area-inset-right)); width: 38px; height: 38px; }
  .pause-button::before, .pause-button::after { top: 10px; height: 16px; }
  .pause-button::before { left: 12px; }
  .pause-button::after { right: 12px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } .catalog-hint { animation: none; outline: 3px solid var(--yellow); outline-offset: 3px; } .catalog-hint::after { animation: none; } }
@keyframes catalog-button-pulse { 0%, 100% { color: #fff; background: #ffffff0b; box-shadow: 0 0 0 #ffd52b00; transform: scale(1); } 50% { color: #19193c; background: var(--yellow); box-shadow: 0 0 24px #ffd52b99; transform: scale(1.035); } }
@keyframes catalog-ring-pulse { 0% { opacity: .9; transform: scale(.98); } 70%, 100% { opacity: 0; transform: scale(1.12); } }
@keyframes reveal-script-warning { to { visibility: visible; opacity: 1; } }

.install-card { margin-bottom: 22px; padding: 18px; border: 1px solid #48c3d0; border-radius: 18px; background: #e5f6f8; color: #19193c; }
.install-card[hidden], #installOpen[hidden] { display: none; }
.install-icon { float: left; margin: 0 14px 8px 0; border-radius: 14px; }
.install-card h3 { margin: 0 0 10px; font-size: 21px; line-height: 1.2; }
.install-card p { font-size: 15px; line-height: 1.5; }
.install-card .primary { clear: both; display: block; width: 100%; white-space: normal; }
.install-card small { display: block; margin-top: 12px; font-size: 12px; line-height: 1.5; }
.install-card .install-help { padding: 12px; background: #fff; border-radius: 10px; }
