/* Frontline theme: modern field map. System fonts only, colors as tokens.
   Bootstrap stays; its variables are pointed at these tokens. */
:root,
:root[data-bs-theme="dark"] {
  --bg: #0e1211;
  --surface: #151a18;
  --surface-2: #1c2320;
  --surface-3: #252d2a;
  --line: #262f2b;
  --line-strong: #36413c;
  --text: #e7ebe8;
  --text-2: #a1aba6;
  --text-3: #6c7772;
  --accent: #f5a524;
  --accent-hover: #ffb84d;
  --accent-soft: rgba(245, 165, 36, .12);
  --on-accent: #1b1204;
  --ok: #5bd18b;
  --warn: #ff8a3d;
  --danger: #f2555a;
  --blue: #4c8dff;
  --red: #ff5a52;
  --sky: #7cc4ff;
  --blue-text: #8fb5ff;
  --red-text: #ff8f88;
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;

  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-body-font-family: var(--font);
  --bs-heading-color: var(--text);
  --bs-emphasis-color: #fff;
  --bs-secondary-color: var(--text-2);
  --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--line);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 245, 165, 36;
  --bs-link-hover-color: var(--accent-hover);
  --bs-link-hover-color-rgb: 255, 184, 77;
  --bs-success-bg-subtle: rgba(91, 209, 139, .1);
  --bs-success-border-subtle: rgba(91, 209, 139, .3);
  --bs-success-text-emphasis: #b9efcf;
  --bs-danger-bg-subtle: rgba(242, 85, 90, .1);
  --bs-danger-border-subtle: rgba(242, 85, 90, .32);
  --bs-danger-text-emphasis: #ffc2c4;
  --bs-warning-bg-subtle: rgba(245, 165, 36, .1);
  --bs-warning-border-subtle: rgba(245, 165, 36, .3);
  --bs-warning-text-emphasis: #ffd99a;
  --bs-info-bg-subtle: var(--surface-2);
  --bs-info-border-subtle: var(--line-strong);
  --bs-info-text-emphasis: var(--text);
}

body { -webkit-font-smoothing: antialiased; overflow-x: clip; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, .h1, .h2, .h3 { letter-spacing: -.015em; font-weight: 650; }
.text-secondary { color: var(--text-2) !important; }
.num { font-variant-numeric: tabular-nums; }
.min-w-0 { min-width: 0; }
.eyebrow { font-size: .7rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }

/* ---------- chrome ---------- */
.app-nav { background: rgba(14, 18, 17, .92); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; letter-spacing: .01em; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark { width: 24px; height: 24px; flex-shrink: 0; }
.app-nav .nav-link { color: var(--text-2); font-weight: 500; border-radius: 8px; padding: .4rem .75rem; white-space: nowrap; }
.app-nav .nav-link:hover, .app-nav .nav-link.active { color: var(--text); text-decoration: none; }
.app-nav .nav-link.active { background: var(--surface-2); }
.user-name { color: var(--text-2); font-size: .9rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); }
.alert { border-radius: var(--radius); }

.btn { border-radius: 8px; font-weight: 600; }
.btn-primary {
  --bs-btn-color: var(--on-accent); --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: var(--on-accent); --bs-btn-hover-bg: var(--accent-hover); --bs-btn-hover-border-color: var(--accent-hover);
  --bs-btn-active-color: var(--on-accent); --bs-btn-active-bg: #e3951a; --bs-btn-active-border-color: #e3951a;
  --bs-btn-disabled-color: var(--text-3); --bs-btn-disabled-bg: var(--surface-3); --bs-btn-disabled-border-color: var(--surface-3);
  --bs-btn-focus-shadow-rgb: 245, 165, 36;
}
.btn-ghost {
  --bs-btn-color: var(--text); --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-color: var(--text); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-border-color: var(--line-strong);
  --bs-btn-active-color: var(--text); --bs-btn-active-bg: var(--surface-3); --bs-btn-active-border-color: var(--line-strong);
}
.btn-icon { --bs-btn-padding-x: .55rem; --bs-btn-color: var(--text-3); --bs-btn-hover-color: var(--danger); --bs-btn-hover-bg: rgba(242, 85, 90, .1); }

.form-label { font-size: .85rem; font-weight: 500; color: var(--text-2); }
.form-control, .form-select { background-color: var(--surface-2); border-color: var(--line-strong); color: var(--text); border-radius: 8px; }
.form-control:focus, .form-select:focus { background-color: var(--surface-2); color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245, 165, 36, .2); }
.form-check-input { background-color: var(--surface-2); border-color: var(--line-strong); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

kbd { background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text-2); border-radius: 5px; font-family: var(--mono); font-size: .72rem; padding: .1rem .35rem; box-shadow: none; }

