:root {
  --bg: #0d0b1a;
  --panel: rgba(20, 16, 36, 0.9);
  --panel-2: rgba(34, 27, 58, 0.95);
  --edge: #c9a24a;
  --edge-dim: #6d5628;
  --text: #efe6cf;
  --muted: #a99e86;
  --good: #7fd35a;
  --bad: #ff6a4d;
  --warn: #ffc94a;
  --blue: #5c8cf0;
  --font: 'VT323', ui-monospace, monospace;
  --font-title: 'Press Start 2P', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 19px; }
canvas#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; image-rendering: pixelated; }
button { font-family: var(--font); font-size: 18px; color: var(--text); background: #2b2244; border: 2px solid var(--edge-dim); padding: 2px 8px; cursor: pointer; image-rendering: pixelated; }
button:hover { border-color: var(--edge); background: #3a2e5c; }
button.on, button.active { border-color: var(--edge); background: #5a4520; color: #fff4c8; }
button:disabled { opacity: 0.45; cursor: default; }
input, select { font-family: var(--font); font-size: 18px; background: #151126; color: var(--text); border: 2px solid var(--edge-dim); padding: 2px 6px; }
.hidden { display: none !important; }

.panel { position: absolute; background: var(--panel); border: 2px solid var(--edge-dim); box-shadow: 0 0 0 2px #000, inset 0 0 0 1px #000; }
.panel h3 { margin: 0 0 6px; font-family: var(--font-title); font-size: 10px; color: var(--edge); letter-spacing: 1px; }
.panel h3 small { font-family: var(--font); font-size: 15px; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.ico { display: inline-block; width: 16px; height: 16px; background-repeat: no-repeat; image-rendering: pixelated; vertical-align: -2px; flex: none; }
.ico.x2 { width: 32px; height: 32px; }

/* ---------- top bar ---------- */
#topbar { top: 6px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 4px 10px; white-space: nowrap; z-index: 5; }
.tb-god { display: flex; flex-direction: column; line-height: 0.9; min-width: 120px; }
.tb-god span { font-family: var(--font-title); font-size: 9px; color: var(--edge); }
.tb-god small { color: var(--muted); font-size: 15px; margin-top: 3px; }
.tb-mana { display: flex; align-items: center; gap: 6px; }
.tb-mana .bar { position: relative; width: 150px; height: 16px; background: #120d22; border: 1px solid #000; }
.tb-mana .bar > div { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#8fb4ff, #3c5fd6); width: 0; }
.tb-mana .bar span { position: absolute; inset: 0; text-align: center; font-size: 16px; line-height: 15px; text-shadow: 1px 1px #000; }
.tb-stat { display: flex; align-items: center; gap: 4px; }
.tb-year { font-family: var(--font-title); font-size: 9px; color: #fff2c0; min-width: 88px; text-align: center; }
.tb-speed { display: flex; gap: 2px; }
.tb-speed button { padding: 0 6px; font-size: 16px; }

/* ---------- powers ---------- */
#powers { left: 6px; top: 64px; display: grid; grid-template-columns: repeat(2, 38px); gap: 3px; padding: 4px; z-index: 4; }
.pw { position: relative; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; }
.pw .ico { width: 28px; height: 28px; }
.pw .key { position: absolute; left: 2px; top: 0; font-size: 14px; color: var(--muted); }
.pw .cost { position: absolute; right: 2px; bottom: -1px; font-size: 14px; color: #9fc0ff; text-shadow: 1px 1px #000; }
.pw .cd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); pointer-events: none; }
.pw.locked { filter: grayscale(1) brightness(0.5); }
.pw.poor .cost { color: var(--bad); }
.pw.sep { }
#powerhint { left: 96px; top: 64px; width: 280px; padding: 6px 8px; z-index: 6; font-size: 17px; line-height: 1.05; pointer-events: none; }
#powerhint b { color: var(--edge); }

/* ---------- priorities ---------- */
#leftcol { position: absolute; left: 98px; bottom: 6px; z-index: 3; }
#priorities { position: relative; width: 250px; padding: 6px 8px; }
.prio { display: grid; grid-template-columns: 18px 78px 1fr 26px; align-items: center; gap: 4px; height: 20px; }
.prio label { font-size: 17px; }
.prio input[type=range] { width: 100%; accent-color: var(--edge); height: 12px; }
.prio .v { text-align: right; color: var(--muted); font-size: 16px; }
.rivals { margin-top: 6px; border-top: 1px solid var(--edge-dim); padding-top: 4px; font-size: 16px; }
.rival { display: flex; justify-content: space-between; gap: 6px; white-space: nowrap; }
.rival > span:first-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rival > span:last-child { flex: none; }
.rival .sw { display: inline-block; width: 10px; height: 10px; border: 1px solid #000; margin-right: 4px; }
.rival.dead { opacity: 0.4; text-decoration: line-through; }

/* ---------- side panel (settlement / army) ---------- */
#sidepanel { right: 6px; top: 64px; width: 330px; max-height: calc(100vh - 330px); overflow-y: auto; padding: 8px 10px; z-index: 4; }
#sidepanel .close { position: absolute; right: 4px; top: 2px; padding: 0 6px; }
.sp-title { font-family: var(--font-title); font-size: 11px; color: var(--edge); margin: 2px 0 4px; }
.sp-sub { color: var(--muted); font-size: 16px; margin-bottom: 6px; }
.kv { display: grid; grid-template-columns: 1fr auto; font-size: 18px; line-height: 1.02; }
.kv .k { color: var(--muted); }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.sp-sec { margin-top: 8px; border-top: 1px solid var(--edge-dim); padding-top: 4px; }
.sp-sec h4 { margin: 0 0 3px; font-family: var(--font-title); font-size: 8px; color: var(--edge); }
.lab { display: grid; grid-template-columns: 90px 1fr 40px; align-items: center; gap: 6px; font-size: 17px; height: 17px; }
.lab .b { height: 9px; background: #120d22; border: 1px solid #000; position: relative; }
.lab .b > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--edge); }
.problems div { color: var(--warn); font-size: 17px; line-height: 1.05; }
.problems div::before { content: '▸ '; }
.stock { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 17px; }
.stock span { display: inline-flex; align-items: center; gap: 3px; }
.techs { display: grid; grid-template-columns: 1fr; gap: 1px; font-size: 16px; }
.tech { display: flex; justify-content: space-between; padding: 0 3px; border-left: 3px solid transparent; line-height: 1.05; }
.tech.researched { border-color: var(--good); color: #cfe9bf; }
.tech.researching { border-color: var(--blue); color: #cfe0ff; }
.tech.available { border-color: #777; color: var(--muted); }
.tech.missing_resources { border-color: var(--warn); color: #c9b27a; }
.tech.blocked { border-color: #333; color: #6d6679; }
.tech .st { font-size: 14px; opacity: 0.85; }
.local-toggle { display: flex; gap: 6px; align-items: center; font-size: 17px; }

/* ---------- log ---------- */
#log { left: 356px; bottom: 6px; width: clamp(220px, calc(100vw - 356px - 222px), 520px); z-index: 3; }
.log-head { display: flex; justify-content: space-between; padding: 2px 6px; font-family: var(--font-title); font-size: 8px; color: var(--edge); }
.log-head button { padding: 0 6px; font-size: 14px; }
#log-body { max-height: 150px; overflow-y: auto; padding: 0 6px 4px; font-size: 17px; line-height: 1.05; }
#log.collapsed #log-body { max-height: 38px; }
.ev { cursor: pointer; padding: 1px 0; }
.ev:hover { color: #fff; }
.ev .t { color: var(--muted); margin-right: 6px; white-space: nowrap; }
.ev.war, .ev.battle_lost, .ev.captured_by, .ev.famine, .ev.defeat, .ev.threat, .ev.siege, .ev.flood { color: #ffb09c; }
.ev.tech, .ev.era, .ev.founded, .ev.battle_won, .ev.captured, .ev.victory { color: #d7f5b8; }

/* ---------- minimap ---------- */
#minimap-wrap { right: 6px; bottom: 6px; padding: 4px; z-index: 3; }
#minimap { display: block; width: 192px; height: 192px; image-rendering: pixelated; cursor: pointer; background: #000; }
#overlays { display: flex; gap: 2px; margin-top: 4px; flex-wrap: wrap; width: 192px; }
#overlays button { flex: 1; padding: 0 2px; font-size: 16px; min-width: 22px; }

#tooltip { position: fixed; pointer-events: none; background: rgba(10,8,20,0.92); border: 1px solid var(--edge-dim); padding: 3px 6px; font-size: 16px; line-height: 1.02; z-index: 20; max-width: 280px; }
#toast { position: fixed; left: 50%; top: 58px; transform: translateX(-50%); background: rgba(60,20,20,0.92); border: 2px solid #a44; padding: 3px 12px; z-index: 30; font-size: 19px; }
#toast.ok { background: rgba(20,40,20,0.92); border-color: #4a4; }

/* ---------- debug ---------- */
#debug { right: 344px; top: 64px; width: 250px; padding: 6px; z-index: 8; font-size: 16px; }
#debug button { font-size: 15px; margin: 1px; padding: 0 4px; }
#debug .row { margin: 3px 0; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 30%, rgba(40,30,80,0.55), rgba(5,4,12,0.92)); z-index: 50; }
#title { background: radial-gradient(ellipse at 50% 45%, rgba(20,16,40,0.35) 0%, rgba(8,6,18,0.78) 75%); }
#title::before { display: none; content: ''; position: absolute; inset: 0; background-image: radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 20%, #cde, transparent), radial-gradient(1px 1px at 40% 70%, #fff, transparent), radial-gradient(1px 1px at 85% 60%, #ffe, transparent), radial-gradient(1px 1px at 10% 85%, #fff, transparent), radial-gradient(1px 1px at 60% 90%, #ccf, transparent); background-size: 240px 240px; opacity: 0.8; }
.title-card { position: relative; background: var(--panel-2); border: 3px solid var(--edge); box-shadow: 0 0 0 3px #000, 0 12px 60px rgba(0,0,0,0.7); padding: 22px 30px; text-align: center; max-width: 560px; }
.title-card.small { max-width: 360px; }
.title-card.wide { max-width: 900px; text-align: left; }
.logo-sm { font-family: var(--font-title); font-size: 16px; color: #d8cfb6; letter-spacing: 6px; }
.logo { font-family: var(--font-title); font-size: 46px; color: #e8dcc0; text-shadow: 4px 4px 0 #3b2d12, 0 0 20px rgba(201,162,74,0.35); letter-spacing: 2px; margin: 8px 0; }
.logo.small { font-size: 20px; text-align: center; }
.subtitle { color: var(--edge); font-size: 20px; margin-bottom: 14px; text-transform: uppercase; letter-spacing: 1px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; text-align: left; margin: 10px 0 14px; }
.form label { display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
.form label.chk { flex-direction: row; align-items: center; gap: 6px; }
.buttons { display: flex; flex-direction: column; gap: 6px; align-items: stretch; margin-top: 8px; }
.buttons button.big { font-family: var(--font-title); font-size: 13px; padding: 10px; background: #5a4520; border-color: var(--edge); }
.help-mini { margin-top: 14px; color: var(--muted); font-size: 17px; line-height: 1.1; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; font-size: 18px; line-height: 1.1; }
.help-grid h4 { font-family: var(--font-title); font-size: 9px; color: var(--edge); margin: 10px 0 4px; }
.help-grid p { margin: 0 0 6px; }
#gpu-error { margin-top: 12px; color: var(--bad); font-size: 18px; }
.loading-text { font-family: var(--font-title); font-size: 14px; color: var(--edge); }

@media (max-width: 1100px) {
  #leftcol { left: 98px; }
  #sidepanel { width: 280px; }
}

/* ---------- phase 9: diplomacy, doctrines, flash ---------- */
.tb-menu { display: flex; gap: 4px; }
#btn-diplo { position: relative; padding: 1px 6px; }
.badge { position: absolute; right: -6px; top: -6px; background: var(--bad); color: #fff; border-radius: 8px; font-size: 13px; line-height: 14px; padding: 0 4px; }
#diplo { left: 50%; top: 64px; transform: translateX(-50%); width: min(620px, calc(100vw - 20px)); max-height: calc(100vh - 120px); overflow-y: auto; padding: 8px 12px; z-index: 9; }
#diplo .close { position: absolute; right: 4px; top: 2px; padding: 0 6px; }
.dp-civ { border: 1px solid var(--edge-dim); padding: 6px 8px; margin: 6px 0; background: rgba(0,0,0,0.25); }
.dp-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dp-name { font-family: var(--font-title); font-size: 9px; }
.dp-state { font-size: 17px; padding: 0 6px; border: 1px solid; }
.dp-state.war { color: var(--bad); border-color: var(--bad); } .dp-state.peace { color: var(--muted); border-color: var(--muted); }
.dp-state.trade { color: var(--warn); border-color: var(--warn); } .dp-state.alliance { color: var(--good); border-color: var(--good); }
.dp-bars { display: grid; grid-template-columns: 150px 1fr 40px; gap: 2px 8px; font-size: 16px; align-items: center; margin: 4px 0; }
.opbar { height: 8px; background: #120d22; border: 1px solid #000; position: relative; }
.opbar > i { position: absolute; top: 0; bottom: 0; }
.opbar::after { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--muted); }
.dp-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.dp-actions button { font-size: 16px; padding: 0 6px; }
.dp-prop { border: 2px solid var(--warn); padding: 6px 8px; margin: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: 6px; background: rgba(80,60,10,0.3); }
.doctrines { margin-top: 6px; border-top: 1px solid var(--edge-dim); padding-top: 4px; }
.doc-head { font-size: 17px; color: var(--edge); display: flex; align-items: center; gap: 4px; }
.doc-head small { color: var(--muted); margin-left: auto; }
.doc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-top: 3px; }
.doc-row button { grid-column: 1 / span 2; }
.doc-row select { font-size: 15px; padding: 0 2px; min-width: 0; }
.doc-row button { font-size: 15px; padding: 0 4px; }
.fol { display: flex; height: 10px; border: 1px solid #000; margin: 2px 0 4px; }
.fol > i { display: block; height: 100%; }
#flash { position: fixed; inset: 0; background: #fffbe8; z-index: 40; pointer-events: none; transition: opacity 1.4s ease-out; }

/* ---------- campaign / objectives (phase 10) ---------- */
.camp-grid { display: grid; grid-template-columns: 300px 1fr; gap: 14px; text-align: left; margin: 10px 0; }
#camp-list { display: flex; flex-direction: column; gap: 4px; }
#camp-list button { text-align: left; }
#camp-list button.sel { outline: 2px solid var(--edge); }
#camp-list button .st { float: right; color: var(--good, #8f8); }
#camp-list button:disabled { opacity: 0.45; }
#camp-brief h4 { margin: 0 0 6px; color: var(--edge); }
#camp-brief ul, #obj-list { margin: 4px 0; padding-left: 18px; }
.muted { color: var(--muted); }
#objectives { left: 50%; transform: translateX(-50%); top: 64px; width: 360px; padding: 4px 8px; z-index: 3; font-size: 17px; }
#objectives h3 { margin: 0 0 2px; }
#obj-list li.done { color: #8fd08f; text-decoration: line-through; }
#ark { margin: 8px 0; text-align: left; }
#ark input { vertical-align: middle; width: 200px; }

/* phase 11 */
@media (max-height: 780px) { #powers { grid-template-columns: repeat(3, 38px); } #powerhint { left: 136px; } #leftcol { left: 138px; } #log { left: 396px; width: clamp(220px, calc(100vw - 396px - 222px), 520px); } }
.spy-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin: 3px 0; }
.spy-row button { padding: 1px 2px; font-size: 15px; }

/* ---------- multiplayer (phase 12) ---------- */
.chatlog { height: 150px; overflow-y: auto; background: rgba(0,0,0,0.35); border: 1px solid var(--edge-dim); padding: 3px 6px; font-size: 16px; text-align: left; }
.chatlog .me { color: #9fc0ff; } .chatlog .sys { color: var(--muted); font-style: italic; }
#mp-chatin, #mpbar-chatin { width: 100%; box-sizing: border-box; margin-top: 3px; }
#mp-players .pl { display: flex; justify-content: space-between; padding: 2px 4px; border-bottom: 1px solid var(--edge-dim); }
#mp-players .pl .sw { display: inline-block; width: 10px; height: 10px; border: 1px solid #000; margin-right: 5px; }
.small-form label { font-size: 16px; }
#mpbar { right: 6px; top: 64px; width: 250px; padding: 4px 6px; z-index: 5; font-size: 16px; }
#mpbar .chatlog { height: 90px; font-size: 15px; }
#mpbar-status { color: var(--warn, #f0c060); min-height: 16px; }
#mpbar-players .pl { display: flex; justify-content: space-between; }
body.mp #sidepanel { top: 250px; max-height: calc(100vh - 516px); }
#mp .title-card.wide { width: min(900px, calc(100vw - 40px)); }
#mp-lobby .camp-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
#mp-lobby .form select, #mp-lobby .form input[type=text] { width: 100%; box-sizing: border-box; min-width: 0; }
#mp-connect.form { grid-template-columns: 1fr 1fr; }
#mp-connect .help-mini, #mp-connect .buttons { grid-column: 1 / -1; }

/* side panel tabs + visible scrollbars (post-13 layout fix) */
.sp-tabs { display: flex; gap: 3px; margin: 2px 0 4px; }
.sp-tabs button { flex: 1; padding: 0 2px; font-size: 15px; white-space: nowrap; }
.panel, #log-body { scrollbar-width: thin; scrollbar-color: var(--edge-dim) rgba(0,0,0,0.3); }
.tech { gap: 8px; }
.tech > span:first-child { flex: none; }
.tech > .st { text-align: right; }

/* volume sliders in the pause menu */
.vol-grid { display: grid; grid-template-columns: 80px 1fr 38px; gap: 2px 8px; align-items: center; padding: 4px 6px; border: 2px solid var(--edge-dim); background: rgba(0,0,0,0.25); font-size: 17px; }
.vol-grid label { color: var(--muted); text-align: left; }
.vol-grid input { width: 100%; accent-color: var(--edge); }
.vol-grid span { text-align: right; color: var(--muted); }

/* new-game form: keep selects inside the card */
.form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.form select, .form input[type=text] { width: 100%; box-sizing: border-box; min-width: 0; }

/* ---------- why tooltips / outlook / diplomacy timeline ---------- */
.pw.blocked { filter: saturate(0.35) brightness(0.8); }
.outlook { display: grid; gap: 1px; font-size: 15px; }
.ol { display: flex; justify-content: space-between; gap: 8px; padding: 0 3px; border-left: 3px solid #333; line-height: 1.05; }
.ol > span:first-child { flex: none; }
.ol .st { text-align: right; font-size: 13px; opacity: 0.85; }
.ol.built { border-color: var(--good); color: #cfe9bf; }
.ol.building { border-color: var(--blue); color: #cfe0ff; }
.ol.waiting { border-color: var(--warn); color: #d8c690; }
.ol.locked { border-color: #333; color: #6d6679; }
.dp-risk { margin: 1px 0 2px; cursor: help; }
.dp-bars { cursor: help; }
#diplo-timeline h4 { margin: 8px 0 2px; font-size: 15px; color: var(--edge, #c9a24a); letter-spacing: 1px; }
.dp-tl { font-size: 15px; line-height: 1.1; padding: 1px 0; color: var(--muted); }
.dp-tl .t { opacity: 0.6; margin-right: 6px; font-size: 13px; }
.dp-tl.war, .dp-tl.massing, .dp-tl.marching, .dp-tl.war_risk, .dp-tl.truce_broken_you, .dp-tl.coalition { color: #f0a090; }
.dp-tl.peace, .dp-tl.alliance, .dp-tl.treaty_trade, .dp-tl.tribute_received, .dp-tl.ceded_to_you { color: #b8e0a0; }
#tutorial { position: fixed; left: 50%; top: 92px; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); z-index: 25; padding: 6px 12px 8px; border-color: var(--edge, #c9a24a); background: rgba(24,18,44,0.95); }
#tutorial.tip { border-color: #6aa8ff; }
/* tutorial pointer: a ring around the control + a bouncing arrow beside it (or above a spot in the world) */
#tut-arrow { position: fixed; z-index: 40; pointer-events: none; }
#tut-arrow.hidden { display: none; }
#tut-arrow .tut-ring { position: absolute; inset: -4px; border: 3px solid #ffd257; box-shadow: 0 0 0 2px #2a1a06, 0 0 14px #ffd257; animation: tutPulse 1s ease-in-out infinite; }
#tut-arrow.world .tut-ring { inset: auto; left: -18px; top: -9px; width: 36px; height: 18px; border-radius: 50%; }
#tut-arrow .tut-pointer { position: absolute; width: 0; height: 0; border: 14px solid transparent; filter: drop-shadow(0 0 2px #2a1a06) drop-shadow(0 0 6px rgba(255,210,87,.8)); }
#tut-arrow.dir-down .tut-pointer { left: calc(50% - 14px); bottom: calc(100% + 6px); border-top: 22px solid #ffd257; border-bottom: 0; animation: tutBobV 0.7s ease-in-out infinite alternate; }
#tut-arrow.world.dir-down .tut-pointer { left: -14px; bottom: 12px; }
#tut-arrow.dir-up .tut-pointer { left: calc(50% - 14px); top: calc(100% + 6px); border-bottom: 22px solid #ffd257; border-top: 0; animation: tutBobV2 0.7s ease-in-out infinite alternate; }
#tut-arrow.dir-left .tut-pointer { top: calc(50% - 14px); left: calc(100% + 6px); border-right: 22px solid #ffd257; border-left: 0; animation: tutBobH 0.7s ease-in-out infinite alternate; }
#tut-arrow.dir-right .tut-pointer { top: calc(50% - 14px); right: calc(100% + 6px); border-left: 22px solid #ffd257; border-right: 0; animation: tutBobH2 0.7s ease-in-out infinite alternate; }
@keyframes tutPulse { 50% { opacity: 0.45; } }
@keyframes tutBobV { to { transform: translateY(-8px); } }
@keyframes tutBobV2 { to { transform: translateY(8px); } }
@keyframes tutBobH { to { transform: translateX(8px); } }
@keyframes tutBobH2 { to { transform: translateX(-8px); } }
#tutorial .tut-h { color: var(--edge, #c9a24a); font-size: 19px; letter-spacing: 1px; }
#tutorial .tut-h small { color: var(--muted); font-size: 14px; }
#tutorial .tut-b { font-size: 17px; line-height: 1.15; margin: 3px 0 6px; }
#tutorial .tut-btns { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.spec-row { display: flex; flex-wrap: wrap; gap: 3px; }
.spec-row button { font-size: 15px; padding: 1px 6px; }
#unit-tags { position: fixed; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 4; }
.utag { position: absolute; left: 0; top: 0; font-size: 13px; line-height: 1; padding: 1px 3px 0; background: rgba(12,10,24,0.78); color: #eee; border: 1px solid #888; border-left-width: 3px; white-space: nowrap; }
.utag.own { color: #fff4c8; }
.utag.foe { color: #ffb0a0; }
.utag.weak { opacity: 0.7; font-style: italic; }
.utag.fleet { color: #bfe2ff; }
#menu .title-card { max-height: calc(100vh - 16px); overflow-y: auto; }
#menu .opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#menu .opt-grid button { font-size: 15px; padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#menu .title-card.small { max-width: 560px; }
