/* Зоряний Бродяга — інтерфейс. Тон порталу: темний космос, один акцент, неон лише на об'єктах карти. */
:root {
    --bg: #0c0e16; --s1: #141723; --s2: #1b1f2e; --s3: #242939; --line: rgba(255,255,255,0.08); --line2: rgba(255,255,255,0.13);
    --t1: #eceef6; --t2: #a2a8bd; --t3: #6f7590; --acc: #8b7bff; --acc2: #a99dff; --acc-soft: rgba(139,123,255,0.14);
    --ok: #4ade80; --warn: #fbbf24; --bad: #fb7185; --cyan: #22d3ee;
    --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--t1); font: 15px/1.4 'Rubik', system-ui, sans-serif; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* --- верхня панель --- */
#hud { position: fixed; left: 0; right: 0; top: 0; z-index: 5; padding: calc(8px + var(--safe-t)) 12px 8px; display: flex; flex-direction: column; gap: 8px; background: linear-gradient(rgba(12,14,22,0.94), rgba(12,14,22,0.75) 75%, rgba(12,14,22,0)); pointer-events: none; }
#hud .loc { display: flex; align-items: baseline; gap: 8px; padding-left: 26px; min-width: 0; }
#hud .loc b { flex: 0 1 auto; min-width: 0; font-family: 'Unbounded', 'Rubik', sans-serif; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hud .loc small { flex: none; font-size: 12px; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hud .loc #locWant { flex: none; }
#hud .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.st { background: rgba(20,23,35,0.85); border: 1px solid var(--line); border-radius: 10px; padding: 5px 8px; min-width: 0; }
.st small { display: block; font-size: 10px; color: var(--t3); text-transform: uppercase; letter-spacing: 0.06em; }
.st b { display: block; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st .bar { display: block; height: 3px; margin-top: 3px; border-radius: 2px; background: var(--s3); overflow: hidden; }
.st .bar u { display: block; height: 100%; width: 0; background: var(--acc); border-radius: 2px; }
.zchip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--z); }
.zchip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--z); }

/* --- перемикач видів --- */
#views { position: fixed; z-index: 5; right: 12px; top: calc(98px + var(--safe-t)); display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: rgba(20,23,35,0.9); border: 1px solid var(--line); }
#views button { height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: none; font-size: 13px; font-weight: 500; color: var(--t2); }
#views button.on { background: var(--s3); color: var(--t1); }

/* --- переліт --- */
#travel { position: fixed; z-index: 6; left: 12px; right: 12px; bottom: calc(14px + var(--safe-b)); padding: 12px 14px; border-radius: 16px; background: rgba(20,23,35,0.95); border: 1px solid var(--line2); }
#travel .tl { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
#travel b { font-size: 14px; font-weight: 600; } #travel small { font-size: 13px; color: var(--t2); font-variant-numeric: tabular-nums; }
#travel .tb { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--s3); overflow: hidden; }
#travel .tb i { display: block; height: 100%; width: 0; background: var(--acc); border-radius: 3px; transition: width 1s linear; }

