:root {
  --bg: #15170f;
  --panel: #1f2218;
  --panel-2: #272b1f;
  --line: #3a3f2d;
  --ink: #ece6d2;
  --muted: #a59f88;
  --accent: #d8b45a;
  --accent-ink: #1b1608;
  --blue: #3b82f6;
  --red: #e5484d;
  --good: #7bd88f;
  --warn: #f0b24a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
a { color: var(--accent); }
button {
  font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; white-space: nowrap;
}
button:hover:not(:disabled) { border-color: #5b6346; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button[aria-pressed="true"], button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input, select { font: inherit; font-size: 0.85rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; width: 100%; min-width: 0; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
label { display: grid; gap: 3px; font-size: 0.75rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 0.8rem; grid-column: 1 / -1; }
kbd { font: 600 0.7rem ui-monospace, monospace; background: #0008; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.hint { color: var(--muted); font-size: 0.78rem; margin: 0; }
.screen { position: fixed; inset: 0; }

/* ---------- picker ---------- */
#screen-picker { display: grid; grid-template-columns: 1fr 380px; }
#pick-map { height: 100%; background: #b7c3a4; }
.pick-panel { background: var(--panel); border-left: 1px solid var(--line); padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.brand h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.8rem; letter-spacing: 0.04em; color: var(--accent); }
.brand p { margin: 2px 0 0; color: var(--muted); }
.search { display: flex; gap: 6px; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; max-height: 190px; overflow-y: auto; }
.results button { width: 100%; text-align: left; white-space: normal; font-weight: 400; }
.presets summary { cursor: pointer; font-weight: 600; font-size: 0.85rem; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips button { font-size: 0.75rem; font-weight: 500; padding: 3px 8px; border-radius: 999px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#start { padding: 10px; font-size: 1rem; }
.credits { font-size: 0.7rem; color: var(--muted); margin: 0; }
.frame-label { background: #000b; color: #fff; border: 0; border-radius: 4px; padding: 1px 6px; font-weight: 700; font-size: 11px; white-space: nowrap; }

/* ---------- loading ---------- */
#screen-loading { display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #2a2d1f, var(--bg)); }
.loading-card { width: min(460px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.loading-card h2 { margin: 0 0 10px; font-family: Georgia, serif; color: var(--accent); }
.steps { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 5px; }
.steps li.done { color: var(--good); }
.steps li.fail { color: var(--warn); }
.steps li.active { color: var(--ink); font-weight: 600; }
.steps li { color: var(--muted); }

/* ---------- game ---------- */
#screen-game { display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); }
.topbar { display: flex; align-items: center; gap: 10px; padding: 5px 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; font-size: 0.82rem; }
.topbar button { padding: 3px 8px; }
#tb-side .tb-sub { display: none; }
.tb-group { display: flex; align-items: center; gap: 6px; }
.tb-k { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.tb-sub { color: var(--good); font-size: 0.75rem; }
.rbar { width: 70px; height: 8px; background: #0009; border-radius: 4px; overflow: hidden; display: inline-block; }
.rfill { display: block; height: 100%; }
.r0 { background: var(--blue); }
.r1 { background: var(--red); }
.obj { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; background: #555; color: #fff; padding: 0 4px; }
.obj.o0 { background: var(--blue); }
.obj.o1 { background: var(--red); }
.arrow { display: inline-block; font-weight: 800; color: var(--accent); }
.speed button { padding: 3px 8px; }
.stage { position: relative; overflow: hidden; min-height: 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: default; touch-action: none; }
/* Vignette as a compositor layer: no cost to the canvas. */
.stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(6, 6, 2, 0.42) 100%); z-index: 1; }
#view.crosshair { cursor: crosshair; }
#minimap { position: absolute; right: 8px; bottom: 8px; border: 1px solid #000; box-shadow: 0 2px 8px #0008; background: #000; cursor: pointer; }
.log { position: absolute; left: 8px; bottom: 8px; width: min(430px, 45%); display: flex; flex-direction: column; gap: 3px; pointer-events: none; }
.log div { background: #000b; border-left: 3px solid var(--muted); padding: 2px 8px; font-size: 0.78rem; border-radius: 3px; pointer-events: auto; cursor: pointer; transition: opacity 0.6s; }
.log .win { border-color: var(--good); }
.log .loss { border-color: var(--red); }
.log .warn { border-color: var(--warn); }
.log .intel { border-color: #b18cf2; }
.mode-hint { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); background: #000c; border: 1px solid #5c4d16; color: #f2deac; padding: 4px 12px; border-radius: 999px; font-size: 0.8rem; pointer-events: none; max-width: calc(100% - 20px); text-align: center; }
.mode-hint:empty { display: none; }
.tip { position: absolute; background: #000d; border: 1px solid var(--line); padding: 4px 8px; font-size: 0.75rem; border-radius: 5px; pointer-events: none; max-width: 280px; z-index: 3; }
.bottom { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(420px, 1.25fr); gap: 0; background: var(--panel); border-top: 1px solid var(--line); height: 210px; }
.selection { min-height: 0; padding: 8px 10px; overflow-y: auto; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.selection h3 { margin: 0; font-size: 0.9rem; }
.selection .sub { color: var(--muted); font-size: 0.75rem; }
.orders { display: flex; flex-wrap: wrap; gap: 4px; }
.orders button { padding: 4px 8px; }
.ulist { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
.ucard { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; font-size: 0.72rem; cursor: pointer; }
.ucard b { font-size: 0.75rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini { flex: none; height: 4px; background: #0009; border-radius: 2px; overflow: hidden; margin-top: 2px; }
.mini > span { display: block; height: 100%; }
.tabs { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.tabbar { display: flex; gap: 4px; padding: 6px 8px 0; }
.tabbar button { border-radius: 6px 6px 0 0; }
.tabpanel { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; border-top: 1px solid var(--line); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 5px; }
.card { text-align: left; white-space: normal; display: grid; gap: 1px; padding: 5px 7px; font-weight: 400; }
.card b { font-size: 0.8rem; }
.card .cost { color: var(--accent); font-size: 0.72rem; }
.card .d { color: var(--muted); font-size: 0.7rem; line-height: 1.25; }
.card[aria-pressed="true"] .d, .card[aria-pressed="true"] .cost { color: var(--accent-ink); }
.section-title { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 6px 0 4px; }
.section-title:first-child { margin-top: 0; }
.row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.row label { display: flex; align-items: center; gap: 6px; }
.row label input[type="range"] { width: 110px; }
.bat { font-size: 0.75rem; display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px dashed var(--line); }
.bad { color: var(--red); }
.ok { color: var(--good); }

dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); padding: 18px; width: min(460px, calc(100vw - 32px)); }
dialog::backdrop { background: #000a; }
dialog h2 { margin: 0 0 8px; font-family: Georgia, serif; color: var(--accent); }
.menu-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.help { width: min(1000px, calc(100vw - 32px)); }
.help-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; font-size: 0.82rem; }
.help h3 { margin: 0 0 4px; font-size: 0.9rem; }
.help ul { margin: 0; padding-left: 16px; display: grid; gap: 4px; }
.stats { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.stats th, .stats td { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.stats th:first-child, .stats td:first-child { text-align: left; }
.toast { pointer-events: none; position: fixed; bottom: 222px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 7px 14px; border-radius: 8px; font-size: 0.85rem; z-index: 10; max-width: calc(100vw - 32px); }
.toast.error { background: var(--red); color: #fff; }

@media (min-width: 1880px) { #tb-side .tb-sub { display: inline; } }
@media (max-width: 900px) {
  #screen-picker { grid-template-columns: 1fr; grid-template-rows: 45vh 1fr; }
  .pick-panel { border-left: 0; border-top: 1px solid var(--line); }
  .bottom { grid-template-columns: 1fr; height: 260px; }
  .selection { border-right: 0; border-bottom: 1px solid var(--line); max-height: 110px; }
  .help-cols { grid-template-columns: 1fr; }
  #minimap { width: 150px; height: auto; }
  .log { width: 60%; }
}

/* ---------- armies, rules, online ---------- */
.army-btn { width: 100%; text-align: left; font-weight: 600; }
.row-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.row-btns button { flex: 1 1 auto; }
#matchup-note { margin: 0; }
.hint.bad, #matchup-note.bad { color: var(--red); }
dialog.factions { width: min(1100px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.faction-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 12px; min-height: 0; }
.faction-list { display: grid; gap: 5px; align-content: start; max-height: 66vh; overflow-y: auto; }
.faction-card { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; text-align: left; white-space: normal; padding: 6px 8px; }
.faction-card .flag { grid-row: span 3; font-size: 1.6rem; align-self: center; }
.faction-card .sub { color: var(--muted); font-size: 0.72rem; font-weight: 400; }
.faction-card[aria-selected="true"] .sub { color: var(--accent-ink); }
.faction-card.inactive { opacity: 0.7; }
.faction-profile { max-height: 66vh; overflow-y: auto; padding-right: 6px; font-size: 0.85rem; }
.faction-profile h3 { margin: 0; font-family: Georgia, serif; color: var(--accent); font-size: 1.3rem; }
.faction-profile h4 { margin: 10px 0 2px; color: var(--accent); font-size: 0.85rem; }
.faction-profile p { margin: 2px 0; }
.faction-profile .basis { color: var(--muted); font-size: 0.76rem; font-style: italic; }
.faction-profile ul { margin: 2px 0; padding-left: 18px; }
.faction-profile ul.cols { columns: 2; }
.faction-profile li.later { color: var(--muted); }
dialog.mp { width: min(560px, calc(100vw - 24px)); }
textarea.code { width: 100%; font: 0.72rem/1.3 ui-monospace, monospace; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px; resize: vertical; word-break: break-all; }
.codebox { display: grid; gap: 4px; margin: 6px 0; }
.codebox button { justify-self: start; }

/* ---------- logistics rows, developer panel ---------- */
.row.stock { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.75rem; color: var(--ink); }
.row.stock span { background: var(--panel-2); border-radius: 4px; padding: 1px 6px; }
.check { display: flex; gap: 6px; align-items: center; font-size: 0.78rem; }
.check input { width: auto; }
.debug { position: absolute; top: 8px; right: 8px; width: min(440px, calc(100% - 16px)); max-height: calc(100% - 16px); overflow-y: auto; background: #111309ee; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: 0.72rem/1.35 ui-monospace, monospace; z-index: 6; }
.debug h3 { margin: 0 0 4px; font: 600 0.85rem system-ui, sans-serif; color: var(--accent); }
.debug h4 { margin: 8px 0 2px; color: var(--accent); font-size: 0.75rem; }
.debug table { width: 100%; border-collapse: collapse; }
.debug td, .debug th { border-bottom: 1px solid #ffffff12; padding: 1px 4px; text-align: left; vertical-align: top; }

/* ---------- touch and small screens ---------- */
.touch-only { display: none; }
@media (pointer: coarse) {
  .touch-only { display: flex; }
  button { padding: 8px 12px; min-height: 36px; }
  .topbar button { padding: 6px 10px; }
  .card { min-height: 44px; }
}
body.panel-collapsed .bottom { height: 0; overflow: hidden; border-top: 0; }
body.panel-collapsed .toast { bottom: 16px; }
@media (max-width: 700px) {
  .topbar { gap: 4px 6px; padding: 4px 6px; font-size: 0.75rem; }
  .topbar .tb-k, #tb-wind, #tb-weather, #tb-income, [data-speed="2"], [data-speed="4"] { display: none; }
  .topbar button { padding: 4px 8px; min-height: 32px; }
  .rbar { width: 46px; }
  .bottom { height: 42dvh; grid-template-rows: auto minmax(0, 1fr); }
  .selection { max-height: 15dvh; }
  .mode-hint { font-size: 0.75rem; max-width: 86%; padding: 4px 10px; }
  #minimap { width: 96px !important; height: auto !important; }
  .faction-wrap { grid-template-columns: 1fr; }
  .faction-list { max-height: 28vh; grid-template-columns: 1fr 1fr; }
  .faction-profile { max-height: 40vh; }
  .faction-profile ul.cols { columns: 1; }
  #minimap { width: 110px; }
  .toast { bottom: calc(46dvh + 10px); }
  .log { width: 75%; font-size: 0.7rem; }
}

/* =====================================================================
   Visual theme: field command. Layered olive panels, brass accents,
   tabular numbers, quiet motion. No backdrop blur over the canvas (it
   would re-composite every frame).
   ===================================================================== */
:root {
  --bg: #12140e;
  --panel: #1b1e15;
  --panel-2: #24281c;
  --panel-3: #2d3223;
  --line: #3a402d;
  --line-soft: #2c3122;
  --ink: #ece6d2;
  --muted: #a39d86;
  --accent: #d2b066;
  --accent-2: #b8954a;
  --accent-ink: #1d1708;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
body { font-feature-settings: "tnum" 1; letter-spacing: 0.005em; }
::selection { background: var(--accent); color: var(--accent-ink); }
* { scrollbar-width: thin; scrollbar-color: #4a5139 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #4a5139; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

button {
  background: linear-gradient(180deg, #2c3122, #23271b);
  border-color: #3d4430;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 0 rgba(0, 0, 0, 0.35);
  transition: background-color 0.12s, border-color 0.12s, transform 0.08s, box-shadow 0.12s;
}
button:hover:not(:disabled) { border-color: #6a7350; background: linear-gradient(180deg, #343a28, #292e20); }
button:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4); }
button.primary, button[aria-pressed="true"], button[aria-selected="true"] {
  background: linear-gradient(180deg, #ddbd72, #c09a4f);
  color: var(--accent-ink);
  border-color: #e3c47e;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(210, 176, 102, 0.18);
}
button.primary:hover:not(:disabled) { background: linear-gradient(180deg, #e6c87f, #c8a257); }
button.danger { color: #ffb4a8; border-color: #6a3a32; }
kbd { font: 600 0.68rem ui-monospace, monospace; padding: 0 4px; border-radius: 3px; background: #0006; border: 1px solid #ffffff1a; color: inherit; opacity: 0.85; }
input, select, textarea { background: #0f110b; border-color: #3a402d; }
input[type="range"] { accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); }

/* ---------- top bar ---------- */
.topbar {
  background: linear-gradient(180deg, #23271c, #1a1d14);
  border-bottom: 1px solid #0b0c08;
  box-shadow: 0 1px 0 #ffffff0a inset, 0 2px 10px rgba(0, 0, 0, 0.45);
  position: relative;
  z-index: 2;
  gap: 6px;
  padding: 5px 8px;
}
.tb-group { padding: 3px 9px; border-radius: 7px; background: #0000002e; border: 1px solid #ffffff0a; min-height: 30px; }
.tb-group.speed { padding: 2px; gap: 2px; }
.tb-group.speed button, .topbar .tb-group button { box-shadow: none; }
#tb-side { background: none; border: 0; padding-left: 2px; }
#tb-side b { font-family: Georgia, "Iowan Old Style", serif; font-size: 0.95rem; font-weight: 700; letter-spacing: 0.01em; }
#tb-supply { font-size: 0.95rem; color: #f3e7c4; }
.tb-k { font-size: 0.66rem; letter-spacing: 0.09em; }
.rbar { height: 7px; background: #00000080; box-shadow: inset 0 1px 2px #000; }
.tb-group.speed { margin-left: auto; } /* clock and controls hug the right edge */
/* Keep the bar on one row on laptop screens: tighter groups, then drop the small caps labels. */
@media (max-width: 1520px) {
  .topbar { gap: 4px; }
  .tb-group { padding: 3px 7px; gap: 5px; }
  .rbar { width: 52px; }
}
@media (max-width: 1439px) {
  .topbar .tb-k { display: none; }
}
@media (max-width: 1200px) {
  #tb-income, #tb-weather { display: none; }
  .tb-group:has(> #tb-weather) { display: none; }
}
/* Desktop: one row, always. Only the army title gives way (with an ellipsis). */
@media (min-width: 960px) and (pointer: fine) {
  .topbar { flex-wrap: nowrap; min-width: 0; }
  .topbar > .tb-group { flex: none; white-space: nowrap; }
  .topbar > #tb-side { flex: 0 1 auto; min-width: 0; overflow: hidden; }
  #tb-side b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 700px) {
  .topbar { gap: 4px 6px; padding: 4px 6px; }
  .tb-group { padding: 2px 6px; min-height: 0; }
  .rbar { width: 46px; }
}
.rfill { transition: width 0.4s ease; }
.r0 { background: linear-gradient(90deg, #2f68c9, #5b93ef); }
.r1 { background: linear-gradient(90deg, #bf3a3f, #e8666a); }
.obj { border-radius: 5px; box-shadow: inset 0 1px 0 #ffffff24; background: #4a4e40; }
.obj.o0 { background: linear-gradient(180deg, #4f86e0, #2f68c9); }
.obj.o1 { background: linear-gradient(180deg, #e0585d, #bf3a3f); }
#tb-clock { font-weight: 700; color: #f3e7c4; }

/* ---------- the stage ---------- */
#minimap {
  border: 1px solid #0b0c08;
  outline: 2px solid #3d4430;
  outline-offset: 0;
  border-radius: 3px;
  box-shadow: 0 0 0 3px #12140ecc, var(--shadow);
  z-index: 2;
}
.log { z-index: 2; gap: 4px; }
.log div {
  background: linear-gradient(90deg, rgba(14, 16, 10, 0.88), rgba(14, 16, 10, 0.72));
  border-left-width: 3px;
  padding: 3px 10px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  animation: dispatch-in 0.28s ease-out;
}
.log div:hover { background: rgba(30, 34, 22, 0.95); }
@keyframes dispatch-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.mode-hint { z-index: 2; background: linear-gradient(180deg, rgba(20, 22, 14, 0.94), rgba(14, 16, 10, 0.94)); border-color: #8a7234; box-shadow: var(--shadow); padding: 5px 14px; }
.tip { z-index: 3; background: rgba(12, 13, 9, 0.95); border-color: #4b5238; box-shadow: var(--shadow); }
.debug { z-index: 4; }

/* ---------- bottom panel ---------- */
.bottom {
  background: linear-gradient(180deg, #1e2117, #181a12);
  border-top: 1px solid #0b0c08;
  box-shadow: 0 -1px 0 #ffffff0a inset, 0 -4px 14px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 2;
}
.selection { border-right-color: var(--line-soft); }
.selection h3 { font-family: Georgia, "Iowan Old Style", serif; font-size: 1rem; letter-spacing: 0.01em; }
.selection h3 .sub { font-family: system-ui, sans-serif; }
.ucard { background: linear-gradient(180deg, #262a1e, #20241a); border-color: var(--line-soft); transition: border-color 0.12s; }
.ucard:hover { border-color: #6a7350; }
.mini { height: 5px; background: #00000080; box-shadow: inset 0 1px 1px #000; }
.tabbar { gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--line-soft); }
.tabbar button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  box-shadow: none;
  color: var(--muted);
  padding: 6px 12px 7px;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}
.tabbar button:hover:not(:disabled) { background: #ffffff08; color: var(--ink); }
.tabbar button[aria-selected="true"] { background: none; color: var(--accent); border-bottom-color: var(--accent); box-shadow: none; }
.tabpanel { border-top: 0; padding: 10px; }
.cards { gap: 6px; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); }
.card {
  background: linear-gradient(180deg, #272b1f, #202419);
  border-color: var(--line-soft);
  border-radius: 7px;
  padding: 7px 9px;
  gap: 2px;
  position: relative;
  overflow: hidden;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: transparent; transition: background-color 0.12s; }
.card:hover:not(:disabled)::before { background: var(--accent); }
.card:hover:not(:disabled) { border-color: #59603f; }
.card b { font-size: 0.82rem; }
.card .cost { font-weight: 600; }
.card[aria-pressed="true"]::before { background: var(--accent-ink); }
.section-title { color: #b8ad8c; font-weight: 600; font-size: 0.68rem; letter-spacing: 0.1em; }
.bat { border-bottom-color: var(--line-soft); padding: 4px 0; }
.row.stock span { background: #0000003a; border: 1px solid #ffffff0d; border-radius: 5px; padding: 2px 7px; }

/* ---------- dialogs, toasts ---------- */
dialog {
  background: linear-gradient(180deg, #22261b, #1a1d14);
  border: 1px solid #454c35;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 #ffffff0d;
  animation: dialog-in 0.18s ease-out;
}
dialog::backdrop { background: rgba(6, 7, 4, 0.66); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }
dialog h2 { letter-spacing: 0.02em; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.toast {
  background: linear-gradient(180deg, #f2ead2, #ddd3b5);
  color: #1d1a10;
  font-weight: 600;
  border-radius: 999px;
  padding: 8px 18px;
  box-shadow: var(--shadow);
  animation: toast-in 0.22s ease-out;
}
.toast.error { background: linear-gradient(180deg, #e0605a, #c3423d); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- picker ---------- */
.pick-panel { background: linear-gradient(180deg, #1f2218, #181a12); box-shadow: -6px 0 20px rgba(0, 0, 0, 0.35); }
.brand { padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.brand h1 { font-size: 2rem; letter-spacing: 0.06em; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.brand p { font-size: 0.85rem; }
.grid2 label:not(.check) { display: grid; gap: 3px; font-size: 0.78rem; color: #c9c1a6; }
.grid2 label.check { color: var(--ink); font-size: 0.8rem; }
.chips button { background: #262a1e; border-color: #3a402d; box-shadow: none; }
#start { letter-spacing: 0.02em; font-size: 1rem; padding: 11px; }
.loading-card { background: linear-gradient(180deg, #22261b, #1a1d14); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- campaign ---------- */
.campaign-start { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; padding: 8px; border: 1px solid var(--line-soft, #2d3223); border-radius: 8px; background: #00000026; }
.campaign-start label { display: grid; gap: 3px; font-size: 0.78rem; color: #c9c1a6; }
.campaign-start button { white-space: nowrap; }
.campaign-continue { border-color: var(--accent); color: var(--accent); }
#screen-campaign { display: grid; grid-template-columns: 1fr 400px; }
#camp-map { height: 100%; background: #b7c3a4; }
.camp-panel { gap: 12px; }
.camp-stages { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.camp-stages li { display: flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 999px; background: #00000033; border: 1px solid #ffffff12; font-size: 0.78rem; color: var(--muted); }
.camp-stages .n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #3a3f2d; color: var(--ink); font-weight: 700; font-size: 0.72rem; }
.camp-stages .won { color: var(--ink); }
.camp-stages .won .n { background: #4f9d5d; }
.camp-stages .current { color: var(--ink); border-color: var(--accent); }
.camp-stages .current .n { background: var(--accent); color: var(--accent-ink); }
.camp-stages .lost .n { background: var(--red); }
.camp-army { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.camp-army > div { background: #00000033; border: 1px solid #ffffff0d; border-radius: 7px; padding: 6px 8px; display: grid; gap: 1px; }
.camp-army .k { font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.camp-army b { font-size: 1.05rem; color: #f3e7c4; }
.camp-brief { background: linear-gradient(180deg, #2a2e20, #212418); border: 1px solid #3a402d; border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; display: grid; gap: 6px; }
.camp-brief h2 { margin: 0; font-family: Georgia, "Iowan Old Style", serif; font-size: 1.3rem; color: var(--accent); }
.camp-brief h2.lost { color: var(--red); }
.camp-brief h2.won { color: var(--good); }
.camp-brief .sub { margin: 0; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.02em; }
.camp-brief ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: 0.86rem; }
.camp-brief .conditions { color: var(--muted); font-size: 0.8rem; }
.camp-brief .bonus { margin: 0; font-size: 0.84rem; color: #cfe08a; }
.camp-brief p { margin: 0; }
.camp-history-wrap summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.camp-history { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: 0.8rem; }
.camp-history .sub { display: block; color: var(--muted); }
.camp-history .won::marker { color: var(--good); }
.camp-history .lost::marker { color: var(--red); }
.camp-label { font-size: 12px; }
.camp-label.current { background: #3a2f0ccc; color: #ffe39a; }
.camp-label.won { background: #183a1fcc; color: #c6f0cd; }
.camp-label.lost { background: #4a1414cc; color: #ffc4c0; }
.camp-label.ahead { background: #000a; color: #d6d2c2; font-weight: 600; }
@media (max-width: 900px) {
  #screen-campaign { grid-template-columns: 1fr; grid-template-rows: 38vh 1fr; }
  .camp-panel { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 420px) {
  .camp-army { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .campaign-start { grid-template-columns: 1fr; }
}

/* Mission card (campaign battles), top left of the battlefield. */
.mission { position: absolute; left: 8px; top: 8px; z-index: 2; width: min(340px, 60%); background: linear-gradient(180deg, rgba(36, 40, 28, 0.94), rgba(26, 29, 20, 0.94)); border: 1px solid #3a402d; border-left: 3px solid var(--accent); border-radius: 8px; padding: 7px 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45); font-size: 0.8rem; pointer-events: none; }
.mission-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.mission-head b { font-family: Georgia, "Iowan Old Style", serif; font-size: 0.95rem; color: var(--accent); }
.mission-clock { font-variant-numeric: tabular-nums; color: var(--ink); }
.mission-clock.urgent { color: var(--red); font-weight: 700; }
.mission ul, .end-mission { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mission li, .end-mission li { padding-left: 18px; position: relative; }
.mission li::before, .end-mission li::before { position: absolute; left: 0; content: "○"; color: var(--muted); }
.mission li.done::before, .end-mission li.done::before { content: "✓"; color: var(--good); }
.mission li.failed::before, .end-mission li.failed::before { content: "✗"; color: var(--red); }
.mission li.bonus { color: #cfe08a; }
.mission li.bonus::before { content: "★"; color: #cfe08a; }
.end-mission { margin: 0 0 10px; }
@media (max-width: 700px) {
  .mission { width: calc(100% - 16px); font-size: 0.74rem; padding: 5px 8px; }
  .mission li.bonus { display: none; }
  .mission:not([hidden]) ~ .mode-hint { top: 66px; }
}
.end-note { margin: 0 0 10px; padding: 7px 10px; border-radius: 6px; background: #00000033; border-left: 3px solid var(--accent); font-size: 0.86rem; }

/* ---------- sandbox ---------- */
.sandbox-new { border-style: dashed; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-radius: 8px; background: #0000003a; border: 1px solid #ffffff0d; }
.seg button { box-shadow: none; padding: 3px 9px; font-size: 0.8rem; }
#tabpanel .row .check { font-size: 0.8rem; }
#tabpanel .row select { width: auto; }

/* ---------- controls: cursors that say what a right-click does, tooltip, first-run card ---------- */
#view[data-cursor="move"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Ccircle cx='14' cy='14' r='8' fill='none' stroke='%230d0f0a' stroke-width='4.5'/%3E%3Ccircle cx='14' cy='14' r='8' fill='none' stroke='%237be08c' stroke-width='2.2'/%3E%3Ccircle cx='14' cy='14' r='2.4' fill='%237be08c' stroke='%230d0f0a' stroke-width='1'/%3E%3C/svg%3E") 14 14, pointer; }
#view[data-cursor="attack"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cg stroke='%230d0f0a' stroke-width='4.5' fill='none'%3E%3Ccircle cx='14' cy='14' r='8'/%3E%3Cpath d='M14 1v7M14 20v7M1 14h7M20 14h7'/%3E%3C/g%3E%3Cg stroke='%23ff5a46' stroke-width='2.2' fill='none'%3E%3Ccircle cx='14' cy='14' r='8'/%3E%3Cpath d='M14 1v7M14 20v7M1 14h7M20 14h7'/%3E%3C/g%3E%3C/svg%3E") 14 14, crosshair; }
#view[data-cursor="man"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M14 3l9 3.5v6c0 6-4.2 10-9 12-4.8-2-9-6-9-12v-6z' fill='%236ea9ff' stroke='%230d0f0a' stroke-width='2'/%3E%3Cpath d='M9 13h10' stroke='%230d0f0a' stroke-width='2'/%3E%3C/svg%3E") 14 14, pointer; }
#view[data-cursor="build"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M5 9c5-5 13-5 18 0' fill='none' stroke='%230d0f0a' stroke-width='5' stroke-linecap='round'/%3E%3Cpath d='M14 7v18' stroke='%230d0f0a' stroke-width='5' stroke-linecap='round'/%3E%3Cpath d='M5 9c5-5 13-5 18 0' fill='none' stroke='%23ffc450' stroke-width='2.6' stroke-linecap='round'/%3E%3Cpath d='M14 7v18' stroke='%23c8a070' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") 14 14, pointer; }
#view[data-cursor="bombard"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Ccircle cx='14' cy='14' r='9' fill='none' stroke='%230d0f0a' stroke-width='4.5'/%3E%3Ccircle cx='14' cy='14' r='9' fill='none' stroke='%23ff8c3c' stroke-width='2.2' stroke-dasharray='3 2.5'/%3E%3Ccircle cx='14' cy='14' r='3' fill='%23ff8c3c' stroke='%230d0f0a' stroke-width='1'/%3E%3C/svg%3E") 14 14, crosshair; }
#view[data-cursor="select"] { cursor: pointer; }
.tip div + div { margin-top: 2px; }
.tip .act { color: #ffd98a; font-weight: 600; }
.tip { max-width: 300px; }
.controls-card { position: absolute; right: 8px; top: 8px; z-index: 3; width: min(400px, calc(100% - 370px)); display: flex; flex-direction: column; gap: 8px; background: linear-gradient(180deg, rgba(36, 40, 28, 0.95), rgba(24, 27, 18, 0.95)); border: 1px solid #3a402d; border-left: 3px solid var(--accent); border-radius: 9px; padding: 9px 11px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); font-size: 0.8rem; pointer-events: none; }
.controls-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; flex: 1; }
.controls-card li span { color: var(--muted); }
.controls-card button { pointer-events: auto; align-self: flex-end; }
.controls-card .touch-only { display: none; }
@media (pointer: coarse) { .controls-card .touch-only { display: grid; } .controls-card .mouse-only { display: none; } }
@media (max-width: 700px) { .controls-card { width: calc(100% - 16px); font-size: 0.74rem; } .mission:not([hidden]) ~ .controls-card { top: 74px; } }
.menu-opt { margin-top: 10px; font-size: 0.82rem; color: var(--muted); }
.orders button.warn-on { border-color: #ff8a7a; color: #ffb3a6; }

/* Charts (ui/chart.js): text in the UI's ink, recessive grid, series colours only on the lines. */
.chart { position: relative; margin: 4px 0 8px; }
.chart svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; opacity: 0.6; }
.chart .axis { stroke: var(--muted); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 9px; }
.chart .label { fill: var(--muted); font-size: 9px; }
.chart .end { fill: var(--ink); font-size: 9px; }
.chart .marker { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hair { stroke: var(--ink); stroke-width: 1; opacity: 0.6; }
.chart .legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.72rem; color: var(--ink); margin-top: 2px; }
.chart .legend span, .chart-tip div { display: inline-flex; align-items: center; gap: 5px; }
.chart .legend i, .chart-tip i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-tip { position: absolute; top: 4px; min-width: 130px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; font-size: 0.72rem; color: var(--ink); pointer-events: none; display: grid; gap: 2px; z-index: 2; }
.chart-tip[hidden] { display: none; }
.chart-tip b { font-weight: 600; color: var(--muted); }

/* Weapons of the war (ui/weapons.js) */
dialog.weapons { width: min(1180px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.weapons-open { width: 100%; }
.wfilters { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: end; margin-bottom: 8px; }
.wfilters label { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--ink); }
.wfilters select { width: auto; }
.wfilters .hint { flex: 1 1 260px; }
.wwrap { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 12px; min-height: 0; }
.wlist { display: grid; align-content: start; gap: 2px; max-height: 62vh; overflow-y: auto; border-right: 1px solid var(--line); padding-right: 8px; }
.wlist label.check { font-size: 0.8rem; grid-column: auto; }
.wcompare { min-width: 0; overflow-x: auto; max-height: 62vh; overflow-y: auto; }
.wtable { border-collapse: collapse; font-size: 0.78rem; width: 100%; }
.wtable th, .wtable td { border-bottom: 1px solid var(--line); padding: 3px 6px; text-align: left; vertical-align: top; }
.wtable th:first-child { color: var(--muted); font-weight: 600; white-space: nowrap; }
.wtable td[title] { cursor: help; }
.wtable td.game { color: var(--ink); background: #0002; }
.wtable td.unknown, .wtable .conf { color: var(--muted); }
.wtable td.conf-low { text-decoration: underline dotted var(--muted); }
.wtable .avail { text-decoration: underline dotted var(--muted); }
.wsources { margin: 0; padding-left: 18px; font-size: 0.75rem; }
.wsources a { color: var(--ink); }
@media (max-width: 720px) { .wwrap { grid-template-columns: 1fr; } .wlist { max-height: 22vh; border-right: 0; border-bottom: 1px solid var(--line); } }
button.linkish { background: none; border: none; padding: 4px 0; color: inherit; text-decoration: underline; opacity: 0.8; cursor: pointer; justify-self: start; }
.lobby { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0; }
.lobby h3 { margin: 0 0 4px; font-size: 0.95em; }
.lobby p { margin: 2px 0; }
dialog.mp input.code { width: 100%; box-sizing: border-box; }
.height-readout { position: absolute; right: 8px; bottom: 166px; max-width: calc(100% - 16px); white-space: nowrap; padding: 2px 7px; font-size: 12px; font-variant-numeric: tabular-nums; color: #e6dcc0; background: #14140ecc; border-radius: 4px; pointer-events: none; }
@media (max-width: 900px) { .height-readout { bottom: 120px; } }
.relief-key { position: absolute; right: 8px; bottom: 190px; display: flex; align-items: center; gap: 6px; padding: 3px 8px; font-size: 12px; font-variant-numeric: tabular-nums; color: #e6dcc0; background: #14140ecc; border-radius: 4px; pointer-events: none; }
.relief-key i { display: block; width: 120px; height: 10px; border-radius: 2px; }
@media (max-width: 900px) { .relief-key { bottom: 144px; } }
.camp-label.blocked { background: #3a1818cc; color: #f0c6c6; }
#tb-clock.building { color: var(--gold, #e0b84f); }
.tb-ready { margin-left: 8px; padding: 3px 10px; font-weight: 700; background: #3d3416; color: #f3e7c4; border: 1px solid #e0b84f; border-radius: 4px; cursor: pointer; }
.tb-ready[aria-pressed="true"] { background: #23351f; border-color: #6fbf73; }
.plan-step { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 6px; margin: 2px 0; border-left: 3px solid #e0b84f55; background: #ffffff08; border-radius: 3px; }
.plan-step.bad { border-left-color: var(--red); }
.plan-step.firing { border-left-color: #ff7a45; }
.plan-step.done { opacity: 0.7; }
.plan-step.failed { border-left-color: var(--red); }
.plan-step input.time { width: 4.2em; text-align: center; font-variant-numeric: tabular-nums; }
.plan-step .bats { display: inline-flex; gap: 3px; flex-wrap: wrap; }
button.step-btn { padding: 2px 7px; font-size: 0.75rem; min-height: 0; }
button.step-btn[aria-pressed="true"] { background: #4a3a14; border-color: #e0b84f; }
#tb-clock.urgent { color: var(--red); font-weight: 700; }

/* ---------- tutorial ---------- */
.tutorial-start { width: 100%; margin-top: 8px; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.tutorial { position: absolute; left: 8px; top: 8px; z-index: 4; width: min(360px, calc(100% - 16px)); display: flex; flex-direction: column; gap: 6px; background: linear-gradient(180deg, rgba(36, 40, 28, 0.96), rgba(24, 27, 18, 0.96)); border: 1px solid #3a402d; border-left: 3px solid var(--accent); border-radius: 9px; padding: 8px 11px 9px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); font-size: 0.82rem; }
.tutorial.done { border-left-color: var(--good); }
.tut-head { display: flex; align-items: baseline; gap: 8px; }
.tut-count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.75rem; }
.tut-title { flex: 1; font-family: Georgia, "Iowan Old Style", serif; font-size: 1rem; color: var(--accent); }
.tut-min { padding: 0 8px; min-height: 0; line-height: 1.4; box-shadow: none; }
.tut-text { margin: 0; line-height: 1.4; }
.tut-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tut-checks li { padding-left: 18px; position: relative; }
.tut-checks li::before { position: absolute; left: 0; content: "○"; color: var(--muted); }
.tut-checks li.done { color: var(--muted); }
.tut-checks li.done::before { content: "✓"; color: var(--good); }
.tut-note { margin: 0; color: var(--good); font-weight: 600; }
.tut-note:empty { display: none; }
.tut-foot { display: flex; gap: 6px; align-items: center; }
.tut-gap { flex: 1; }
.tut-foot button { padding: 3px 10px; font-size: 0.8rem; }
.tut-foot button[hidden] { display: none; }
.tutorial.folded .tut-body, .tutorial.folded .tut-foot { display: none; }
.tut-glow { outline: 2px solid #ffd60a !important; outline-offset: 1px; animation: tut-pulse 1.1s ease-in-out infinite; }
@keyframes tut-pulse { 50% { outline-color: rgba(255, 214, 10, 0.25); box-shadow: 0 0 12px rgba(255, 214, 10, 0.55); } }
@media (prefers-reduced-motion: reduce) { .tut-glow { animation: none; } }
@media (max-width: 700px) {
  .tutorial { font-size: 0.76rem; padding: 6px 9px; gap: 4px; }
  .tut-text { max-height: 7.5em; overflow-y: auto; }
  .tutorial ~ .mode-hint { top: auto; bottom: 8px; }
}

/* ---------- sniper duel ---------- */
.duel-new { border-color: #8a7234; }
.screen.duel { position: fixed; inset: 0; background: #000; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.screen.duel canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#duel-overlay { pointer-events: none; }
.screen.duel.map-open #duel-overlay { pointer-events: auto; }
.duel-top { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; z-index: 2; }
.duel-compass { position: relative; width: min(420px, 70vw); height: 22px; border-bottom: 1px solid rgba(255,255,255,0.35); overflow: hidden; }
.duel-compass i { position: absolute; bottom: 0; width: 1px; height: 6px; background: rgba(255,255,255,0.45); font: 600 11px system-ui; font-style: normal; color: #e9e1cc; text-shadow: 0 1px 2px #000; }
.duel-compass i.big { height: 9px; background: rgba(255,255,255,0.8); }
.duel-compass b { position: absolute; top: 0; transform: translateX(-50%); color: #ff7a64; font-size: 12px; text-shadow: 0 1px 2px #000; }
.duel-compass b.decoy { color: #ffc95a; }
.duel-compass b.spot { color: #ffbe50; font-size: 11px; }
.duel-clock { font: 12px system-ui; color: #e9e1cc; text-shadow: 0 1px 3px #000; background: rgba(0,0,0,0.35); padding: 2px 10px; border-radius: 999px; }
.duel-msgs { position: absolute; left: 12px; top: 64px; width: min(460px, 70vw); display: flex; flex-direction: column; gap: 4px; pointer-events: none; z-index: 2; }
.duel-msg { font: 13px system-ui; color: #f2ead4; background: rgba(10,10,6,0.55); border-left: 3px solid #8a7234; padding: 4px 8px; border-radius: 4px; text-shadow: 0 1px 2px #000; }
.duel-msg.warn { border-left-color: #d0533d; }
.duel-msg.good { border-left-color: #7bd88f; }
.duel-msg.info { border-left-color: #8fb3d9; }
.duel-banner { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); font: 600 26px Georgia, serif; color: #f4ecd2; text-shadow: 0 2px 8px #000; background: rgba(0,0,0,0.45); padding: 10px 22px; border-radius: 8px; z-index: 3; pointer-events: none; text-align: center; max-width: 90vw; }
.duel-status { position: absolute; left: 12px; right: 12px; bottom: 10px; display: flex; justify-content: space-between; gap: 12px; font: 13px system-ui; color: #f2ead4; text-shadow: 0 1px 3px #000; pointer-events: none; z-index: 2; }
.duel-status em { color: #ffb15a; font-style: normal; font-weight: 600; }
.duel-click { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: rgba(0,0,0,0.25); color: #f4ecd2; font: 600 20px Georgia, serif; z-index: 4; cursor: pointer; text-shadow: 0 2px 6px #000; }
.duel-click span { font: 13px system-ui; opacity: 0.85; }
.duel-help { position: absolute; right: 12px; top: 60px; width: min(400px, 90vw); max-height: 70vh; overflow: auto; background: rgba(20,20,14,0.88); color: #ece6d2; border: 1px solid #3a402d; border-left: 3px solid #d8b45a; border-radius: 8px; padding: 8px 12px; font: 12.5px system-ui; z-index: 3; }
.duel-help h3 { margin: 4px 0; font: 600 14px Georgia, serif; color: #d8b45a; }
.duel-help td { padding: 1px 6px 1px 0; vertical-align: top; }
.duel-help ul { margin: 0; padding-left: 16px; }
.duel-dialog { max-width: min(560px, 92vw); }
.duel-dialog h2 { margin-top: 0; }
.duel-menu-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.duel-setup .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.duel-setup label { display: flex; flex-direction: column; gap: 3px; font-size: 0.85rem; }
.duel-setup label.check { flex-direction: row; align-items: center; gap: 6px; }
.ds-basis { font-size: 0.8rem; }
.duel-touch { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.duel-stick { position: absolute; left: 24px; bottom: 70px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.25); pointer-events: auto; }
.duel-stick i { position: absolute; left: 40px; top: 40px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.3); }
.duel-tbtns { position: absolute; right: 8px; bottom: 60px; display: grid; grid-template-columns: repeat(3, auto); gap: 6px; pointer-events: auto; }
.duel-tbtns button { min-width: 62px; padding: 8px 6px; font-size: 0.8rem; background: rgba(20,20,14,0.6); }
.duel-tbtns button.fire { background: rgba(140,40,30,0.7); }
.duel-tbtns button.on { outline: 2px solid #d8b45a; }
@media (max-width: 700px) { .duel-setup .grid2 { grid-template-columns: 1fr; } .duel-status { flex-direction: column; font-size: 11px; } .duel-banner { font-size: 18px; } }
@media (pointer: coarse) {
  .duel-status { top: 64px; bottom: auto; flex-direction: column; gap: 2px; font-size: 11px; }
  .duel-msgs { top: 112px; font-size: 12px; }
  .duel-help { top: 110px; }
}
