/* Layout: one narrow column, tab bar on top.
   Each game tab commits to its own look (always dark, like the games): colors, fonts and shape
   come from the [data-game] blocks below, which app.js sets on <html>. */
:root {
  --bg: #111318;
  --surface: #1a1d24;
  --line: #2b2f38;
  --fg: #e8e6e1;
  --muted: #9a9ca3;
  --track: #282c35;
  --ok: #5cc49a;
  --warn: #e3aa4a;
  --crit: #f07565;
  --accent: #e8e6e1;
  --accent-fg: #111318;
  --f-display: "Arial Narrow", system-ui, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-num: ui-monospace, Consolas, monospace;
  --radius: 10px;
  --display-case: uppercase;
  --display-spacing: .05em;
  color-scheme: dark;
}

/* Helldivers 2 — Super Earth military terminal: black, propaganda yellow, hazard stripes, cut corners. */
[data-game="helldivers"] {
  --bg: #0a0b0c;
  --surface: #131517;
  --line: #2c2f33;
  --fg: #eceee8;
  --muted: #8d928f;
  --track: #24272a;
  --ok: #7fd36b;
  --warn: #ffb020;
  --crit: #ff4a3d;
  --accent: #ffe710;
  --accent-fg: #0a0b0c;
  --f-display: "Teko", "Arial Narrow", sans-serif;
  --f-body: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --f-num: "Chakra Petch", ui-monospace, monospace;
  --radius: 0px;
  --display-spacing: .04em;
}

/* Dune: Awakening — Arrakis at dusk: deep umber, sand, spice orange, thin gold rules, wide caps. */
[data-game="dune"] {
  --bg: #16110c;
  --surface: #211a13;
  --line: #3d3122;
  --fg: #eadcc3;
  --muted: #a8977b;
  --track: #33291d;
  --ok: #8fbf7a;
  --warn: #e39a3b;
  --crit: #e0614a;
  --accent: #d98a3a;
  --accent-fg: #16110c;
  --gold: #b99a62;
  --f-display: "Syncopate", "Arial", sans-serif;
  --f-body: "Jost", "Segoe UI", system-ui, sans-serif;
  --f-num: "Jost", system-ui, sans-serif;
  --radius: 4px;
  --display-spacing: .14em;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px 16px;
}
.brand {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding-bottom: 8px;
}
.tabs { display: flex; gap: 4px; overflow-x: auto; max-width: 100%; }
.tab {
  font-family: var(--f-display);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  font-size: 1rem;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px 8px;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 22px 56px;
  display: grid;
  gap: 20px;
}

/* ---------- shared pieces ---------- */
h1, h2 { font-family: var(--f-display); text-transform: var(--display-case); letter-spacing: var(--display-spacing); margin: 0; line-height: 1.1; text-wrap: balance; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.15rem; }
.eyebrow { font-family: var(--f-display); text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 10px; min-width: 0; }
.row-between { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; }
.bar { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: width .6s ease; }
.pill { font-family: var(--f-display); text-transform: uppercase; letter-spacing: .08em; font-size: .76rem; font-weight: 600; padding: 1px 9px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.error { color: var(--crit); }

button {
  font: inherit; cursor: pointer; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); padding: 8px 14px; font-weight: 500;
}
button:hover { border-color: var(--muted); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); padding-inline: 8px; }
button.ghost:hover { color: var(--fg); }
button.danger { color: var(--crit); }
button:disabled { opacity: .6; cursor: default; }

label { display: grid; gap: 4px; font-size: .82rem; color: var(--muted); font-weight: 500; min-width: 0; }
input {
  font: inherit; font-size: 1rem; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 10px; width: 100%; min-width: 0;
}
input[type="number"] { font-family: var(--f-num); font-variant-numeric: tabular-nums; }