/* --- нижній лист --- */
.sheet { position: fixed; z-index: 7; left: 0; right: 0; bottom: 0; max-height: 72vh; display: flex; flex-direction: column; background: var(--s1); border-top: 1px solid var(--line2); border-radius: 20px 20px 0 0; padding: 6px 16px calc(14px + var(--safe-b)); box-shadow: 0 -12px 40px rgba(0,0,0,0.5); }
.sheet.tall { max-height: 86vh; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--s3); margin: 4px auto 10px; flex: none; cursor: pointer; }
#sheetBody { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.sh-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sh-h h3 { margin: 0; font-family: 'Unbounded', 'Rubik', sans-serif; font-size: 17px; line-height: 1.2; }
.sh-h small { display: block; font-size: 12.5px; color: var(--t2); margin-top: 2px; }
.sh-h .grow { flex: 1; min-width: 0; }
.x { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--s2); color: var(--t2); font-size: 18px; flex: none; }
.tabs { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--bg); margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: 1; height: 36px; border: 0; border-radius: 9px; background: none; font-size: 13.5px; font-weight: 500; color: var(--t2); white-space: nowrap; padding: 0 10px; }
.tabs button.on { background: var(--s3); color: var(--t1); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line2); background: var(--s2); font-weight: 600; font-size: 14px; }
.btn.primary { background: var(--acc); border-color: transparent; color: #fff; }
.btn.wide { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.row2 { display: flex; gap: 8px; } .row2 > * { flex: 1; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; } .kv span { color: var(--t2); } .kv b { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.note { font-size: 13px; color: var(--t2); margin: 8px 0; }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 11.5px; font-weight: 600; background: var(--s3); color: var(--t2); white-space: nowrap; }
.chip.prod { color: var(--ok); background: rgba(74,222,128,0.12); } .chip.cons { color: var(--warn); background: rgba(251,191,36,0.12); }
.sec { font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--t3); margin: 16px 0 8px; }

/* ринок */
.good { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.good:last-child { border-bottom: 0; }
.gi { width: 34px; height: 34px; border-radius: 10px; background: var(--s2); display: grid; place-items: center; }
.gi svg { width: 20px; height: 20px; }
.good .nm b { display: block; font-size: 14px; font-weight: 600; } .good .nm small { font-size: 12px; color: var(--t2); }
.good .pr { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; line-height: 1.35; }
.good .pr b { font-size: 14px; } .good .pr span { color: var(--t3); }
.good .act { grid-column: 2 / span 2; display: flex; gap: 6px; align-items: center; }
.qty { display: flex; align-items: center; border-radius: 10px; background: var(--bg); border: 1px solid var(--line2); }
.qty button { width: 34px; height: 34px; border: 0; background: none; font-size: 18px; color: var(--t2); }
.qty input { width: 52px; height: 34px; border: 0; background: none; color: var(--t1); text-align: center; font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; outline: none; }
.best { font-size: 11.5px; color: var(--t3); grid-column: 2 / span 2; }
.best b { color: var(--ok); font-weight: 600; }

/* картки (контракти, верф) */
.card { border: 1px solid var(--line); background: var(--s2); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.card .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card b { font-size: 14.5px; } .card .rw { color: var(--ok); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card p { margin: 6px 0 10px; font-size: 13px; color: var(--t2); }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }

/* буріння */
#mine { position: fixed; inset: 0; z-index: 20; background: #05060b; }
#mcv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.mhud { position: absolute; left: 12px; right: 12px; top: calc(10px + var(--safe-t)); display: flex; gap: 8px; align-items: stretch; }
.mhud > div { background: rgba(20,23,35,0.85); border: 1px solid var(--line); border-radius: 10px; padding: 5px 10px; min-width: 64px; }
.mhud small { display: block; font-size: 10px; color: var(--t3); text-transform: uppercase; letter-spacing: 0.06em; }
.mhud b { font-size: 16px; font-variant-numeric: tabular-nums; }
.mhud .heat { flex: 1; } .mhud .heat i { display: block; height: 8px; margin-top: 6px; border-radius: 4px; background: var(--s3); overflow: hidden; }
.mhud .heat u { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--cyan), var(--warn), var(--bad)); }
.mhint { position: absolute; left: 16px; right: 16px; bottom: calc(18px + var(--safe-b)); text-align: center; font-size: 13.5px; color: var(--t2); pointer-events: none; }

.toast { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); top: calc(150px + var(--safe-t)); max-width: calc(100% - 32px); padding: 10px 14px; border-radius: 12px; background: rgba(27,31,46,0.97); border: 1px solid var(--line2); font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,0.45); }
.loading { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--bg); }
.loading b { font-family: 'Unbounded', 'Rubik', sans-serif; font-size: 22px; } .loading small { color: var(--t2); }
[hidden] { display: none !important; }
@media (min-width: 760px) {
    .sheet { left: auto; right: 16px; bottom: 16px; width: 430px; border-radius: 20px; border: 1px solid var(--line2); max-height: calc(100vh - 170px); }
    .sheet.tall { max-height: calc(100vh - 170px); }
    #travel { left: 16px; right: auto; width: 420px; }
    #hud .stats { max-width: 560px; }
}

