/* Swarajya 3D — interface (2 Oct 2026).
 *
 * One stylesheet for the whole 3D interface. It replaces the page's inline
 * <style> block and presentation.css, which had grown into two layers fighting
 * each other: four typefaces, three golds, emoji for icons, and inline styles
 * written into the HTML by the game code.
 *
 * Two typefaces: Cinzel for names and titles (carved, the voice of the world),
 * Inter for everything you read while playing (numbers line up, small sizes
 * stay legible). Colours are tokens; nothing below should need a raw hex.
 */
:root {
  --bg: #0a1014;
  --panel: rgba(13, 21, 25, 0.93);
  --panel-solid: #111b20;
  --panel-raised: #18252b;
  --inset: #0c1518;
  --line: rgba(225, 185, 116, 0.24);
  --line-strong: rgba(225, 185, 116, 0.5);
  --line-soft: rgba(255, 255, 255, 0.08);
  --gold: #e1b974;
  --gold-bright: #f2d49a;
  --text: #ebe6d9;
  --muted: #a3aeab;
  --dim: #6f7c7a;
  --good: #79c08e;
  --warn: #e0a458;
  --bad: #d9654f;
  --magic: #9d8ce0;
  --res-gold: #e8bd52;
  --res-timber: #93b86e;
  --res-food: #dcc57e;
  --res-pop: #93b4cc;
  --radius: 6px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font-ui: Inter, "Segoe UI", system-ui, sans-serif;
  --font-title: Cinzel, Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
kbd {
  display: inline-block; min-width: 18px; padding: 0 4px;
  font: 600 10px/16px var(--font-ui); text-align: center; color: var(--muted);
  background: var(--inset); border: 1px solid var(--line-soft); border-bottom-width: 2px; border-radius: 3px;
}
/* Thin, themed scrollbars for the menu, guide and tooltips */
* { scrollbar-width: thin; scrollbar-color: rgba(225, 185, 116, .35) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(225, 185, 116, .3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(225, 185, 116, .5); }
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Shared panel surface */
.panel, #top-bar, #army-roster-panel, #campaign-hud, #selection-info, #action-bar, #field-guide,
#hud-tooltip, #hud-game-notice, .menu-card, .modal-card, #victory-banner {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.panel-label {
  font: 600 10px var(--font-ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold);
}

#canvas-container { position: absolute; inset: 0; z-index: 1; }
#select-box {
  position: absolute; display: none; z-index: 20; pointer-events: none;
  border: 1px solid var(--gold-bright); background: rgba(242, 212, 154, 0.12);
}

/* ---------------------------------------------------------------- Top bar */
#top-bar {
  position: absolute; z-index: 30; top: 10px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  width: max-content; max-width: calc(100vw - 24px);
  padding: 5px 6px 5px 12px;
}
.res-group { display: flex; align-items: center; gap: 4px; }
.res-item {
  display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 8px;
  border-radius: 4px; background: var(--inset); border: 1px solid var(--line-soft);
  font: 600 14px var(--font-ui); font-variant-numeric: tabular-nums; white-space: nowrap; cursor: default;
}
.res-item .ico { width: 18px; height: 18px; }
.res-item small { font-size: 11px; font-weight: 500; color: var(--dim); }
#res-gold .ico { color: var(--res-gold); }
#res-timber .ico { color: var(--res-timber); }
#res-food .ico { color: var(--res-food); }
#res-pop .ico { color: var(--res-pop); }
.bar-sep { width: 1px; height: 22px; margin: 0 6px; background: var(--line-soft); }
.hud-time-tag { font: 600 12px var(--font-ui); color: var(--muted); font-variant-numeric: tabular-nums; padding: 0 6px; white-space: nowrap; }
.header-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px;
  font: 500 12px var(--font-ui); color: var(--text); white-space: nowrap;
  background: transparent; border: 1px solid transparent; border-radius: 4px;
  transition: background .12s, border-color .12s, color .12s;
}
.header-btn:hover { background: var(--panel-raised); border-color: var(--line); color: var(--gold-bright); }
.header-btn kbd { margin-left: 2px; }
#hud-idle-worker-badge { color: var(--muted); }
#hud-idle-worker-badge.has-idle { color: var(--warn); }
#hud-idle-worker-badge strong { font-variant-numeric: tabular-nums; }

