:root {
  color-scheme: dark;
  --ink: #e9f2fa;
  --muted: #90a4b7;
  --accent: #69eed0;
  --green: #69eed0;
  --green-hover: #a0ffe6;
  --soft: #152434;
  --line: #26384a;
  --white: #0f1a28;
  --danger: #ff927c;
  --shadow: 0 12px 40px #0005;
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  --edge: 24px;
  --viewport-height: 100vh;
  --bottom: max(22px, env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px));
  --top: max(22px, env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px));
  --dock-height: 72px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --ink: #101c2b;
  --muted: #546a82;
  --accent: #008f73;
  --green: #008f73;
  --green-hover: #00b390;
  --soft: #e2ecf5;
  --line: #bfd1e2;
  --white: #ffffff;
  --danger: #d9381e;
  --shadow: 0 12px 32px #00152b1f;
}
:root[data-theme="light"] html, :root[data-theme="light"] body, :root[data-theme="light"] .map-viewport {
  background: #d8e5f2;
}
:root[data-theme="light"] .surface {
  background: #ffffffeb;
  border-color: #bfd1e2;
}
:root[data-theme="light"] button:disabled {
  background: #e6eef5;
  color: #8c9fae;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #080f19; color: var(--ink); font: 14px var(--font); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; color: inherit; transition: background .16s, border-color .16s, color .16s, transform .16s; }
button, a, input, summary { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--accent); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { cursor: default; color: #768a9c; background: #162230; box-shadow: none; }
[hidden], button[hidden] { display: none !important; }
a { color: var(--accent); }
svg { width: 22px; height: 22px; display: block; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 750; letter-spacing: -.035em; }
.game, .map-viewport { position: fixed; inset: 0; min-height: 0; }
.map-viewport { background: #080f19; }
.map-viewport::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 140px #03080e88; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
canvas:active { cursor: grabbing; }
canvas.placement { cursor: crosshair; }
.surface { background: #0e1928f5; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 12px; }
.map-header { position: absolute; top: var(--top); left: var(--edge); right: var(--edge); display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; pointer-events: none; z-index: 20; }
.map-header > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--ink); text-decoration: none; font-size: 16px; letter-spacing: .04em; height: 62px; white-space: nowrap; }
.brand b { color: var(--accent); font-weight: 800; }
.brand small { display: block; margin-top: 5px; font-size: 8px; letter-spacing: .23em; color: var(--muted); }
.brand-mark { display: grid; grid-template-columns: 8px 8px; gap: 3px; transform: rotate(-8deg); }
.brand-mark i { width: 8px; height: 8px; background: var(--accent); box-shadow: 0 0 12px #69eed02a; }
.brand-mark i:last-child { opacity: .35; }
.header-actions { display: flex; gap: 8px; }
.factions-button, .profile-button { display: flex; align-items: center; justify-content: center; gap: 9px; height: 52px; padding: 0 16px; font-size: 12px; font-weight: 600; }
.factions-button:hover, .profile-button:hover { border-color: #486277; background: #192a3c; }
.profile-button svg { width: 18px; height: 18px; color: var(--accent); }
.profile-button span { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resource-bar { display: flex; align-items: center; position: absolute; left: 50%; transform: translateX(-50%); padding: 6px; height: 62px; }
.resource-pill { height: 44px; border: 0; border-right: 1px solid var(--line); background: transparent; display: flex; align-items: center; justify-content: center; gap: 12px; min-width: 120px; padding: 0 18px; text-align: left; }
.resource-pill:last-child { border-right: 0; min-width: 82px; }
.resource-pill strong { display: block; font-size: 19px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.resource-pill small { font-size: 10px; color: var(--muted); white-space: nowrap; line-height: 17px; }
.energy-pill svg { color: #ffd26d; filter: drop-shadow(0 0 7px #ffd26d44); }
.territory-pill svg { color: var(--accent); }
.crystal-pill svg { color: #c29aff; }
.resource-pill:hover { background: #1b2b3c; border-radius: 6px; }
.operation-label { position: absolute; top: calc(var(--top) + 84px); left: var(--edge); display: flex; align-items: flex-start; gap: 10px; color: #c2d0db; font-size: 10px; letter-spacing: .13em; pointer-events: none; z-index: 5; }
.operation-label small { display: block; color: #728ca1; margin-top: 6px; font-size: 8px; letter-spacing: .12em; }
.status-light { display: inline-block; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 10px #69eed077; flex-shrink: 0; margin-top: 3px; }
.world-intel { position: absolute; top: calc(var(--top) + 88px); right: var(--edge); width: 252px; padding: 22px; z-index: 10; border-top: 2px solid #526a7d; }
.intel-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.intel-code { font: 9px ui-monospace, monospace; color: #71889a; }
.world-intel h2 { font-size: 23px; line-height: 1.16; margin-bottom: 13px; }
.world-intel p { color: var(--muted); font-size: 12px; line-height: 1.7; }
.mission-steps { display: grid; gap: 17px; padding: 22px 0; }
.mission-steps span { display: flex; align-items: center; gap: 11px; color: #8297a9; font-size: 11px; }
.mission-steps b { font: 10px ui-monospace, monospace; width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; }
.mission-steps .current { color: var(--accent); }
.mission-steps .current b { background: #69eed010; border-color: #69eed05a; }
.intel-footer { display: flex; align-items: center; gap: 9px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 10px; color: #8b9eae; line-height: 1.6; }
.intel-footer svg { width: 16px; height: 16px; color: var(--accent); }
.world-intel .secondary-button { margin: 20px 0; }
.floating-card { position: absolute; z-index: 30; background: #101c2bf7; border: 1px solid #31465a; border-radius: 16px; padding: 24px; box-shadow: 0 20px 70px #0006; width: 348px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #385064 transparent; }
.welcome-card { left: var(--edge); bottom: calc(var(--bottom) + 46px); width: 390px; padding: 28px; max-height: calc(var(--viewport-height) - 160px); border-top: 2px solid var(--accent); }
.game-panel { left: var(--edge); top: calc(var(--top) + 141px); bottom: auto; max-height: calc(var(--viewport-height) - var(--top) - 210px); }
.eyebrow { display: flex; gap: 8px; align-items: center; color: var(--accent); font: 9px ui-monospace, 'SFMono-Regular', monospace; letter-spacing: .12em; line-height: 1.5; }
.eyebrow .status-light { margin: 0; }
.welcome-card h1 { font-size: clamp(25px, 2.2vw, 32px); font-weight: 850; letter-spacing: -.045em; line-height: 1.15; margin: 16px 0 12px; }
.welcome-card h1 em { font-style: normal; color: var(--accent); }
.welcome-card h2 { font-size: 26px; line-height: 1.15; margin: 12px 0 16px; }
.welcome-art { position: relative; height: 164px; display: grid; place-items: center; margin: 18px -6px 4px; overflow: hidden; background: radial-gradient(ellipse at center, #1f626333, transparent 68%); }
.welcome-art::before, .headquarters-preview::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(#6be8d00a 1px, transparent 1px), linear-gradient(90deg, #6be8d00a 1px, transparent 1px); background-size: 23px 23px; pointer-events: none; mask-image: radial-gradient(ellipse, #000, transparent 75%); }
.welcome-art img { width: 156px; height: 156px; object-fit: contain; image-rendering: pixelated; z-index: 1; }
.art-orbit { position: absolute; width: 188px; height: 90px; border: 1px solid #69eed035; border-radius: 50%; transform: translateY(24px); }
.art-caption { position: absolute; bottom: 3px; font: 7px ui-monospace, monospace; letter-spacing: .14em; color: #71a99f; z-index: 2; }
.card-description { font-size: 13px; line-height: 1.7; color: var(--muted); margin: 8px 0 18px; }
.close-button { padding: 0; border: 1px solid transparent; border-radius: 8px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: transparent; color: #9caec0; flex-shrink: 0; }
.close-button svg { width: 18px; height: 18px; }
.close-button:hover { background: #24364a; color: var(--ink); border-color: #3c5266; }
.welcome-card > .close-button, dialog > .close-button { position: absolute; right: 12px; top: 12px; }
.primary-button, .secondary-button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; border: 1px solid transparent; border-radius: 8px; min-height: 46px; padding: 12px 15px; font-size: 12px; font-weight: 700; line-height: 1.4; }
.primary-button { background: var(--accent); color: #0a211f; box-shadow: 0 3px 0 #2b9480; }
.primary-button:hover:not(:disabled) { background: var(--green-hover); }
.primary-button:active:not(:disabled) { box-shadow: 0 1px 0 #2b9480; transform: translateY(2px); }
.primary-button:disabled, .secondary-button:disabled { border-color: var(--line); }
.secondary-button { background: #1a2b3d; border-color: #30465b; color: #c4d7e6; }
.secondary-button:hover:not(:disabled) { background: #273f55; border-color: #526e86; }
.auth-button { justify-content: center; margin-top: 12px; }
.auth-button span:last-child { margin-left: auto; }
.auth-button span:first-of-type { margin: 0 auto; }
.auth-button[aria-busy=true] { opacity: .7; }
.auth-button svg { width: 19px; height: 19px; }
.soon-label { font-size: 9px; color: #b0a3cf; background: #29263e; border-radius: 4px; padding: 3px 5px; }
.auth-notice { font-size: 11px; line-height: 1.7; color: #9bb0c1; text-align: center; margin-top: 12px; }
.auth-notice:empty { display: none; }
.bot-link { display: block; text-align: center; font-size: 10px; line-height: 1.6; padding: 8px 0 0; text-underline-offset: 3px; color: #a9c4d6; }
.welcome-emblems { display: flex; align-items: center; gap: 7px; margin: 18px 0; }
.welcome-emblems button { border: 1px solid #304356; background: #182839; width: 44px; height: 44px; border-radius: 8px; padding: 5px; }
.welcome-emblems button:hover { border-color: var(--accent); background: #1e3a43; transform: translateY(-3px); }
.welcome-emblems img { width: 100%; height: 100%; object-fit: contain; }
.local-login { display: flex; gap: 8px; padding-top: 12px; }
.local-login input { min-width: 0; width: 60%; }
.local-login button { width: 40%; justify-content: center; }
.faction-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.faction-picker button { padding: 9px 2px; border: 1px solid #304356; border-radius: 8px; background: #182839; display: flex; align-items: center; flex-direction: column; gap: 7px; min-width: 0; }
.faction-picker button:hover { background: #243c4d; }
.faction-picker button.selected { border-color: var(--faction, var(--accent)); background: #213644; box-shadow: inset 0 -2px var(--faction, var(--accent)); }
.faction-picker img { width: 42px; height: 42px; object-fit: contain; }
.faction-picker b { font-size: 8px; letter-spacing: 0; font-weight: 600; white-space: nowrap; }
.faction-description { font-size: 12px; line-height: 1.65; color: #a7bccb; min-height: 44px; margin: 14px 0 18px; }
.faction-description strong { display: block; color: var(--ink); font-size: 12px; margin-bottom: 4px; }
.headquarters-preview { position: relative; display: flex; align-items: center; flex-direction: column; background: radial-gradient(ellipse, #31425466, #0b1624); border: 1px solid #2a4154; border-radius: 10px; margin: 0 0 18px; padding: 10px; overflow: hidden; }
.headquarters-preview img { display: block; width: 148px; height: 148px; object-fit: contain; image-rendering: pixelated; z-index: 1; }
.headquarters-preview h3 { font-size: 11px; margin-top: 4px; color: #adc5d8; font-weight: 600; letter-spacing: 0; z-index: 1; }
#spawnCard .onboarding-copy { font-size: 12px; margin-bottom: 18px; }
.simple-details { border-top: 1px solid var(--line); font-size: 12px; margin-top: 18px; padding-top: 12px; }
.simple-details summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; color: #9db4c6; min-height: 30px; }
.simple-details summary::-webkit-details-marker { display: none; }
.simple-details summary::after { content: '+'; margin-left: auto; font-size: 17px; color: var(--accent); }
.simple-details[open] summary::after { content: '−'; }
.simple-details[open] > input { margin-top: 12px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin: -4px -7px 20px 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { font-size: 22px; }
.commander { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; }
.faction-avatar { display: grid; place-items: center; width: 49px; height: 49px; background: #203448; border: 1px solid #3c5266; border-radius: 9px; flex-shrink: 0; }
.faction-avatar img { width: 41px; height: 41px; object-fit: contain; }
.commander h3 { font-size: 15px; max-width: 165px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.commander > div > span { font-size: 10px; display: block; color: var(--muted); margin-top: 4px; text-transform: capitalize; }
.level-badge { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--accent); background: #69eed012; border: 1px solid #69eed035; border-radius: 5px; white-space: nowrap; padding: 6px 8px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-heading h3 { font-size: 13px; font-weight: 600; letter-spacing: 0; }
.section-heading > span, .section-heading > b { font-size: 11px; color: #aac1d1; white-space: nowrap; }
.upgrade-block { border-top: 1px solid var(--line); padding-top: 20px; }
.upgrade-block .card-description { font-size: 11px; margin: 6px 0 16px; }
.project-meter { height: 7px; background: #080f1b; border: 1px solid #2d4255; border-radius: 3px; overflow: hidden; }
.project-meter i { height: 100%; width: 0; background: linear-gradient(90deg, #38bfa3, #9bffdb); display: block; transition: width .4s; }
.project-info { font-size: 11px; color: var(--muted); line-height: 1.65; margin: 10px 0 16px; }
.amount-details { border: 0; padding: 0; margin-top: 10px; }
.amount-details summary { justify-content: center; font-size: 11px; }
.amount-details summary::after { margin-left: 0; }
.stat-list { margin: 18px 0 0; }
.stat-list > div { display: flex; justify-content: space-between; gap: 15px; margin: 14px 0; font-size: 11px; line-height: 1.5; }
.stat-list dt { color: var(--muted); }
.stat-list dd { margin: 0; text-align: right; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.event-log { margin-top: 12px; }
.event-row { display: flex; gap: 12px; font-size: 11px; line-height: 1.6; margin: 10px 0; }
.event-row time { color: #7191a8; font: 10px ui-monospace, monospace; padding-top: 3px; }
.event-row span { color: #b0c1cf; }
.sector-summary { display: flex; align-items: center; gap: 14px; padding-bottom: 20px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.sector-symbol { width: 48px; height: 48px; background: #1c3c40; border: 1px solid #396261; border-radius: 9px; display: grid; place-items: center; color: var(--accent); }
.sector-symbol svg { width: 27px; height: 27px; transform: rotate(25deg); }
.sector-summary strong { display: block; font-size: 26px; letter-spacing: -.04em; }
.sector-summary span:not(.sector-symbol) { font-size: 10px; color: var(--muted); display: block; margin-top: 4px; }
.sector-summary .sector-cap { margin-left: auto; text-align: right; }
.sector-cap strong { font-size: 19px; }
input { accent-color: var(--accent); }
input[type=number], input[type=text], input:not([type]) { border: 1px solid #3a5165; border-radius: 7px; background: #0b1623; width: 100%; padding: 11px 12px; min-height: 44px; color: var(--ink); font-size: 13px; }
input::placeholder { color: #8da2b5; font-size: 11px; }
input[type=range] { width: 100%; display: block; height: 24px; margin: 18px 0 4px; cursor: pointer; }
.compass-labels { display: flex; justify-content: space-between; font-size: 9px; color: #8ea5b6; margin: 0 0 22px; }
#selectCellsBtn { margin-top: 18px; justify-content: center; }
.daily-reward { display: flex; gap: 18px; align-items: center; padding-bottom: 10px; }
.reward-symbol { width: 64px; height: 64px; border-radius: 12px; background: #2b2442; border: 1px solid #51416e; color: #c29aff; display: grid; place-items: center; }
.reward-symbol svg { width: 30px; height: 30px; }
.daily-reward strong { display: flex; align-items: center; gap: 8px; font-size: 40px; font-weight: 750; letter-spacing: -.05em; }
.daily-reward strong svg { width: 22px; height: 22px; color: #c29aff; }
.daily-reward > div > span { font-size: 11px; color: var(--muted); }
.energy-offer { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 24px; }
.subtle { color: var(--muted); font-size: 10px; line-height: 1.6; margin-top: 12px; }
.ranking { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ranking:last-child { border: 0; }
.ranking.you { background: #69eed00c; border: 1px solid #69eed02a; border-radius: 8px; padding: 12px 8px; margin: 0 -8px; }
.ranking-position { width: 18px; font: 11px ui-monospace, monospace; color: #8faabd; }
.ranking:first-child .ranking-position { color: #ffd26d; }
.ranking-symbol { width: 34px; height: 34px; display: grid; place-items: center; background: var(--soft); border-radius: 7px; }
.ranking-symbol img { width: 30px; height: 30px; object-fit: contain; }
.ranking-name { font-size: 12px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-name small, .ranking-score small { display: block; color: var(--muted); font-size: 9px; margin-top: 4px; font-weight: 400; }
.ranking-score { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.empty-state { color: #8ca4b6; font-size: 12px; line-height: 1.7; padding: 14px 0; }
.account-panel { right: var(--edge); top: calc(var(--top) + 66px); width: 245px; padding: 18px; max-height: calc(var(--viewport-height) - 130px); border-radius: 12px; z-index: 45; }
.account-panel h3 { font-size: 15px; padding: 4px 7px 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px solid var(--line); margin-bottom: 7px; }
.menu-item { display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 6px; background: transparent; width: 100%; min-height: 44px; padding: 12px 8px; text-align: left; font-size: 12px; }
.menu-item span { color: var(--muted); font-size: 10px; }
.menu-item:hover { background: #23394d; }
#logoutBtn { color: var(--danger); }
.map-dock { position: absolute; bottom: var(--bottom); left: 50%; transform: translateX(-50%); height: var(--dock-height); display: flex; align-items: center; gap: 4px; padding: 6px; z-index: 40; border-top: 1px solid #476076; }
.map-dock button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-width: 75px; height: 58px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #91a9bd; font-size: 10px; font-weight: 600; }
.map-dock button:hover:not(:disabled) { background: #1e3348; color: var(--ink); }
.map-dock button[aria-expanded=true] { background: #69eed012; border-color: #69eed030; color: var(--accent); }
.map-dock button:disabled { background: transparent; color: #5a6d7d; }
.map-dock svg { width: 21px; height: 21px; }
.notification-dot { position: absolute; right: 17px; top: 10px; width: 6px; height: 6px; border-radius: 50%; background: #ffd26d; box-shadow: 0 0 6px #ffd26d66; }
.ability-bar { position: absolute; bottom: calc(var(--bottom) + var(--dock-height) + 12px); left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 6px; padding: 6px; z-index: 35; width: 358px; border-color: #31475a; }
.ability-button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; width: 100%; height: 80px; border: 1px solid #2d4357; border-radius: 6px; background: #162637; color: #89a1b4; padding: 8px 3px; overflow: hidden; }
.ability-button::after { content: ''; position: absolute; bottom: 0; left: 0; height: 2px; width: var(--cooldown-progress, 100%); background: currentColor; opacity: .7; }
.ability-button:hover:not(:disabled) { background: #274054; border-color: #6c90a9; }
.ability-icon svg { width: 23px; height: 23px; }
.ability-label { font-size: 10px; font-weight: 600; }
.ability-state { font-size: 9px; font-variant-numeric: tabular-nums; color: #9bb2c6; white-space: nowrap; }
.ability-key { position: absolute; top: 4px; left: 6px; font: 8px ui-monospace, monospace; color: #8ea7b8; }
.ability-button.ready { color: var(--accent); border-color: #69eed047; }
.ability-button.ready .ability-state { color: #a1dfcc; }
.ability-button.active { background: #1b3c40; color: #94ffe0; border-color: #69eed094; }
.ability-button.active .ability-state { color: #94ffe0; }
.ability-button.cooling { background: #111e2b; color: #6c8397; }
.ability-button[data-ability=ultimate].ready { color: #d6b3ff; border-color: #b088e16b; }
.ability-button:disabled { color: #61798c; }
.map-tools { position: absolute; right: var(--edge); bottom: calc(var(--bottom) + 50px); display: flex; align-items: center; flex-direction: column; gap: 9px; z-index: 25; }
.map-tools button { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--line); background: #0e1928f5; color: #a9c0d2; font-size: 23px; }
.map-tools > button { border-radius: 8px; }
.map-tools svg { width: 19px; height: 19px; }
.map-tools button:hover { background: #243c50; color: var(--accent); }
.zoom-controls { display: flex; flex-direction: column; overflow: hidden; border-radius: 8px; }
.zoom-controls button { border: 0; box-shadow: none; }
.zoom-controls button:first-child { border-bottom: 1px solid var(--line); }
.map-tooltip { position: absolute; z-index: 20; pointer-events: auto; max-width: 280px; padding: 10px 14px; font-size: 12px; color: var(--ink); border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); white-space: normal; line-height: 1.4; }
.placement-hint, .selection-bar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottom) + 10px); z-index: 35; display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 56px; padding: 10px 14px; font-size: 11px; border-color: #69eed077; }
.placement-hint > svg { color: var(--accent); }
.placement-hint strong { display: block; color: var(--accent); font-size: 10px; letter-spacing: .1em; margin-bottom: 4px; }
.placement-hint > button { border: 0; background: transparent; color: #a3bccd; display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; }
.game.has-base .selection-bar { bottom: calc(var(--bottom) + var(--dock-height) + 116px); }
.selection-bar { white-space: nowrap; }
.selection-bar .primary-button { width: auto; min-height: 40px; padding: 8px 13px; }
.map-readout { position: absolute; bottom: var(--bottom); left: var(--edge); display: flex; align-items: center; gap: 12px; color: #8da9be; font: 9px ui-monospace, monospace; letter-spacing: .04em; pointer-events: none; }
.map-readout i { height: 12px; border-left: 1px solid #3c5367; }
.crosshair-mark { color: var(--accent); font-size: 22px; }
.map-legend { position: absolute; right: var(--edge); bottom: var(--bottom); display: flex; gap: 14px; font-size: 9px; color: #92aabc; pointer-events: none; }
.map-legend span { display: flex; align-items: center; gap: 6px; }
.map-legend i { width: 7px; height: 7px; border-radius: 1px; }
.legend-own { background: #69eed0; }
.legend-free { border: 1px solid #456275; }
.connection-notice { position: absolute; top: calc(var(--top) + 82px); left: 50%; transform: translateX(-50%); z-index: 50; display: flex; gap: 15px; align-items: center; padding: 10px 15px; font-size: 11px; color: #ffd26d; background: #292515; border-color: #675333; }
.connection-notice button { min-height: 30px; border: 0; background: transparent; color: #ffe5a6; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.map-loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 12px; background: #101f30f5; border: 1px solid #36526a; border-radius: 10px; padding: 18px 22px; font-size: 12px; color: #b1c5d6; z-index: 50; max-width: calc(100vw - 32px); }
.loader { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #355366; border-top-color: var(--accent); animation: spin 1s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; top: calc(var(--top) + 84px); transform: translateX(-50%); z-index: 100; background: #132d30; color: #c0ffea; border: 1px solid #3b7167; border-radius: 8px; box-shadow: var(--shadow); padding: 13px 18px; font-size: 12px; line-height: 1.6; max-width: min(470px, calc(100vw - 32px)); text-align: center; }
.toast.error { color: #ffbfaa; background: #35231f; border-color: #795347; }
#income.negative { color: var(--danger); }
dialog { background: #101e2d; color: var(--ink); border: 1px solid #3a536a; border-top: 2px solid var(--accent); border-radius: 14px; box-shadow: 0 30px 120px #0008; padding: 32px; width: min(440px, calc(100vw - 30px)); max-height: 85dvh; overscroll-behavior: contain; scrollbar-width: thin; }
dialog::backdrop { background: #030a13bb; }
dialog h2 { font-size: 29px; line-height: 1.15; margin: 12px 0 24px; }
dialog .primary-button { margin-top: 24px; justify-content: center; }
dialog .secondary-button { margin-top: 16px; justify-content: center; }
.help-steps { counter-reset: help; }
.help-steps p { position: relative; font-size: 12px; line-height: 1.7; color: var(--muted); margin: 22px 0; padding-left: 32px; }
.help-steps p::before { counter-increment: help; content: '0' counter(help); position: absolute; left: 0; top: 2px; color: var(--accent); font: 10px ui-monospace, monospace; }
.help-steps b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 5px; font-size: 13px; }
.factions-dialog { width: min(960px, calc(100vw - 40px)); }
.faction-atlas { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; margin-top: 28px; }
.faction-sheet { padding: 18px 14px; background: #182b3d; border: 1px solid #354c60; border-top: 2px solid var(--faction, var(--accent)); border-radius: 8px; min-width: 0; }
.faction-sheet > img { display: block; width: 88px; height: 88px; object-fit: contain; margin: 0 auto 20px; }
.faction-sheet h3 { text-align: center; font-size: 12px; letter-spacing: .04em; margin-bottom: 12px; }
.faction-sheet p { font-size: 11px; line-height: 1.7; color: #a7bccd; margin-top: 12px; }
.faction-sheet .faction-benefit { color: #b6e8d7; padding-top: 13px; border-top: 1px solid #385064; font-size: 10px; }
.shop-items { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 20px; }
.shop-item { border: 1px solid #3a4b64; border-radius: 8px; padding: 16px; min-width: 0; background: #19263a; }
.shop-item > b { display: block; font-size: 13px; }
.shop-item > span { display: block; font-size: 13px; color: #c3a4eb; margin-top: 8px; }
.shop-item .primary-button { padding: 10px; font-size: 11px; margin-top: 16px; }
.shop-item small { display: block; font-size: 10px; line-height: 1.5; color: var(--muted); margin-top: 10px; }
.text-button { border: 0; background: transparent; color: #a6c3d7; font-size: 11px; width: 100%; min-height: 40px; padding: 12px; text-align: center; text-decoration: underline; text-underline-offset: 3px; }
#billingBtn { margin-top: 24px; }
@media (min-width: 1500px) { :root { --edge: 32px; --top: max(28px, env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px)); } .welcome-card { left: 6vw; bottom: 10vh; } .world-intel { width: 280px; } }
@media (max-width: 1200px) { .world-intel { width: 222px; padding: 18px; } .resource-pill { min-width: 100px; padding: 0 12px; } .resource-pill:last-child { min-width: 70px; } .factions-button span { display: none; } .factions-button { padding: 0 14px; } .brand { font-size: 14px; padding: 12px; } .map-legend { display: none; } .map-readout { font-size: 8px; } }
@media (max-width: 1150px) { .world-intel { display: none; } .brand small { font-size: 7px; } .profile-button span { max-width: 64px; } .game.has-base .game-panel { top: calc(var(--top) + 90px); max-height: calc(var(--viewport-height) - var(--top) - 312px); } .game.has-base .operation-label { display: none; } .faction-atlas { grid-template-columns: repeat(3,minmax(0,1fr)); } .map-readout { bottom: calc(var(--bottom) + 7px); } .has-base .map-readout { display: none; } }
@media (max-width: 760px) {
  :root { --edge: 14px; --top: max(14px, env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px)); --bottom: max(12px, env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px)); --dock-height: 66px; }
  .map-header { align-items: center; gap: 8px; }
  .brand { height: 48px; padding: 0 11px; font-size: 12px; gap: 9px; border-radius: 8px; }
  .brand small { font-size: 6px; letter-spacing: .17em; margin-top: 4px; }
  .brand-mark { grid-template-columns: 6px 6px; gap: 2px; }
  .brand-mark i { width: 6px; height: 6px; }
  .header-actions { gap: 6px; }
  .factions-button, .profile-button { height: 44px; min-width: 44px; padding: 0 11px; border-radius: 8px; }
  .profile-button span { display: none; }
  .game:not(.has-base) .profile-button span { display: inline; max-width: 54px; font-size: 11px; }
  .resource-bar { top: 60px; height: 52px; border-radius: 9px; padding: 4px; }
  .resource-pill { min-width: 107px; height: 38px; padding: 0 12px; gap: 8px; }
  .resource-pill:last-child { min-width: 76px; }
  .resource-pill strong { font-size: 16px; }
  .resource-pill small { font-size: 9px; line-height: 13px; }
  .resource-pill svg { width: 18px; height: 18px; }
  .operation-label { top: calc(var(--top) + 65px); font-size: 8px; gap: 7px; }
  .operation-label small { font-size: 7px; margin-top: 4px; }
  .welcome-card { left: 14px; bottom: calc(var(--bottom) + 28px); width: min(370px, calc(100vw - 28px)); padding: 22px; max-height: calc(var(--viewport-height) - var(--top) - var(--bottom) - 122px); border-radius: 12px; }
  .welcome-card h1 { font-size: clamp(24px, 7vw, 29px); margin-top: 12px; }
  .welcome-art { height: 124px; margin-top: 10px; }
  .welcome-art img { width: 126px; height: 126px; }
  .art-orbit { width: 164px; height: 65px; }
  .art-caption { font-size: 6px; }
  .welcome-card .card-description { font-size: 12px; margin-bottom: 12px; }
  .welcome-emblems { margin: 12px 0; gap: 7px; }
  .welcome-emblems button { width: 40px; height: 40px; }
  .auth-notice { font-size: 10px; margin-top: 8px; }
  .bot-link { font-size: 9px; }
  .headquarters-preview img { width: 120px; height: 120px; }
  .headquarters-preview { margin-bottom: 14px; }
  .faction-picker img { width: 36px; height: 36px; }
  .faction-picker b { font-size: 8px; }
  .game.has-base .game-panel { top: auto; bottom: calc(var(--bottom) + var(--dock-height) + 112px); max-height: calc(var(--viewport-height) - var(--top) - var(--bottom) - 308px); width: min(358px, calc(100vw - 28px)); padding: 20px; border-radius: 12px; }
  .panel-heading { margin-bottom: 16px; }
  .panel-heading h2 { font-size: 21px; }
  .map-dock { width: min(358px, calc(100vw - 28px)); gap: 2px; padding: 5px; border-radius: 10px; }
  .map-dock button { flex: 1; min-width: 0; height: 54px; font-size: 9px; gap: 6px; }
  .ability-bar { width: min(330px, calc(100vw - 36px)); bottom: calc(var(--bottom) + var(--dock-height) + 10px); border-radius: 10px; gap: 5px; padding: 5px; }
  .ability-button { height: 74px; gap: 5px; }
  .ability-label { font-size: 9px; }
  .ability-state { font-size: 8px; }
  .ability-icon svg { width: 22px; height: 22px; }
  .ability-key { display: none; }
  .map-tools { right: 14px; bottom: calc(var(--bottom) + 36px); gap: 7px; }
  .game.has-base .map-tools { bottom: calc(var(--bottom) + var(--dock-height) + 112px); }
  .map-tools button { width: 44px; height: 44px; }
  body:has(.floating-card:not([hidden])) .map-tools { opacity: 0; pointer-events: none; }
  .map-readout { bottom: var(--bottom); left: 14px; gap: 8px; font-size: 7px; }
  .placement-hint { left: 14px; transform: none; bottom: var(--bottom); max-width: calc(100vw - 80px); line-height: 1.6; gap: 9px; padding: 10px; }
  .placement-hint > svg { display: none; }
  .placement-hint strong { font-size: 9px; }
  .game.has-base .selection-bar { bottom: calc(var(--bottom) + var(--dock-height) + 112px); max-width: calc(100vw - 28px); gap: 8px; }
  .account-panel { top: calc(var(--top) + 60px); width: 235px; right: 14px; padding: 16px; }
  .connection-notice, .toast { top: calc(var(--top) + 124px); }
  .faction-atlas { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .factions-dialog, dialog { padding: 26px; }
  dialog h2 { font-size: 25px; }
}
@media (max-width: 380px) { .brand { font-size: 10px; padding: 0 9px; } .brand small { letter-spacing: .08em; } .factions-button { padding: 0 8px; } .resource-pill { min-width: 94px; padding: 0 10px; } .resource-pill:last-child { min-width: 68px; } .welcome-card { padding: 20px; } .welcome-card h1 { font-size: 24px; } .faction-picker img { width: 30px; height: 30px; } .faction-picker b { font-size: 7px; } }
@media (max-height: 740px) { .welcome-art { height: 100px; } .welcome-art img { width: 106px; height: 106px; } .welcome-card h1 { font-size: 25px; } .welcome-card { padding: 22px; } .headquarters-preview img { width: 100px; height: 100px; } }
@media (max-height: 560px) { .welcome-art { display: none; } .welcome-card { bottom: var(--bottom); max-height: calc(var(--viewport-height) - var(--top) - 78px); } .operation-label { display: none; } .game.has-base .game-panel { top: calc(var(--top) + 65px); bottom: 12px; max-height: none; width: min(320px, calc(100vw - 28px)); } .game.has-base .resource-bar { left: auto; right: 130px; transform: none; top: 0; height: 48px; } .game.has-base .brand { max-width: 160px; } .game.has-base .map-dock, .game.has-base .ability-bar { left: auto; right: 70px; transform: none; width: 290px; } .game.has-base .map-dock button { min-width: 0; flex: 1; } .game.has-base .map-tools { bottom: var(--bottom); } .world-intel { display: none; } .headquarters-preview { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

@supports (height: 100dvh) { :root { --viewport-height: 100dvh; } }
#telegramWidget { display: flex; justify-content: center; margin-top: 8px; max-width: 100%; }
#telegramWidget:empty { display: none; }
#telegramWidget iframe { max-width: 100%; }
@media (max-height: 560px) and (max-width: 700px) { body:has(.game-panel:not([hidden])) .map-dock, body:has(.game-panel:not([hidden])) .ability-bar { visibility: hidden; } }

/* One shared WebGL renderer supplies these views and cached map stamps. */
.headquarters-preview .model-canvas { position: relative; z-index: 1; width: 148px; height: 148px; }
.model-canvas { display: block; aspect-ratio: 1; touch-action: pan-y; cursor: grab; }
.model-canvas:active { cursor: grabbing; }
.headquarters-preview img, .welcome-art img { image-rendering: auto; }
.model-inspect-button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 38px; width: 100%; margin-top: 9px; padding: 9px 10px; border: 1px solid #466176; border-radius: 7px; background: #203649; color: #d5eaf5; font-size: 10px; font-weight: 600; position: relative; z-index: 1; }
.model-inspect-button:hover { background: #2b4b5b; border-color: var(--accent); }
.base-model-button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 72px; margin: -6px 0 18px; padding: 5px 12px 5px 5px; border: 1px solid var(--line); border-radius: 8px; background: #0d1826; text-align: left; }
.base-model-button:hover { border-color: var(--accent); background: #182c3c; }
.base-model-button img { width: 60px; height: 60px; object-fit: contain; }
.base-model-button > span { font-size: 12px; }
.base-model-button > span:last-child { margin-left: auto; color: var(--accent); }
.base-model-button small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.headquarters-dialog { width: min(540px, calc(100vw - 28px)); }
.headquarters-dialog h2 { font-size: 25px; margin-bottom: 18px; }
.model-stage { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; border: 1px solid #30495e; border-radius: 12px; overflow: hidden; background: radial-gradient(ellipse at 50% 64%, #25465488, transparent 65%), repeating-linear-gradient(0deg, #9bd5f308 0 1px, transparent 1px 32px), repeating-linear-gradient(90deg, #9bd5f308 0 1px, transparent 1px 32px), #0a1421; }
.model-stage > img, .model-stage > canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.model-stage > canvas { position: absolute; inset: 0; }
.model-status { color: #a4becf; font-size: 11px; line-height: 1.7; margin: 12px 0; min-height: 18px; }
.model-controls { display: flex; align-items: center; gap: 8px; }
.model-controls .secondary-button { justify-content: center; width: 48px; min-height: 44px; margin: 0; padding: 10px; }
.model-controls .secondary-button:nth-child(2) { flex: 1; width: auto; font-size: 11px; }
.model-faction-picker { margin-top: 20px; }
.faction-sheet .model-inspect-button { font-size: 9px; margin-top: 17px; }
@media (max-width: 760px) {
  .headquarters-preview .model-canvas { width: 120px; height: 120px; }
  .headquarters-dialog { padding: 24px; }
  .headquarters-dialog h2 { font-size: 22px; }
  .model-stage { width: min(100%, 42vh); margin: 0 auto; }
  .model-status { font-size: 10px; }
}
@media (max-height: 740px) { .headquarters-preview .model-canvas { width: 100px; height: 100px; } }
@media (max-height: 560px) { .model-stage { width: min(100%, 40vh); margin: 0 auto; } }
/* Theme & Language & Header Tools */
.theme-button, .lang-button, .tutorial-button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 52px; padding: 0 14px; font-size: 12px; font-weight: 600; }
.theme-button { width: 52px; padding: 0; }
.lang-picker-wrap { position: relative; }
.lang-dropdown { position: absolute; top: calc(100% + 8px); right: 0; display: flex; flex-direction: column; min-width: 150px; padding: 6px; z-index: 100; gap: 4px; }
.lang-dropdown button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border-radius: 8px; background: transparent; border: none; text-align: left; font-size: 13px; font-weight: 600; color: var(--ink); }
.lang-dropdown button:hover { background: var(--soft); }

/* WoW-Style Achievement Banner */
.wow-achievement {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-140%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #1b120c 0%, #2e1d0f 50%, #150d06 100%);
  border: 2px solid #e5a93b;
  border-radius: 8px;
  padding: 12px 20px;
  box-shadow: 0 0 24px #e5a93b66, 0 12px 36px #000c;
  z-index: 10001;
  pointer-events: none;
  min-width: 320px;
  max-width: min(480px, calc(100vw - 32px));
  transition: transform 0.45s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.3s ease;
  opacity: 0;
}
.wow-achievement.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.wow-shield {
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: radial-gradient(circle, #ffe175 0%, #b8860b 80%);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 16px #ffcc00aa;
  flex-shrink: 0;
}
.wow-body { flex: 1; min-width: 0; }
.wow-header { display: block; font-size: 10px; font-weight: 800; letter-spacing: 0.16em; color: #ffdf7a; text-transform: uppercase; text-shadow: 0 0 8px #ffcc0088; }
.wow-title { margin: 2px 0 0 0; font-size: 16px; font-weight: 800; color: #ffffff; text-shadow: 0 2px 4px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wow-desc { margin: 2px 0 0 0; font-size: 11px; color: #d0c0a8; line-height: 1.3; }
.wow-points { display: flex; flex-direction: column; align-items: center; justify-content: center; padding-left: 12px; border-left: 1px solid #e5a93b44; }
.wow-points span { font-size: 17px; font-weight: 900; color: #ffeb3b; text-shadow: 0 0 10px #ffea00; }
.wow-points small { font-size: 9px; font-weight: 800; letter-spacing: 0.05em; color: #e5a93b; }

/* Fireworks Salute Canvas */
.salute-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10000;
}

/* Interactive Tutorial Overlay */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.tutorial-card {
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: modalPop 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
@keyframes modalPop { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
.tutorial-header { display: flex; align-items: center; justify-content: space-between; }
.tutorial-icon { font-size: 32px; }
.tutorial-step { font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 12px; background: var(--soft); color: var(--accent); }
.tutorial-card h3 { font-size: 20px; color: var(--ink); }
.tutorial-card p { font-size: 14px; line-height: 1.5; color: var(--muted); }
.tutorial-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }

/* Achievements Dialog */
.achievements-dialog { width: min(520px, calc(100vw - 28px)); max-height: calc(var(--viewport-height) - 60px); }
.achievements-summary { display: flex; gap: 12px; padding: 14px 18px; margin: 12px 0 16px 0; }
.ach-total-badge, .ach-count-badge { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ach-total-badge strong { font-size: 20px; color: #ffeb3b; }
.ach-count-badge strong { font-size: 20px; color: var(--accent); }
.achievements-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 55vh; padding-right: 4px; }
.ach-card { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); }
.ach-card.unlocked { border-color: #ffd70066; background: linear-gradient(90deg, #ffd70014, transparent); }
.ach-card-icon { font-size: 24px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: #0004; border-radius: 8px; flex-shrink: 0; }
.ach-card-info { flex: 1; min-width: 0; }
.ach-card-info h4 { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink); }
.ach-card-info p { margin: 3px 0 0 0; font-size: 12px; color: var(--muted); }
.ach-card-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.ach-card-points { font-size: 13px; font-weight: 800; color: #ffeb3b; }
.ach-progress-bar { width: 70px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.ach-progress-bar i { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }

/* Referral Dialog & Battery */
.referral-dialog { width: min(480px, calc(100vw - 28px)); }
.referral-battery { display: flex; flex-direction: column; gap: 12px; padding: 16px; margin: 14px 0; align-items: stretch; }
.battery-meter { display: flex; align-items: center; gap: 14px; }
.battery-icon { font-size: 32px; filter: drop-shadow(0 0 8px #ffeb3b); }
.battery-meter strong { font-size: 26px; color: #ffd700; font-weight: 800; }
.battery-meter small { display: block; font-size: 11px; color: var(--muted); }
.referral-stats-row { display: flex; justify-content: space-between; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.referral-stats-row strong { color: var(--ink); margin-left: 6px; }
.ref-link-box { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.copy-input-row { display: flex; gap: 8px; }
.copy-input-row input { flex: 1; background: var(--soft); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 8px 12px; font-size: 12px; }
.telegram-share-btn { margin-top: 4px; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* Profile Customization (Color & Social Link) */
.profile-customization { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.color-palette { display: flex; flex-wrap: wrap; gap: 8px; }
.color-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #ffffff44; cursor: pointer; transition: transform 0.15s, border-color 0.15s; }
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: #fff; box-shadow: 0 0 10px currentColor; transform: scale(1.2); }
.custom-color-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.custom-color-row input[type="color"] { width: 44px; height: 32px; border: none; border-radius: 6px; cursor: pointer; background: transparent; }
.profile-customization input[type="url"], .profile-customization input[type="text"] { background: var(--soft); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 10px 12px; font-size: 13px; width: 100%; }
.panel-divider { border: 0; height: 1px; background: var(--line); margin: 12px 0; }

/* Tooltip Social Link */
.tooltip-social-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 10px; border-radius: 6px; background: #0088cc26; border: 1px solid #0088cc88; color: #29b6f6; text-decoration: none; font-size: 12px; font-weight: 700; }
.tooltip-social-link:hover { background: #0088cc44; color: #fff; }



.troops-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; image-rendering: auto; }
#troopsToggle[aria-pressed=false] { opacity: .5; }
.troop-role-picker { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; margin-top: 18px; }
.troop-role-picker button { display: grid; justify-items: center; gap: 7px; padding: 6px 2px 10px; background: #102031; border: 1px solid #30495e; border-radius: 8px; min-width: 0; }
.troop-role-picker button.selected { border-color: var(--accent); background: #1d3d43; }
.troop-role-picker img { width: 100%; max-height: 62px; object-fit: contain; }
.troop-role-picker b { font-size: 9px; }
.troop-animation-controls { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.troop-animation-controls button { border: 1px solid #38546a; background: #172b3d; color: #b7d2df; padding: 9px 10px; border-radius: 6px; font-size: 10px; min-height: 36px; }
.troop-animation-controls button.selected { border-color: var(--accent); color: var(--accent); background: #1d3b40; }
#troopRotateControls { justify-content: center; margin: 8px 0; }
@media (max-width: 560px) { .troop-role-picker img { max-height: 45px; } .troop-role-picker b { font-size: 8px; } }
.ability-icon img { width: 44px; height: 29px; object-fit: contain; }

#troopsBtn { flex-direction: column; gap: 3px; font-size: 8px; min-height: 48px; }
#troopsToggle { font-size: 14px; font-weight: 700; }
.troop-role-picker button, .troops-dialog .faction-picker button { color: #d5e5ef; }
:root[data-theme="light"] .troops-dialog { background: #f3f8fc; color: #142a3c; }
:root[data-theme="light"] .troops-dialog .model-status { color: #405e75; }
