/* Plain, simple styles for the first version. */
:root {
  --bg: #f6f6f4; --fg: #1d1d1f; --muted: #6b6b70; --line: #c9c9cc; --card: #ffffff;
  --team-1: #2f6fdb; --team-2: #d2462d; --team-3: #2e9b5a; --team-4: #9b4fd1;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
body { margin: 0; background: var(--bg); color: var(--fg); }
/* Elements hidden by the page stay hidden even if a rule sets display. */
[hidden] { display: none !important; }
#app { padding: 16px; max-width: 1100px; margin: 0 auto; }
button { font: inherit; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); cursor: pointer; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
select, input { font: inherit; padding: 4px 6px; }
/* Every screen is one centred column: a heading on top (breadcrumb, title,
   a grey line under it), the content, then a row of buttons. The column and
   its groups are centred; text inside cards and forms stays left-aligned. */
.page { display: flex; flex-direction: column; gap: 14px; margin: 24px auto 40px; }
.page.narrow { max-width: 360px; }   /* menus and settings */
.page.medium { max-width: 560px; }   /* the result */
.page-head { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.page-head h1 { margin: 0; font-size: 1.6rem; }
.page-head h1.game-title { font-size: 2.2rem; margin: 12px 0; }
.page-head .muted { margin: 0; }
.page-head .crumbs { justify-content: center; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.menu { gap: 10px; }
.menu > .back { margin-top: 8px; }
.settings fieldset { display: flex; justify-content: center; gap: 12px; }
.settings > label { align-self: center; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.muted { color: var(--muted); margin: 4px 0; }
.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.team { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.team-1 { border-left-color: var(--team-1); } .team-2 { border-left-color: var(--team-2); }
.team-3 { border-left-color: var(--team-3); } .team-4 { border-left-color: var(--team-4); }
.team h2 { margin: 0; font-size: 1.1rem; }
/* Setting up a fight: the sides in a row with VS between them. */
.sides { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 10px; }
.vs-group { display: flex; align-items: flex-start; gap: 10px; }
.vs-group > .vs { align-self: center; }
.vs { align-self: center; font-weight: 700; font-size: 1.2rem; color: var(--team-2); padding: 0 4px; }
.fighter-card.side, .team-box { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 8px; }
.fighter-card.side { padding: 10px; min-width: 260px; }
.team-box { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 280px; }
.team-box.team-1, .fighter-card.side.team-1 { border-left-color: var(--team-1); } .team-box.team-2, .fighter-card.side.team-2 { border-left-color: var(--team-2); }
.team-box.team-3, .fighter-card.side.team-3 { border-left-color: var(--team-3); } .team-box.team-4, .fighter-card.side.team-4 { border-left-color: var(--team-4); }
.team-name { font-weight: 700; font-size: 1rem; }
.grow { flex: 1; min-width: 0; }
.card-top { align-items: flex-start; flex-wrap: nowrap; }
.remove-x { padding: 0 8px; line-height: 1.4; }
.map-choice.off { opacity: 0.5; }
.side-legend { margin: 0; text-align: center; }
.setup .errors { align-self: center; }
.side-num { display: inline-block; min-width: 1.4em; text-align: center; border-radius: 4px; color: #fff; }
.side-num.team-1 { background: var(--team-1); } .side-num.team-2 { background: var(--team-2); }
.side-num.team-3 { background: var(--team-3); } .side-num.team-4 { background: var(--team-4); }
.side-pick { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 140px; padding: 14px 18px;
  background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 8px; }
.side-pick.chosen { outline: 3px solid #c25b12; }
.side-pick.team-1 { border-left-color: var(--team-1); } .side-pick.team-2 { border-left-color: var(--team-2); }
.side-pick.team-3 { border-left-color: var(--team-3); } .side-pick.team-4 { border-left-color: var(--team-4); }
@media (max-width: 600px) {
  .sides, .vs-group { flex-direction: column; align-items: stretch; }
  .vs, .vs-group > .vs { align-self: center; }
  .fighter-card.side, .team-box { min-width: 0; }
}
/* The short fighter card: who, Health and Stamina, one icon per slot. */
.fighter-card { border: 1px dashed var(--line); border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.mini-icons { display: flex; flex-wrap: wrap; gap: 4px 10px; }
/* Slots and consumables wrap as whole groups, never one icon alone. */
.mini-group { display: flex; gap: 4px; }
.mini { width: 26px; height: 26px; border: 1px solid #9a9aa0; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 13px; background: var(--bg); }
.mini.over { border-color: #a1260f; border-style: dashed; }
/* The character screen, over the setup screen. */
.character-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); overflow: auto; overscroll-behavior: contain; z-index: 10; padding: 16px; box-sizing: border-box; }
.sheet { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 10px; padding: 12px; max-width: 760px; margin: 0 auto; box-sizing: border-box; }
.sheet.team-1 { border-left-color: var(--team-1); } .sheet.team-2 { border-left-color: var(--team-2); }
.sheet.team-3 { border-left-color: var(--team-3); } .sheet.team-4 { border-left-color: var(--team-4); }
.sheet:focus { outline: none; }
.sheet .top { margin-bottom: 10px; }
.sheet .top input { min-width: 0; max-width: 160px; }
.grow { flex: 1; }
.muted-inline { color: var(--muted); }
.label2 { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 10px 0 4px; }
.stats { font-size: 0.8rem; }
.bar { display: flex; height: 6px; background: #ddd; border-radius: 3px; margin: 2px 0 6px; overflow: hidden; }
.bar i { display: block; height: 6px; }
.bar .base { background: #9a9aa0; }
.bar .plus { background: var(--team-1); }
/* The body figure with a button on each body part (the character screen and
   Items' "What type of item is it?"), and the character screen's item menu
   that opens beside the clicked part (on a phone, under the figure). */
.figure-area { position: relative; width: 100%; max-width: 560px; margin: 0 auto; }
.figure-box { position: relative; width: 100%; aspect-ratio: 10 / 9; }
.posed { position: absolute; inset: 0; width: 100%; height: 100%; fill: #8a8a8f; stroke: #333; stroke-width: 2; }
.body-spot { position: absolute; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 2px 3px; background: rgba(200, 200, 204, 0.72); border: 2px solid rgba(255, 255, 255, 0.9); border-radius: 8px;
  font-size: 0.78rem; color: #1d1d1f; text-align: center; line-height: 1.15; overflow: hidden; }
.body-spot b { font-weight: 700; }
.body-spot .worn { display: flex; align-items: center; gap: 3px; font-size: 0.7rem; color: #333; max-width: 100%; }
.body-spot .wname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.body-spot { cursor: pointer; }
button.body-spot:hover, button.body-spot:focus-visible { background: rgba(251, 231, 214, 0.9); }
.body-spot.filled { background: rgba(222, 233, 252, 0.88); border-color: var(--team-1); }
.body-spot.open, .cons-pick.open { outline: 3px solid #c25b12; }
.extra-spots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.extra-spots .body-spot { position: static; min-width: 110px; min-height: 52px; }
.spot-pic { width: 26px; height: auto; flex: none; }
.necklace .chain { fill: none; stroke: #8a5a14; stroke-width: 2; }
.necklace .gem { fill: #5aa9e6; stroke: #1d5f99; stroke-width: 1; }
.potion .glass { fill: #f3f3f6; stroke: #555; stroke-width: 1.5; }
.potion .liquid { fill: #e05a6a; }
.potion .cork { fill: #b8865b; stroke: #6b4a2b; stroke-width: 1; }
.cons-limit { font-size: 0.68rem; color: var(--muted); }
.cons-picks { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 2px; }
.cons-pick { width: 28px; height: 28px; padding: 0; border: 1px solid #9a9aa0; border-radius: 6px; background: var(--card); font-size: 14px; }
.cons-pick.filled { border-color: var(--team-1); background: #eef3fd; }
.cons-pick.over { border-color: #a1260f; border-style: dashed; }
.slot-menu { position: absolute; z-index: 5; box-sizing: border-box; width: max-content; max-width: min(460px, 100%); display: flex; flex-direction: column; gap: 6px;
  padding: 8px; background: var(--card); border: 1px solid #9a9aa0; border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
.slot-menu.below { position: static; width: auto; max-width: 560px; margin: 8px auto 0; }
.menu-title { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.menu-items { display: flex; flex-direction: column; gap: 2px; }
.menu-item { display: flex; align-items: center; gap: 8px; text-align: left; border: none; background: none; padding: 5px 8px; border-radius: 6px; font-size: 0.9rem; }
.menu-item:hover, .menu-item:focus-visible { background: var(--bg); }
.menu-item.selected { background: #fff1e3; outline: 2px solid #c25b12; }
.menu-item.off { color: #8a8a8f; }
.menu-item .micon { width: 1.4em; text-align: center; }
.menu-item .worn-tag { font-size: 0.7rem; padding: 0 6px; border-radius: 4px; background: #eef3fd; color: #1d4f9a; }
.menu-item .why { font-size: 0.75rem; color: #a1260f; }
.menu-cards { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 600px) {
  .slot-menu { position: static; width: auto; max-width: none; margin-top: 8px; transform: none !important; }
  .body-spot { font-size: 0.68rem; }
  .body-spot .wname, .cons-limit, .spot-pic { display: none; }
}
.maps { align-self: center; display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 12px; margin: 0; }
.maps legend { padding: 0 6px; }
.map-choice { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.map-preview { width: 160px; height: 140px; }
.map-preview .tile { fill: #e8e8e4; stroke: #9a9aa0; stroke-width: 0.6; }
.map-preview .tile-side { stroke-width: 0.3; } .map-preview .model .face { stroke-width: 0.2; }
.map-preview .start.team-1 { fill: var(--team-1); } .map-preview .start.team-2 { fill: var(--team-2); }
.map-preview .start.team-3 { fill: var(--team-3); } .map-preview .start.team-4 { fill: var(--team-4); }
.tile-label { font-size: 6px; text-anchor: middle; fill: #111; }
.errors { color: #a1260f; margin: 0; }
.notice { background: #fff6d6; border: 1px solid #e3c75f; border-radius: 6px; padding: 8px 10px; margin: 0; }
/* Fight screen */
.fight { display: flex; flex-direction: column; gap: 10px; }
.fight-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.fight-head > button { justify-self: start; } .fight-head > button.rotate-map { justify-self: end; }
.fight-head h1 { margin: 0; font-size: 1.3rem; text-align: center; }
/* Buttons | map | combat log; the team cards go under all three. */
.fight-main { display: grid; grid-template-columns: 150px minmax(0, 1fr) 240px; grid-template-areas: "actions map log"; gap: 12px; align-items: stretch; }
.fight-main.no-log { grid-template-columns: 150px minmax(0, 1fr); grid-template-areas: "actions map"; }
.action-col { grid-area: actions; display: flex; flex-direction: column; gap: 8px; }
.fight-main .board-wrap { grid-area: map; align-self: start; }
.fight-main .combat-log { grid-area: log; }
.turn-number { font-weight: 400; color: var(--muted); margin-left: 8px; }
/* The turn order row: who goes now, then who comes after. */
.turn-order { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; align-items: center; font-size: 0.9rem; }
.turn-label { color: var(--muted); }
.turn-chip { border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 0; padding: 3px 8px; background: var(--card); }
.turn-chip.now { font-weight: 700; background: #fff6d6; border-color: #c25b12; }
.turn-chip.team-1 { border-left-color: var(--team-1); } .turn-chip.team-2 { border-left-color: var(--team-2); }
.turn-chip.team-3 { border-left-color: var(--team-3); } .turn-chip.team-4 { border-left-color: var(--team-4); }
.board { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
/* overflow: visible, so a hit's number near the map's edge isn't cut off. */
.hexmap { width: 100%; height: auto; max-height: 70vh; display: block; overflow: visible; }
.tile { fill: #ecece8; stroke: #9a9aa0; stroke-width: 1; }
/* A painted tile (it gives status effects): a light tint; the in-reach,
   move, dodge, preview and danger colours below win over it. */
.tile.painted { fill: #e3ecd2; }
.tile-dots { pointer-events: none; }
.tile-dot { stroke: #fff; stroke-width: 1; } .tile-dot.buff { fill: #2e7d32; } .tile-dot.debuff { fill: #c62828; }
.tile.clickable { cursor: pointer; stroke-width: 2.5; stroke-dasharray: 5 3; }
.tile.move { fill: #dfeee0; stroke: #2e7d3c; }
.tile.direction, .tile.target, .tile.extra { fill: #fbe7d6; stroke: #c25b12; }
.tile.dodge { fill: #dde8fb; stroke: #2f5fb3; }
/* An enemy one of your attacks can hit: click it for the attack menu. */
.tile.enemy { fill: #f3b8ac; stroke: #a1260f; }
.attack-menu { position: absolute; z-index: 2; display: flex; flex-direction: column; gap: 2px; min-width: 170px; max-width: calc(100% - 8px); box-sizing: border-box; padding: 4px; background: var(--card); border: 1px solid #9a9aa0; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); }
.attack-menu button { display: flex; justify-content: space-between; gap: 10px; text-align: left; border: none; padding: 5px 8px; font-size: 0.9rem; white-space: nowrap; }
.attack-menu button:hover:not(:disabled), .attack-menu button:focus-visible { background: var(--bg); }
/* While you can defend, your token glows; clicking it defends. */
/* (More specific than the token rules, which fill every circle in a token.) */
.hexmap .fighter .defend-ring { fill: none; stroke-linejoin: round; stroke-width: 3; animation: defend-pulse 1.2s ease-in-out infinite; }
.hexmap .fighter.team-1 .defend-ring { stroke: var(--team-1); } .hexmap .fighter.team-2 .defend-ring { stroke: var(--team-2); }
.hexmap .fighter.team-3 .defend-ring { stroke: var(--team-3); } .hexmap .fighter.team-4 .defend-ring { stroke: var(--team-4); }
@keyframes defend-pulse { 0%, 100% { stroke-width: 2; opacity: 1; } 50% { stroke-width: 6; opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .hexmap .fighter .defend-ring { animation: none; } }
.tile.preview { fill: #f6c39c; stroke: #8a3a06; stroke-dasharray: none; }
/* The 3D map: slabs' sides, and the models standing on the tiles. A click
   goes through a model to the tile behind it, unless its own tile can be
   clicked: then the model is the tile. */
.tile-side { stroke: #8a8578; stroke-width: 0.6; stroke-linejoin: round; }
.model .face { stroke: rgba(0, 0, 0, 0.35); stroke-width: 0.4; stroke-linejoin: round; }
.standing > g, .labels, .effects { pointer-events: none; }
/* A harmful zone: a striped patch in the object's colour on each tile it reaches. */
.zone { stroke-width: 0.8; stroke-linejoin: round; pointer-events: none; }
.zone-legend { margin: 4px 6px 2px; font-size: 0.75rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.zone-key i { display: inline-block; width: 0.9em; height: 0.9em; border-radius: 2px; margin-right: 4px; border: 1px solid #555; vertical-align: -1px;
  background-image: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.45) 0 2px, transparent 2px 5px); }

.standing > g.clickable { pointer-events: auto; cursor: pointer; }
.hexmap .fighter .acting-ring { fill: rgba(255, 255, 255, 0.35); stroke: #111; stroke-width: 2; stroke-linejoin: round; }
.fighter.down .model { opacity: 0.8; }
/* Hit effects: hidden until played (the screen animates them in and out). */
.flash { opacity: 0; stroke: none; }
.flash.attack { fill: #e0503a; } .flash.explosion { fill: #f08a24; }
.pop { opacity: 0; font-size: 12px; font-weight: 700; text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.pop.damage { fill: #a1260f; } .pop.safe { fill: #2f5fb3; } .pop.heal { fill: #2e7d32; } .pop.armor { fill: #5f7390; } .pop.stamina { fill: #9a7a10; }
/* Status effects: dots on the token, badges on the fighter card (red debuffs, green buffs). */
.hexmap .fighter circle.status-dot { stroke: #fff; stroke-width: 1; }
.hexmap .fighter circle.status-dot.debuff { fill: #c62828; } .hexmap .fighter circle.status-dot.buff { fill: #2e7d32; }
.status-dot-text { fill: #fff; font-size: 9px; font-weight: 700; text-anchor: middle; pointer-events: none; }
input.short { width: 4.5em; }
.statuses .card-form input[type=number] { width: 6em; }
.status-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.status-badge { font-size: 0.75rem; padding: 1px 6px; border-radius: 4px; }
.status-badge.debuff { background: #fdecea; color: #8e1c12; } .status-badge.buff { background: #e8f5e9; color: #1b5e20; }
.fighter circle { stroke: #111; stroke-width: 1.5; }
.small-label { font-size: 8px; text-anchor: middle; fill: #222; paint-order: stroke; stroke: rgba(255, 255, 255, 0.85); stroke-width: 2px; }
.flee-mark { font-size: 8px; text-anchor: middle; fill: #8a3a06; font-weight: 700; }
.object-label { font-size: 9px; text-anchor: middle; fill: #3d2610; font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 2.5px; }
/* Team cards under the map, one box per team. */
.fight-teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.fight-team { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.fight-team.team-1 { border-left-color: var(--team-1); } .fight-team.team-2 { border-left-color: var(--team-2); }
.fight-team.team-3 { border-left-color: var(--team-3); } .fight-team.team-4 { border-left-color: var(--team-4); }
.fight-team h2 { font-size: 1rem; margin: 0 0 6px; }
.fight-cards { display: flex; flex-wrap: wrap; gap: 6px; }
.fight-card { border: 1px dashed var(--line); border-radius: 6px; padding: 5px 8px; font-size: 0.9rem; min-width: 200px; flex: 1 1 200px; box-sizing: border-box; }
.fight-card.acting { background: #fff6d6; border-style: solid; border-color: #e3c75f; }
.fight-card.out { opacity: 0.6; }
/* Health and Stamina bars on the fighter cards: the numbers inside, the
   filled part shrinking from the right as they go down. */
.stat-bars { display: flex; flex-direction: column; gap: 4px; margin-top: 5px; }
.stat-bar { position: relative; height: 24px; border-radius: 3px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.stat-bar i { position: absolute; left: 0; top: 0; bottom: 0; }
.stat-bar span { position: relative; color: #fff; font-weight: 700; font-size: 0.85rem; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55); }
.stat-bar.hp { background: #7b2a24; } .stat-bar.hp i { background: #d63a30; }
.stat-bar.sp { background: #6f5d22; } .stat-bar.sp i { background: #e2bf48; }
.stat-bar.armor { background: #3c4a5c; } .stat-bar.armor i { background: #7d93b0; }
/* The small pair under each token on the map. */
.token-bar-track { fill: #3a3a3d; stroke: #fff; stroke-width: 0.6; }
.token-bar.hp { fill: #d63a30; } .token-bar.sp { fill: #e2bf48; } .token-bar.armor { fill: #7d93b0; }
/* A fighter card opened with "More ▾": the whole sheet; the card and its
   team box take the whole row. Everything on it is a clickable icon; a
   click opens that thing's card under it (.sheet-pop). */
.fight-card.open { flex-basis: 100%; }
.fight-teams { align-items: start; }
.fight-team:has(.fight-card.open) { grid-column: 1 / -1; }
/* A lone fighter: their card alone, with the side's colour down its edge. */
.fight-card.lone { border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--card); }
.fight-card.lone.team-1 { border-left-color: var(--team-1); } .fight-card.lone.team-2 { border-left-color: var(--team-2); }
.fight-card.lone.team-3 { border-left-color: var(--team-3); } .fight-card.lone.team-4 { border-left-color: var(--team-4); }
.fight-card.lone.acting { background: #fff6d6; border-top-color: #e3c75f; border-right-color: #e3c75f; border-bottom-color: #e3c75f; }
.fight-card.lone.open { grid-column: 1 / -1; }
.fight-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sheet-toggle { border: none; background: none; padding: 0 2px; color: #2f5fb3; font-size: 0.85rem; cursor: pointer; white-space: nowrap; }
.fighter-sheet { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 14px; margin-top: 6px; }
.sheet-section { margin-top: 6px; }
.sheet-head { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 6px 0 4px; }
.sheet-figure { max-width: 320px; }
.sheet-icons { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet-icon { position: relative; box-sizing: border-box; width: 34px; height: 34px; padding: 0; font-size: 18px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; border: 1px solid #9a9aa0; border-radius: 6px; background: var(--card); }
.sheet-icon:disabled { cursor: default; }
.sheet-icon.open { outline: 3px solid #c25b12; }
.sheet-icon.debuff { background: #fdecea; color: #8e1c12; } .sheet-icon.buff { background: #e8f5e9; color: #1b5e20; }
/* On the figure: the body part's place, like the character screen's buttons. */
.sheet-icon.on-figure, .sheet-bag { position: absolute; width: auto; height: auto; background: rgba(200, 200, 204, 0.72); border: 2px solid rgba(255, 255, 255, 0.9); border-radius: 8px; }
.sheet-icon.on-figure { font-size: 22px; }
.sheet-icon.on-figure.empty { opacity: 0.5; border-style: dashed; background: rgba(255, 255, 255, 0.45); }
.sheet-bag { box-sizing: border-box; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 3px; padding: 2px; font-size: 0.7rem; text-align: center; }
.sheet-bag .sheet-icon { width: 26px; height: 26px; font-size: 15px; }
.sheet-bag > .spot-pic { opacity: 0.35; }
.sheet-pop { position: absolute; z-index: 3; }
.actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.actions button { text-align: left; }
.actions button.active { outline: 3px solid #c25b12; }
/* Always the same height, so showing a banner never moves the map. */
.banner-slot { height: 64px; display: flex; align-items: center; justify-content: center; }
.banner { background: rgba(29, 29, 31, 0.88); color: var(--bg); font-size: 1.2rem; font-weight: 700; text-align: center; padding: 6px 16px; border-radius: 8px; max-height: 64px; box-sizing: border-box; overflow: hidden; }
.react-banner { background: rgba(161, 38, 15, 0.92); font-size: 1rem; }
.react-who { font-size: 1.3rem; }
.react-time { font-size: 1rem; opacity: 0.9; font-weight: 400; }
.tile.danger { fill: #f5c9c0; }
.team-badge { fill: #fff; stroke: #111; stroke-width: 1; }
.team-badge-text { font-size: 8px; font-weight: 700; text-anchor: middle; fill: #111; }
/* The map card (the attack menu is placed inside it). */
.board-wrap { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.board-wrap .board { border: none; }
/* The combat log: a chat column as tall as the map, newest at the bottom.
   The list fills the column and scrolls inside it. "–" minimizes it. */
.combat-log { position: relative; display: flex; flex-direction: column; min-height: 240px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.combat-log .log-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 0.85rem; color: var(--muted); font-weight: 400; margin: 6px 8px 0; white-space: nowrap; }
.combat-log .log-head > span:first-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.log-mini { border: none; background: none; color: #2f5fb3; font-size: 1rem; line-height: 1; padding: 0 4px; cursor: pointer; }
/* Minimized: a short box at the top of its column with the last entries. */
.combat-log.minimized { min-height: 0; height: auto; align-self: start; cursor: pointer; }
.combat-log.minimized .log-lines { position: static; inset: auto; flex: none; overflow: visible; padding-top: 4px; }
.combat-log.minimized .log-lines > :first-child { margin-top: 0; }
.log-lines { position: absolute; inset: 28px 0 0 0; overflow-y: auto; list-style: none; margin: 0; padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 5px; font-size: 0.85rem; }
.log-lines > :first-child { margin-top: auto; }
.log-lines .bubble { align-self: flex-start; max-width: 88%; padding: 4px 9px; border-radius: 12px 12px 12px 3px; background: #eef3fd; border: 1px solid var(--line); overflow-wrap: anywhere; }
/* Teams 2 and 4 speak from the right, like the other side of a chat. */
.log-lines .bubble.team-2, .log-lines .bubble.team-4 { align-self: flex-end; border-radius: 12px 12px 3px 12px; }
.log-lines .bubble.team-1 { background: #e6eefc; border-color: #b9cdf3; } .log-lines .bubble.team-2 { background: #fbe6e1; border-color: #efbcae; }
.log-lines .bubble.team-3 { background: #e2f3e8; border-color: #b0dcc0; } .log-lines .bubble.team-4 { background: #f1e6fa; border-color: #d6bdec; }
.log-lines .turn { align-self: center; color: var(--muted); font-size: 0.75rem; text-align: center; }
.log-lines .system { align-self: center; font-weight: 700; text-align: center; }
.pause-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; z-index: 10; }
.pause-box { background: var(--card); border-radius: 10px; padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; min-width: 280px; }
.pause-box h1 { margin: 0 0 6px; font-size: 2rem; text-align: center; }
.pause-box .settings { margin: 0; }
.note { color: #a1260f; min-height: 1.2em; margin: 0; }
/* The result: one line per fighter, in their team's colour. */
.roster { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.roster li { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.roster li.team-1 { border-left-color: var(--team-1); } .roster li.team-2 { border-left-color: var(--team-2); }
.roster li.team-3 { border-left-color: var(--team-3); } .roster li.team-4 { border-left-color: var(--team-4); }
/* Items (and the other editors' layout) */
.items .tabs button.active { background: var(--fg); color: var(--bg); }
.items-main { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.item-list { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.item-list h2 { margin: 0; font-size: 1rem; }
.item-list ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.item-list li { display: flex; gap: 6px; align-items: center; }
.item-list li span { flex: 1; }
.card-form { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.card-form h3 { margin: 6px 0 0; font-size: 1rem; }
.field { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.effect { border: 1px dashed var(--line); border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.tile-pick { width: 150px; height: auto; }
.tile-pick .pick polygon { fill: #ecece8; stroke: #9a9aa0; stroke-width: 1; cursor: pointer; }
.tile-pick .pick.on polygon { fill: #f6c39c; stroke: #8a3a06; stroke-width: 2; }
.tile-pick .pick.attacker polygon { fill: #2f6fdb; cursor: default; }
/* The attacker's figure and arrow: a click goes through to the tiles. */
.tile-pick .pick-figure { pointer-events: none; opacity: 0.85; } .tile-pick .pick-figure .face { stroke-width: 0.3; }
.tile-pick { overflow: visible; }
/* The Height choice with its model beside it. */
.height-pick { display: flex; align-items: flex-end; gap: 10px; }
.height-model { flex: none; } .height-model .face { stroke-width: 0.3; }
.pick-label { font-size: 10px; text-anchor: middle; fill: #111; pointer-events: none; }
.tile-pick .attacker .pick-label { fill: #fff; }
.check-area { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
/* The Maps preview */
.preview { background: #fffdf3; border: 1px solid #e3c75f; border-radius: 8px; padding: 8px 10px; }
/* Item cards (character screen and the editors' previews) */
.icard { width: 210px; max-width: 100%; box-sizing: border-box; border: 1px solid #9a9aa0; border-radius: 8px; background: var(--card); padding: 8px 10px; font-size: 0.8rem; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); }
.icard .tag { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.icard .head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.icard .icon { flex: none; width: 36px; height: 36px; border: 1px solid #9a9aa0; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 19px; background: var(--bg); }
.icard .name { font-weight: 700; font-size: 0.85rem; overflow-wrap: anywhere; }
.icard .sub { color: var(--muted); font-size: 0.7rem; }
.icard .line { display: flex; justify-content: space-between; gap: 6px; padding: 1px 0; }
.icard .why { color: #a1260f; }
/* Attack pattern pictures on cards. */
.hexpic { margin-top: 6px; }
.hexpic-title, .hexpic-caption { font-size: 0.7rem; color: var(--muted); }
.hexpic svg { display: block; max-width: 100%; height: auto; }
.hexpic polygon.top { fill: transparent; stroke: #c9c9ce; stroke-width: 1; }
.hexpic .t-hit polygon.top { fill: #e0503a; stroke: #a1260f; }
.hexpic .t-extra polygon.top { fill: #f6c9b4; stroke: #c25b12; stroke-dasharray: 3 2; stroke-width: 1.5; }
.hexpic .t-aim polygon.top { fill: #cfe0f6; stroke: #8fb3e0; }
.hexpic .t-attacker polygon.top { fill: #2f5fb3; stroke: #1d3f7a; }
.hexpic .t-source polygon.top { fill: #e8e8e4; stroke: #9a9aa0; }
.hexpic .t-blast polygon.top { fill: #f4a261; stroke: #c25b12; }
.hexpic .t-reach polygon.top { fill: #d9cdf3; stroke: #8c79c7; }
.hexpic-arrow { fill: #fff; stroke: #1d3f7a; stroke-width: 0.8; stroke-linejoin: round; }
.hexpic .tile-side { stroke-width: 0.4; } .hexpic .model .face { stroke-width: 0.25; }
.icard.changes { border-color: #c25b12; background: #fffaf5; }
.icard .up { color: #2e7d3c; font-weight: 700; } .icard .down { color: #a1260f; font-weight: 700; }
/* Characters */
.stat-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 6px 14px; }
.stat-boxes input { width: 70px; }
.ability-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 2px 12px; }
.card-form .equipment-panel { width: 100%; max-width: 560px; align-self: center; }
/* Abilities: a changed built-in ability */
.changed-tag { margin-left: 6px; font-size: 0.75rem; padding: 1px 6px; border-radius: 6px; background: #fff6d6; border: 1px solid #e3c75f; }
/* Maps */
.map-edit { width: 100%; max-width: 560px; height: auto; }
/* A slab's side lets a click through to the empty place it hangs over. */
.edit-tile .tile-side { pointer-events: none; }
.edit-tile polygon.top { fill: #f6f6f4; stroke: #d6d6d8; stroke-width: 1; stroke-dasharray: 2 2; cursor: pointer; }
.edit-tile.on polygon.top { fill: #ecece8; stroke: #9a9aa0; stroke-dasharray: none; }
.edit-tile.on.painted polygon.top { fill: #e3ecd2; }
.edit-tile.start.team-1 polygon.top { fill: var(--team-1); } .edit-tile.start.team-2 polygon.top { fill: var(--team-2); }
.edit-tile.start.team-3 polygon.top { fill: var(--team-3); } .edit-tile.start.team-4 polygon.top { fill: var(--team-4); }
.edit-tile.chosen polygon.top { stroke: #c25b12; stroke-width: 3; }
.edit-objects { pointer-events: none; }
.edit-label { font-size: 10px; text-anchor: middle; fill: #111; pointer-events: none; }
.edit-tile.start .edit-label { fill: #fff; font-weight: 700; }
/* The shape pool (Tiles tab) beside the map, and the preview over the map:
   green is added, blue is already there, red is left out. The map lets the
   preview show past its edge. */
.map-edit { overflow: visible; }
.tiles-area { display: flex; align-items: flex-start; gap: 12px; width: 100%; }
.tiles-area .map-edit { flex: 1; min-width: 0; }
.shape-pool { display: flex; flex-direction: column; gap: 6px; width: 110px; flex: none; }
.shape-pick { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; font-size: 0.8rem; }
.shape-pick polygon { fill: #ecece8; stroke: #9a9aa0; stroke-width: 1; }
.shape-pick[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.shape-pick[aria-pressed="true"] polygon { fill: #fff; stroke: var(--fg); }
/* Delete tile: a hex with a red ✕; red while deleting. Undo sits at the end of the tool tabs. */
.delete-pick polygon { fill: #fbe4e4; stroke: #a32d2d; }
.delete-mark { font-size: 8px; font-weight: 700; text-anchor: middle; fill: #a32d2d; }
.delete-pick[aria-pressed="true"] { background: #a32d2d; border-color: #a32d2d; color: #fff; }
.delete-pick[aria-pressed="true"] polygon { fill: #fff; stroke: #fff; }
.tabs .undo { margin-left: auto; }
.shape-preview polygon { pointer-events: none; stroke-width: 1.5; }
.preview-new { fill: rgba(99, 153, 34, 0.6); stroke: #3b6d11; }
.preview-kept { fill: rgba(55, 138, 221, 0.35); stroke: #185fa5; }
.preview-out { fill: rgba(226, 75, 74, 0.55); stroke: #a32d2d; }
@media (max-width: 600px) {
  .tiles-area { flex-direction: column; }
  .shape-pool { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .shape-pick { width: 84px; }
}
.edit-flag { font-size: 9px; font-weight: 700; fill: #a1260f; text-anchor: middle; pointer-events: none; }
@media (max-width: 760px) { .items-main { grid-template-columns: 1fr; } }
/* On a phone: the map, then the buttons, then a shorter log. */
@media (max-width: 760px) {
  .fight-main, .fight-main.no-log { grid-template-columns: minmax(0, 1fr); grid-template-areas: "map" "actions" "log"; }
  .actions { flex-direction: row; flex-wrap: wrap; }
  /* One line of turns that slides sideways, so it doesn't push the map down. */
  .turn-order { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; white-space: nowrap; padding-bottom: 2px; }
  .combat-log { min-height: 0; height: 220px; }
}
/* Items, step by step: the page, the choice, the picker,
   and the card as the form. */
.item-flow .item-list.wide { max-width: 520px; }
.item-flow button.big { align-self: flex-start; font-size: 1.05rem; padding: 10px 18px; }
/* An editor page's stage: its groups centred, one under the other. */
.stage { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.stage h2 { margin: 0; font-size: 1.1rem; text-align: center; }
.stage > p { margin: 0; text-align: center; }
.item-flow > .notice { align-self: center; width: 100%; max-width: 760px; box-sizing: border-box; }
.item-flow > .note { text-align: center; }
.item-flow > .export { justify-content: center; }
.big-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.big-choice { min-width: 220px; padding: 18px 20px; font-size: 1.05rem; }
.pick-row { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.pick-row h3 { margin: 0; font-size: 0.95rem; text-align: center; }
.pick-row > .muted { text-align: center; }
.pick-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; align-items: flex-start; }
.pick-card { padding: 0; border: none; background: none; text-align: left; border-radius: 8px; }
.pick-card:hover .icard, .pick-card:focus-visible .icard { outline: 3px solid #c25b12; }
/* The open card and its Save / Cancel, one centred column. */
.card-stage { width: 100%; max-width: 560px; margin-inline: auto; align-items: stretch; }
.check-area > .row { justify-content: center; }
.icard.editing { width: 100%; font-size: 0.9rem; }
.icard.editing .head-lines { flex: 1; min-width: 0; }
.eline { border-radius: 6px; }
.eline.open { border: 1px solid #2f5fb3; background: #f2f6fd; padding: 4px 6px; margin: 2px 0; }
.eline-text { display: flex; width: 100%; justify-content: space-between; text-align: left; padding: 3px 4px; border: none; background: none; border-radius: 4px; }
.eline-text:hover, .eline-text:focus-visible { background: #eef2f8; }
.eline-text.name { font-weight: 700; }
.eline-text.sub { color: var(--muted); font-size: 0.8rem; }
.eline-text .pen { color: var(--muted); }
.eline-body { display: flex; flex-direction: column; gap: 6px; padding: 4px 2px; }
.add-thing { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.add-choices { display: flex; flex-wrap: wrap; gap: 6px; }
/* "What kind of ability is it?" / "Is it good or bad …?": big kind buttons. */
.kind-picks { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: 100%; max-width: 640px; }
.kind-pick { width: 140px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px; }
.kind-icon { font-size: 1.6rem; }
.kind-pick.buff { background: #e8f5e9; border-color: #8cc59a; color: #1b5e20; }
.kind-pick.debuff { background: #fdecea; border-color: #e7a39b; color: #8e1c12; }
.plain-line { padding: 3px 4px; }
/* A map's tile picture on its card. */
.hexpic .t-tile polygon.top { fill: #d8d8dc; stroke: #a7a7ab; }
.hexpic .t-painted polygon.top { fill: #c9dcae; stroke: #a7a7ab; }
.hexpic .t-block polygon.top { fill: #d8d8dc; stroke: #a7a7ab; }
.hexpic .t-walk polygon.top { fill: #d8d8dc; stroke: #a7a7ab; }
.hexpic .t-start-1 polygon.top { fill: var(--team-1); stroke: #333; }
.hexpic .t-start-2 polygon.top { fill: var(--team-2); stroke: #333; }
/* A map (or a character): its card on top, then the form, both centred. */
.map-stage { width: 100%; }
.map-stage > .check-area { width: 100%; max-width: 560px; }
.check-area > .icard { align-self: center; }
.map-stage > .card-form { width: 100%; max-width: 760px; box-sizing: border-box; }
/* A card in "Edit existing abilities", with its "changed" mark or Delete under it. */
.pick-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
/* The Editor's breadcrumb: links back to each earlier step; wraps on a phone. */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 0.9rem; margin: 0 0 4px; }
.crumbs .crumb { border: none; background: none; padding: 2px 0; color: #1f5fbf; text-decoration: underline; cursor: pointer; }
.crumbs .crumb:hover, .crumbs .crumb:focus-visible { color: #c25b12; }
.crumb-sep { color: var(--muted); }
.crumb-here { font-weight: 600; }
/* "Are you sure you want to quit …?" over an open card. */
.quit-box { box-sizing: border-box; max-width: min(420px, calc(100vw - 32px)); }
.quit-box h2 { margin: 0; font-size: 1.2rem; text-align: center; }
.quit-box p { margin: 0; text-align: center; color: var(--muted); }

/* Tile effects tab: the clicked tile's effects, each with × */
.tile-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.tile-effect { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border: 1px solid #d6d6d8; border-radius: 6px; }

/* The tooltip bubble beside the mouse (ui/tooltip.js); above every overlay,
   and never in the mouse's way. */
.tip-bubble { position: fixed; z-index: 100; pointer-events: none; max-width: 280px; box-sizing: border-box;
  padding: 6px 9px; border-radius: 6px; background: rgba(29, 29, 31, 0.94); color: #fff; font-size: 0.8rem; line-height: 1.35;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); white-space: pre-line; }

/* Edit tile (map editor): the picked tile's card beside it on the map; on a
   phone, under the map. The map and its box are the same size, so the card
   is placed in percent. */
.map-wrap { position: relative; width: 100%; max-width: 560px; }
.map-wrap .map-edit { display: block; max-width: none; }
.tile-card { position: absolute; z-index: 4; width: 300px; box-sizing: border-box; display: flex; flex-direction: column; gap: 6px;
  padding: 8px 10px; background: var(--card); border: 1px solid #9a9aa0; border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); font-size: 0.85rem; }
.tile-head { flex-wrap: nowrap; }
.tile-row { display: flex; flex-direction: column; gap: 3px; padding-top: 6px; border-top: 1px solid #ececef; }
.tile-key { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tile-val { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tile-flee { width: 100%; box-sizing: border-box; }
.tile-add { gap: 4px; }
button.danger { color: #a1260f; border-color: #e7a39b; }
@media (max-width: 600px) { .tile-card { position: static; width: auto; margin-top: 8px; } }

/* Damage type labels ("10 Fire"), one per swatch: light fill, dark text. */
.dtype { padding: 0 4px; border-radius: 4px; font-weight: 600; white-space: nowrap; }
.dtype.grey { background: #e6e4dc; color: #3d3c38; } .dtype.red { background: #fbe1df; color: #8f2a20; }
.dtype.blue { background: #dfeafa; color: #1c4b80; } .dtype.amber { background: #fbecd2; color: #7a4a0a; }
.dtype.green { background: #e3f0d3; color: #2f5410; } .dtype.purple { background: #e8e6fb; color: #3f3592; }
.dtype.pink { background: #f9e2ea; color: #84284a; } .dtype.teal { background: #d9f1e9; color: #0b5a45; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { border: 2px solid transparent; padding: 2px 8px; cursor: pointer; }
.swatch[aria-pressed="true"] { border-color: var(--fg); }