/* Blessings and notices under the bar */
.hud-blessings {
  position: absolute; z-index: 25; top: 60px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; pointer-events: none;
}
.blessing {
  padding: 3px 10px; font-size: 11px; color: var(--text);
  background: var(--panel); border: 1px solid var(--accent, var(--gold)); border-radius: 999px;
}
.blessing b { color: var(--accent, var(--gold)); font-weight: 600; margin-right: 4px; }
#hud-game-notice {
  position: absolute; z-index: 150; top: 96px; left: 50%; transform: translate(-50%, -6px);
  padding: 8px 16px; font: 500 13px var(--font-ui); color: var(--text);
  border-left: 3px solid var(--accent, var(--gold));
  pointer-events: none; opacity: 0; transition: opacity .25s, transform .25s;
}
#hud-game-notice.visible { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------- Left: roster, groups */
#army-roster-panel {
  position: absolute; z-index: 15; top: 62px; left: 12px; width: 196px; padding: 10px 12px;
}
#army-roster-panel h3 { margin-bottom: 8px; }
.roster-empty { font-size: 12px; color: var(--dim); }
.roster-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.roster-unit {
  position: relative; height: 40px; padding: 0; border-radius: 4px;
  background: var(--inset); border: 1px solid var(--line-soft);
  display: grid; place-items: center;
}
.roster-unit:hover { border-color: var(--line-strong); }
.roster-unit img { width: 32px; height: 32px; object-fit: contain; pointer-events: none; }
.roster-unit b {
  position: absolute; right: 2px; bottom: 1px; font: 700 10px var(--font-ui); color: var(--text);
  text-shadow: 0 1px 2px #000;
}
.roster-total { margin-top: 8px; font-size: 11px; color: var(--muted); }
.hud-groups { position: absolute; z-index: 25; left: 132px; bottom: 120px; display: flex; gap: 4px; }
.grp-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px 0 4px;
  font: 600 12px var(--font-ui); color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
}
.grp-chip:hover { border-color: var(--gold); }

