@font-face { font-family: px; src: local('Courier New'); }
:root { --ink: #f4ead8; --red: #c0262d; --gold: #e8b84a; --bg: rgba(20, 16, 14, 0.92); --line: rgba(232, 184, 74, 0.35); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #14110f; color: var(--ink); font: 15px/1.35 "Trebuchet MS", system-ui, sans-serif; user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; display: block; }
button { font: inherit; color: var(--ink); background: #2a221d; border: 2px solid #4a3b30; border-bottom-width: 4px; padding: 9px 16px; border-radius: 6px; cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
button:hover:not(:disabled) { border-color: var(--gold); }
button:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--red); border-color: #7a141a; }
button.big { font-size: 18px; padding: 12px 24px; }
button.danger { background: #3a1414; border-color: #7a2a2a; margin-top: 12px; width: 100%; }
.screen { position: fixed; z-index: 20; }
.screen[hidden], [hidden] { display: none !important; }

/* title */
.title { inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; background: radial-gradient(ellipse at center, rgba(20, 16, 14, 0.15), rgba(20, 16, 14, 0.75) 75%); padding: 20px; }
.logo { font: 900 clamp(54px, 13vw, 110px)/0.86 Impact, "Arial Black", sans-serif; letter-spacing: 0.03em; color: var(--ink); text-shadow: 4px 4px 0 var(--red), 8px 8px 0 #000; }
.logo small { display: block; font-size: 0.24em; letter-spacing: 0.4em; color: var(--gold); text-shadow: 2px 2px 0 #000; }
.logo em { display: block; font: italic 700 0.22em Georgia, serif; color: var(--gold); letter-spacing: 0.05em; margin-top: 10px; text-shadow: 2px 2px 0 #000; }
.title p { margin: 0; text-shadow: 1px 1px 0 #000; font-weight: 700; }
.family { display: flex; flex-direction: column; gap: 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold); text-shadow: 1px 1px 0 #000; }
.family input { font: 700 18px Georgia, serif; text-align: center; padding: 8px; width: 220px; background: var(--bg); color: var(--ink); border: 2px solid var(--line); border-radius: 6px; user-select: text; }
.col { display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.link { color: var(--gold); font-weight: 700; text-shadow: 1px 1px 0 #000; margin-top: 4px; }

/* panels */
.panel { inset: 0; display: flex; flex-direction: column; background: rgba(20, 16, 14, 0.82); }
.panel header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 2px solid var(--line); background: var(--bg); }
.panel header > div { flex: 1; display: flex; flex-direction: column; }
.panel header b { font: 700 20px Georgia, serif; }
.panel header small { color: var(--gold); }
.panel header button { padding: 6px 14px; font-size: 20px; }
.cash { color: #7dff8a; font-weight: 700; font-size: 18px; text-shadow: 1px 1px 0 #000; }
.progress { height: 6px; background: #2a221d; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); }
#districts { flex: 1; overflow-y: auto; padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; align-content: start; }
.district { background: var(--bg); border: 2px solid #3a2e26; border-left: 6px solid var(--gang); border-radius: 8px; padding: 10px; }
.district.locked { opacity: 0.45; }
.district.owned { border-color: var(--red); border-left-color: var(--red); }
.d-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.d-head > div { flex: 1; display: flex; flex-direction: column; }
.d-head small { color: #b8a890; font-size: 12px; }
.d-num { font: 900 22px Impact, sans-serif; color: var(--gold); width: 28px; }
.d-time { width: 14px; height: 14px; border-radius: 50%; }
.d-time.day { background: #ffd84a; } .d-time.dusk { background: #f08a4a; } .d-time.night { background: #8a9aff; box-shadow: inset -4px -2px 0 #14110f; }
.d-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.lvl { padding: 4px 0; font-size: 13px; display: flex; flex-direction: column; align-items: center; line-height: 1.1; min-height: 38px; justify-content: center; }
.lvl i { font-style: normal; font-size: 9px; color: var(--gold); letter-spacing: -1px; }
.lvl.done { background: #5a1a1d; border-color: var(--red); }
.lvl.next { background: var(--red); border-color: var(--gold); animation: pulse 1.2s infinite; }
.lvl.boss span::before { content: '☠ '; font-size: 10px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(232, 184, 74, 0.35); } }
.panel footer { padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); display: flex; justify-content: center; background: var(--bg); border-top: 2px solid var(--line); }
.scroll { flex: 1; overflow-y: auto; padding: 8px 16px 20px; max-width: 640px; width: 100%; margin: 0 auto; }
.scroll h3 { font: 700 15px Georgia, serif; color: var(--gold); text-transform: uppercase; letter-spacing: 0.12em; margin: 18px 0 8px; }
.shop-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--bg); border: 2px solid #3a2e26; border-radius: 8px; margin-bottom: 8px; }
.shop-row > div:first-child { flex: 1; display: flex; flex-direction: column; }
.shop-row small { color: #b8a890; font-size: 12px; }
.shop-row button { min-width: 100px; }
.shop-row button.buy:not(:disabled) { background: #1f4a28; border-color: #2f7a3a; }
.seg { display: flex; gap: 4px; }
.seg button { padding: 6px 10px; font-size: 12px; min-width: 0; }
.seg button.on { background: var(--red); border-color: var(--gold); }

/* cards */
.card { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; background: var(--bg); border: 2px solid var(--line); border-radius: 10px; padding: 20px; text-align: center; box-shadow: 0 10px 0 rgba(0, 0, 0, 0.4); }
.card h2 { font: 900 30px/1 Impact, "Arial Black", sans-serif; letter-spacing: 0.03em; margin: 6px 0 10px; color: var(--ink); text-shadow: 3px 3px 0 var(--red); }
.card small { color: var(--gold); text-transform: uppercase; letter-spacing: 0.1em; font-size: 12px; }
.card p { margin: 8px 0; }
.muted { color: #b8a890; font-size: 13px; }
.stars { color: var(--gold); font-size: 22px; letter-spacing: 4px; min-height: 4px; }
.stars.big { font-size: 40px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.chip { font-size: 11px; padding: 5px 9px; }
.chip.on { background: var(--red); border-color: var(--gold); }
.stats { display: flex; justify-content: center; gap: 18px; margin: 12px 0; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-size: 20px; color: #7dff8a; }
.stats span { font-size: 11px; text-transform: uppercase; color: #b8a890; }
#settings-list { text-align: left; margin-bottom: 12px; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.hud-top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.hud-right { display: flex; gap: 8px; align-items: center; }
.hud-box { background: rgba(20, 16, 14, 0.78); border: 2px solid rgba(232, 184, 74, 0.3); border-radius: 6px; padding: 6px 10px; font-weight: 700; text-shadow: 1px 1px 0 #000; }
#hud-level { font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: 0.08em; }
#hud-goal { font-size: 15px; }
.hud-btn { pointer-events: auto; padding: 6px 12px; background: rgba(42, 34, 29, 0.85); }
.hud-bottom { position: absolute; bottom: max(10px, env(safe-area-inset-bottom)); left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.hp { width: min(260px, 42vw); display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.bar { height: 12px; background: #3a1414; border: 1px solid #000; border-radius: 3px; overflow: hidden; }
#hp-fill { height: 100%; background: linear-gradient(#ff5a5a, #c0262d); transition: width 0.15s; }
.weapon { display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; }
.weapon b { font-size: 14px; color: var(--gold); }
#bossbar { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); width: min(420px, 70vw); text-align: center; font: 700 14px Georgia, serif; text-shadow: 1px 1px 0 #000; }
#bossbar .bar { height: 14px; }
#boss-fill { height: 100%; background: linear-gradient(#ffe070, #d4a017); transition: width 0.1s; }
.touch-btns { display: none; position: absolute; right: 12px; bottom: 74px; flex-direction: column; gap: 10px; align-items: flex-end; }
body.touch .touch-btns { display: flex; }
.touch-btns .hud-btn { width: 54px; height: 54px; border-radius: 50%; padding: 0; font-size: 20px; }
.touch-btns .nade { width: 66px; height: 66px; font-size: 26px; position: relative; }
.touch-btns .nade small { position: absolute; bottom: 2px; right: 6px; font-size: 12px; }
.keys-hint { position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%); font-size: 11px; color: rgba(244, 234, 216, 0.55); text-shadow: 1px 1px 0 #000; white-space: nowrap; }
body.touch .keys-hint { display: none; }
@media (max-width: 700px) { .keys-hint { display: none; } }
.stick { position: fixed; left: -60px; top: -60px; width: 120px; height: 120px; border-radius: 50%; border: 3px solid rgba(244, 234, 216, 0.35); background: rgba(20, 16, 14, 0.25); pointer-events: none; z-index: 11; }
.stick div { position: absolute; left: 35px; top: 35px; width: 44px; height: 44px; border-radius: 50%; background: rgba(244, 234, 216, 0.6); }
.stick.fire { border-color: rgba(192, 38, 45, 0.6); }
.stick.fire div { background: rgba(192, 38, 45, 0.75); }
#pointer { position: fixed; left: 0; top: 0; z-index: 9; color: var(--gold); font-size: 30px; text-shadow: 2px 2px 0 #000; pointer-events: none; animation: bob 0.8s infinite; }
@keyframes bob { 50% { opacity: 0.55; } }
#floats { position: fixed; inset: 0; pointer-events: none; z-index: 9; overflow: hidden; }
.float { position: absolute; left: 0; top: 0; font-weight: 900; font-size: 15px; text-shadow: 1px 1px 0 #000, -1px -1px 0 #000; white-space: nowrap; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 8; box-shadow: inset 0 0 120px 40px rgba(200, 0, 0, 0.55); opacity: 0; transition: opacity 0.12s; }
#vignette.on { opacity: 1; }
#banner { position: fixed; top: 22%; left: 50%; transform: translate(-50%, -20px); z-index: 12; text-align: center; pointer-events: none; opacity: 0; transition: opacity 0.3s, transform 0.3s; display: flex; flex-direction: column; }
#banner.show { opacity: 1; transform: translate(-50%, 0); }
#banner b { font: 900 clamp(28px, 6vw, 46px)/1 Impact, "Arial Black", sans-serif; letter-spacing: 0.04em; text-shadow: 3px 3px 0 var(--red), 5px 5px 0 #000; }
#banner span { font-weight: 700; text-shadow: 1px 1px 0 #000, 0 0 6px #000; margin-top: 6px; }
