:root {
  --background: 240 10% 3.9%; --foreground: 0 0% 98%; --card: 240 8% 6%; --muted: 240 4% 14%; --muted-fg: 240 5% 62%;
  --border: 240 4% 16%; --input: 240 4% 20%; --primary: 0 0% 98%; --primary-fg: 240 6% 10%; --accent: 240 4% 16%;
  --destructive: 0 72% 51%; --success: 142 64% 45%; --warn: 38 92% 50%; --ring: 240 5% 70%;
  --red-fg: 0 84% 66%; --green-fg: 142 64% 52%; --amber-fg: 38 92% 58%; --blue-fg: 217 91% 68%;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px;
  --shadow-sm: 0 1px 2px #0000004d; --shadow: 0 4px 16px #00000059; --shadow-lg: 0 12px 32px #00000080;
  --scrim: #000000a6; --map-bg: #0b0b0d; --float-bg: hsl(var(--background) / .86);
  --safe-b: max(calc(env(safe-area-inset-bottom, 0px) - 14px), 0px); --safe-t: env(safe-area-inset-top, 0px);
  --nav-h: 92px; --dock-gap: 12px;
  color-scheme: dark;
}
html[data-theme=light] {
  --background: 0 0% 100%; --foreground: 240 10% 3.9%; --card: 0 0% 100%; --muted: 240 5% 95.5%; --muted-fg: 240 4% 44%;
  --border: 240 6% 90%; --input: 240 6% 86%; --primary: 240 6% 10%; --primary-fg: 0 0% 98%; --accent: 240 5% 95.5%;
  --destructive: 0 72% 51%; --success: 142 72% 30%; --warn: 32 95% 40%; --ring: 240 6% 10%;
  --red-fg: 0 72% 44%; --green-fg: 142 72% 28%; --amber-fg: 32 95% 34%; --blue-fg: 217 80% 42%;
  --shadow-sm: 0 1px 2px #0000000f; --shadow: 0 4px 14px #00000014; --shadow-lg: 0 12px 32px #0000001f;
  --scrim: #00000059; --map-bg: #f2f2f0;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: hsl(var(--background)); color: hsl(var(--foreground)); }
html, body { position: fixed; inset: 0; overflow: hidden; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; overscroll-behavior: none; font-feature-settings: 'cv11', 'ss01'; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 14px; }
p { margin: 0; }
.ic { flex-shrink: 0; display: block; }

.muted { color: hsl(var(--muted-fg)); }
.mono { font-variant-numeric: tabular-nums; }
.small { font-size: 13px; } .xs { font-size: 12px; } .b { font-weight: 600; }
.center { text-align: center; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.green { color: hsl(var(--green-fg)); } .red { color: hsl(var(--red-fg)); } .amber { color: hsl(var(--amber-fg)); } .blue { color: hsl(var(--blue-fg)); }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sep { height: 1px; background: hsl(var(--border)); margin: 4px 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid transparent; background: hsl(var(--primary)); color: hsl(var(--primary-fg)); font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; user-select: none; transition: background .15s, opacity .15s; }
.btn:active { opacity: .85; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.outline { background: transparent; border-color: hsl(var(--border)); color: hsl(var(--foreground)); }
.btn.ghost { background: transparent; color: hsl(var(--foreground)); }
.btn.secondary { background: hsl(var(--muted)); color: hsl(var(--foreground)); }
.btn.danger { background: hsl(var(--destructive)); color: #fff; }
.btn.danger.outline { background: transparent; color: hsl(var(--red-fg)); border-color: hsl(var(--destructive) / .45); }
@media (hover: hover) { .btn.outline:hover, .btn.ghost:hover { background: hsl(var(--accent)); } .btn.secondary:hover { background: hsl(var(--accent)); } }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; } .btn.icon.sm { width: 32px; }
.btn.block { width: 100%; }
.btn:focus-visible, .input:focus-visible, .tabs button:focus-visible, .li:focus-visible, .option:focus-visible { outline: 2px solid hsl(var(--ring) / .6); outline-offset: 2px; }

.input, select.input, textarea.input { width: 100%; height: 38px; border-radius: var(--r-sm); border: 1px solid hsl(var(--input)); background: transparent; padding: 0 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: hsl(var(--ring) / .5); box-shadow: 0 0 0 3px hsl(var(--ring) / .12); }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, hsl(var(--muted-fg)) 50%), linear-gradient(135deg, hsl(var(--muted-fg)) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.lbl, label.lbl { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field .lbl { margin: 0; color: hsl(var(--muted-fg)); font-size: 12px; font-weight: 500; }
input[type=range] { width: 100%; accent-color: hsl(var(--foreground)); }

.card { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--r-md); padding: 14px; }
.card.tight { padding: 10px 12px; }
.card.tap { width: 100%; cursor: pointer; text-align: left; color: inherit; }
@media (hover: hover) { .card.tap:hover { background: hsl(var(--accent)); } }

.section { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--r-md); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notice { border: 1px solid hsl(var(--border)); border-radius: var(--r-md); padding: 12px; display: flex; flex-direction: column; gap: 8px; background: hsl(var(--muted) / .45); }
.notice.warn { border-color: hsl(var(--warn) / .45); background: hsl(var(--warn) / .07); }
.notice.danger { border-color: hsl(var(--destructive) / .45); background: hsl(var(--destructive) / .07); }

.list { display: flex; flex-direction: column; border: 1px solid hsl(var(--border)); border-radius: var(--r-md); overflow: hidden; background: hsl(var(--card)); min-width: 0; }
.li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 0; border-bottom: 1px solid hsl(var(--border)); background: transparent; text-align: left; width: 100%; min-width: 0; flex-shrink: 0; }
.li:last-child { border-bottom: 0; }
.li .grow { min-width: 0; }
button.li { cursor: pointer; }
@media (hover: hover) { button.li:hover { background: hsl(var(--accent) / .6); } }
.li.unread { background: hsl(var(--accent) / .5); }
.li.active { background: hsl(var(--accent)); }
.li .ico, .chat-head .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: hsl(var(--muted)); flex-shrink: 0; }
.li-title { font-size: 14px; font-weight: 500; }
.li-sub { font-size: 12px; color: hsl(var(--muted-fg)); margin-top: 1px; }
.nav-row .ic.muted { color: hsl(var(--muted-fg)); }

.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 0; font-size: 13px; border-bottom: 1px solid hsl(var(--border) / .6); }
.kv:last-child { border-bottom: 0; }
.kv > span:first-child { min-width: 0; }
.kv > span:last-child { text-align: right; white-space: nowrap; }
.kv.total { font-weight: 600; border-top: 1px solid hsl(var(--border)); border-bottom: 0; margin-top: 2px; padding-top: 8px; }

.stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid hsl(var(--border)); border-radius: var(--r-md); background: hsl(var(--card)); min-width: 0; }
.stat .l { font-size: 12px; color: hsl(var(--muted-fg)); display: flex; align-items: center; gap: 5px; }
.stat .v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; border: 1px solid hsl(var(--border)); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.badge.solid { background: hsl(var(--muted)); border-color: transparent; }
.badge.red { background: hsl(var(--destructive) / .1); border-color: hsl(var(--destructive) / .3); color: hsl(var(--red-fg)); }
.badge.green { background: hsl(var(--success) / .1); border-color: hsl(var(--success) / .3); color: hsl(var(--green-fg)); }
.badge.amber { background: hsl(var(--warn) / .1); border-color: hsl(var(--warn) / .3); color: hsl(var(--amber-fg)); }
.badge.blue { background: hsl(217 91% 60% / .1); border-color: hsl(217 91% 60% / .3); color: hsl(var(--blue-fg)); }

.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: hsl(var(--muted)); padding: 3px; border-radius: 10px; gap: 2px; }
.tabs button { height: 30px; border: 0; border-radius: var(--r-sm); background: transparent; color: hsl(var(--muted-fg)); font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; padding: 0 8px; }
.tabs button.on { background: hsl(var(--background)); color: hsl(var(--foreground)); box-shadow: var(--shadow-sm); }

.progress { height: 6px; border-radius: 999px; background: hsl(var(--muted)); overflow: hidden; }
.progress > i { display: block; height: 100%; background: hsl(var(--foreground)); border-radius: inherit; transition: width .4s; }
.progress.green > i { background: hsl(var(--success)); } .progress.red > i { background: hsl(var(--destructive)); } .progress.amber > i { background: hsl(var(--warn)); }
.progress.rad > i { background: hsl(84 70% 45%); } .progress.fert > i { background: hsl(80 55% 38%); }
.meter { display: flex; flex-direction: column; gap: 5px; }
.slider { display: flex; flex-direction: column; gap: 4px; }