/* --------------------------------------------- Bottom dock: selection + commands */
#bottom-hud-console {
  position: absolute; z-index: 20; bottom: 12px; left: 128px; right: 228px;
  display: flex; align-items: flex-end; justify-content: center; gap: 8px; pointer-events: none;
}
#selection-info {
  display: none; gap: 12px; width: 280px; flex: none; padding: 10px 12px; pointer-events: auto;
}
.sel-portrait {
  width: 64px; height: 64px; flex: none; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #22343b, var(--inset));
  border: 1px solid var(--line); border-radius: 4px; color: var(--muted);
}
.sel-portrait img { width: 58px; height: 58px; object-fit: contain; }
.sel-portrait .ico { width: 32px; height: 32px; }
.sel-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sel-title { display: flex; align-items: center; gap: 8px; font: 600 15px var(--font-title); color: var(--gold-bright); letter-spacing: .02em; }
.sel-tag { font: 600 9px var(--font-ui); letter-spacing: .1em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; color: var(--muted); border: 1px solid var(--line-soft); }
.sel-tag.enemy { color: var(--bad); border-color: rgba(217, 101, 79, .5); }
.sel-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-row { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sel-stats { display: flex; gap: 10px; }
.sel-stats span, .sel-line, .sel-chips span { display: inline-flex; align-items: center; gap: 4px; }
.sel-stats .ico { width: 13px; height: 13px; color: var(--dim); }
.sel-line { font-size: 12px; color: var(--text); }
.sel-line .ico { width: 14px; height: 14px; color: var(--gold); }
.sel-line.dim { color: var(--dim); font-size: 11px; }
.sel-line.dim .ico { color: var(--dim); }
.sel-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.sel-chips span { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--inset); border: 1px solid var(--line-soft); color: var(--muted); }
.sel-chips .ico { width: 12px; height: 12px; }
.sel-queue, .sel-group { display: flex; gap: 4px; flex-wrap: wrap; }
.sel-queue span, .sel-group span {
  position: relative; width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--inset); border: 1px solid var(--line-soft); border-radius: 4px; color: var(--muted);
}
.sel-queue span:first-child { border-color: var(--line-strong); }
.sel-queue img, .sel-group img { width: 28px; height: 28px; object-fit: contain; }
.sel-queue b, .sel-group b { position: absolute; right: 2px; bottom: 0; font: 700 10px var(--font-ui); color: var(--text); text-shadow: 0 1px 2px #000; }

/* Meters: health, progress, experience */
.meter { height: 6px; border-radius: 3px; background: var(--inset); border: 1px solid var(--line-soft); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 2px; transition: width .2s linear; }
.meter.good i { background: linear-gradient(90deg, #4f9a68, var(--good)); }
.meter.warn i { background: linear-gradient(90deg, #b8823d, var(--warn)); }
.meter.bad i { background: linear-gradient(90deg, #a5402f, var(--bad)); }
.meter.progress i { background: linear-gradient(90deg, #b48a4c, var(--gold-bright)); }
.meter.xp i { background: linear-gradient(90deg, #6d5fb0, var(--magic)); }

/* Command grid */
#action-bar {
  display: none; pointer-events: auto; padding: 6px; gap: 4px;
  grid-template-columns: repeat(var(--cols, 5), var(--cell, 148px)); grid-auto-rows: 46px; flex: none;
}
.cmd {
  position: relative; display: flex; align-items: center; gap: 6px; height: 46px; padding: 4px 5px 4px 4px;
  text-align: left; background: var(--panel-raised); border: 1px solid var(--line-soft); border-radius: 4px;
  transition: border-color .12s, background .12s;
}
.cmd:hover { border-color: var(--line-strong); background: #1e2e35; }
.cmd:active { transform: translateY(1px); }
.cmd.group-start { margin-left: 0; }
.cmd-pic {
  position: relative; width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  background: var(--inset); border-radius: 3px; color: var(--gold);
}
.cmd-art { width: 34px; height: 34px; object-fit: contain; pointer-events: none; }
.cmd-glyph { width: 22px; height: 22px; }
.cmd-lock { display: none; position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; padding: 1px; color: var(--muted); background: var(--panel-solid); border-radius: 3px; }
.cmd-cd { position: absolute; inset: 0; display: none; place-items: center; border-radius: 3px; background: rgba(5, 9, 11, .72); font: 700 13px var(--font-ui); color: var(--text); }
.cmd-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cmd-name { font: 600 12px var(--font-ui); letter-spacing: -0.01em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-cost { display: flex; gap: 6px; font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cmd-key { position: absolute; top: 3px; right: 3px; min-width: 15px; font-size: 9px; line-height: 13px; }
.cost { display: inline-flex; align-items: center; gap: 2px; }
.cost .ico { width: 12px; height: 12px; }
.cost.gold .ico { color: var(--res-gold); }
.cost.timber .ico { color: var(--res-timber); }
.cost.food .ico { color: var(--res-food); }
.cost.short { color: var(--bad); }
.cost.free { color: var(--dim); }
.cmd.short .cmd-cost { color: var(--bad); }
.cmd.short .cmd-pic { opacity: .7; }
.cmd.locked { background: var(--inset); }
.cmd.locked .cmd-pic img, .cmd.locked .cmd-glyph { filter: grayscale(1) brightness(.6); opacity: .6; }
.cmd.locked .cmd-name, .cmd.locked .cmd-cost { color: var(--dim); }
.cmd.locked .cmd-lock { display: block; }
.cmd.active { border-color: var(--gold); background: #2a3125; box-shadow: inset 0 0 0 1px rgba(225, 185, 116, .35); }
.cmd.cooling .cmd-cd { display: grid; }

#action-bar.compact { grid-auto-rows: 50px; }
#action-bar.compact .cmd { height: 50px; padding: 0; justify-content: center; }
#action-bar.compact .cmd-text { display: none; }
#action-bar.compact .cmd-pic { width: 42px; height: 42px; }
#action-bar.compact .cmd-art { width: 40px; height: 40px; }

/* Tooltip */
#hud-tooltip {
  position: fixed; z-index: 200; width: 280px; padding: 10px 12px; pointer-events: none;
  font-size: 12px; color: var(--muted); border-color: var(--line-strong);
}
#hud-tooltip[hidden] { display: none; }
.tip-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tip-head b { font: 600 14px var(--font-title); color: var(--gold-bright); }
.tip-cost { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; font: 600 12px var(--font-ui); color: var(--text); }
.tip-cost .ico { width: 14px; height: 14px; }
.tip-extra { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-weight: 500; }
#hud-tooltip p { margin-top: 6px; line-height: 1.5; }
#hud-tooltip .tip-warn { display: flex; gap: 6px; align-items: flex-start; color: var(--warn); }
#hud-tooltip .tip-warn .ico { width: 14px; height: 14px; margin-top: 2px; }

/* ------------------------------------------------------- Right: guide, campaign */
#field-guide {
  position: absolute; z-index: 15; top: 62px; right: 12px; width: 236px; padding: 14px 16px;
  max-height: calc(100vh - 290px); overflow-y: auto;
}
#field-guide[hidden] { display: none; }
#field-guide h2 { font: 600 17px var(--font-title); color: var(--gold-bright); margin: 6px 0 4px; }
#field-guide p { font-size: 12px; line-height: 1.6; color: var(--muted); margin-top: 6px; }
#field-guide ol { list-style: none; counter-reset: steps; margin-top: 8px; font-size: 12px; }
#field-guide li { counter-increment: steps; display: flex; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line-soft); }
#field-guide li::before { content: counter(steps); flex: none; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; font: 700 10px var(--font-ui); color: var(--bg); background: var(--gold); }
#field-guide li.done { color: var(--good); }
#field-guide li.done::before { content: "✓"; background: var(--good); }
.guide-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 8px; }
.link-btn { background: none; border: 0; padding: 3px 0; font-size: 12px; color: var(--gold); }
.link-btn:hover { color: var(--gold-bright); text-decoration: underline; }
#match-clock { display: block; margin-top: 8px; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }

#campaign-hud { position: absolute; z-index: 15; top: 62px; right: 12px; width: 280px; padding: 12px 14px; }
#campaign-title { display: block; margin: 4px 0 8px; font: 600 14px var(--font-title); color: var(--gold-bright); }
#campaign-objectives-list { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text); }

.objective { display: flex; align-items: flex-start; gap: 8px; color: var(--text); }
.objective .tick { flex: none; width: 14px; height: 14px; margin-top: 2px; border: 1px solid var(--line-strong); border-radius: 3px; }
.objective b { color: var(--gold-bright); font-weight: 600; font-variant-numeric: tabular-nums; }
.objective.done { color: var(--dim); text-decoration: line-through; }
.objective.done .tick { background: var(--good); border-color: var(--good); }

/* Minimap and path wheel frames (elements are created by their modules) */
#minimap-wrapper { border: 1px solid var(--line-strong) !important; border-radius: var(--radius) !important; box-shadow: var(--shadow) !important; }

/* --------------------------------------------------------------- Main menu */
#main-menu-modal {
  position: absolute; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; gap: 64px; padding: 28px;
  background: linear-gradient(90deg, rgba(7, 14, 16, .9), rgba(9, 16, 20, .55) 55%, rgba(7, 14, 16, .8)), url("../assets/front/front_bg.jpg") center/cover no-repeat;
  overflow: auto;
}
.menu-intro { max-width: 400px; color: var(--text); }
.menu-intro .eyebrow { font: 600 11px var(--font-ui); letter-spacing: .3em; text-transform: uppercase; color: var(--gold); }
.menu-intro h2 { margin: 18px 0; font: 600 52px/1.08 var(--font-title); color: #f3ecdc; text-shadow: 0 2px 20px rgba(0, 0, 0, .5); }
.menu-intro p { font-size: 15px; line-height: 1.75; color: #c3cbc6; }
.menu-intro .lore-credit { margin-top: 30px; font-size: 11px; line-height: 1.7; color: var(--dim); }

.menu-card { width: 560px; max-width: calc(100vw - 32px); max-height: calc(100vh - 40px); overflow-y: auto; padding: 26px 30px 22px; background: rgba(12, 20, 24, .96); }
.menu-head { text-align: center; }
.mandala-icon { width: 40px; height: 40px; color: var(--gold); }
.menu-card h1 { margin-top: 6px; font: 600 32px var(--font-title); letter-spacing: .32em; color: var(--gold); padding-left: .32em; }
.menu-subtitle { margin-top: 4px; font: 500 10px var(--font-ui); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

.menu-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; margin: 20px 0 16px; padding: 3px; background: var(--inset); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.tab-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px;
  font: 600 12px var(--font-ui); color: var(--muted); background: transparent; border: 0; border-radius: 4px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--gold-bright); background: var(--panel-raised); box-shadow: inset 0 0 0 1px var(--line); }
.tab-btn .ico { width: 15px; height: 15px; }

.menu-panel { display: none; }
.menu-panel.active { display: block; }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; margin-bottom: 6px; }
.menu-row > label:first-child { font-size: 13px; color: var(--text); }
.menu-row .hint { display: block; font-size: 11px; color: var(--dim); }
.menu-select, .menu-input {
  width: 300px; max-width: 62%; height: 34px; padding: 0 10px; font-size: 13px;
  background: var(--inset); border: 1px solid var(--line-soft); border-radius: 4px; color: var(--text); outline: none;
}
.menu-select:focus, .menu-input:focus { border-color: var(--gold); }
.menu-input { text-transform: uppercase; letter-spacing: .15em; font-weight: 600; }
.menu-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.menu-toggle input { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
.menu-slider { width: 200px; accent-color: var(--gold); cursor: pointer; }

.menu-btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 46px; margin-top: 14px;
  font: 600 14px var(--font-title); letter-spacing: .12em; text-transform: uppercase;
  color: #1b1408; background: linear-gradient(180deg, #f0d29c, var(--gold)); border: 1px solid #f6dfb2; border-radius: 4px;
  box-shadow: 0 6px 18px rgba(225, 185, 116, .18);
  transition: filter .12s, transform .12s;
}
.menu-btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.menu-btn-primary.small { height: 34px; margin-top: 0; font-size: 12px; width: auto; padding: 0 16px; }
.menu-btn-quiet {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 40px; margin-top: 8px;
  font: 600 13px var(--font-ui); color: var(--gold-bright); background: var(--panel-raised); border: 1px solid var(--line); border-radius: 4px;
}
.menu-btn-quiet:hover { border-color: var(--gold); }
.menu-btn-secondary { background: none; border: 0; font-size: 12px; color: var(--muted); text-decoration: none; }
.menu-btn-secondary:hover { color: var(--gold-bright); text-decoration: underline; }
#resume-match-btn[hidden] { display: none; }

.segmented { display: inline-flex; gap: 2px; padding: 2px; background: var(--inset); border: 1px solid var(--line-soft); border-radius: 4px; }
.seg-btn { height: 28px; padding: 0 12px; font: 600 11px var(--font-ui); color: var(--muted); background: transparent; border: 0; border-radius: 3px; }
.seg-btn:hover { color: var(--text); }
.seg-btn:disabled { opacity: .45; cursor: not-allowed; }
.seg-btn.active { color: var(--gold-bright); background: var(--panel-raised); box-shadow: inset 0 0 0 1px var(--line); }

.menu-settings { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.menu-settings .panel-label { display: block; margin-bottom: 6px; }
.menu-footer { display: flex; justify-content: center; gap: 18px; margin-top: 14px; }

/* Campaign chapters */
.chapters { display: flex; flex-direction: column; gap: 8px; }
.chapter {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 4px 12px; align-items: center;
  padding: 12px 14px; background: var(--panel-raised); border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.chapter:hover { border-color: var(--line); }
.chapter-num { grid-row: span 2; font: 600 20px var(--font-title); color: var(--gold); text-align: center; }
.chapter h3 { display: flex; align-items: center; gap: 8px; font: 600 14px var(--font-title); color: var(--text); }
.chapter p { grid-column: 2; font-size: 12px; line-height: 1.5; color: var(--muted); }
.chapter .menu-btn-primary { grid-row: 1 / span 2; grid-column: 3; }
.pill { font: 600 9px var(--font-ui); letter-spacing: .1em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; border: 1px solid currentColor; }
.pill.novice { color: var(--good); }
.pill.adept { color: var(--res-pop); }
.pill.master { color: var(--warn); }
.pill.grandmaster { color: var(--bad); }
.pill.legendary { color: var(--magic); }

/* Online panel */
.callout { padding: 12px 14px; margin-bottom: 12px; background: var(--panel-raised); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.callout-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.callout-head b { font: 600 13px var(--font-title); color: var(--gold-bright); }
.callout p { font-size: 12px; color: var(--muted); line-height: 1.5; }
.wallet-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 10px; background: var(--inset); border-radius: 4px; font-size: 12px; color: var(--muted); }
.wallet-row b { color: var(--gold-bright); font-weight: 600; }
.wager-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 6px 0 12px; }
.wager-grid .seg-btn { height: 32px; border: 1px solid var(--line-soft); }
.field-label { display: block; font-size: 12px; color: var(--muted); }
.divider { height: 1px; margin: 14px 0; background: var(--line-soft); }
#mp-status-msg { margin-top: 10px; font-size: 12px; color: var(--muted); text-align: center; }

/* How to play */
.guide-box { padding: 12px 14px; margin-bottom: 8px; background: var(--panel-raised); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.guide-title { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font: 600 13px var(--font-title); color: var(--gold-bright); }
.guide-title .ico { color: var(--gold); }
.guide-box ul { list-style: none; display: flex; flex-direction: column; gap: 5px; font-size: 12px; line-height: 1.55; color: var(--muted); }
.guide-box li strong { color: var(--text); font-weight: 600; }
.guide-box li em { color: var(--gold-bright); font-style: normal; }
.guide-link { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--gold-bright); text-decoration: none; font-weight: 600; font-size: 12px; }
.guide-link:hover { text-decoration: underline; }

/* ----------------------------------------------------- Modals and overlays */
.modal { position: absolute; inset: 0; z-index: 1050; display: none; align-items: center; justify-content: center; background: rgba(5, 9, 11, .78); backdrop-filter: blur(4px); }
.modal-card { width: min(520px, 92vw); padding: 20px 24px; background: rgba(12, 20, 24, .97); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h2 { font: 600 16px var(--font-title); letter-spacing: .08em; color: var(--gold-bright); }
.icon-btn { width: 30px; height: 30px; display: grid; place-items: center; background: none; border: 1px solid transparent; border-radius: 4px; color: var(--muted); }
.icon-btn:hover { border-color: var(--line); color: var(--text); }
.chain-panel { font-size: 12px; }
.chain-box { padding: 12px; margin-bottom: 10px; background: var(--inset); border: 1px solid var(--line-soft); border-radius: 4px; color: var(--muted); }
.chain-box .mono { font: 11px ui-monospace, Consolas, monospace; color: var(--gold-bright); word-break: break-all; }
.chain-box .ok { color: var(--good); font-weight: 600; }
.chain-note { margin-top: 8px; font-size: 11px; color: var(--dim); line-height: 1.5; }

#victory-banner {
  position: absolute; z-index: 500; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.96);
  display: none; opacity: 0; min-width: 380px; padding: 32px 44px; text-align: center; border-color: var(--line-strong);
  transition: opacity .3s, transform .3s;
}
#victory-banner.visible { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); }
#victory-banner h2 { font: 600 26px var(--font-title); letter-spacing: .08em; color: var(--good); margin-bottom: 8px; }
#victory-banner p { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
#victory-banner button { width: auto; padding: 0 28px; margin: 0 auto; }

#cinematic-overlay { position: absolute; inset: 0; z-index: 900; display: none; pointer-events: none; }
.letterbox { position: absolute; left: 0; width: 100%; background: #000; }
.letterbox.top { top: 0; height: 12vh; }
.letterbox.bottom { bottom: 0; height: 16vh; display: flex; align-items: center; justify-content: center; }
#cinematic-dialogue-box {
  pointer-events: auto; display: flex; align-items: center; gap: 16px; width: min(780px, 90%);
  padding: 12px 20px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
#cinematic-avatar { font-size: 32px; width: 48px; text-align: center; }
#cinematic-speaker { font: 600 14px var(--font-title); color: var(--gold-bright); }
#cinematic-text { margin-top: 3px; font-size: 13px; line-height: 1.5; color: var(--text); }
#cinematic-skip-btn { flex: none; height: 32px; padding: 0 12px; font: 600 12px var(--font-ui); color: var(--gold-bright); background: var(--panel-raised); border: 1px solid var(--line); border-radius: 4px; }

#runtime-error { position: fixed; z-index: 9999; inset: 30% auto auto 50%; transform: translateX(-50%); max-width: 420px; padding: 24px 28px; color: var(--text); background: var(--panel-solid); border: 1px solid var(--gold); border-radius: var(--radius); }
#runtime-error h2 { font: 600 18px var(--font-title); color: var(--gold-bright); margin-bottom: 8px; }
#runtime-error p { color: var(--muted); margin-bottom: 14px; }
#runtime-error button { height: 36px; padding: 0 18px; color: #1b1408; background: var(--gold); border: 0; border-radius: 4px; font-weight: 600; }

/* ------------------------------------------------------------- Narrow screens */
@media (max-width: 1280px) {
  .cmd-pic { width: 32px; height: 32px; }
  .cmd-art { width: 30px; height: 30px; }
}
@media (max-width: 1100px) {
  .menu-intro { display: none; }
  #selection-info { width: 250px; }
  .sel-portrait { width: 52px; height: 52px; }
  .sel-portrait img { width: 46px; height: 46px; }
  .header-btn .lbl { display: none; }
  #army-roster-panel { width: 168px; }
}
@media (max-width: 860px) {
  #bottom-hud-console { left: 8px; right: 8px; bottom: 170px; flex-direction: column; align-items: center; }
  #selection-info { width: min(420px, 100%); }
  #army-roster-panel, #field-guide { display: none; }
  .res-item { padding: 0 8px 0 6px; font-size: 13px; }
  .res-item small, .hud-time-tag, .bar-sep { display: none; }
  .menu-card { padding: 18px; }
  .menu-tabs .lbl { display: none; }
  #top-bar { flex-wrap: wrap; justify-content: center; width: calc(100vw - 16px); top: 6px; padding: 4px; gap: 4px; }
  .header-btn { padding: 0 8px; }
  .header-btn kbd, #open-wallet-btn, #open-docs-btn { display: none; }
  #rts-chat-panel { max-width: calc(100vw - 24px) !important; }
}

/* ------------------------------------------------- Touch devices (9 Oct 2026) */
/* Hints that name a mouse button, or a finger, show only on the matching device. */
body.touch .mouse-only { display: none !important; }
body:not(.touch) .touch-only { display: none !important; }

#touch-bar { display: none; }
body.touch.in-match #touch-bar {
  position: fixed; z-index: 60; left: 8px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 8px;
}
.touch-btn {
  min-width: 58px; height: 44px; padding: 0 10px;
  font: 600 12px var(--font-ui); color: var(--text);
  background: rgba(12, 20, 24, .88); border: 1px solid var(--line); border-radius: var(--radius);
  touch-action: manipulation;
}
.touch-btn:active { background: var(--gold); color: #1b1408; }
.touch-btn:disabled { opacity: .35; }

/* Phones held sideways: short screens. Keep the battlefield visible. */
@media (pointer: coarse) and (max-height: 520px) {
  #top-bar { top: 4px; padding: 3px; gap: 3px; }
  .res-item { height: 30px; padding: 0 6px; font-size: 12px; }
  .header-btn { height: 30px; padding: 0 7px; }
  .header-btn .lbl, .header-btn kbd, .res-item small, .hud-time-tag, .bar-sep { display: none; }
  #bottom-hud-console { left: 78px; right: 170px; bottom: 6px; flex-direction: row; align-items: flex-end; gap: 6px; }
  #selection-info { width: 220px; padding: 8px 10px; font-size: 12px; }
  .sel-portrait { width: 40px; height: 40px; }
  .sel-portrait img { width: 36px; height: 36px; }
  .cmd-pic, .cmd-art { width: 26px; height: 26px; }
  #army-roster-panel, #field-guide, #alignment-wheel-wrapper { display: none !important; }
  #minimap-wrapper { width: 150px !important; height: 116px !important; bottom: 6px !important; right: 6px !important; }
}

/* Phones held upright: a real-time strategy game needs the width. */
#rotate-hint { display: none; }
@media (pointer: coarse) and (orientation: portrait) and (max-width: 600px) {
  body.in-match #rotate-hint {
    position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: 24px;
    font: 600 18px var(--font-title); color: var(--gold-bright); text-align: center;
    background: rgba(8, 12, 14, .94);
  }
}