/* ---------- бій ---------- */
#combat { position: fixed; inset: 0; z-index: 22; background: #05060c; }
#ccv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#cbody { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
#cbody > * { pointer-events: auto; }
.ctop { display: grid; grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr); gap: 8px; align-items: start; padding: calc(10px + var(--safe-t)) 12px 0; }
.cside { background: rgba(20,23,35,0.88); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.cside b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cside small { display: block; font-size: 11px; color: var(--t3); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cside span { display: block; font-size: 11px; color: var(--t2); font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.cside.r { text-align: right; }
.cb { display: block; height: 7px; border-radius: 4px; background: var(--s3); overflow: hidden; }
.cb u { display: block; height: 100%; border-radius: 4px; transition: width 0.45s ease; }
.cb.hull u { background: linear-gradient(90deg, #f97316, #fb7185); } .cb.sh u { background: linear-gradient(90deg, #38bdf8, #7dd3fc); }
.cside.r .cb u { margin-left: auto; }
.cmid { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 4px; }
.cring { --p: 1; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--acc) calc(var(--p) * 360deg), var(--s3) 0); }
.cring b { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #0b0d16; font-family: 'Unbounded', 'Rubik', sans-serif; font-size: 16px; }
.cmid small { font-size: 11px; color: var(--t2); white-space: nowrap; }
.cbot { padding: 0 12px calc(12px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; background: linear-gradient(rgba(5,6,12,0), rgba(5,6,12,0.92) 18%); padding-top: 26px; }
.crange { display: flex; gap: 4px; justify-content: center; }
.crange span { flex: 1; max-width: 110px; text-align: center; font-size: 12px; font-weight: 600; color: var(--t3); padding: 5px 0; border-radius: 8px; background: rgba(27,31,46,0.7); }
.crange span.on { color: #fff; background: var(--acc); }
.cweap { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.cweap .chip.opt { color: var(--ok); background: rgba(74,222,128,0.12); }
.clog { min-height: 34px; font-size: 12.5px; color: var(--t2); text-align: center; line-height: 1.4; }
.clog div:last-child { color: var(--t1); }
.cctl { background: rgba(20,23,35,0.94); border: 1px solid var(--line2); border-radius: 16px; padding: 10px; }
.crow { margin-bottom: 8px; } .crow small { display: block; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--t3); margin: 0 0 4px 2px; }
.seg3, .seg4 { display: grid; gap: 4px; padding: 3px; border-radius: 11px; background: var(--bg); }
.seg3 { grid-template-columns: repeat(3, 1fr); } .seg4 { grid-template-columns: repeat(4, 1fr); }
.seg3 button, .seg4 button { height: 38px; border: 0; border-radius: 8px; background: none; color: var(--t2); font-size: 13px; font-weight: 600; }
.seg3 button.on, .seg4 button.on { background: var(--s3); color: #fff; box-shadow: inset 0 0 0 1px rgba(139,123,255,0.6); }
.seg3 button:disabled, .seg4 button:disabled { opacity: 0.35; }
.fire .btn { min-height: 50px; } .fire .btn.primary { flex: 2; font-size: 16px; }
.hail p { margin: 2px 0 12px; font-size: 15px; line-height: 1.45; } .hail .note { display: block; margin-top: 8px; }
.btn.ghost { background: transparent; }
.cend { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(5,6,12,0.72); }
.endcard { width: 100%; max-width: 380px; background: var(--s1); border: 1px solid var(--line2); border-radius: 20px; padding: 20px; }
.endcard h3 { margin: 0; font-family: 'Unbounded', 'Rubik', sans-serif; font-size: 22px; }
.endcard small { display: block; color: var(--t2); margin: 4px 0 14px; }
.endcard.ok h3 { color: var(--ok); } .endcard.bad h3 { color: var(--bad); }
.endcard .btn { margin-top: 16px; }
.lvl { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 7px; background: var(--acc); color: #fff; font-size: 12px; font-weight: 700; font-family: 'Unbounded', 'Rubik', sans-serif; margin-right: 2px; }
body.incombat #hud, body.incombat #views, body.incombat #travel, body.incombat #sheet { visibility: hidden; }

.cweap .chip { flex: none; }
.clog .pol { color: #93c5fd; font-size: 12px; }
body.incombat .toast { top: auto; bottom: calc(330px + var(--safe-b)); }

/* ---------- фаза 3: інші пілоти, ефір, розшук ---------- */
.comm { position: fixed; z-index: 5; right: 12px; top: calc(144px + var(--safe-t)); width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line); background: rgba(20,23,35,0.9); color: var(--t2); display: grid; place-items: center; }
.comm svg { width: 22px; height: 22px; }
.comm small { position: absolute; left: -6px; bottom: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--s3); color: #d8d3ff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center; }
.comm small:empty { display: none; }
.comm i { position: absolute; right: -3px; top: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 0 2px var(--bg); }
body.incombat .comm, body.incombat .zoomctl { visibility: hidden; }
.clanbtn { top: calc(200px + var(--safe-t)); }
body.incombat .clanbtn { visibility: hidden; }
.zoomctl { position: fixed; z-index: 5; right: 12px; top: calc(256px + var(--safe-t)); display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: rgba(20,23,35,0.9); }
.zoomctl button { width: 46px; height: 42px; border: 0; background: none; color: var(--t2); font-size: 22px; font-weight: 500; line-height: 1; display: grid; place-items: center; }
.zoomctl button + button { border-top: 1px solid var(--line); }
.zoomctl button:active { background: var(--s3); color: var(--t1); }
.zoomctl svg { width: 20px; height: 20px; }
.wchip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; margin-left: 4px; border-radius: 6px; font-size: 11px; font-weight: 700; color: #fecdd3; background: rgba(251,113,133,0.2); }
.chip.bad { color: var(--bad); background: rgba(251,113,133,0.13); } .chip.warn { color: var(--warn); background: rgba(251,191,36,0.13); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.warnbox { font-size: 13px; line-height: 1.45; color: #fecdd3; background: rgba(251,113,133,0.08); border: 1px solid rgba(251,113,133,0.28); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.warnbox b { color: var(--bad); }
.card.wanted { border-color: rgba(251,113,133,0.35); background: rgba(251,113,133,0.06); } .card.wanted .top b { color: var(--bad); }
.autoset { margin-bottom: 2px; }
.autoset button { height: 36px; }
.chatlist { display: flex; flex-direction: column; gap: 6px; min-height: 160px; max-height: 46vh; overflow-y: auto; padding: 2px 2px 8px; overscroll-behavior: contain; }
.msg { align-self: flex-start; max-width: 86%; background: var(--s2); border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; padding: 6px 10px; font-size: 13.5px; user-select: text; -webkit-user-select: text; }
.msg b { display: block; font-size: 11.5px; color: var(--acc2); font-weight: 600; }
.msg small { display: block; font-size: 10.5px; color: var(--t3); margin-top: 2px; }
.msg.own { align-self: flex-end; background: var(--acc-soft); border-color: rgba(139,123,255,0.3); border-radius: 12px 12px 4px 12px; }
.msg.sys { align-self: center; max-width: 100%; text-align: center; font-size: 12px; color: #fcd34d; background: rgba(251,191,36,0.07); border-color: rgba(251,191,36,0.2); border-radius: 10px; }
.chatform { display: flex; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.chatform input { flex: 1; min-width: 0; height: 40px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg); color: var(--t1); padding: 0 12px; font: inherit; font-size: 14px; outline: none; user-select: text; -webkit-user-select: text; }
.chatform input:focus { border-color: rgba(139,123,255,0.6); }
.chatform .btn { min-height: 40px; }
.hailwait { font-size: 13px; line-height: 1.45; color: #fed7aa; background: rgba(251,146,60,0.08); border: 1px solid rgba(251,146,60,0.25); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.wtag { font-style: normal; color: var(--bad); font-weight: 700; }

/* ---------- фаза 4: клан ---------- */
.ctabs { display: flex; gap: 4px; padding: 3px; border-radius: 11px; background: var(--bg); margin-bottom: 10px; }
.ctabs button { flex: 1; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--t2); font-size: 13px; font-weight: 600; position: relative; }
.ctabs button.on { background: var(--s3); color: var(--t1); }
.ctabs button i { position: absolute; top: 6px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--acc); }
.ctag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px; background: rgba(74,222,128,0.13); color: #86efac; font-size: 12px; font-weight: 700; margin-right: 6px; }
.bankbig { font-family: 'Unbounded', 'Rubik', sans-serif; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.qcard .bar { height: 8px; border-radius: 4px; background: var(--s3); overflow: hidden; margin: 8px 0 6px; }
.qcard .bar u { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--acc), #4ade80); }
.qcard.done { border-color: rgba(74,222,128,0.35); } .qcard.done .top b { color: var(--ok); }
.qcard .who { font-size: 12px; color: var(--t3); }
.secrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.secrow:last-child { border-bottom: 0; }
.secrow b { font-weight: 600; } .secrow small { grid-column: 1 / -1; color: var(--t3); font-size: 12px; }
.secrow .own { color: var(--ok); font-weight: 700; }
.moneyrow { display: flex; gap: 8px; margin: 8px 0; }
.moneyrow input { flex: 1; min-width: 0; height: 40px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg); color: var(--t1); padding: 0 12px; font: inherit; font-variant-numeric: tabular-nums; outline: none; user-select: text; -webkit-user-select: text; }
.blog { font-size: 12.5px; }
.blog div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--t2); }
.blog b.p { color: var(--ok); } .blog b.m { color: var(--warn); }
.msg.mate b { color: #86efac; }

/* ---------- фаза 5: колонії ---------- */
.plots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 6px 0 10px; }
.plot { border: 1px solid var(--line); background: var(--s2); border-radius: 12px; padding: 9px 10px; min-height: 64px; font-size: 13px; }
.plot small { display: block; color: var(--t3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.plot b { display: block; margin-top: 3px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plot.free { border-style: dashed; color: var(--t3); }
.plot.mine { border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.06); }
.plot .open { color: var(--bad); font-size: 11.5px; font-weight: 600; }
.fillbar { height: 10px; border-radius: 5px; background: var(--s3); overflow: hidden; margin: 8px 0 4px; }
.fillbar u { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #4ade80, #a3e635); }
.fillbar.full u { background: linear-gradient(90deg, var(--warn), var(--bad)); }
.bld { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.bld:last-child { border-bottom: 0; }
.bld b { font-size: 14px; } .bld .lv { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.bld .lv i { width: 8px; height: 8px; border-radius: 2px; background: var(--s3); } .bld .lv i.on { background: var(--acc2); }
.bld p { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--t2); }
.bld .cost { grid-column: 1 / -1; font-size: 12px; color: var(--t3); }
.bld .cost .miss { color: var(--bad); }
.raidwarn { font-size: 13.5px; color: #fecdd3; background: rgba(251,113,133,0.1); border: 1px solid rgba(251,113,133,0.35); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.winsel { width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg); color: var(--t1); font: inherit; padding: 0 10px; margin: 6px 0; }
.colrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.colrow .grow { flex: 1; min-width: 0; } .colrow small { color: var(--t3); font-size: 12px; }
.colrow .fillbar { margin: 5px 0 0; height: 6px; }

.kv.gl span { display: flex; align-items: center; gap: 8px; }
.kv.gl .gi { width: 26px; height: 26px; border-radius: 8px; flex: none; } .kv.gl .gi svg { width: 16px; height: 16px; }
.kv.gl b { align-self: center; }

/* ---------- фаза 6: сюжет, новини, події ---------- */
.storybar { position: fixed; z-index: 5; left: 12px; right: 206px; top: calc(98px + var(--safe-t)); min-height: 40px; padding: 6px 10px 6px 12px; text-align: left; border-radius: 12px; border: 1px solid rgba(251,191,36,0.3); background: rgba(28,24,16,0.92); color: #fde68a; font-size: 12px; line-height: 1.3; }
.storybar b { display: block; font-size: 12.5px; color: #fcd34d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.storybar span { display: block; color: #e7dcc0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.storybar.pulse { animation: sbpulse 1.4s ease-out 2; }
@keyframes sbpulse { 0% { box-shadow: 0 0 0 0 rgba(251,191,36,0.6); } 100% { box-shadow: 0 0 0 14px rgba(251,191,36,0); } }
body.incombat .storybar { visibility: hidden; }
.letter { background: #f4ecd8; color: #3b2f1e; border-radius: 14px; padding: 14px 16px; font-family: Georgia, 'Times New Roman', serif; font-size: 15px; line-height: 1.55; margin-bottom: 12px; box-shadow: inset 0 0 30px rgba(120,90,40,0.25); }
.letter i { display: block; text-align: right; margin-top: 8px; font-size: 13px; color: #6b5636; }
.steps { counter-reset: st; }
.steps div { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--t3); }
.steps div b { font-weight: 600; }
.steps div.done { color: var(--ok); } .steps div.cur { color: var(--t1); }
.steps div::before { counter-increment: st; content: counter(st); width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; background: var(--s3); color: var(--t2); font-size: 11.5px; font-weight: 700; flex: none; }
.steps div.done::before { content: '✓'; background: rgba(74,222,128,0.18); color: var(--ok); }
.steps div.cur::before { background: #fbbf24; color: #1c1408; }
.evcard { border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.05); }
.evcard .top b { color: #fcd34d; }
.news div { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.news small { display: block; color: var(--t3); font-size: 11.5px; margin-top: 2px; }
.chip.ev { color: #fcd34d; background: rgba(251,191,36,0.14); }

/* =====================================================================
   Інтерфейс v2: телефон — як раніше + кнопка корабля; ПК (від 1000 px) — бічна панель зліва,
   мапа по центру, панелі на всю висоту справа. Мапа не змінює масштаб, коли відкривається панель.
   ===================================================================== */
#side { display: contents; }
#sidenav, #side .keys { display: none; }
#hud .stats { pointer-events: auto; cursor: pointer; }
.shipbtn { top: calc(144px + var(--safe-t)); }
#comm.comm { top: calc(200px + var(--safe-t)); }
.clanbtn { top: calc(256px + var(--safe-t)); }
.zoomctl { top: calc(312px + var(--safe-t)); }
body.incombat .shipbtn { visibility: hidden; }
.shipbtn svg { width: 22px; height: 22px; }

/* панель «Корабель і пілот» */
.shipcard { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: center; margin-bottom: 8px; }
.shipcard canvas { width: 76px; height: 76px; border-radius: 16px; background: radial-gradient(circle at 50% 45%, rgba(34,211,238,0.14), rgba(12,14,22,0.9) 70%); border: 1px solid var(--line); }
.shipcard b { font-family: 'Unbounded', 'Rubik', sans-serif; font-size: 17px; } .shipcard p { margin: 4px 0 0; font-size: 13px; color: var(--t2); }
.meter { margin: 8px 0; } .meter .h { display: flex; justify-content: space-between; font-size: 13px; color: var(--t2); } .meter .h b { color: var(--t1); font-variant-numeric: tabular-nums; }
.meter i { display: block; height: 6px; margin-top: 4px; border-radius: 3px; background: var(--s3); overflow: hidden; } .meter i u { display: block; height: 100%; border-radius: 3px; background: var(--acc); }
.modrow { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.modrow:last-child { border-bottom: 0; } .modrow small { color: var(--t3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; padding-top: 2px; }
.modrow span { color: var(--t3); font-size: 12px; grid-column: 2; }
.xpbar { height: 8px; border-radius: 4px; background: var(--s3); overflow: hidden; margin: 6px 0 2px; } .xpbar u { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), #22d3ee); }
.statgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.statgrid div { background: var(--s2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; } .statgrid small { display: block; font-size: 11px; color: var(--t3); } .statgrid b { font-size: 16px; font-variant-numeric: tabular-nums; }

@media (min-width: 1000px) {
    :root { --sw: 300px; --pw: 440px; }
    #side { display: flex; flex-direction: column; gap: 12px; position: fixed; z-index: 8; left: 0; top: 0; bottom: 0; width: var(--sw); padding: 18px 16px 14px 28px; background: rgba(12,14,22,0.97); border-right: 1px solid var(--line); overflow-y: auto; }
    #side #hud { position: static; padding: 0; background: none; gap: 12px; }
    #hud .loc { padding-left: 0; flex-wrap: wrap; row-gap: 2px; }
    #hud .loc b { font-size: 17px; flex-basis: 100%; }
    #hud .loc small { font-size: 12.5px; }
    #hud .stats { grid-template-columns: 1fr 1fr; max-width: none; gap: 8px; }
    .st { padding: 8px 10px; border-radius: 12px; } .st b { font-size: 16px; } .st small { font-size: 10.5px; }
    #hud .stats:hover .st { border-color: var(--line2); }
    #side .storybar { position: static; width: auto; right: auto; left: auto; top: auto; min-height: 0; padding: 10px 12px; }
    #side .storybar span { -webkit-line-clamp: 3; }
    #sidenav { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
    #sidenav button { position: relative; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--s2); color: var(--t1); font-size: 14px; font-weight: 600; text-align: left; }
    #sidenav button:hover { border-color: rgba(139,123,255,0.5); background: var(--s3); }
    #sidenav button.on { border-color: var(--acc); background: var(--acc-soft); }
    #sidenav button:disabled { opacity: 0.45; }
    #sidenav svg { width: 20px; height: 20px; color: var(--acc2); flex: none; }
    #sidenav span { flex: 1; }
    #sidenav em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--t3); }
    #sidenav i { position: absolute; top: 9px; left: 26px; width: 8px; height: 8px; border-radius: 50%; background: var(--acc); }
    #side .keys { display: block; margin-top: auto; font-size: 11.5px; line-height: 1.6; color: var(--t3); }
    #side .keys b { display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 5px; background: var(--s3); color: var(--t2); font-size: 11px; text-align: center; }
    .shipbtn, #comm.comm, .clanbtn { display: none; }
    #views { top: 16px; right: auto; left: calc(var(--sw) + (100vw - var(--sw)) / 2); transform: translateX(-50%); }
    .zoomctl { top: auto; bottom: 20px; left: calc(var(--sw) + 16px); right: auto; }
    body.sheet-open #views { left: calc(var(--sw) + (100vw - var(--sw) - var(--pw)) / 2); }
    .sheet, .sheet.tall { top: 0; bottom: 0; right: 0; left: auto; width: var(--pw); max-height: none; border-radius: 0; border: 0; border-left: 1px solid var(--line2); padding: 14px 20px 16px; box-shadow: -16px 0 40px rgba(0,0,0,0.35); }
    .sheet .grab { display: none; }
    #sheetBody { flex: 1; }
    #travel { left: calc(var(--sw) + (100vw - var(--sw)) / 2); transform: translateX(-50%); bottom: 20px; width: 460px; right: auto; }
    body.sheet-open #travel { left: calc(var(--sw) + (100vw - var(--sw) - var(--pw)) / 2); }
    .toast { top: 70px; left: calc(var(--sw) + (100vw - var(--sw)) / 2); }
    /* бій і буріння — компактно по центру, а не на всю ширину */
    .ctop { width: min(760px, 100%); margin: 0 auto; }
    .cbot { width: min(620px, 100%); margin: 0 auto; border-radius: 20px 20px 0 0; }
    .mhud { left: 50%; right: auto; transform: translateX(-50%); width: min(620px, calc(100% - 24px)); }
    body.incombat #side { visibility: hidden; }
    .chatlist { max-height: none; min-height: 50vh; }
}

/* ---------- скролбари в стилі гри; відступ, щоб числа не ховались під смугою ---------- */
#sheetBody, #side, .chatlist { scrollbar-width: thin; scrollbar-color: rgba(139,123,255,0.45) transparent; }
#sheetBody { scrollbar-gutter: stable; padding-right: 10px; margin-right: -4px; }
#sheetBody::-webkit-scrollbar, #side::-webkit-scrollbar, .chatlist::-webkit-scrollbar { width: 8px; }
#sheetBody::-webkit-scrollbar-track, #side::-webkit-scrollbar-track, .chatlist::-webkit-scrollbar-track { background: transparent; }
#sheetBody::-webkit-scrollbar-thumb, #side::-webkit-scrollbar-thumb, .chatlist::-webkit-scrollbar-thumb { background: rgba(139,123,255,0.35); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
#sheetBody::-webkit-scrollbar-thumb:hover, .chatlist::-webkit-scrollbar-thumb:hover { background-color: rgba(139,123,255,0.6); }
#sheetBody::-webkit-scrollbar-button, #side::-webkit-scrollbar-button, .chatlist::-webkit-scrollbar-button { display: none; height: 0; }