.side-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.side-blue { background: var(--blue); }
.side-red { background: var(--red); }
.side-text-blue { color: var(--blue-text); }
.side-text-red { color: var(--red-text); }

.tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.tag-ok { background: rgba(91, 209, 139, .12); color: var(--ok); }
.tag-warn { background: rgba(255, 138, 61, .13); color: var(--warn); }
.tag-danger { background: rgba(242, 85, 90, .13); color: var(--danger); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- navbar (Pixelgolf pattern: avatar menu, sheet menu on mobile) ---------- */
.skip-link { position: absolute; left: -999px; top: .5rem; z-index: 2000; background: var(--accent); color: var(--on-accent); padding: .4rem .8rem; border-radius: 8px; font-weight: 600; }
.skip-link:focus { left: .5rem; }
.site-header { position: sticky; top: 0; z-index: 1030; }
.app-nav { backdrop-filter: blur(8px); padding-block: .45rem; }
.app-nav > .container-fluid { flex-wrap: nowrap; gap: 1rem; }
.nav-main { display: flex; gap: .15rem; list-style: none; margin: 0 0 0 .5rem; padding: 0; }
.nav-main .nav-link, .dropdown-item, .mobile-links a { display: inline-flex; align-items: center; gap: .5rem; }
.ico { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-main .ico { opacity: .75; }
.nav-badge { min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; border-radius: 999px; display: inline-grid; place-items: center; background: var(--accent); color: var(--on-accent); font-size: .68rem; font-weight: 800; line-height: 1; }
.user-btn { position: relative; display: inline-flex; align-items: center; gap: .55rem; background: transparent; border: 1px solid transparent; color: var(--text-2); border-radius: 999px; padding: .2rem .7rem .2rem .2rem; font-weight: 500; }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.user-dot { position: absolute; top: 1px; left: 26px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
.menu-btn { position: relative; display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); }
.menu-btn .user-dot { top: 4px; left: auto; right: 4px; }
.user-menu { min-width: 250px; padding: .4rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 18px 48px rgba(0, 0, 0, .5); --bs-dropdown-link-color: var(--text-2); --bs-dropdown-link-hover-bg: var(--surface-2); --bs-dropdown-link-hover-color: var(--text); --bs-dropdown-divider-bg: var(--line); }
.user-menu .dropdown-item { border-radius: 8px; padding: .45rem .6rem; font-size: .9rem; }
.user-menu .nav-badge { margin-left: auto; }
.user-menu-head { display: flex; align-items: center; gap: .7rem; padding: .5rem .6rem .3rem; }
.user-menu-head b { display: block; color: var(--text); }
.user-menu-head span { font-size: .78rem; color: var(--text-3); }
.text-danger-soft { color: #ff8f88 !important; }
.text-ok { color: var(--ok) !important; }

.mobile-menu { position: fixed; inset: 0; z-index: 1060; }
.mobile-menu-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.mobile-menu-sheet { position: absolute; top: 0; right: 0; bottom: 0; width: min(340px, 88vw); background: var(--surface); border-left: 1px solid var(--line-strong); padding: 1rem; display: flex; flex-direction: column; gap: .8rem; animation: sheet-in .2s ease; overflow-y: auto; }
@keyframes sheet-in { from { transform: translateX(30px); opacity: 0; } }
.mobile-menu-head { display: flex; justify-content: space-between; align-items: center; }
.mobile-profile { display: flex; align-items: center; gap: .75rem; padding: .75rem; border-radius: 12px; background: var(--surface-2); color: var(--text); }
.mobile-profile:hover { text-decoration: none; color: var(--text); background: var(--surface-3); }
.mobile-profile b { display: block; }
.mobile-profile span span { font-size: .8rem; color: var(--text-3); }
.mobile-links { display: grid; gap: .1rem; }
.mobile-links a { padding: .75rem .6rem; border-radius: 10px; color: var(--text-2); font-weight: 500; }
.mobile-links a span:not(.nav-badge) { flex: 1; }
.mobile-links a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.mobile-links a .ico:last-child, .mobile-profile > .ico { width: 14px; color: var(--text-3); }
.mobile-foot { margin-top: auto; padding-top: .8rem; border-top: 1px solid var(--line); }
body.menu-open { overflow: hidden; }

/* avatars: initials on a color picked from the username */
.avatar { --av: #4c8dff; width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; display: inline-grid; place-items: center; font-size: .78rem; font-weight: 750; letter-spacing: .02em; color: #fff; background: var(--av); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .14); }
.avatar-sm { width: 24px; height: 24px; font-size: .62rem; }
.avatar-lg { width: 42px; height: 42px; font-size: .95rem; }
.avatar-xl { width: 84px; height: 84px; font-size: 1.9rem; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .16), 0 10px 30px rgba(0, 0, 0, .35); }
.av-0 { --av: #3f7be0; } .av-1 { --av: #d0503f; } .av-2 { --av: #2f9e68; } .av-3 { --av: #b5782a; }
.av-4 { --av: #7b5bd6; } .av-5 { --av: #1f8fa3; } .av-6 { --av: #c24a86; } .av-7 { --av: #5d7a3a; }
.av-ai { --av: var(--surface-3); color: var(--text-2); font-size: .7rem; }
.av-none { --av: var(--surface-3); color: var(--text-3); }

/* friends, invites, profile */
.game-row.attention { box-shadow: inset 3px 0 0 var(--accent); background: linear-gradient(90deg, var(--accent-soft), transparent 50%); }
.game-row .side-dot { width: 8px; height: 8px; margin-right: .2rem; }
.deadline { display: inline-flex; align-items: center; gap: .25rem; }
.deadline .ico { width: 13px; height: 13px; }
.deadline.urgent { color: var(--warn); font-weight: 600; }
.pvp-fields { border-left: 2px solid var(--accent-soft); padding-left: .8rem; margin-bottom: 1rem; }
.invite-wrap { max-width: 620px; margin: 1rem auto; }
.copy-row { display: flex; align-items: center; gap: .5rem; padding: .35rem .35rem .35rem .7rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); }
.copy-row .form-control { border: 0; background: transparent; padding-inline: 0; font-family: var(--mono); font-size: .85rem; }
.copy-row .form-control:focus { box-shadow: none; }
.copy-ico { color: var(--accent); }
.kv .ico { width: 15px; height: 15px; vertical-align: -2px; color: var(--text-3); }
.people li { display: flex; align-items: center; gap: .6rem; padding: .5rem 1rem; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.people .p-name { flex: 1; color: var(--text); font-weight: 600; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } .mobile-menu-sheet { animation: none; } }

.profile { max-width: 1100px; margin: 0 auto; }
.profile-head { margin-bottom: 1rem; background: radial-gradient(ellipse at 0% 0%, rgba(245, 165, 36, .1), transparent 55%), var(--surface); }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.stat-tile span { display: block; font-size: .68rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.stat-tile b { font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; }
.stat-tile b small { font-size: .78rem; font-weight: 600; color: var(--text-3); }
.stat-tile em, .h2h-score em { font-style: normal; }
.h2h-card .h2h-score { font-size: 1.4rem; font-weight: 800; }
.stat-line { display: grid; grid-template-columns: minmax(110px, 1.2fr) 2fr 3rem 4.5rem; align-items: center; gap: .7rem; padding: .35rem 0; font-size: .88rem; }
.stat-line b { text-align: right; }
.stat-line small { color: var(--text-3); text-align: right; }
.wl-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.wl-bar i { display: block; height: 100%; }
.wl-win { background: var(--ok); } .wl-draw { background: var(--text-3); } .wl-loss { background: var(--danger); }
.form-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.form-chip { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 8px; font-weight: 800; font-size: .85rem; color: #0e1211; }
.form-chip:hover { text-decoration: none; filter: brightness(1.1); }
.res-win { background: var(--ok); } .res-loss { background: var(--danger); color: #fff; } .res-draw { background: var(--text-3); }

/* chess clocks on the game page */
.clocks { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.clock { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .4rem .7rem; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-3); }
.clock b { font-size: 1.15rem; font-weight: 750; font-family: var(--mono); }
.clock.running { color: var(--text); border-color: rgba(245, 165, 36, .6); background: var(--accent-soft); }
.clock.low { color: var(--danger); border-color: var(--danger); animation: pulse 1s ease-in-out infinite; }
.clock.mine { box-shadow: inset 0 -2px 0 var(--line-strong); }

/* ---------- landing ---------- */
.hero { position: relative; padding: 4.5rem 0 3rem; }
.hero::before {
  content: ""; position: absolute; inset: 0 -10vw; z-index: -1; opacity: .5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='52' height='90' viewBox='0 0 52 90'%3E%3Cpath d='M26 0l26 15v30L26 60 0 45V15zM26 60v30M0 45l-26 15M52 45l26 15' fill='none' stroke='%2336413c' stroke-width='1'/%3E%3C/svg%3E");
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse at 50% 30%, #000 0%, transparent 70%);
}
.hero h1 { font-size: clamp(2.4rem, 6vw, 3.8rem); font-weight: 750; letter-spacing: -.035em; line-height: 1.05; }
.hero h1 span { color: var(--accent); }
.hero .lead { color: var(--text-2); max-width: 36rem; font-size: 1.15rem; }
.feature { height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.feature h3 { font-size: 1rem; margin: .7rem 0 .3rem; }
.feature p { color: var(--text-2); font-size: .92rem; margin: 0; }
.feature-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.feature-icon svg { width: 20px; height: 20px; }

/* ---------- dashboard / auth ---------- */
.games-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.game-row { display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.game-row:last-child { border-bottom: 0; }
.game-row:hover { background: var(--surface-2); }
.game-row .title { color: var(--text); font-weight: 600; }
.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--text-2); }
.ai-explain { font-size: .84rem; color: var(--text-2); border-top: 1px solid var(--line); padding-top: .7rem; }
.ai-explain summary { color: var(--accent); font-weight: 600; cursor: pointer; }
.ai-explain dl { margin: .6rem 0; }
.ai-explain dt { color: var(--text); font-weight: 650; margin-top: .5rem; }
.ai-explain dd { margin: .1rem 0 0; line-height: 1.5; }
.auth-card { max-width: 400px; margin: 2rem auto; }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%;
  padding: .55rem 1rem; border-radius: 8px; font-weight: 600; background: #fff; color: #1f1f1f;
  border: 1px solid #dadce0; text-decoration: none;
}
.btn-google:hover { background: #f8f9fa; color: #1f1f1f; }
.auth-or { display: flex; align-items: center; gap: .75rem; color: var(--text-3); font-size: .8rem; margin: 1rem 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- army purchase ---------- */
.cat-nav { display: flex; flex-wrap: wrap; gap: .4rem; position: sticky; top: 0; z-index: 4; padding: .6rem 0; background: var(--bg); }
.cat-nav a { display: inline-flex; align-items: center; gap: .4rem; color: var(--text-2); font-size: .85rem; font-weight: 500; padding: .3rem .8rem; border: 1px solid var(--line-strong); border-radius: 999px; }
.cat-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.cat-count:empty { display: none; }
.cat-count { min-width: 1.25rem; padding: 0 .35rem; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: .72rem; font-weight: 700; text-align: center; }
.shop-cat { margin-bottom: 2rem; scroll-margin-top: 3.5rem; }
.shop-cat-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .8rem; margin-bottom: .8rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.shop-cat-head h2 { font-size: 1rem; margin: 0; }
.shop-cat-head span { font-size: .82rem; color: var(--text-3); }

.shop-card {
  position: relative; display: flex; flex-direction: column; height: 100%; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem .95rem; transition: border-color .15s, background .15s, opacity .15s;
}
.shop-card:hover { border-color: var(--line-strong); }
.shop-card.picked { border-color: rgba(245, 165, 36, .7); background: linear-gradient(180deg, rgba(245, 165, 36, .1), rgba(245, 165, 36, .03) 60%), var(--surface); box-shadow: inset 3px 0 0 var(--accent); }
.shop-card.unaffordable { opacity: .55; }
.shop-top { display: flex; gap: .8rem; }
.shop-icon-wrap { position: relative; flex-shrink: 0; align-self: flex-start; }
.shop-badge { position: absolute; top: -7px; right: -7px; min-width: 1.6rem; height: 1.6rem; padding: 0 .35rem; border-radius: 999px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-size: .78rem; font-weight: 800; box-shadow: 0 2px 8px rgba(0, 0, 0, .45); }
.shop-badge:empty { display: none; }
.shop-name { line-height: 1.25; }
.shop-cost { color: var(--accent); font-weight: 700; font-size: .95rem; white-space: nowrap; }
.shop-cost small { font-size: .7rem; font-weight: 600; color: var(--text-3); }
.shop-stats { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .35rem; }
.shop-stats span { display: inline-flex; align-items: baseline; gap: .3rem; font-size: .76rem; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--surface-2); border-radius: 6px; padding: .1rem .45rem; }
.shop-stats i { font-style: normal; font-size: .6rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.shop-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin: .6rem 0 .35rem; }
.shop-tags .tag { font-size: .68rem; padding: .1rem .45rem; }
.tag-ammo { background: rgba(124, 196, 255, .12); color: var(--sky); }
.shop-blurb { font-size: .8rem; color: var(--text-3); margin: 0 0 .7rem; flex-grow: 1; }

.shop-buy { display: flex; align-items: center; gap: .6rem; min-height: 2.1rem; }
.shop-buy svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.btn-add {
  display: inline-flex; align-items: center; gap: .4rem; border: 1px solid rgba(245, 165, 36, .55); background: var(--accent-soft);
  color: var(--accent); font-weight: 650; font-size: .85rem; border-radius: 999px; padding: .32rem .9rem .32rem .7rem; transition: background .15s, color .15s;
}
.btn-add:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); }
.btn-add:disabled { border-color: var(--line-strong); background: transparent; color: var(--text-3); cursor: not-allowed; }
.stepper { display: none; align-items: center; gap: .15rem; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 999px; padding: .15rem; }
.stepper button { width: 1.85rem; height: 1.85rem; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text); }
.stepper button:hover:not(:disabled) { background: var(--surface-3); }
.stepper button[data-step="1"] { background: var(--accent); color: var(--on-accent); }
.stepper button[data-step="1"]:hover:not(:disabled) { background: var(--accent-hover); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; background: transparent; color: var(--text-3); }
.stepper .num { min-width: 2.6rem; text-align: center; }
.stepper .count { font-size: 1rem; }
.stepper .of { color: var(--text-3); font-size: .78rem; }
.shop-card.picked .btn-add { display: none; }
.shop-card.picked .stepper { display: inline-flex; }
.shop-why { color: var(--text-3); }

.army-panel { position: sticky; top: 1rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.army-budget { display: flex; justify-content: space-between; align-items: baseline; }
.army-budget b { font-size: 1.5rem; font-weight: 750; }
.budget-bar { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.budget-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .2s; }
.budget-fill.full { background: var(--ok); }
.roster { list-style: none; padding: 0; margin: .9rem 0; max-height: 46vh; overflow-y: auto; border-top: 1px solid var(--line); }
.roster li { display: flex; align-items: center; gap: .55rem; padding: .4rem 0; border-bottom: 1px solid var(--line); font-size: .86rem; }
.roster canvas { flex-shrink: 0; }
.roster .r-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster .r-n { font-weight: 700; }
.roster .r-cost { color: var(--text-3); width: 2rem; text-align: right; font-size: .8rem; }
.roster .r-del { width: 1.5rem; height: 1.5rem; border: 0; border-radius: 50%; background: transparent; color: var(--text-3); line-height: 1; }
.roster .r-del:hover { background: rgba(242, 85, 90, .12); color: var(--danger); }
.roster .r-empty { color: var(--text-3); font-size: .82rem; display: block; }

/* ---------- rules ---------- */
.rules { max-width: 1100px; margin: 0 auto; }
.rules p { color: var(--text-2); max-width: 75ch; }
.rules b { color: var(--text); }
.rules-nav { display: flex; flex-wrap: wrap; gap: .4rem; position: sticky; top: 0; z-index: 5; padding: .6rem 0; background: var(--bg); }
.rules-nav a { color: var(--text-2); font-size: .85rem; font-weight: 500; padding: .3rem .75rem; border: 1px solid var(--line-strong); border-radius: 999px; }
.rules-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.rule-card { height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.35rem; scroll-margin-top: 4rem; }
.rule-card h2 { display: flex; align-items: center; gap: .6rem; font-size: 1.1rem; margin: 0 0 .8rem; }
.rule-card p:last-child { margin-bottom: 0; }
.rule-num { font-family: var(--mono); font-size: .72rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: .15rem .4rem; }
.keys { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; color: var(--text-2); }
.effect { height: 100%; background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 0 8px 8px 0; padding: .6rem .8rem; }
.effect.danger { border-left-color: var(--danger); }
.effect b { display: block; }
.effect span { font-size: .82rem; color: var(--text-2); }
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--line); --bs-table-color: var(--text); }
.table th { color: var(--text-3); font-size: .72rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }

/* ---------- game page ---------- */
.map-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #0b0e0d; }
#map { display: block; width: 100%; height: auto; cursor: pointer; }
.map-busy, .map-banner, .map-combat {
  position: absolute; background: rgba(14, 18, 17, .93); border: 1px solid var(--line-strong); border-radius: 10px;
  color: var(--text); padding: .5rem .85rem; font-size: .9rem; pointer-events: none; box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.map-busy { top: 12px; right: 12px; display: flex; align-items: center; color: var(--text-2); }
.map-banner { top: 12px; left: 50%; transform: translateX(-50%); max-width: 80%; text-align: center; font-weight: 600; }
.map-combat { bottom: 12px; left: 12px; max-width: 360px; }
.die { font-size: 1.4rem; line-height: 1; opacity: .35; }
.die.hit { opacity: 1; color: var(--accent); }
.legend { color: var(--text-3); }

.sidebar .card-body { font-size: .9rem; }
.round-num { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.round-num small { font-size: .9rem; color: var(--text-3); font-weight: 600; }
.vp-row { display: flex; justify-content: space-between; align-items: baseline; }
.vp-num { font-size: 1.35rem; font-weight: 700; }
.vp-bar { position: relative; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.vp-fill { position: absolute; top: 0; height: 100%; width: 0; transition: width .4s; }
.vp-blue { left: 0; background: var(--blue); }
.vp-red { right: 0; background: var(--red); }
.vp-bar::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--bg); }

.unit-head { display: flex; align-items: center; gap: .5rem; }
.unit-head b { flex: 1; }
.hpbar { height: 5px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.hpfill { height: 100%; width: 0; background: var(--ok); border-radius: 999px; }
.hpfill.mid { background: #f5c84c; }
.hpfill.low { background: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: .25rem; margin: .6rem 0; }
.stats div { background: var(--surface-2); border-radius: 7px; padding: .3rem 0; text-align: center; }
.stats span { display: block; font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.stats b { font-size: .9rem; font-variant-numeric: tabular-nums; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.note { font-size: .8rem; color: var(--text-2); margin-top: .35rem; }
.blurb { font-size: .8rem; color: var(--text-3); margin: .5rem 0 0; }
.odds { margin-top: .6rem; background: rgba(242, 85, 90, .07); border: 1px solid rgba(242, 85, 90, .28); border-radius: 9px; padding: .55rem .7rem; font-size: .82rem; }
.odds .eyebrow { color: var(--red-text); }
.terrain-line { font-size: .82rem; color: var(--text-2); }
.divider { border-top: 1px solid var(--line); margin: .75rem -1rem; }

.unit-panel { min-height: 262px; }
.stats b small { font-size: .62rem; color: var(--sky); font-weight: 600; }
.legend-list div { display: flex; align-items: center; gap: .5rem; color: var(--text-2); margin-bottom: .3rem; }
.swatch { width: 18px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.sw-move { background: rgba(255, 255, 255, .25); border: 1px solid rgba(255, 255, 255, .35); }
.sw-range { border: 2px solid var(--danger); }
.sw-air { border: 2px dashed var(--sky); }
.sw-cut { background: rgba(255, 138, 61, .3); border: 1px solid rgba(255, 138, 61, .6); }
.odds.laser { background: var(--accent-soft); border-color: rgba(245, 165, 36, .35); }
.odds.laser .eyebrow { color: var(--accent); }

/* turn state, forces list, air support */
.turn-state { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--text-2); min-height: 1.3rem; }
.turn-state b { color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex-shrink: 0; display: inline-block; }
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(91, 209, 139, .18); }
.dot-red { background: var(--red); }
.dot-accent { background: var(--accent); }
.turn-flash {
  position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); z-index: 8; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .7rem 2.2rem; border-radius: 14px;
  background: rgba(14, 18, 17, .9); border: 1px solid rgba(245, 165, 36, .5); box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.turn-flash b { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; color: var(--accent); }
.turn-flash.go { animation: turn-flash 1.7s ease forwards; }
@keyframes turn-flash { 0% { opacity: 0; transform: translate(-50%, -40%); } 15%, 70% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -55%); } }
@media (prefers-reduced-motion: reduce) { .turn-flash.go { animation-duration: .01s; } }

.forces { max-height: 34vh; overflow-y: auto; }
.forces li { display: flex; align-items: center; gap: .55rem; padding: .35rem 1rem; border-bottom: 1px solid var(--line); cursor: pointer; font-size: .84rem; }
.forces li:last-child { border-bottom: 0; }
.forces li:hover { background: var(--surface-2); }
.forces li.sel { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.forces li.spent { opacity: .55; }
.forces canvas { flex-shrink: 0; }
.f-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.f-hp { height: 3px; margin-top: 3px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.f-hp i { display: block; height: 100%; background: var(--ok); }
.f-hp i.mid { background: #f5c84c; }
.f-hp i.low { background: var(--danger); }
.f-ammo { font-size: .72rem; color: var(--sky); }
.forces .tag { font-size: .66rem; padding: .05rem .4rem; }

.strike-btn {
  display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; margin: .35rem 0; padding: .45rem .6rem;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); transition: border-color .15s, background .15s;
}
.strike-btn:hover:not(:disabled) { border-color: rgba(245, 165, 36, .6); }
.strike-btn.active { border-color: var(--accent); background: var(--accent-soft); }
.strike-btn:disabled { opacity: .5; cursor: not-allowed; }
.strike-btn b { display: block; font-size: .86rem; }
.strike-btn small { display: block; color: var(--text-3); font-size: .74rem; }
.strike-btn .s-left { font-weight: 800; color: var(--accent); }

.unit-head.big { gap: .75rem; }
.unit-head.big b { font-size: 1rem; flex: none; }
.matchups { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .7rem; margin: .7rem 0 0; font-size: .8rem; }
.matchups dt { color: var(--text-3); font-weight: 500; }
.matchups dd { margin: 0; color: var(--text-2); }
.ammo-row { display: flex; align-items: center; gap: .3rem; margin-top: .6rem; font-size: .8rem; color: var(--text-3); }
.ammo-row span { margin-right: .3rem; }
.ammo-row i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--line-strong); }
.ammo-row i.on { background: var(--sky); border-color: var(--sky); }
.ammo-row b { margin-left: auto; color: var(--sky); }

/* hover card that follows the cursor on the map */
.map-tip {
  position: absolute; left: 0; top: 0; z-index: 6; width: 280px; pointer-events: none;
  background: rgba(14, 18, 17, .96); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: .65rem .8rem; font-size: .82rem; box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
}
.map-tip .stats { margin: .45rem 0; }

/* full-map overlays: game over, coin toss */
.map-overlay { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; background: rgba(14, 18, 17, .62); }
.end-card { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; padding: 1.6rem 2.2rem; text-align: center; min-width: 320px; box-shadow: 0 24px 64px rgba(0, 0, 0, .5); }
.end-title { font-size: 2.8rem; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; margin: .2rem 0 .4rem; }
.end-title.win { color: var(--accent); }
.end-title.loss { color: var(--danger); }
.end-title.draw { color: var(--text); }
.coin-box { text-align: center; perspective: 700px; }
.coin { width: 124px; height: 124px; margin: 0 auto 1.2rem; position: relative; transform-style: preserve-3d; }
.coin-side {
  position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; backface-visibility: hidden;
  font-weight: 800; letter-spacing: .12em; color: #fff; font-size: 1.05rem;
  border: 5px solid rgba(255, 255, 255, .85); box-shadow: inset 0 0 0 7px rgba(0, 0, 0, .14), 0 10px 30px rgba(0, 0, 0, .45);
}
.coin-side.blue { background: var(--blue); }
.coin-side.red { background: var(--red); transform: rotateY(180deg); }
.coin.spin-blue { animation: coin-blue 2.4s cubic-bezier(.2, .65, .25, 1) forwards; }
.coin.spin-red { animation: coin-red 2.4s cubic-bezier(.2, .65, .25, 1) forwards; }
@keyframes coin-blue {
  0% { transform: translateY(0) rotateY(0deg); }
  35% { transform: translateY(-46px) rotateY(1080deg); }
  100% { transform: translateY(0) rotateY(1800deg); }
}
@keyframes coin-red {
  0% { transform: translateY(0) rotateY(0deg); }
  35% { transform: translateY(-46px) rotateY(1080deg); }
  100% { transform: translateY(0) rotateY(1980deg); }
}
@media (prefers-reduced-motion: reduce) { .coin.spin-blue, .coin.spin-red { animation-duration: .01s; } }
.coin-result { font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; min-height: 2.2rem; }

.log { max-height: 42vh; overflow-y: auto; }
.log li { display: flex; gap: .55rem; padding: .4rem 1rem; border-bottom: 1px solid var(--line); color: var(--text-2); line-height: 1.35; }
.log li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; margin-top: .42rem; flex-shrink: 0; background: var(--line-strong); }
.log .log-turn { color: var(--text); font-weight: 600; }
.log .log-turn::before { background: var(--text-3); }
.log .log-attack::before { background: var(--red); }
.log .log-capture { color: var(--text); }
.log .log-capture::before { background: var(--ok); }
.log .log-vp::before { background: var(--blue); }
.log .log-radio { color: var(--accent); font-style: italic; }
.log .log-radio::before { background: var(--accent); }
.log .log-gameover { color: #fff; font-weight: 700; }
.log .log-gameover::before { background: #fff; }
.log .log-contact::before, .log .log-supply::before { background: var(--warn); }
.log .log-supply { color: var(--warn); }
.supply-warn { color: var(--warn); }

/* ---------- footer (same pattern as edvinby.com/p11 and strandbergswing.se) ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding-block: 3rem 2rem; margin-top: 4rem; font-size: .92rem; }
.footer-brand { font-size: 1.15rem; display: inline-flex; }
.footer-brand:hover { text-decoration: none; }
.footer-text { color: var(--text-2); line-height: 1.7; }
.footer-measure { max-width: 34ch; }
.footer-heading { color: var(--accent); font-family: var(--font); font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .85rem; }
.footer-links li { margin-bottom: .55rem; line-height: 1.5; }
.footer-links a, .footer-company a { color: var(--text-2); }
.footer-links a:hover, .footer-links a:focus, .footer-company a:hover { color: var(--accent); text-decoration: none; }
.footer-facts li { display: flex; align-items: baseline; gap: .55rem; margin-bottom: .55rem; color: var(--text-2); }
.footer-facts svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--accent); transform: translateY(2px); }
.footer-rule { border-color: var(--line); opacity: 1; margin-block: 2rem; }
.footer-company { color: var(--text-2); line-height: 1.6; }
.footer-company-name { font-weight: 700; color: var(--text); margin: 0 0 .35rem; }
.footer-company li { margin-bottom: .15rem; }
.footer-text a { color: var(--accent); }

.cookie-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1050; padding: .9rem 0; background: rgba(14, 18, 17, .97); border-top: 1px solid var(--line-strong); box-shadow: 0 -8px 24px rgba(0, 0, 0, .35); }
.cookie-bar p { color: var(--text-2); }
.cookie-bar .footer-heading { color: var(--text); margin: 0; }

/* ---------- legal pages and account ---------- */
.legal { max-width: 760px; margin: 0 auto; }
.legal h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.legal .lead { color: var(--text-2); }
.legal h2 { color: var(--accent); font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin: 2.2rem 0 .7rem; }
.legal p, .legal li { color: var(--text-2); line-height: 1.7; }
.legal b, .legal strong { color: var(--text); }
.legal ul { padding-left: 1.2rem; }
.legal li { margin-bottom: .35rem; }
.legal .table td, .legal .table th { padding: .6rem .5rem; }
.legal .table td { color: var(--text-2); font-size: .9rem; }
.legal code { color: var(--text); background: var(--surface-2); padding: .1rem .35rem; border-radius: 5px; }
.legal-version { font-size: .85rem; color: var(--text-3); }
.legal-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin: .8rem 0; }
.legal-box p { margin: 0; }
.danger-zone { border-color: rgba(242, 85, 90, .35); }
.danger-zone .eyebrow { color: var(--danger); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0; }
.kv dt { color: var(--text-3); font-weight: 500; }
.kv dd { margin: 0; }

@media print {
  .app-nav, .site-footer, .cookie-bar, .btn { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- touch and small screens ---------- */
.map-scroll { overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#map { touch-action: pan-x pan-y; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.map-zoom { position: absolute; left: 10px; top: 10px; z-index: 5; display: flex; flex-direction: column; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-strong); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.map-zoom button { width: 2.5rem; height: 2.5rem; border: 0; background: rgba(14, 18, 17, .9); color: var(--text); font-size: 1.25rem; font-weight: 600; line-height: 1; }
.map-zoom button + button { border-top: 1px solid var(--line-strong); }
.map-zoom button:active { background: var(--surface-3); }
body:not(.touch) .map-zoom { opacity: .7; }
body:not(.touch) .map-zoom:hover { opacity: 1; }
.legend-touch { display: none !important; }
body.touch .legend-touch { display: flex !important; }
body.touch .legend-mouse { display: none !important; }

/* touch: the hover card docks to the bottom of the map instead of following a cursor */
.map-tip.docked { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 55%; overflow-y: auto; pointer-events: auto; transform: none; padding-right: 2.2rem; }
.tip-close { position: absolute; top: .35rem; right: .45rem; width: 1.9rem; height: 1.9rem; border: 0; border-radius: 50%; background: var(--surface-3); color: var(--text); font-size: 1.1rem; line-height: 1; }
.tap-hint { margin: -.15rem 0 .5rem; padding: .35rem .6rem; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: .85rem; text-align: center; }

/* bottom action bar on phones (game and army builder) */
.mbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040; display: flex; align-items: center; gap: .5rem;
  padding: .55rem .75rem calc(.55rem + env(safe-area-inset-bottom)); background: rgba(14, 18, 17, .96);
  border-top: 1px solid var(--line-strong); box-shadow: 0 -8px 24px rgba(0, 0, 0, .35); }
.mbar-state { flex: 1; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mbar .btn { min-height: 2.4rem; padding-inline: .9rem; }
@media (max-width: 991.98px) {
  body.game-page, body:has(#army-mbar) { padding-bottom: 4.5rem; }
  body.game-page .site-footer { margin-top: 1.5rem; }
  .map-scroll { max-height: 64vh; max-height: 64svh; }
  .map-combat { left: 8px; right: 8px; bottom: 8px; max-width: none; font-size: .82rem; }
  .map-banner { max-width: calc(100% - 4rem); font-size: .82rem; }
  .army-panel { position: static; }
  .cat-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -.75rem; padding-inline: .75rem; }
  .cat-nav a { flex-shrink: 0; }
  .end-card { min-width: 0; width: calc(100% - 2rem); padding: 1.2rem; }
  .end-title { font-size: 2.2rem; }
  .stat-line { grid-template-columns: minmax(90px, 1fr) 1.4fr 2.6rem; }
  .stat-line small { display: none; }
}
/* bigger tap targets wherever the pointer is a finger */
@media (pointer: coarse) {
  .btn-sm, .stepper button, .btn-add { min-height: 2.5rem; }
  .stepper button { width: 2.4rem; height: 2.4rem; }
  .forces li { padding-block: .55rem; }
  .roster .r-del { width: 2.2rem; height: 2.2rem; }
  .user-menu .dropdown-item, .mobile-links a { padding-block: .8rem; }
  .form-chip { width: 2.4rem; height: 2.4rem; }
}