/* ---------- Helldivers ---------- */
.hd-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px 20px; }
.hd-divers { text-align: right; }
.hd-divers .big { font-family: var(--f-num); font-weight: 700; font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.hd-status { font-size: .85rem; margin: 0; }
.mo { border-left: 4px solid var(--accent); }
.mo-brief { margin: 0; max-width: 65ch; }
.mo-tasks { display: grid; gap: 12px; margin: 4px 0 0; padding: 0; list-style: none; }
.mo-task { display: grid; gap: 5px; }
.mo-task.done .bar > span { background: var(--ok); }
.mo-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: .88rem; }
.mo-meta b { font-weight: 600; }
.planet-name { font-family: var(--f-display); font-weight: 700; font-size: 1.6rem; text-transform: uppercase; letter-spacing: .04em; line-height: 1.1; }
.faction { font-weight: 600; }
.faction.terminids { color: var(--warn); }
.faction.automatons { color: var(--crit); }
.faction.illuminate { color: #8c6bd1; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 20px; }
.stat .v { font-family: var(--f-num); font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.fronts { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.front { display: grid; gap: 4px; }
.front .row-between { font-size: .9rem; }
.front .players { font-family: var(--f-num); font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; }
.skeleton { color: var(--muted); }
/* planet biome pictures */
.biome-banner { margin: -16px -18px 4px; position: relative; aspect-ratio: 5 / 2; max-width: none; overflow: hidden; background: var(--track); }
.biome-banner > .biome { display: block; width: 100%; height: 100%; object-fit: cover; }
.biome-banner figcaption {
  position: absolute; left: 12px; bottom: 10px;
  font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  background: rgb(0 0 0 / .6); color: #fff; padding: 3px 8px;
}
.biome-desc { margin: 0; font-size: .85rem; color: var(--muted); max-width: 65ch; }
.front { grid-template-columns: 76px minmax(0, 1fr); align-items: center; column-gap: 12px; }
.front-info { display: grid; gap: 4px; min-width: 0; }
.fronts-toggle { justify-self: center; color: var(--accent); }
.biome-thumb { display: block; width: 76px; height: 44px; object-fit: cover; background: var(--track); }
[data-game="helldivers"] .biome-banner { border-bottom: 2px solid var(--accent); }
[data-game="helldivers"] .biome-thumb { clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%); }

/* ---------- Dune ---------- */
.dn-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.summary { border-block: 1px solid var(--line); padding-block: 14px; display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: baseline; }
.summary .big { font-family: var(--f-num); font-weight: 700; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.summary .who { font-weight: 600; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; gap: 3px; background: var(--bg); width: fit-content; max-width: 100%; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: var(--radius); color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgb(0 0 0 / .15); }
.hint { font-size: .82rem; color: var(--muted); margin: 0; min-height: 1.2em; }
.hint b { color: var(--fg); font-family: var(--f-num); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.list { display: grid; gap: 14px; }
.base { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 10px; }
.base.example { border-style: dashed; opacity: .75; }
.base .name { font-weight: 600; font-size: 1.05rem; min-width: 0; overflow-wrap: anywhere; }
.count { font-family: var(--f-num); font-weight: 700; font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.count small { font-size: .55em; color: var(--muted); font-weight: 500; margin-inline: 1px 8px; }
.base .bar > span { background: var(--ok); }
.s-ok .pill { color: var(--ok); }
.s-warn .pill, .s-warn .count { color: var(--warn); }
.s-warn .bar > span { background: var(--warn); }
.s-crit .pill, .s-crit .count, .s-out .count { color: var(--crit); }
.s-crit .bar > span, .s-out .bar > span { background: var(--crit); }
.s-out .pill { background: var(--crit); color: var(--surface); border-color: var(--crit); }
.meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-size: .84rem; color: var(--muted); }
.meta b { color: var(--fg); font-weight: 500; }
.confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .88rem; }
.bulk-rows { display: grid; gap: 14px; }
.bulk-row { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.bulk-row:first-child { border-top: 0; padding-top: 0; }
.empty { display: grid; gap: 10px; justify-items: start; }
.empty p { margin: 0; color: var(--muted); max-width: 60ch; }
.tag { font-family: var(--f-display); text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; color: var(--muted); }
.note { color: var(--muted); font-size: .8rem; max-width: 65ch; margin: 0; }

/* ---------- tab labels always wear their own game's type ---------- */
.tab[data-id="helldivers"] { font-family: "Teko", "Arial Narrow", sans-serif; font-size: 1.3rem; font-weight: 600; letter-spacing: .05em; line-height: 1; padding-top: 8px; }
.tab[data-id="dune"] { font-family: "Syncopate", Arial, sans-serif; font-size: .78rem; font-weight: 700; letter-spacing: .18em; }

/* ================= Helldivers 2 look ================= */
[data-game="helldivers"] body {
  background:
    repeating-linear-gradient(0deg, rgb(255 255 255 / .018) 0 1px, transparent 1px 3px),
    var(--bg);
  font-size: 15.5px;
}
[data-game="helldivers"] .topbar { border-bottom: 2px solid var(--accent); }
[data-game="helldivers"] .brand { font-family: "Teko", sans-serif; font-size: 1.9rem; line-height: 1; letter-spacing: .06em; }
[data-game="helldivers"] h1 { font-size: 3.2rem; font-weight: 600; line-height: .85; color: var(--accent); }
[data-game="helldivers"] h2 { font-size: 1.7rem; font-weight: 500; line-height: 1; }
[data-game="helldivers"] .eyebrow,
[data-game="helldivers"] .tag { font-family: "Chakra Petch", sans-serif; font-weight: 600; font-size: .72rem; letter-spacing: .16em; }
[data-game="helldivers"] .pill { font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: .7rem; letter-spacing: .1em; padding: 2px 8px; }
/* cut-corner panels, like the in-game terminals */
[data-game="helldivers"] .card {
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  border-color: #33373b;
}
/* Major Order: hazard-striped header band */
[data-game="helldivers"] .mo { border-left: 0; padding-top: 22px; position: relative; background: linear-gradient(180deg, rgb(255 231 16 / .06), transparent 45%), var(--surface); }
[data-game="helldivers"] .mo::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 8px;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 10px, #0a0b0c 10px 20px);
}
[data-game="helldivers"] .mo > .row-between .eyebrow { color: var(--accent); font-size: .85rem; }
[data-game="helldivers"] .mo-brief { font-size: 1.02rem; }
[data-game="helldivers"] .bar { height: 10px; border-radius: 0; background: repeating-linear-gradient(90deg, var(--track) 0 6px, #1b1e21 6px 8px); }
[data-game="helldivers"] .bar > span { border-radius: 0; }
[data-game="helldivers"] .hd-divers .big { font-family: "Teko", sans-serif; font-size: 3.4rem; font-weight: 500; line-height: .8; color: var(--accent); }
[data-game="helldivers"] .planet-name { font-family: "Teko", sans-serif; font-size: 2.6rem; font-weight: 600; line-height: .9; }
[data-game="helldivers"] .stat .v { font-family: "Teko", sans-serif; font-size: 2rem; font-weight: 500; line-height: 1; }
[data-game="helldivers"] button { text-transform: uppercase; letter-spacing: .08em; font-weight: 600; font-size: .85rem; }

/* ================= Dune: Awakening look ================= */
[data-game="dune"] body {
  background:
    radial-gradient(120% 60% at 50% -10%, rgb(217 138 58 / .16), transparent 60%),
    radial-gradient(90% 50% at 100% 110%, rgb(185 154 98 / .08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
[data-game="dune"] .topbar { background: rgb(22 17 12 / .9); backdrop-filter: blur(6px); border-bottom-color: var(--gold); }
[data-game="dune"] .brand { font-family: "Syncopate", sans-serif; font-size: 1rem; letter-spacing: .3em; padding-bottom: 12px; }
[data-game="dune"] h1 { font-size: 1.55rem; font-weight: 700; color: var(--fg); }
[data-game="dune"] h2 { font-size: .95rem; font-weight: 700; color: var(--gold); }
[data-game="dune"] .eyebrow,
[data-game="dune"] .tag { font-family: "Jost", sans-serif; font-weight: 500; letter-spacing: .32em; font-size: .7rem; color: var(--gold); }
[data-game="dune"] .pill { font-family: "Jost", sans-serif; font-weight: 500; letter-spacing: .2em; font-size: .68rem; padding: 2px 10px; border-radius: 2px; }
/* thin gold rules framing each base, like the game's HUD panels */
[data-game="dune"] .base,
[data-game="dune"] .panel {
  background: linear-gradient(180deg, rgb(234 220 195 / .035), transparent 40%), var(--surface);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgb(185 154 98 / .35);
}
[data-game="dune"] .summary { border-color: var(--gold); border-block-width: 1px; }
[data-game="dune"] .count { font-weight: 300; font-size: 2.4rem; letter-spacing: .02em; }
[data-game="dune"] .count small { font-weight: 400; color: var(--gold); }
[data-game="dune"] .summary .big { font-weight: 400; font-size: 1.4rem; }
[data-game="dune"] .bar { height: 4px; border-radius: 2px; }
[data-game="dune"] .bar > span { border-radius: 2px; }
[data-game="dune"] button { letter-spacing: .06em; }
[data-game="dune"] button.primary { background: linear-gradient(180deg, #e39a4c, #c9772b); border-color: #c9772b; }

@media (max-width: 460px) {
  [data-game="helldivers"] h1 { font-size: 2.6rem; }
  [data-game="helldivers"] .hd-divers .big { font-size: 2.8rem; }
  [data-game="dune"] h1 { font-size: 1.2rem; }
  [data-game="dune"] .brand { letter-spacing: .2em; }
  .grid3 { gap: 6px; }
  .count { font-size: 1.65rem; }
  h1 { font-size: 1.6rem; }
  .hd-divers { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .bar > span { transition: none; }
}