.option { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid hsl(var(--border)); border-radius: var(--r-md); cursor: pointer; background: transparent; text-align: left; width: 100%; transition: border-color .15s, background .15s; }
@media (hover: hover) { .option:hover { background: hsl(var(--accent) / .6); } }
.option.on { border-color: hsl(var(--foreground)); background: hsl(var(--accent)); }
.option.disabled { opacity: .5; cursor: not-allowed; }

.stepper { display: inline-flex; align-items: center; border: 1px solid hsl(var(--border)); border-radius: var(--r-sm); overflow: hidden; flex-shrink: 0; }
.stepper button { width: 32px; height: 32px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.stepper button:active { background: hsl(var(--accent)); }
.stepper input { width: 44px; height: 32px; border: 0; border-inline: 1px solid hsl(var(--border)); background: transparent; text-align: center; outline: none; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

.switch-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; cursor: pointer; }
.switch { appearance: none; -webkit-appearance: none; width: 40px; height: 22px; border-radius: 99px; background: hsl(var(--input)); position: relative; flex-shrink: 0; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: var(--shadow-sm); }
.switch:checked { background: hsl(var(--primary)); }
html[data-theme=dark] .switch:checked::after { background: hsl(var(--primary-fg)); }
.switch:checked::after { transform: translateX(18px); }

details > summary { cursor: pointer; list-style: none; padding: 2px 0; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▸ '; display: inline-block; transition: transform .2s; }
details[open] > summary::before { transform: rotate(90deg); }
details > div { margin-top: 6px; }

.empty { padding: 28px 12px; text-align: center; color: hsl(var(--muted-fg)); font-size: 13px; }
.spinner { width: 20px; height: 20px; border: 2px solid hsl(var(--muted)); border-top-color: hsl(var(--foreground)); border-radius: 50%; animation: spin .7s linear infinite; }
.sk { border-radius: var(--r-md); background: hsl(var(--muted)); animation: skPulse 1.4s ease-in-out infinite; }
@keyframes skPulse { 50% { opacity: .55; } }
@keyframes fade { from { opacity: 0; } }
.linkish { border: 0; background: transparent; padding: 0; color: inherit; cursor: pointer; text-align: left; }
@media (hover: hover) { .linkish:hover { text-decoration: underline; } }
.map-credits a { text-decoration: underline; text-underline-offset: 2px; }

#app { position: fixed; inset: 0; overflow: hidden; }
body.kb-open #app { bottom: auto; height: var(--app-h, 100%); }
.center-screen { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; display: flex; flex-direction: column; align-items: center; padding: calc(24px + var(--safe-t)) 16px calc(32px + var(--safe-b)); }
.center-screen > * { margin-block: auto; flex-shrink: 0; }
.bg-grid { position: fixed; inset: 0; z-index: -1; background-image: linear-gradient(hsl(var(--border) / .45) 1px, transparent 1px), linear-gradient(90deg, hsl(var(--border) / .45) 1px, transparent 1px); background-size: 32px 32px; mask-image: radial-gradient(ellipse at 50% 30%, #000 10%, transparent 70%); }
.auth-wrap { width: 100%; max-width: 380px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brand h1 { font-size: 26px; letter-spacing: -0.04em; }
.wizard { width: 100%; max-width: 520px; }
.steps { display: flex; gap: 6px; margin-bottom: 16px; }
.steps i { flex: 1; height: 4px; border-radius: 9px; background: hsl(var(--muted)); }
.steps i.on { background: hsl(var(--foreground)); }
.emblem-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.emblem-grid button { aspect-ratio: 1; min-height: 46px; border: 1px solid hsl(var(--border)); border-radius: var(--r-sm); background: transparent; display: grid; place-items: center; cursor: pointer; padding: 4px; }
.emblem-grid button.on { border-color: hsl(var(--foreground)); background: hsl(var(--accent)); }
.div-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.div-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid hsl(var(--border)); border-radius: var(--r-sm); background: transparent; cursor: pointer; font-size: 11px; color: hsl(var(--muted-fg)); }
.div-grid button.on { border-color: hsl(var(--foreground)); color: hsl(var(--foreground)); background: hsl(var(--accent)); }
.emblem-preview { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px; border-radius: var(--r-md); background: hsl(var(--muted) / .5); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 999px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px hsl(var(--foreground) / .15); }
.swatch.on { border-color: hsl(var(--foreground)); }
#pickmap { height: 320px; border-radius: var(--r-md); border: 1px solid hsl(var(--border)); overflow: hidden; }
.pickwrap { position: relative; }

#map { position: absolute; inset: 0; }
#map, .leaflet-container { background: var(--map-bg) !important; font-family: inherit !important; }
.leaflet-container { touch-action: none; }
.dark-tiles .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.88) saturate(.35); }
.leaflet-control-attribution { display: none; }

.topbar { position: absolute; z-index: 500; top: calc(8px + var(--safe-t)); left: 8px; right: 8px; display: flex; gap: 8px; align-items: center; }
.topbar > *, .op-pill, .toast { background: var(--float-bg); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); border: 1px solid hsl(var(--border)); box-shadow: var(--shadow); }
.topbar > * { border-radius: var(--r-lg); height: 48px; cursor: pointer; }
.state-chip { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 8px; min-width: 0; flex: 1; }
.state-chip .name { font-weight: 600; font-size: 13.5px; }
.money { padding: 0 14px; display: flex; flex-direction: column; justify-content: center; align-items: flex-end; }
.money .v { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; transition: color .4s; }
.money .d { font-size: 11px; font-variant-numeric: tabular-nums; }
.money.flash-up .v { color: hsl(var(--green-fg)); } .money.flash-down .v { color: hsl(var(--red-fg)); }
.bell { width: 48px; display: grid; place-items: center; position: relative; }
.bell .dot { position: absolute; top: 7px; right: 7px; min-width: 17px; height: 17px; border-radius: 99px; background: hsl(var(--destructive)); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid hsl(var(--background)); }
.alert-strip { position: absolute; z-index: 500; top: calc(64px + var(--safe-t)); left: 8px; right: 8px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.alert-strip > * { pointer-events: auto; }
.op-pill { display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-size: 12.5px; border-radius: var(--r-md); cursor: pointer; color: inherit; text-align: left; }
.op-pill.danger { border-color: hsl(var(--destructive) / .55); }
body.map-moving .topbar > *, body.map-moving .op-pill { backdrop-filter: none; -webkit-backdrop-filter: none; background: hsl(var(--background) / .95); }

.nav { position: absolute; z-index: 600; left: 50%; bottom: calc(var(--safe-b) + var(--dock-gap)); transform: translateX(-50%); display: flex; align-items: center; justify-content: center; gap: 24px; padding: 12px 24px; border-radius: 999px; background: hsl(var(--background) / .2); backdrop-filter: blur(40px) saturate(1.6); -webkit-backdrop-filter: blur(40px) saturate(1.6); border: 1px solid hsl(var(--border) / .6); box-shadow: 0 20px 25px -5px #0000001a, 0 8px 10px -6px #0000001a; isolation: isolate; }
html[data-theme=dark] .nav { background: hsl(0 0% 0% / .3); box-shadow: 0 20px 25px -5px #00000066, 0 8px 10px -6px #00000066; }
.luma-clip { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; z-index: -1; pointer-events: none; }
.luma-glow { position: absolute; top: 50%; left: 50%; width: 64px; height: 64px; margin-top: -32px; border-radius: 50%; background: linear-gradient(90deg, #60a5fa, #a855f7); filter: blur(24px); transform: translateX(-50%); transition: left .5s cubic-bezier(.34, 1.45, .64, 1); opacity: .9; }
.luma-item { position: relative; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; border: 0; padding: 0; background: transparent; color: hsl(240 5% 34%); cursor: pointer; z-index: 1; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
html[data-theme=dark] .luma-item { color: hsl(240 5% 84%); }
.luma-ic { display: grid; place-items: center; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), color .15s; pointer-events: none; }
.luma-item.on .luma-ic { transform: scale(1.4); }
@media (hover: hover) and (pointer: fine) { .luma-item:hover { color: var(--nav-accent, #3b82f6); } html[data-theme=dark] .luma-item:hover { color: var(--nav-accent, #60a5fa); } .luma-item:not(.on):hover .luma-ic { transform: scale(1.2); } .luma-item.on:hover .luma-ic { transform: scale(1.4); } }
.luma-item:active .luma-ic { transform: scale(.9); }
.luma-item.on:active .luma-ic { transform: scale(1.25); }
.luma-tip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 8px; padding: 4px 8px; font-size: 12px; line-height: 1; border-radius: 6px; background: hsl(240 4% 46%); color: #fff; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; }
html[data-theme=dark] .luma-tip { background: hsl(240 5% 90%); color: #000; }
@media (hover: hover) and (pointer: fine) { .luma-item:hover .luma-tip { opacity: 1; } }
.nav .count { position: absolute; top: 6px; right: 4px; min-width: 18px; height: 18px; border-radius: 9px; background: hsl(var(--destructive)); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid hsl(var(--background)); z-index: 2; }
.fab-col { position: absolute; z-index: 500; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); padding: 4px; border-radius: 999px; background: hsl(var(--background) / .2); backdrop-filter: blur(40px) saturate(1.6); -webkit-backdrop-filter: blur(40px) saturate(1.6); border: 1px solid hsl(var(--border) / .6); box-shadow: 0 10px 20px -5px #0000002a; }
html[data-theme=dark] .fab-col { background: hsl(0 0% 0% / .3); }
.fab-col .luma-item { width: 44px; height: 44px; }
.fab-col .luma-tip { left: auto; right: 0; transform: none; }
@media (max-width: 520px) { .nav { gap: 6px; padding: 10px 14px; } .luma-item { width: 50px; height: 50px; } }
:root { --nav-h: 104px; --dock-gap: 20px; }
@media (max-width: 520px) { :root { --nav-h: 94px; --dock-gap: 16px; } }

.panel { position: absolute; z-index: 550; inset: 0; background: hsl(var(--background)); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.panel.enter { animation: fade .15s ease-out; }
.panel-inner { max-width: 640px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 16px calc(var(--nav-h) + var(--safe-b) + 18px); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; }
.state-head { display: flex; align-items: center; gap: 12px; padding: 4px 0 2px; }
.state-head h2 { font-size: 20px; }
@media (min-width: 720px) { .panel-inner { max-width: 760px; padding-left: 24px; padding-right: 24px; } }

.scrim { position: fixed; inset: 0; z-index: 700; background: var(--scrim); animation: fade .15s; }
.scrim.top { z-index: 750; }
.sheet { position: fixed; z-index: 710; left: 0; right: 0; bottom: 0; max-height: 88dvh; overflow-y: auto; background: hsl(var(--background)); border-top: 1px solid hsl(var(--border)); border-radius: 20px 20px 0 0; padding: 6px 16px calc(20px + var(--safe-b)); box-shadow: var(--shadow-lg); animation: sheetUp .22s cubic-bezier(.2, .9, .3, 1); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
@keyframes sheetUp { from { transform: translateY(100%); } }
@media (min-width: 720px) { .sheet { left: 0; right: 0; margin: 0 auto; width: 560px; max-width: calc(100% - 32px); bottom: 16px; border: 1px solid hsl(var(--border)); border-radius: var(--r-lg); animation: sheetIn .2s ease-out; } }
@keyframes sheetIn { from { opacity: 0; transform: translateY(16px); } }
.sheet { max-height: calc(var(--app-h, 100vh) * .88); }
.handle { width: 36px; height: 4px; border-radius: 9px; background: hsl(var(--muted)); margin: 6px auto 12px; }
.dialog { position: fixed; z-index: 760; left: 0; right: 0; top: 0; bottom: calc(100% - var(--app-h, 100%)); margin: auto; height: fit-content; width: calc(100% - 24px); max-width: 440px; max-height: calc(var(--app-h, 100vh) - 24px); overflow-y: auto; background: hsl(var(--background)); border: 1px solid hsl(var(--border)); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-lg); animation: dlgIn .18s ease-out; overscroll-behavior: contain; }
@keyframes dlgIn { from { opacity: 0; transform: scale(.97); } }
.toasts { position: fixed; z-index: 900; left: 8px; right: 8px; top: calc(64px + var(--safe-t)); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; width: 100%; max-width: 420px; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); animation: fade .15s; position: relative; }
.toast.err { border-color: hsl(var(--destructive) / .5); }
.toast .t { font-weight: 600; font-size: 13px; }
.toast .m { font-size: 12.5px; color: hsl(var(--muted-fg)); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.toast.out { opacity: 0; transition: opacity .2s; }
.toast-x { border: 0; background: transparent; color: hsl(var(--muted-fg)); cursor: pointer; padding: 2px; display: grid; place-items: center; }
@media (min-width: 900px) { .toasts { left: auto; right: 16px; width: 380px; } }
@media (max-width: 899px) { body.sheet-open .toasts { display: none; } }

.notif-ico.war, .notif-ico.attack, .notif-ico.strike, .notif-ico.fallen { background: hsl(var(--destructive) / .12); color: hsl(var(--red-fg)); }
.notif-ico.battle, .notif-ico.revolt { background: hsl(var(--warn) / .12); color: hsl(var(--amber-fg)); }
.notif-ico.peace, .notif-ico.peace_offer { background: hsl(var(--success) / .12); color: hsl(var(--green-fg)); }
.li .ndel { width: 26px; height: 26px; margin: -4px -6px -4px 0; color: hsl(var(--muted-fg)); }
.li.out { opacity: 0; transition: opacity .18s; }
.unread-badge { min-width: 20px; height: 20px; border-radius: 99px; background: hsl(var(--destructive)); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; padding: 0 6px; flex-shrink: 0; }

.owner-row { width: 100%; padding: 10px 12px; border: 1px solid hsl(var(--border)); border-radius: var(--r-md); background: transparent; cursor: pointer; color: inherit; }
@media (hover: hover) { .owner-row:hover { background: hsl(var(--accent) / .6); } }
.terrain { background: hsl(var(--card)); }
.stars { display: inline-flex; gap: 1px; }
.stars i { color: hsl(var(--muted)); display: inline-flex; }
.stars i.on { color: hsl(45 93% 52%); }
.stars i.on .ic { fill: currentColor; }
.lvl-tag { font-size: 11px; font-weight: 600; color: hsl(var(--muted-fg)); }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 7px; height: 7px; border-radius: 2px; background: hsl(var(--muted)); }
.pips i.on { background: hsl(45 93% 52%); }
.pips i.up { background: hsl(45 93% 52% / .4); }
.ico.bico { position: relative; }
.ico.bico.lv2, .ico.bico.lv3 { box-shadow: inset 0 0 0 1.5px hsl(45 93% 52% / .7); }
.ico.bico.lv4, .ico.bico.lv5 { box-shadow: inset 0 0 0 2px hsl(45 93% 52%); }
.ico.bico sup { position: absolute; right: -5px; top: -6px; font-size: 9px; font-weight: 700; background: hsl(45 93% 52%); color: #1c1917; border-radius: 5px; padding: 1px 3px; line-height: 1.2; }
.ico.bico.work { background: conic-gradient(hsl(var(--warn) / .5) calc(var(--p) * 360deg), hsl(var(--muted)) 0); }
.chance { height: 8px; border-radius: 99px; background: linear-gradient(90deg, hsl(0 72% 51%), hsl(38 92% 50%), hsl(142 64% 42%)); position: relative; }
.chance i { position: absolute; top: -4px; width: 4px; height: 16px; background: hsl(var(--foreground)); border-radius: 2px; box-shadow: 0 0 0 2px hsl(var(--background)); transform: translateX(-50%); }
.rad-card { border-color: hsl(84 70% 40% / .4); background: hsl(84 70% 40% / .06); }
.rad-card .ic { color: hsl(84 70% 45%); }
.listing-card.bailiff { border-color: hsl(var(--warn) / .5); background: hsl(var(--warn) / .06); }
.bailiff { border-color: hsl(var(--destructive) / .5) !important; background: hsl(var(--destructive) / .06) !important; }
.hexpick .li { cursor: pointer; }
.hexpick input, .trade-side input[type=checkbox] { width: 18px; height: 18px; accent-color: hsl(var(--foreground)); }
.market-row .input { height: 32px; }

.tech-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tech { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid hsl(var(--border)); border-radius: var(--r-md); background: hsl(var(--card)); }
.tech.owned { border-color: hsl(var(--success) / .45); background: hsl(var(--success) / .06); }
.tech.locked { opacity: .55; }
.tech .btn { margin-top: auto; }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.badge-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; padding: 10px 6px; border: 1px solid hsl(var(--border)); border-radius: var(--r-md); color: hsl(var(--muted-fg)); }
.badge-card.got { border-color: hsl(45 93% 52% / .5); color: hsl(var(--foreground)); background: hsl(45 93% 52% / .06); }
.season-hero { border-color: hsl(45 93% 52% / .4); background: hsl(45 93% 52% / .06); }
.event-card { border-color: hsl(var(--warn) / .45); background: hsl(var(--warn) / .06); }

.panel.chatp { display: flex; flex-direction: column; overflow: hidden; }
.panel.chatp .panel-inner { height: 100%; width: 100%; display: flex; flex-direction: column; gap: 0; min-height: 0; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 4px); }
body.kb-open .panel-inner, body.kb-open .panel.chatp .panel-inner { padding-bottom: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid hsl(var(--border)); flex-shrink: 0; }
.chat-head .ico.ann, .li .ico.ann { background: hsl(var(--warn) / .14); color: hsl(var(--amber-fg)); }
.chat-log { flex: 1; overflow-y: auto; padding: 12px 2px; display: flex; flex-direction: column; gap: 8px; min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 86%; }
.msg > svg, .msg > span:first-child { flex: 0 0 22px; width: 22px; min-width: 22px; height: auto; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg .bub { background: hsl(var(--muted)); border-radius: 16px 16px 16px 4px; padding: 7px 11px; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; min-width: 0; cursor: pointer; }
.msg.mine .bub { background: hsl(var(--primary)); color: hsl(var(--primary-fg)); border-radius: 16px 16px 4px 16px; }
.msg .who { font-size: 12px; font-weight: 600; margin-bottom: 1px; }
.msg .who .muted { font-weight: 500; }
.msg .when { font-size: 10px; opacity: .55; text-align: right; margin-top: 2px; }
.msg.deleted .bub { opacity: .6; font-style: italic; background: transparent; color: hsl(var(--muted-fg)); border: 1px dashed hsl(var(--border)); cursor: default; }
.msg.deleted .bub i { display: inline-flex; align-items: center; gap: 5px; }
.msg img.gif, .card img.gif { display: block; max-width: min(240px, 60vw); max-height: 240px; border-radius: 10px; margin: 2px 0; }
.msg .bub:has(img.gif) { padding: 4px; background: transparent; }
.msg .bub:has(img.gif) .when, .msg .bub:has(img.gif) .who { padding: 0 6px; color: hsl(var(--foreground)); }
.msg.flash .bub { animation: msgFlash 1.4s ease-out; }
@keyframes msgFlash { 0%, 35% { box-shadow: 0 0 0 2px hsl(var(--ring) / .7); } 100% { box-shadow: 0 0 0 2px transparent; } }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px -2px -2px; }
.react { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 7px; border-radius: 99px; border: 1px solid hsl(var(--border)); background: hsl(var(--background)); color: hsl(var(--foreground)); font-size: 13px; line-height: 1; cursor: pointer; }
.react span { font-size: 11px; font-weight: 600; color: hsl(var(--muted-fg)); }
.react.mine { border-color: hsl(217 91% 60% / .6); background: hsl(217 91% 60% / .12); }
.react-bar { display: flex; justify-content: space-between; gap: 4px; padding: 6px; border-radius: 99px; background: hsl(var(--muted)); }
.react-bar button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; }
.react-bar button.on, .react-bar button:hover { background: hsl(var(--background)); }
.chat-input { display: flex; gap: 8px; padding: 10px 0 12px; border-top: 1px solid hsl(var(--border)); flex-shrink: 0; background: hsl(var(--background)); }
.chat-input { align-items: flex-end; }
.chat-input .input { height: 40px; border-radius: 99px; padding: 0 16px; }
.chat-input textarea.input { height: 40px; min-height: 40px; max-height: 140px; border-radius: 20px; padding: 9px 16px; line-height: 20px; resize: none; overflow-y: hidden; font-family: inherit; overflow-anchor: none; }
.chat-input textarea.input::-webkit-scrollbar { width: 0; }
.chat-input .btn.icon { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.gif-btn { height: 40px; padding: 0 10px; font-weight: 700; font-size: 12px; letter-spacing: .04em; border-radius: 99px; flex-shrink: 0; }
.chat-readonly { padding: 14px 12px; border-top: 1px solid hsl(var(--border)); color: hsl(var(--muted-fg)); font-size: 13px; text-align: center; flex-shrink: 0; }
.pin-bar { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-bottom: 1px solid hsl(var(--border)); background: hsl(var(--background)); color: inherit; padding: 8px 2px; cursor: pointer; flex-shrink: 0; text-align: left; }
.pin-bar.hidden { display: none; }
.pin-bar .pin-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: hsl(var(--muted)); flex-shrink: 0; }
.pin-bar .pin-x { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; color: hsl(var(--muted-fg)); }
@media (hover: hover) { .pin-bar:hover { background: hsl(var(--accent) / .5); } }
.ch-del { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: hsl(var(--muted-fg)); flex-shrink: 0; margin-right: -4px; }
@media (hover: hover) { .ch-del { opacity: 0; } button.li:hover .ch-del { opacity: 1; } .ch-del:hover { color: hsl(var(--red-fg)); background: hsl(var(--destructive) / .1); } }
.chat-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
@media (min-width: 720px) {
  .panel.chatp .panel-inner { max-width: 1180px; }
  .chat-split { display: grid; grid-template-columns: minmax(230px, 30%) 1fr; gap: 14px; height: 100%; min-height: 0; }
  .chat-side { overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; min-height: 0; }
  .chat-side > * { flex-shrink: 0; }
  .chat-main { display: flex; flex-direction: column; min-height: 0; border: 1px solid hsl(var(--border)); border-radius: var(--r-md); background: hsl(var(--card)); padding: 12px 14px 0; }
  .chat-main .chat-input, .chat-main .pin-bar { background: transparent; }
  .chat-main .msg { max-width: 72%; }
}
@media (min-width: 900px) { .chat-split { grid-template-columns: 320px 1fr; gap: 16px; } }

.gif-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 108px; gap: 6px; max-height: 46vh; overflow-y: auto; min-height: 120px; align-content: start; overscroll-behavior: contain; }
.gif-item { position: relative; height: 108px; border: 0; padding: 0; background: hsl(var(--muted)); border-radius: var(--r-sm); overflow: hidden; cursor: pointer; }
.gif-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gif-grid > .empty, .gif-grid > .xs { grid-column: 1 / -1; align-self: center; }
@media (min-width: 720px) { .gif-grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 96px; } .gif-item { height: 96px; } }
.giphy-attr { font-size: 11px; color: hsl(var(--muted-fg)); text-align: right; }
.giphy-attr b { color: hsl(var(--foreground)); letter-spacing: .08em; }

.ban-card { max-width: 420px; text-align: center; align-items: center; border-color: hsl(var(--destructive) / .5); }
.ban-ico { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: hsl(var(--destructive) / .12); }

@media (max-width: 899px) { .input, select.input, .stepper input, .chat-input .input, textarea { font-size: 16px; } }
body.kb-open .nav, body.kb-open .fab-col { display: none; }
body.kb-open .toasts { display: none; }
button, a, label, .li, .option, .swatch, .tabs button, .luma-item, .bell, .money, .state-chip { touch-action: manipulation; }
button, .nav, .topbar, .li, .option, .tabs, .badge, .btn, #map, .leaflet-container, .swatch, .emblem-grid, .div-grid { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.msg .bub, .paper, input, textarea { -webkit-user-select: text; user-select: text; }

html.pwa, html.pwa body { position: relative; inset: auto; width: 100%; height: 100vh; min-height: 100vh; overflow: hidden; }
html.pwa #app { position: absolute; top: 0; left: 0; right: 0; bottom: auto; height: 100vh; }
html.pwa body.kb-open #app { height: var(--app-h, 100vh); }
html.pwa .scrim, html.pwa .sheet, html.pwa .dialog, html.pwa .toasts, html.pwa .doc-scrim, html.pwa .doc-actions, html.pwa .screen-flash, html.pwa .bg-grid { position: absolute; }
html.pwa .scrim, html.pwa .doc-scrim, html.pwa .screen-flash, html.pwa .bg-grid { height: 100vh; bottom: auto; }
html.pwa body:not(.kb-open) .dialog { bottom: 0; }
html[data-theme=light].pwa body::before { content: ''; position: fixed; z-index: 2000; top: 0; left: 0; right: 0; height: env(safe-area-inset-top, 0px); background: #000000b3; pointer-events: none; }

::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; min-height: 40px; }
::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-fg) / .5); background-clip: padding-box; border: 3px solid transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }
@supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: hsl(var(--border)) transparent; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

.cap-marker { filter: drop-shadow(0 2px 4px #000c); }
.op-line { animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -20; } }
.hex-label { background: transparent; border: 0; box-shadow: none; color: #fff; font-weight: 600; font-size: 11px; text-shadow: 0 1px 3px #000; }
.doc-scrim { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 800; background: #000c; overflow-y: auto; padding: calc(16px + var(--safe-t)) 10px calc(90px + var(--safe-b)); animation: fade .2s; }
.paper { max-width: 620px; margin: 0 auto; background: #f6f1e4; color: #1c1917; border-radius: 4px; padding: 34px 30px 30px; font-family: 'Cormorant Garamond', 'EB Garamond', Georgia, 'Times New Roman', serif; box-shadow: 0 30px 80px #000; position: relative; background-image: radial-gradient(circle at 20% 10%, #fffaf0 0, transparent 45%), radial-gradient(circle at 90% 90%, #e9dfc8 0, transparent 50%); animation: docIn .45s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes docIn { from { opacity: 0; transform: translateY(30px) rotate(-1.5deg) scale(.96); } }
.paper::before { content: ''; position: absolute; top: 10px; right: 10px; bottom: 10px; left: 10px; border: 1.5px solid #1c191733; border-radius: 2px; pointer-events: none; }
.paper::after { content: ''; position: absolute; top: 14px; right: 14px; bottom: 14px; left: 14px; border: .5px solid #1c191722; pointer-events: none; }
.paper .doc-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.paper .doc-state { font-size: 15px; letter-spacing: .22em; text-transform: uppercase; font-weight: 700; }
.paper .doc-gov { font-size: 12px; letter-spacing: .15em; text-transform: uppercase; color: #57534e; }
.paper .doc-title { font-size: 26px; font-weight: 700; letter-spacing: .08em; margin-top: 14px; line-height: 1.15; }
.paper .doc-no { font-size: 15px; font-style: italic; color: #44403c; }
.paper .doc-sub { font-size: 18px; font-weight: 600; margin-top: 2px; }
.paper .doc-pre { margin: 22px 0 12px; font-size: 16.5px; font-style: italic; text-align: justify; hyphens: auto; }
.paper ol { list-style: none; padding: 0; margin: 0; counter-reset: par; }
.paper ol li { counter-increment: par; font-size: 16.5px; line-height: 1.5; margin: 0 0 10px; text-align: justify; hyphens: auto; }
.paper ol li::before { content: '§ ' counter(par) '. '; font-weight: 700; }
.paper .doc-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 30px; gap: 12px; }
.paper .sign { text-align: center; min-width: 180px; }
.paper .sign .hand { font-family: 'Caveat', 'Segoe Script', 'Brush Script MT', cursive; font-size: 30px; color: #1e3a8a; line-height: 1; transform: rotate(-4deg); }
.paper .sign .line { border-top: 1px solid #1c1917; margin-top: 2px; padding-top: 3px; font-size: 13px; }
.paper .stamp { width: 110px; height: 110px; opacity: .78; transform: rotate(-12deg); mix-blend-mode: multiply; }
.doc-actions { position: fixed; z-index: 810; left: 0; right: 0; bottom: 0; padding: 12px 12px calc(12px + var(--safe-b)); display: flex; gap: 8px; justify-content: center; background: linear-gradient(transparent, #000e 40%); }
@media print {
  body * { visibility: hidden; }
  .paper, .paper * { visibility: visible; }
  .paper { position: absolute; left: 0; top: 0; box-shadow: none; animation: none; }
}
.spinner { width: 22px; height: 22px; border: 2px solid hsl(var(--muted)); border-top-color: hsl(var(--foreground)); border-radius: 50%; animation: spin .7s linear infinite; }
.cap-name { transform: translateX(-50%); white-space: nowrap; }
.bchips { position: absolute; transform: translate(-50%, 0); display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; width: 92px; pointer-events: none; }
.bchip { position: relative; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: #09090bdd; color: #e4e4e7; border: 1px solid #3f3f46; box-shadow: 0 2px 6px #000a; }
.bchip.lv2 { border-color: hsl(45 93% 58% / .6); }
.bchip.lv3 { border-color: hsl(45 93% 58% / .85); color: hsl(45 93% 75%); }
.bchip.lv4, .bchip.lv5 { border: 1.5px solid hsl(45 93% 58%); color: hsl(45 93% 72%); box-shadow: 0 0 10px hsl(45 93% 58% / .45); }
.bchip sup { position: absolute; top: -7px; right: -7px; font: 800 8.5px/1 Inter, sans-serif; background: hsl(45 93% 58%); color: #1c1917; border-radius: 4px; padding: 2px 3px; }
.bchip.work { background: conic-gradient(hsl(38 92% 50% / .75) calc(var(--p) * 360deg), #18181bdd 0); border-color: hsl(38 92% 50%); color: #fff; }
.bchip.work .ic { opacity: .55; }
.bchip em, .bbadge em { font: 700 8.5px/1 Inter, sans-serif; font-style: normal; }
.bchip em { position: absolute; bottom: -11px; left: 50%; transform: translateX(-50%); background: #09090b; color: hsl(38 92% 62%); padding: 1px 3px; border-radius: 3px; }
.bbadge { position: absolute; transform: translate(-50%, 0); display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 6px; border-radius: 99px; background: #09090bdd; border: 1px solid #3f3f46; color: #e4e4e7; white-space: nowrap; }
.bbadge sup { font: 800 9px Inter, sans-serif; color: hsl(45 93% 62%); }
.bbadge.work { border-color: hsl(38 92% 50%); background: linear-gradient(90deg, hsl(38 92% 50% / .45) calc(var(--p) * 100%), #09090bdd 0); }

.unit-mk { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; }
.unit-mk .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fafafa; color: #09090b; box-shadow: 0 0 0 4px #fafafa33, 0 4px 12px #000c; animation: bob 1.2s ease-in-out infinite; }
.unit-mk.enemy .dot { background: #ef4444; color: #fff; box-shadow: 0 0 0 4px #ef444455, 0 0 18px #ef4444aa; }
.unit-mk.air .dot { border-radius: 8px; animation: none; }
.unit-mk .pill { font: 600 10.5px/1 Inter, sans-serif; background: #09090be6; color: #fafafa; padding: 4px 7px; border-radius: 99px; border: 1px solid #3f3f46; white-space: nowrap; }
.unit-mk.enemy .pill { border-color: #ef4444; }
.unit-mk .pbar { width: 54px; height: 3px; border-radius: 3px; background: #3f3f46; overflow: hidden; }
.unit-mk .pbar i { display: block; height: 100%; width: 0; background: #fafafa; transition: width 1s linear; }
.unit-mk.enemy .pbar i { background: #ef4444; }
@keyframes bob { 50% { transform: translateY(-3px); } }

.rad-zone { animation: radPulse 2.4s ease-in-out infinite; }
@keyframes radPulse { 50% { fill-opacity: .08; stroke-opacity: .25; } }
.rad-chip { position: absolute; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px 2px 4px; border-radius: 99px; background: #1a2e05e6; border: 1px solid #84cc16; color: #d9f99d; font: 700 10px/1 Inter, sans-serif; box-shadow: 0 0 12px #84cc1666; pointer-events: none; }
.crater { position: relative; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, #000 0 30%, #1c0a02 38%, #431407 48%, #7c2d12 56%, #9a3412cc 60%, #57534e88 68%, #1c191700 76%);
  box-shadow: inset 0 0 18px #000, 0 0 30px #ea580c33; animation: smolder 3s ease-in-out infinite; }
.crater i { position: absolute; top: 22%; right: 22%; bottom: 22%; left: 22%; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #292524, #000 70%); box-shadow: inset 0 4px 12px #000, 0 0 0 2px #7c2d1288; }
.crater b { position: absolute; top: 6%; right: 6%; bottom: 6%; left: 6%; border-radius: 50%; border: 2px dashed #f9731655; animation: spin 40s linear infinite; }
@keyframes smolder { 50% { box-shadow: inset 0 0 18px #000, 0 0 44px #f9731655; } }
.ruins { mix-blend-mode: multiply; }

.blast { position: relative; pointer-events: none; }
.blast i { position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 50%; }
.blast .flash { background: radial-gradient(circle, #fff 0, #fde047 25%, #f97316 45%, #dc262600 70%); animation: flash 1.1s ease-out forwards; }
.blast .wave { border: 3px solid #fff8; animation: wave 1.3s ease-out forwards; }
.blast .w2 { animation-delay: .25s; border-color: #f9731688; }
.blast.nuke .flash { animation-duration: 2.6s; }
.blast.nuke .wave { animation-duration: 2.8s; border-width: 5px; }
.blast.nuke .cloud { top: 18%; right: 18%; bottom: 18%; left: 18%; background: radial-gradient(circle at 50% 45%, #fef3c7, #f97316 35%, #7c2d12 60%, #29252400 72%); animation: cloud 6s ease-out forwards; filter: blur(2px); }
@keyframes flash { 0% { transform: scale(.1); opacity: 1; } 60% { opacity: .9; } 100% { transform: scale(1); opacity: 0; } }
@keyframes wave { 0% { transform: scale(.1); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes cloud { 0% { transform: scale(.2); opacity: 0; } 15% { opacity: 1; } 70% { opacity: .9; transform: scale(1.1); } 100% { transform: scale(1.3); opacity: 0; } }
.screen-flash { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 9999; pointer-events: none; background: #fff; animation: sflash 1.6s ease-out forwards; }
@keyframes sflash { 0% { opacity: .95; } 100% { opacity: 0; } }
.doc-scrim { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

.when .ic, .xs .ic, .badge .ic { display: inline-block; vertical-align: -1px; }
.luma-glow { width: 84px; height: 60px; margin-top: -30px; filter: blur(15px); opacity: 1; }
html[data-theme=dark] .luma-glow { opacity: .95; filter: blur(14px) saturate(1.3); }
html[data-theme=light] .luma-glow { opacity: .55; }

/* Markdown w wiadomościach */
.md { overflow-wrap: anywhere; }
.md b { font-weight: 650; }
.md .md-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; padding: 1px 5px; border-radius: 5px; background: hsl(var(--foreground) / .1); }
.md .md-pre { margin: 4px 0; padding: 8px 10px; border-radius: 8px; background: hsl(var(--foreground) / .1); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 260px; overflow: auto; }
.md .md-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: currentColor; }
.msg:not(.mine) .md .md-link { color: hsl(217 91% 60%); }
.md .md-quote { margin: 3px 0; padding: 1px 0 1px 9px; border-left: 3px solid currentColor; opacity: .85; }
.md .md-list { margin: 3px 0; padding-left: 20px; }
.md .md-list li { margin: 1px 0; }
.md .md-h { font-weight: 700; margin: 2px 0; }
.md .md-h1 { font-size: 1.2em; }
.md .md-h2 { font-size: 1.1em; }
.md .md-spoiler { background: currentColor; border-radius: 4px; cursor: pointer; transition: background .15s; }
.md .md-spoiler.open { background: hsl(var(--foreground) / .12); cursor: text; }
.md .md-spoiler:not(.open) * { visibility: hidden; }

/* Rozmieszczenie wojsk */
.garr-mk { position: absolute; transform: translate(-50%, -135%); width: max-content; display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px 0 5px; border-radius: 99px; background: #09090be6; color: #fafafa; border: 1px solid #52525b; font: 600 10.5px/1 Inter, sans-serif; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 8px #0008; }
.garr-mk svg { flex: 0 0 12px; width: 12px; height: 12px; display: block; }
.garr-mk b { font-weight: 700; }
.garr-mk span { opacity: .65; font-weight: 500; }
.garr-mk.cap { border-color: hsl(45 93% 55%); transform: translate(-50%, calc(-100% - 22px)); }
.org-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.org-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 32px; padding: 0 10px; border-radius: 99px; border: 1px solid hsl(var(--border)); background: transparent; color: inherit; font-size: 12.5px; cursor: pointer; }
.org-chip span { max-width: 150px; }
.org-chip b { font-size: 11px; opacity: .75; }
.org-chip.on { border-color: hsl(var(--foreground)); background: hsl(var(--accent)); }

/* Ochrona danych osobowych / moderacja */
.pd-ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: hsl(38 92% 50% / .15); color: hsl(38 92% 55%); flex-shrink: 0; }
.msg .mod-deleted { color: hsl(38 92% 60%); }

/* Cofanie gestem od lewej krawędzi (rozmowa → lista czatów) */
.panel.swiping { will-change: transform; overflow: hidden; touch-action: pan-y; }
.panel.swipe-under { z-index: 549; pointer-events: none; overflow: hidden; will-change: transform; transform: translate3d(-30%, 0, 0); }
.panel.swipe-under .swipe-dim { position: absolute; inset: 0; background: #000; opacity: .32; pointer-events: none; }
/* Wyłącza wbudowane w Chrome cofanie strony poziomym przesunięciem – dublowałoby się z gestem cofania z rozmowy
   (systemowy gest/przycisk „wstecz” nadal działa przez historię i zamyka rozmowę). */
html, body { overscroll-behavior-x: none; }

/* Błąd połączenia – w stylu shadcn/ui */
.spin { display: inline-grid; place-items: center; animation: spin 1s linear infinite; }
.conn-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 28px 24px 18px; border: 1px solid hsl(var(--border)); border-radius: 14px; background: hsl(var(--card)); box-shadow: 0 1px 2px rgb(0 0 0 / .06), 0 12px 32px -12px rgb(0 0 0 / .45); animation: conn-in .35s cubic-bezier(.2, .9, .25, 1); }
@keyframes conn-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.conn-ico { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: hsl(var(--muted)); color: hsl(var(--foreground)); box-shadow: 0 0 0 8px hsl(var(--muted) / .4); margin-bottom: 6px; }
.conn-card.offline .conn-ico { color: hsl(0 84% 64%); background: hsl(0 84% 60% / .12); box-shadow: 0 0 0 8px hsl(0 84% 60% / .06); }
.conn-card.server .conn-ico { color: hsl(38 92% 58%); background: hsl(38 92% 50% / .12); box-shadow: 0 0 0 8px hsl(38 92% 50% / .06); }
.conn-badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; border: 1px solid hsl(var(--border)); font: 500 11.5px/1 Inter, sans-serif; color: hsl(var(--muted-fg)); }
.conn-badge i { width: 6px; height: 6px; border-radius: 50%; background: hsl(var(--muted-fg)); }
.conn-card.offline .conn-badge i { background: hsl(0 84% 60%); box-shadow: 0 0 0 3px hsl(0 84% 60% / .2); }
.conn-card.server .conn-badge i { background: hsl(38 92% 50%); box-shadow: 0 0 0 3px hsl(38 92% 50% / .2); animation: conn-pulse 1.6s ease-in-out infinite; }
@keyframes conn-pulse { 50% { box-shadow: 0 0 0 5px hsl(38 92% 50% / .05); } }
.conn-card h2 { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; margin: 2px 0 0; }
.conn-card > p { margin: 0; font-size: 14px; line-height: 1.55; color: hsl(var(--muted-fg)); max-width: 320px; }
.conn-retry { width: 100%; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.conn-bar { height: 4px; border-radius: 99px; background: hsl(var(--muted)); overflow: hidden; }
.conn-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: hsl(var(--foreground)); transition: width .2s linear; }
.conn-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.conn-actions .btn { width: 100%; }
.conn-details { width: 100%; margin-top: 6px; border-top: 1px solid hsl(var(--border)); padding-top: 10px; text-align: left; }
.conn-details summary { cursor: pointer; font-size: 12.5px; color: hsl(var(--muted-fg)); list-style: none; display: flex; align-items: center; justify-content: center; gap: 6px; }
.conn-details summary::-webkit-details-marker { display: none; }
.conn-details summary::before, .conn-details summary::marker { content: none; display: none; }
.conn-details summary::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
.conn-details[open] summary::after { transform: rotate(225deg) translateY(-1px); }
.conn-details > div { margin-top: 10px; border: 1px solid hsl(var(--border)); border-radius: 8px; overflow: hidden; }
.conn-details > div > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; }
.conn-details > div > div + div { border-top: 1px solid hsl(var(--border)); }
.conn-details > div span:first-child { color: hsl(var(--muted-fg)); }
.conn-details > div span:last-child { text-align: right; overflow-wrap: anywhere; }
.conn-banner { position: fixed; z-index: 990; left: 50%; bottom: calc(var(--nav-h, 64px) + var(--safe-b, 0px) + 84px); transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px 0 12px; border-radius: 99px; border: 1px solid hsl(var(--border)); background: hsl(var(--card) / .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font: 500 12.5px/1 Inter, sans-serif; box-shadow: 0 8px 24px -8px rgb(0 0 0 / .5); animation: conn-drop .3s cubic-bezier(.2, .9, .25, 1); white-space: nowrap; }
.conn-banner.out { opacity: 0; transform: translate(-50%, 8px); transition: opacity .2s, transform .2s; }
@keyframes conn-drop { from { opacity: 0; transform: translate(-50%, 10px); } }
body.kb-open .conn-banner { bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ======================= PREMIUM ======================= */
.prem-badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 6px; font: 500 11px/1 Inter, sans-serif; white-space: nowrap; vertical-align: middle; color: hsl(var(--foreground)); background: hsl(var(--muted)); border: 1px solid hsl(var(--border)); }
.prem-badge svg { display: block; flex: 0 0 auto; }
.prem-badge > span { display: block; line-height: 1; transform: translateY(.5px); }
.prem-badge.premium svg { color: #a78bfa; }
.prem-badge.patron svg { color: #f59e0b; }
h2 .prem-badge { margin-left: 6px; transform: translateY(-2px); }
.prem-mark { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin: 0 2px 0 4px; vertical-align: -3px; }
.prem-mark svg { display: block; }
.prem-mark.premium { color: #a78bfa; }
.prem-mark.patron { color: #f59e0b; }

.prem-entry { align-items: center; gap: 10px; border: 1px solid hsl(var(--border)); border-radius: 12px; margin-bottom: 10px; background: hsl(var(--card)); }
.prem-entry-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: hsl(var(--muted-fg)); background: hsl(var(--muted)); }
.prem-entry.on .prem-entry-ic { color: #f59e0b; background: hsl(38 92% 50% / .12); }
.prem-entry .li-sub { font-size: 11.5px; color: hsl(var(--muted-fg)); }
.prem-entry .chev { color: hsl(var(--muted-fg)); display: flex; }

.shop-hero { text-align: center; padding: 22px 20px; border-radius: 14px; border: 1px solid hsl(var(--border)); background: hsl(var(--card)); margin-bottom: 14px; }
.shop-hero-ic { width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 14px; display: grid; place-items: center; color: hsl(var(--muted-fg)); background: hsl(var(--muted)); }
.shop-hero.on .shop-hero-ic { color: #f59e0b; background: hsl(38 92% 50% / .12); }
.shop-hero h2 { margin: 2px 0; font-size: 19px; letter-spacing: -.01em; }
.shop-hero p { margin: 0 auto; max-width: 320px; font-size: 13px; line-height: 1.5; color: hsl(var(--muted-fg)); }

.redeem-row { display: flex; gap: 8px; margin-bottom: 6px; }
.redeem-row .input { flex: 1; font-family: ui-monospace, monospace; letter-spacing: .04em; }

.tier-card { border: 1px solid hsl(var(--border)); border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.tier-card.have { border-color: hsl(var(--foreground) / .25); }
.tier-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.tier-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: hsl(var(--muted-fg)); background: hsl(var(--muted)); }
.tier-card.premium .tier-ic { color: #a78bfa; background: hsl(262 83% 62% / .12); }
.tier-card.patron .tier-ic { color: #f59e0b; background: hsl(38 92% 50% / .12); }
.tier-name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 7px; }
.tier-badge { font-size: 11px; color: hsl(var(--muted-fg)); margin-top: 1px; }
.tier-have-tag { font: 600 10px/1 Inter; color: hsl(var(--muted-fg)); border: 1px solid hsl(var(--border)); border-radius: 6px; padding: 3px 7px; }
.tier-perks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.tier-perks li { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.45; color: hsl(var(--muted-fg)); }
.tier-perks li svg { flex: 0 0 13px; margin-top: 2px; color: hsl(var(--foreground) / .55); }

/* Ściana patronów */
.patron-wall { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.patron-wall .patron { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid hsl(var(--border)); border-radius: 10px; background: transparent; color: inherit; cursor: pointer; min-width: 0; }
.patron-wall .patron:hover { background: hsl(var(--accent)); }

/* Generator kodów (admin) */
.code-box { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.code-box code, .code-list code { font-family: ui-monospace, monospace; font-size: 12.5px; padding: 3px 8px; border-radius: 6px; background: hsl(var(--muted)); border: 1px dashed hsl(var(--border)); }

/* Pola premium w edytorze symboli */
.prem-fields { border: 1px solid hsl(38 80% 50% / .4); border-radius: 12px; padding: 12px; background: hsl(38 92% 50% / .05); display: flex; flex-direction: column; gap: 10px; }
.prem-fields-head { display: flex; align-items: center; gap: 6px; font: 700 12px Inter; color: hsl(38 92% 45%); }
html[data-theme=dark] .prem-fields-head { color: hsl(38 92% 62%); }
.nick-pick { display: flex; align-items: center; gap: 8px; }
.prem-teaser { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px; border: 1px dashed hsl(262 60% 55% / .6); border-radius: 12px; background: hsl(262 83% 58% / .08); color: inherit; cursor: pointer; text-align: left; }
.prem-teaser b { font-size: 13px; }
.prem-teaser .xs { color: hsl(var(--muted-fg)); line-height: 1.35; margin-top: 2px; }
.prem-teaser > svg:first-child { color: hsl(262 70% 60%); flex-shrink: 0; }

/* Własny kolor (color picker jako próbka) */
.swatch.custom { position: relative; overflow: hidden; background-image: conic-gradient(#f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.swatch.custom.on { outline: 2px solid hsl(var(--foreground)); outline-offset: 1px; }
.swatch.custom input[type=color] { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); opacity: 0; cursor: pointer; }

/* Wyróżniona stolica premium na mapie */
.cap-wrap { position: relative; display: grid; place-items: center; }
.cap-badge { position: absolute; right: -5px; bottom: -3px; width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; background: #18181b; border: 1px solid #3f3f46; pointer-events: none; }
.cap-badge svg { display: block; }
.cap-prem.cap-premium .cap-badge { color: #a78bfa; }
.cap-prem.cap-patron .cap-badge { color: #f59e0b; }

/* Dewiza i ozdobny dokument */
.doc-motto { text-align: center; font-style: italic; font-size: 13px; opacity: .7; margin-top: 2px; }
.paper-prem { box-shadow: 0 0 0 1px #d9c48a inset, 0 0 0 7px #fcf7e8 inset, 0 0 0 8px #d9c48a inset, 0 20px 60px -15px rgba(0,0,0,.5); }
.paper-prem.patron { box-shadow: 0 0 0 1px #e3b94f inset, 0 0 0 7px #fffaf0 inset, 0 0 0 8px #e3b94f inset, 0 20px 60px -15px rgba(0,0,0,.5); }

/* ======================= KRONIKA / HISTORIA ======================= */
.chart-card { border: 1px solid hsl(var(--border)); border-radius: 12px; padding: 12px 12px 6px; margin-bottom: 10px; }
.chart-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.chart-title { font-size: 13px; font-weight: 600; }
.chart-val { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-val .xs { font-weight: 600; margin-left: 4px; }
.mini-chart { width: 100%; height: 92px; display: block; }
.chart-empty { height: 60px; display: grid; place-items: center; color: hsl(var(--muted-fg)); font-size: 12px; }
.kron-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kron-cell { border: 1px solid hsl(var(--border)); border-radius: 11px; padding: 11px; }
.kron-ic { color: hsl(var(--muted-fg)); margin-bottom: 4px; }
.kron-val { font-size: 19px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kron-lab { font-size: 12px; color: hsl(var(--muted-fg)); }
.kron-sub { font-size: 10.5px; color: hsl(var(--muted-fg)); opacity: .8; margin-top: 1px; }

/* Blokada premium */
.prem-lock { text-align: center; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.prem-lock-ic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: 0 10px 30px -8px #8b5cf6aa; }
.prem-lock h2 { margin: 4px 0 0; font-size: 19px; }
.prem-lock p { margin: 0; max-width: 300px; color: hsl(var(--muted-fg)); font-size: 13px; line-height: 1.5; }

/* Timelapse */
.tl-scrim { position: fixed; inset: 0; z-index: 800; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; }
.tl-box { width: 100%; max-width: 560px; background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.tl-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid hsl(var(--border)); }
.tl-canvas { background: radial-gradient(ellipse at 45% 40%, #1a1f24, #0b0d10); aspect-ratio: 520 / 400; display: grid; place-items: center; }
.tl-svg { width: 100%; height: 100%; }
.tl-ctrl { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.tl-ctrl input[type=range] { accent-color: hsl(var(--foreground)); }

/* Księga Państwa */
.book-scrim { overflow: auto; }
.book { max-width: 640px; margin: 20px auto; }
.book-page { background: #fbf7ec; color: #2a241a; border-radius: 6px; padding: 40px 36px; box-shadow: 0 0 0 1px #d9c48a inset, 0 20px 60px -15px rgba(0,0,0,.5); font-family: Georgia, 'Times New Roman', serif; }
.book-cover { text-align: center; padding-bottom: 20px; border-bottom: 2px solid #d9c48a; margin-bottom: 20px; }
.book-title { font-size: 15px; letter-spacing: .3em; text-transform: uppercase; color: #8a7a4f; margin-top: 10px; }
.book-state { font-size: 28px; font-weight: 700; margin: 6px 0; }
.book-motto { font-style: italic; opacity: .7; }
.book-leader { margin-top: 6px; font-size: 14px; }
.book-h { font-size: 13px; letter-spacing: .15em; text-transform: uppercase; color: #8a7a4f; border-bottom: 1px solid #e0d4ad; padding-bottom: 4px; margin: 22px 0 12px; }
.book-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; }
.book-stats > div { display: flex; justify-content: space-between; border-bottom: 1px dotted #cdbf93; padding: 3px 0; font-size: 14px; }
.book-doc { padding: 6px 0; border-bottom: 1px solid #ece2c4; }
.book-doc-t { font-size: 14px; }
.book-doc-d { font-size: 11.5px; color: #8a7a4f; }
.book-foot { text-align: center; margin-top: 24px; font-size: 11px; color: #8a7a4f; }
.book-actions { max-width: 640px; margin: 0 auto 24px; display: flex; gap: 8px; justify-content: center; }
@media print { body > *:not(.book-scrim) { display: none !important; } .book-scrim { position: static; } .book-actions { display: none !important; } .book-page { box-shadow: none; } }

/* ======================= ZGŁOSZENIA ======================= */
.fb-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fb-opt { display: flex; align-items: center; justify-content: center; gap: 6px; height: 40px; border: 1px solid hsl(var(--border)); border-radius: 10px; background: transparent; color: hsl(var(--muted-fg)); font-size: 13px; font-weight: 600; cursor: pointer; }
.fb-opt.on { border-color: hsl(var(--foreground)); background: hsl(var(--accent)); color: hsl(var(--foreground)); }
.fb-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { height: 28px; padding: 0 12px; border-radius: 99px; border: 1px solid hsl(var(--border)); background: transparent; color: hsl(var(--muted-fg)); font-size: 12px; cursor: pointer; }
.chip.on { border-color: hsl(var(--foreground)); background: hsl(var(--foreground)); color: hsl(var(--background)); }
.fb-card { border: 1px solid hsl(var(--border)); border-radius: 12px; padding: 12px; margin-bottom: 10px; border-left: 3px solid hsl(var(--border)); }
.fb-card.blad { border-left-color: hsl(0 72% 55%); }
.fb-card.pomysl { border-left-color: hsl(45 90% 52%); }
.fb-tag { font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.fb-tag svg { opacity: .7; }
.fb-tag.blad { color: hsl(0 72% 62%); }
.fb-tag.pomysl { color: hsl(45 80% 55%); }
.fb-st { font-size: 10.5px; padding: 2px 8px; border-radius: 99px; background: hsl(var(--muted)); color: hsl(var(--muted-fg)); }
.fb-st.fb-nowe { background: hsl(217 91% 60% / .15); color: hsl(217 91% 65%); }
.fb-st.fb-zrobione { background: hsl(142 70% 45% / .15); color: hsl(142 70% 55%); }
.fb-st.fb-odrzucone { background: hsl(0 72% 55% / .12); color: hsl(0 72% 60%); }
.fb-text { font-size: 13.5px; line-height: 1.45; margin: 8px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.fb-actions .btn.on { background: hsl(var(--accent)); color: hsl(var(--foreground)); }

/* ======================= FLAGI ======================= */
.flag { display: block; border-radius: 3px; }
.flag-preview { display: grid; place-items: center; padding: 10px; border: 1px solid hsl(var(--border)); border-radius: 12px; background: hsl(var(--muted) / .4); margin-bottom: 8px; }
.flag-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.flag-grid button { padding: 6px; border: 1px solid hsl(var(--border)); border-radius: 8px; background: transparent; cursor: pointer; display: grid; place-items: center; }
.flag-grid button.on { border-color: hsl(var(--foreground)); background: hsl(var(--accent)); }
.flag-emb-toggle { display: inline-flex; align-items: center; gap: 5px; color: hsl(var(--muted-fg)); cursor: pointer; }
.state-flag { margin-top: 4px; }
.state-flag .flag { box-shadow: none; }

/* Nowoczesny nagłówek państwa: baner z flagą + mgła na dole + godło jako avatar */
.state-hero { position: relative; border: 1px solid hsl(var(--border)); border-radius: 16px; overflow: hidden; background: hsl(var(--card)); margin-bottom: 12px; }
.state-hero-banner { position: relative; height: 116px; overflow: hidden; }
.state-hero-flag { display: block; width: 100%; height: 100%; }
.state-hero-fog { position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 0%, transparent 34%, hsl(var(--card) / .55) 72%, hsl(var(--card)) 100%); pointer-events: none; }
.state-hero-body { position: relative; display: flex; align-items: flex-end; gap: 12px; padding: 0 14px 14px; margin-top: -34px; }
.state-hero-emblem { flex: 0 0 auto; width: 72px; height: 72px; display: grid; place-items: center; position: relative; }
.state-hero-emblem::before { content: ''; position: absolute; inset: -14px -10px -18px; border-radius: 50%; background: radial-gradient(ellipse at 50% 55%, hsl(var(--card) / .9) 0%, hsl(var(--card) / .5) 45%, transparent 72%); z-index: -1; pointer-events: none; }
.state-hero-emblem svg { filter: drop-shadow(0 4px 10px rgb(0 0 0 / .45)); }
.state-hero-body h2 { margin: 0; font-size: 19px; letter-spacing: -.01em; line-height: 1.15; }
.state-hero-body .min0 { min-width: 0; padding-bottom: 2px; }
.state-hero-body > .btn { align-self: flex-end; margin-bottom: 2px; }
.sheet-flag { margin: 4px 0 2px; }

/* Operacje w toku – wiersz z przyciskiem wycofania */
.op-row { display: flex; align-items: stretch; gap: 6px; }
.op-row .li.grow { flex: 1; min-width: 0; }
.op-recall { align-self: center; white-space: nowrap; flex-shrink: 0; }

/* Losowanie nazwy w kreatorze */
.name-row { display: flex; gap: 6px; align-items: stretch; }
.name-row .input { flex: 1; min-width: 0; }
.name-row .btn.icon { flex-shrink: 0; width: 44px; }

/* Badania w toku (panel technologii) */
.research-now { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid hsl(262 83% 62% / .4); background: hsl(262 83% 62% / .08); border-radius: 12px; }
.research-now .spin-dot { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: hsl(262 83% 62% / .15); animation: pulse-soft 1.6s ease-in-out infinite; }
@keyframes pulse-soft { 0%, 100% { opacity: .6 } 50% { opacity: 1 } }
.progress-rail { margin-top: 5px; height: 5px; border-radius: 999px; background: hsl(var(--muted)); overflow: hidden; }
.progress-rail > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #8b5cf6, #a855f7); transition: width .4s ease; }
.tech.researching { border-color: hsl(262 83% 62% / .55); box-shadow: 0 0 0 1px hsl(262 83% 62% / .25) inset; }

/* Państwa niezależne (dawniej „AI”) */
.npc-badge { display: inline-flex; align-items: center; gap: 3px; height: 17px; padding: 0 6px; border-radius: 6px; font-size: 10px; font-weight: 600; background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); vertical-align: middle; }
.npc-badge svg { opacity: .8; }

/* Role administracji */
.role-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #fff; background: var(--rc, #666); }
.li.nav-head { pointer-events: none; padding-bottom: 2px; }

/* Co wpływa na stabilność */
.stab-details > summary { display: flex; align-items: center; gap: 5px; cursor: pointer; list-style: none; }
.stab-details > summary::-webkit-details-marker { display: none; }
.stab-list { margin-top: 4px; }

/* Podgląd czatu zgłoszonego gracza */
.chat-review { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; }
.rev-msg { border: 1px solid hsl(var(--border)); border-radius: 10px; padding: 6px 9px; background: hsl(var(--card)); }
.rev-msg.del { opacity: .55; }

/* Kod odzyskiwania konta */
.reco { align-items: stretch; }
.reco-ic { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto; border-radius: 16px; color: #34d399; background: hsl(152 60% 45% / .14); }
.reco-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px; font-weight: 700; letter-spacing: .12em; text-align: center; padding: 14px 10px; border: 1px dashed hsl(var(--border)); border-radius: 12px; background: hsl(var(--muted)); user-select: all; word-break: break-all; }
.reco-ack { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.reco-ack input { width: 18px; height: 18px; }
.link-btn { background: none; border: none; color: hsl(var(--primary, 220 90% 60%)); font: inherit; font-size: 13px; padding: 0; cursor: pointer; text-align: left; text-decoration: underline; }
