/* ============ "FJORD CHALK" THEME (v2 redesign) ============
   Loaded last: slate glass pills over the world, chalk bottom sheets, gold for actions.
   Display: Alegreya SC. UI + numbers: Barlow Semi Condensed. */
:root {
  --c-ink: #1b2227; --c-glass: rgba(27, 34, 39, .84); --c-glass2: rgba(15, 20, 24, .58);
  --c-chalk: #efe9dc; --c-paper: #f7f3ea; --c-card: #e7e0d1; --c-card2: #e0d8c7; --c-line: #d8d0bf;
  --c-text: #f3eee2; --c-muted: #5d6266; --c-muted2: #8a8f93;
  --c-gold: #f0c050; --c-gold-d: #99723a; --c-gold-t: #8a6a1c; --c-sea: #2f6470;
  --c-ok: #6fbf4f; --c-warn: #d9a531; --c-bad: #d0543c;
  --f-disp: 'Alegreya SC', Georgia, serif; --f-ui: 'Barlow Semi Condensed', 'Arial Narrow', sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
}
#screen-strategy, #game-menu, .modal { font-family: var(--f-ui); }
#screen-strategy { background: #1d4652; }

/* ---------- shared buttons ---------- */
.modal .cta, #screen-strategy .cta, #screen-menu .cta, #game-menu .cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 0 26px; min-height: 50px; border: 0; border-radius: 12px;
  background: var(--c-gold); color: var(--c-ink); font: 700 17px/1 var(--f-ui); letter-spacing: .08em; text-transform: uppercase;
  box-shadow: inset 0 -3px 0 var(--c-gold-d), 0 6px 16px rgba(0, 0, 0, .18); filter: none; }
.modal .cta::before, #screen-menu .cta::before, #game-menu .cta::before { display: none; }
.modal .cta:hover, #screen-menu .cta:hover, #game-menu .cta:hover { filter: brightness(1.05); }
.modal .cta:active, #screen-menu .cta:active, #game-menu .cta:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 var(--c-gold-d); }
.modal .cta svg.ic, #screen-menu .cta svg.ic { width: 18px; height: 18px; }
.modal .ghost, #game-menu .ghost { min-height: 50px; padding: 0 18px; border-radius: 12px; border: 2px solid var(--c-ink); background: transparent; color: var(--c-ink);
  font: 700 15px/1 var(--f-ui); letter-spacing: .05em; text-transform: uppercase; }
.modal .ghost svg.ic { color: inherit; }

/* ---------- strategy: floating pills ---------- */
#screen-strategy #strat-topbar { top: calc(var(--st) + 12px); left: calc(var(--sl) + 12px); right: calc(var(--sr) + 12px); width: auto; height: 44px; transform: none;
  padding: 0; gap: 8px; background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; font-family: var(--f-ui); }
#strat-topbar > span:not(.tb-spacer):not(.tb-zoom), #strat-topbar .tb-btn, #screen-strategy #btn-endturn {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 22px; border: 0; background: var(--c-glass); color: var(--c-text);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 4px 14px rgba(0, 0, 0, .18); font: 700 15px/1 var(--f-ui); }
#screen-strategy #hud-tribe { padding-left: 6px; font-family: var(--f-ui); font-size: 15px; letter-spacing: 0; }
#hud-tribe .tb-em { width: 32px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; color: #fff; }
#hud-tribe .tb-em svg.ic { width: 17px; height: 17px; }
#screen-strategy #hud-tribe .tb-tt, #screen-strategy #hud-tribe .tb-em { display: flex !important; }
#hud-tribe .tb-tt { flex-direction: column; line-height: 1; }
#hud-tribe .tb-tt small { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; color: #aab3b8; display: block !important; }
#hud-tribe .tb-tt b { font-size: 18px; font-weight: 700; color: var(--c-text) !important; }
#screen-strategy #hud-tribe { color: var(--c-text) !important; }
#screen-strategy #hud-gold { gap: 6px; background: var(--c-glass); border: 0; color: var(--c-text); }
#screen-strategy #hud-gold svg.ic { color: var(--c-gold); fill: rgba(240, 192, 80, .3); width: 20px; height: 20px; }
#screen-strategy #hud-gold b { font-size: 20px; }
#screen-strategy #hud-gold small { display: inline !important; font-size: 14px; font-weight: 600; color: #9be07a; }
#screen-strategy #hud-turn { font-family: var(--f-disp); font-size: 17px; font-weight: 800; color: var(--c-text); }
#screen-strategy #hud-turn span { display: inline !important; }
#strat-topbar .tb-btn { width: 44px; padding: 0; justify-content: center; font-size: 0; }
#strat-topbar .tb-btn [data-icon] { display: flex; }
#strat-topbar .tb-btn svg.ic { width: 20px; height: 20px; color: var(--c-text); }
#strat-topbar .tb-btn:hover:not(:disabled) { background: rgba(27, 34, 39, .95); }
#strat-topbar .tb-zoom { display: flex; gap: 8px; }
html.touch #strat-topbar .tb-zoom { display: none; }
#screen-strategy #btn-endturn { position: absolute; z-index: 11; right: calc(var(--sr) + 12px); bottom: calc(var(--sb) + 14px); top: auto; left: auto;
  height: 50px; padding: 0 20px; border-radius: 25px; font-size: 16px; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
  background: var(--c-glass); color: var(--c-text); box-shadow: inset 0 0 0 2px rgba(240, 192, 80, .55), 0 6px 18px rgba(0, 0, 0, .25); transition: bottom .2s; }
#screen-strategy #btn-endturn svg.ic { width: 18px; height: 18px; }
#screen-strategy #btn-endturn:disabled { opacity: .7; box-shadow: none; }
#screen-strategy #strat-log { top: calc(var(--st) + 66px); right: calc(var(--sr) + 14px); color: #f3eee2; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); font: 600 13px/1.3 var(--f-ui); }

/* ---------- strategy: bottom sheets (unit, resource, city) ---------- */
#screen-strategy #strat-panel, #screen-strategy #strat-citybar {
  position: absolute; z-index: 10; top: auto; bottom: calc(var(--sb) + 12px); left: calc(var(--sl) + 12px); right: auto; transform: none;
  width: 400px; max-height: calc(100% - 90px - var(--st)); overflow-y: auto; display: block; padding: 10px 16px 16px; border: 0; border-radius: 18px;
  background: var(--c-chalk); color: var(--c-ink); backdrop-filter: none; box-shadow: 0 -6px 30px rgba(0, 0, 0, .25); font: 500 14px/1.35 var(--f-ui); }
#screen-strategy #strat-citybar { width: 440px; }
.sh-grab { width: 40px; height: 4px; border-radius: 2px; background: #cbc3b2; margin: 0 auto 10px; }
#screen-strategy .sp-head { display: flex; align-items: center; gap: 12px; }
.pt { flex-shrink: 0; display: block; width: 40px; height: 40px; border-radius: 50%; background: var(--c-ink); overflow: hidden; }
.pt.big { width: 62px; height: 62px; }
.pt img { width: 100%; height: 100%; display: block; object-fit: cover; transform: scale(1.12) translateY(4%); }
.sp-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sp-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
#screen-strategy #strat-panel h3, #screen-strategy #strat-citybar h3 { font: 800 24px/1 var(--f-disp); color: var(--c-ink); margin: 0; }
#screen-strategy #strat-panel h3 em, #screen-strategy #strat-citybar h3 em { font: 700 12px var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--c-gold-t); margin-left: 4px; }
.sp-moves { font-size: 13px; font-weight: 600; color: var(--c-muted); white-space: nowrap; }
.sp-hp { display: flex; align-items: center; gap: 8px; }
.sp-hp .hp { flex: 1; height: 8px; border-radius: 4px; background: var(--c-line); }
.sp-hp b { font-size: 14px; }
#screen-strategy .sp-head small { display: block; margin: 0; font-size: 13px; color: var(--c-muted); }
#screen-strategy .sp-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 12px 0 8px; }
#screen-strategy .sp-stats .sc { padding: 8px 10px; border-radius: 10px; background: var(--c-card); border: 0; text-align: left; }
#screen-strategy .sp-stats small { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: #6b7074; }
#screen-strategy .sp-stats small svg.ic { width: 12px; height: 12px; color: #6b7074; }
#screen-strategy .sp-stats b { display: block; font-size: 20px; font-weight: 700; line-height: 1.1; }
#screen-strategy .sp-note { background: #e2ecee; color: #2f5562; border-radius: 10px; }
#screen-strategy .sp-label { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--c-muted2); margin: 10px 0 6px; }
#screen-strategy #strat-panel button.sp-unit { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 6px 10px 6px 6px; border: 0; border-radius: 12px;
  background: var(--c-card); color: var(--c-ink); font-family: var(--f-ui); }
#screen-strategy #strat-panel button.sp-unit .pt { width: 36px; height: 36px; }
#screen-strategy #strat-panel button.sp-unit:hover { background: var(--c-card2); }
#screen-strategy .su-name { font-size: 14px; font-weight: 700; }
#screen-strategy .su-state { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: #4a8a3a; }
#screen-strategy .sp-unit.done .pt { filter: grayscale(1); opacity: .7; }
#screen-strategy .sp-legend { font-size: 12px; color: var(--c-muted); }
#screen-strategy .lg.move { background: #ffffff; box-shadow: 0 0 0 1px #c9c1b0; } #screen-strategy .lg.atk { background: #e5533d; }
#screen-strategy #strat-panel button.sp-cta, #screen-strategy #strat-citybar button.sp-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin-top: 12px; border: 0; border-radius: 12px;
  background: var(--c-gold); color: var(--c-ink); font: 700 15px/1 var(--f-ui); letter-spacing: .06em; text-transform: uppercase; box-shadow: inset 0 -3px 0 var(--c-gold-d); cursor: pointer; }
#screen-strategy button.sp-cta svg.ic { color: var(--c-ink) !important; }
#screen-strategy button.sp-cta .star, #screen-strategy button.sp-cta .star svg.ic { color: var(--c-ink); }
.sp-xp { color: var(--c-muted); }

/* city */
#screen-strategy .cb-head { display: flex; align-items: center; gap: 10px; }
.cb-lv { flex-shrink: 0; width: 30px; height: 30px; border-radius: 7px; color: #fff; font: 700 17px/30px var(--f-ui); text-align: center; }
#screen-strategy .cb-stats { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 4px; font-size: 13px; color: var(--c-muted); }
#screen-strategy .cb-stats svg.ic { color: var(--c-muted); }
#screen-strategy .cb-stats .pop i { width: 14px; height: 6px; border-radius: 3px; border: 0; background: var(--c-line); }
#screen-strategy .cb-stats .pop i.on { background: var(--c-ok); }
.cb-income { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 16px; background: var(--c-card); font-weight: 700; font-size: 15px; white-space: nowrap; }
.cb-income small { font-size: 12px; color: var(--c-muted); font-weight: 600; }
#screen-strategy .cb-close { width: 40px; height: 40px; border-radius: 20px; margin-left: 0; border: 0; background: var(--c-card); color: var(--c-ink); }
.cb-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; margin: 12px 0 10px; border-radius: 12px; background: var(--c-card2); }
#screen-strategy .cb-tabs button { height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--c-ink); font: 700 15px/1 var(--f-ui); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
#screen-strategy .cb-tabs button.on { background: var(--c-ink); color: var(--c-text); }
.cb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#screen-strategy #strat-citybar button.ca { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; width: auto; min-height: 0; padding: 8px 4px 10px;
  border-radius: 12px; border: 2px solid transparent; background: var(--c-card); color: var(--c-ink); font-family: var(--f-ui); }
#screen-strategy #strat-citybar button.ca:hover:not(:disabled) { transform: none; border-color: var(--c-gold); background: #fbf3dc; box-shadow: none; }
#screen-strategy #strat-citybar button.ca:disabled { opacity: .5; }
#strat-citybar .ca .pt { width: 52px; height: 52px; }
#screen-strategy .ca-ic { width: 52px; height: 52px; border-radius: 26px; background: var(--c-ink); color: var(--c-gold); }
#screen-strategy .ca-ic svg.ic { width: 22px !important; height: 22px !important; }
#screen-strategy .ca-name { font-size: 14px; font-weight: 700; line-height: 1.15; }
#screen-strategy .ca-name small { font-weight: 600; color: var(--c-muted); }
#screen-strategy .ca-cost { font-size: 14px; font-weight: 700; color: var(--c-gold-t); }
#screen-strategy .ca-cost small { font-size: 12px; color: var(--c-muted); font-weight: 600; }
#screen-strategy .star { color: var(--c-gold-t); }
#screen-strategy .star svg.ic { color: var(--c-gold-t); fill: none; }

/* growth: the level track, and the clickable growth bar in the header */
#screen-strategy .cb-stats button.pop { display: inline-flex; align-items: center; gap: 3px; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
#screen-strategy .cb-stats button.pop:hover { color: var(--c-ink); }
.cg { margin: 0 0 10px; }
.cg-how { margin: 0 0 8px; font-size: 13.5px; line-height: 1.35; color: var(--c-ink); }
.gold-ring { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2.5px solid var(--c-gold); vertical-align: -1px; }
.cg-ladder { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
.cg-ladder li { display: flex; flex-direction: column; gap: 3px; padding: 7px 7px 8px; border-radius: 10px; background: var(--c-card); color: var(--c-muted); font-size: 12px; line-height: 1.2; opacity: .7; }
.cg-ladder li b { width: 22px; height: 22px; border-radius: 6px; background: var(--c-line); color: var(--c-ink); font: 700 13px/22px var(--f-ui); text-align: center; }
.cg-ladder li small { margin-top: auto; font-size: 11.5px; font-weight: 700; }
.cg-ladder li.done { opacity: .85; }
.cg-ladder li.done b { background: var(--c-ok); color: #fff; }
.cg-ladder li.now { opacity: 1; background: var(--c-ink); color: var(--c-text); }
.cg-ladder li.now b { background: var(--c-gold); }
.cg-ladder li.now .star, .cg-ladder li.now .star svg.ic { color: var(--c-gold) !important; }
.cg-ladder li.next { opacity: 1; box-shadow: inset 0 0 0 2px var(--c-gold); color: var(--c-ink); }
.cg-empty { grid-column: 1 / -1; margin: 0; padding: 10px; border-radius: 10px; background: var(--c-card); color: var(--c-muted); font-size: 13px; }
#screen-strategy .sp-link { margin-left: 4px; padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: inherit; text-decoration: underline; cursor: pointer; }
/* level-up reward pick: light backdrop so the town's new borders show behind it */
#levelup-modal { background: rgba(10, 16, 20, .25); backdrop-filter: none; align-items: flex-end; padding-bottom: calc(var(--sb) + 24px); }
.modal .modal-inner.lvup { position: relative; width: min(440px, calc(100% - 24px)); padding: 34px 22px 18px; border-radius: 20px; background: var(--c-paper); color: var(--c-ink);
  text-align: center; overflow: visible; max-height: none; box-shadow: 0 30px 80px rgba(0,0,0,.45); animation: lvPop .45s cubic-bezier(.2,1.5,.4,1); }
@keyframes lvPop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lv-badge { position: absolute; top: -26px; left: 50%; width: 52px; height: 52px; margin-left: -26px; border-radius: 14px; color: #fff; font: 700 30px/52px var(--f-ui);
  box-shadow: 0 0 0 4px var(--c-gold), 0 10px 24px rgba(0,0,0,.3); animation: lvGlow 1.6s ease-in-out infinite; }
@keyframes lvGlow { 50% { box-shadow: 0 0 0 4px var(--c-gold), 0 0 28px 6px rgba(240,192,80,.7); } }
.lv-kicker { font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--c-gold-t); }
.lvup h2 { margin: 2px 0 4px; font: 700 30px/1.1 var(--f-disp); }
.lv-perk { margin: 0 0 16px; color: var(--c-muted); font-size: 15px; font-weight: 600; }
.lv-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal button.lv-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px 12px; border: 2px solid transparent; border-radius: 14px;
  background: var(--c-card); color: var(--c-ink); font-family: var(--f-ui); cursor: pointer; transition: transform .12s, border-color .12s; }
.modal button.lv-pick:hover:not(:disabled) { border-color: var(--c-gold); background: #fbf3dc; transform: translateY(-2px); }
.modal button.lv-pick:disabled { opacity: .5; cursor: default; }
.lv-pick .pt, .lv-ic { width: 60px; height: 60px; }
.lv-ic { display: flex; align-items: center; justify-content: center; border-radius: 30px; background: var(--c-ink); color: var(--c-gold); }
.lv-ic svg.ic { width: 30px !important; height: 30px !important; fill: currentColor; }
.lv-pick b { font-size: 18px; }
.lv-pick small { font-size: 12.5px; color: var(--c-muted); }
.lv-foot { display: block; margin-top: 12px; font-size: 12px; color: var(--c-muted2); letter-spacing: .08em; text-transform: uppercase; }
@media (max-height: 520px) {
  #levelup-modal { align-items: center; justify-content: flex-end; padding: 0 calc(var(--sr) + 14px) 0 0; }
  .modal .modal-inner.lvup { width: 380px; padding: 26px 16px 12px; }
  .lvup h2 { font-size: 24px; }
  .lv-perk { margin-bottom: 10px; font-size: 13px; }
  .lv-pick .pt, .lv-ic { width: 46px; height: 46px; }
  .lv-foot { display: none; }
}
@media (max-height: 520px) {
  .cg-how { font-size: 12px; margin-bottom: 6px; }
  .cg-ladder li { padding: 5px; font-size: 10.5px; }
  .cg-ladder li b { width: 18px; height: 18px; line-height: 18px; font-size: 11px; }
}

/* phones held upright: true bottom sheets, edge to edge */
@media (max-width: 640px) {
  #screen-strategy #strat-panel, #screen-strategy #strat-citybar { left: 0; right: 0; bottom: 0; width: auto; max-height: 64vh; border-radius: 22px 22px 0 0;
    padding: 10px 16px calc(var(--sb) + 18px); }
  #screen-strategy #hud-turn { display: none; }
  #screen-strategy.sheet-open #btn-endturn { bottom: calc(var(--sheet-h, 0px) + 12px); }
}
/* phones held sideways: a compact card on the left */
@media (max-height: 520px) and (min-width: 641px) {
  #screen-strategy #strat-panel, #screen-strategy #strat-citybar { left: calc(var(--sl) + 10px); bottom: calc(var(--sb) + 8px); width: 360px; max-height: calc(100% - 70px - var(--st)); padding: 8px 12px 12px; }
  #screen-strategy #strat-citybar { width: 400px; }
  #screen-strategy.sheet-open #btn-endturn { bottom: calc(var(--sb) + 12px); }
  .sh-grab { display: none; }
  .pt.big { width: 50px; height: 50px; }
  #screen-strategy #strat-panel h3, #screen-strategy #strat-citybar h3 { font-size: 21px; }
  #screen-strategy .sp-stats { margin: 8px 0 4px; }
  #screen-strategy .sp-stats .sc { padding: 6px 8px; }
  #screen-strategy .sp-stats b { font-size: 17px; }
  .cb-tabs { margin: 8px 0 8px; }
  #screen-strategy .cb-tabs button { height: 34px; }
  #strat-citybar .ca .pt, #screen-strategy .ca-ic { width: 42px; height: 42px; }
}

/* ---------- briefing: board → battle ---------- */
.modal .modal-inner.bp.brief { width: min(880px, 96vw); max-width: none; display: grid; grid-template-columns: 300px 1fr; padding: 0; overflow: hidden; text-align: left;
  background: var(--c-ink); color: var(--c-text); border: 0; border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.br-left { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px; min-height: 100%;
  background: linear-gradient(180deg, rgba(27, 34, 39, .25), rgba(27, 34, 39, .9)),
    radial-gradient(circle at 18% 28%, color-mix(in srgb, var(--a) 55%, transparent) 0, transparent 55%),
    radial-gradient(circle at 85% 80%, color-mix(in srgb, var(--b) 55%, transparent) 0, transparent 55%), #24505c; }
.modal .brief .bp-kicker { justify-content: flex-start; font: 700 12px/1 var(--f-ui); letter-spacing: .2em; color: var(--c-gold); text-transform: uppercase; }
.modal .brief .bp-kicker.warn { color: #ff8a6c; }
.modal .modal-inner.bp.brief h2 { margin: 0; text-align: left; font: 800 32px/1 var(--f-disp); color: var(--c-text); letter-spacing: 0; }
.br-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.br-chips span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 14px; background: rgba(15, 20, 24, .55); font-size: 13px; font-weight: 600; color: #d9dcd6; }
.br-chips svg.ic { width: 14px; height: 14px; }
.modal .brief .bp-desc { margin: 0; font-size: 13px; line-height: 1.45; color: #c9d0d2; text-align: left; }
.br-ems { margin-top: auto; display: flex; align-items: center; gap: 10px; font: 800 16px var(--f-disp); color: #aab3b8; }
.br-right { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; }
.br-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; flex: 1; }
.br-h { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; letter-spacing: .14em; margin-bottom: 4px; }
.br-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.br-row .pt { background: #2c363c; }
.br-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.br-id b { font-size: 15px; font-weight: 700; }
.br-id small { font-size: 12px; color: #9aa2a6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-pips { display: flex; gap: 2px; }
.br-pips i { width: 5px; height: 14px; border-radius: 2px; opacity: .85; }
.br-n { width: 22px; text-align: right; font-size: 15px; font-weight: 700; }
.br-side .vs-walls { color: #aab3b8; font-size: 12px; margin-top: 6px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.br-oh { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: #aab3b8; margin-bottom: 6px; }
.br-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; }
.modal .modal-inner.bp.brief .battle-choice { display: flex; gap: 10px; justify-content: stretch; flex-wrap: nowrap; position: static; margin: 0; padding: 0; background: none; border: 0; }
.modal .brief .battle-choice .cta { flex: 1; }
.modal .brief .ghost { border-color: #4a555b; color: var(--c-text); }
.modal .brief .ghost.icon { width: 50px; padding: 0; }
.modal .brief .bp-warn { flex: 1; color: #ff8a6c; font-size: 13px; margin: 0; align-self: center; }
@media (max-height: 520px) {
  .modal .modal-inner.bp.brief { grid-template-columns: 210px 1fr; max-height: calc(100% - 16px); }
  .br-left { padding: 14px; gap: 8px; }
  .modal .modal-inner.bp.brief h2 { font-size: 24px; }
  .modal .brief .bp-desc { display: none; }
  .br-right { padding: 12px 14px; gap: 10px; overflow-y: auto; }
  .br-row { margin: 5px 0; }
  .br-row .pt { width: 32px; height: 32px; }
}
@media (max-width: 640px) {
  .modal .modal-inner.bp.brief { grid-template-columns: 1fr; max-height: calc(100% - 16px); overflow-y: auto; }
  .br-left { min-height: 0; }
  .br-ems { display: none; }
  .br-cols { grid-template-columns: 1fr; gap: 8px; }
}

/* ---------- other modals pick up the chalk palette ---------- */
.modal { background: rgba(10, 16, 20, .55); }
.modal .modal-inner { background: var(--c-chalk); color: var(--c-ink); border: 0; border-radius: 18px; font-family: var(--f-ui); }
.modal .modal-inner h2 { font-family: var(--f-disp); font-weight: 800; letter-spacing: 0; }
.tc { background: var(--c-paper); border: 0; }
.tc.open { box-shadow: inset 0 0 0 2px rgba(240, 192, 80, .7); }
.tc h4 { font-family: var(--f-disp); font-weight: 800; }
.tc button { background: var(--c-gold); color: var(--c-ink); box-shadow: inset 0 -2px 0 var(--c-gold-d); }
.tc button .star, .tc button .star svg.ic { color: var(--c-ink); }
.tc-ic, .sp-badge { background: var(--c-ink); color: var(--c-gold); }

/* ---------- main menu: wordmark + mode list on the left, panel on the right ---------- */
#screen-menu .menu-shade { background: linear-gradient(90deg, rgba(20, 38, 45, .95) 0%, rgba(20, 38, 45, .8) 30%, rgba(20, 38, 45, .15) 62%, rgba(20, 38, 45, .05) 100%); }
#screen-menu .menu-box { width: 100%; min-height: 100%; margin: 0; padding: calc(var(--st) + 28px) calc(var(--sr) + 28px) calc(var(--sb) + 22px) calc(var(--sl) + 36px);
  display: grid; grid-template-columns: minmax(280px, 330px) minmax(0, 1fr); gap: 36px; align-items: start; text-align: left; }
.menu-side { position: sticky; top: calc(var(--st) + 28px); display: flex; flex-direction: column; gap: 22px; }
#screen-menu .menu-head { margin: 0; text-shadow: none; }
#screen-menu .game-title { font: 800 60px/0.9 var(--f-disp); letter-spacing: .04em; text-transform: none; color: var(--c-text); text-shadow: 0 2px 18px rgba(0, 0, 0, .3); }
#screen-menu .tagline { margin-top: 8px; font: 500 15px/1.3 var(--f-ui); letter-spacing: 0; text-transform: none; color: #c9d4d2; opacity: 1; }
#screen-menu .continue-card { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0; padding: 10px 16px; min-height: 60px; border: 0; border-radius: 12px;
  background: var(--c-gold); color: var(--c-ink); box-shadow: inset 0 -3px 0 var(--c-gold-d), 0 8px 20px rgba(0, 0, 0, .25); font-family: var(--f-ui); }
#screen-menu .continue-card.hidden { display: none; }
#screen-menu .continue-card:hover { transform: none; filter: brightness(1.05); box-shadow: inset 0 -3px 0 var(--c-gold-d), 0 8px 20px rgba(0, 0, 0, .25); }
#screen-menu .ct-go { width: auto; height: auto; background: none; color: var(--c-ink); }
#screen-menu .ct-go svg.ic { width: 20px; height: 20px; }
#screen-menu .ct-txt b { font: 700 17px/1.1 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; }
#screen-menu .ct-txt small { font-size: 12px; font-weight: 500; color: rgba(27, 34, 39, .75); }
#screen-menu .menu-tabs { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; background: none; border: 0; border-radius: 0; backdrop-filter: none; }
#screen-menu .menu-tab { justify-content: flex-start; gap: 12px; width: 100%; min-height: 52px; padding: 0 16px; border-radius: 12px; border: 2px solid rgba(243, 238, 226, .22);
  background: rgba(27, 34, 39, .55); color: var(--c-text); font: 700 17px/1 var(--f-ui); letter-spacing: .06em; text-transform: uppercase; box-shadow: none; }
#screen-menu .menu-tab:hover { background: rgba(27, 34, 39, .75); }
#screen-menu .menu-tab.sel { background: var(--c-chalk); color: var(--c-ink); border-color: var(--c-chalk); }
#screen-menu .menu-tab .tab-ic { display: flex; }
#screen-menu .menu-tab svg.ic { width: 20px; height: 20px; }
.menu-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#screen-menu .version-badge { margin: 0; }
#screen-menu .menu-foot .hint { margin: 0; color: #9fb0b2; text-shadow: none; }
.menu-main { min-width: 0; }
#screen-menu .menu-panel { background: rgba(239, 233, 220, .96); border: 0; border-radius: 18px; padding: 20px 22px 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
#screen-menu #menu-campaign, #screen-menu #menu-updates { width: auto; max-width: 820px; margin: 0; }
#screen-menu .panel-h { justify-content: flex-start; font: 800 22px/1 var(--f-disp); letter-spacing: 0; text-transform: none; color: var(--c-ink); }
#screen-menu .panel-h::before, #screen-menu .panel-h::after { display: none; }
#screen-menu .tribe-card { background: var(--c-paper); border: 0; border-radius: 14px; }
#screen-menu .tribe-card h3 { font: 800 19px var(--f-disp); }
#screen-menu .tribe-card p { color: var(--c-muted); font-size: 13px; }
#screen-menu #btn-start { width: 100%; }
#screen-menu .qb-preset { background: var(--c-paper); border: 0; }
#screen-menu .qb-chip { background: var(--c-paper); }
#screen-menu .qb-chip.on { background: var(--c-ink); }
@media (max-width: 860px), (max-height: 520px) {
  #screen-menu .menu-box { grid-template-columns: minmax(220px, 250px) minmax(0, 1fr); gap: 18px; padding: calc(var(--st) + 14px) calc(var(--sr) + 14px) calc(var(--sb) + 14px) calc(var(--sl) + 18px); }
  .menu-side { gap: 12px; top: calc(var(--st) + 14px); }
  #screen-menu .game-title { font-size: 44px; }
  #screen-menu .tagline { font-size: 13px; }
  #screen-menu .menu-tab, #screen-menu .continue-card { min-height: 46px; font-size: 15px; }
  #screen-menu .menu-panel { padding: 14px 16px 16px; }
}
@media (max-width: 600px) {
  #screen-menu .menu-box { grid-template-columns: 1fr; }
  .menu-side { position: static; }
  #screen-menu .menu-shade { background: linear-gradient(180deg, rgba(20, 38, 45, .9), rgba(20, 38, 45, .55) 45%, rgba(20, 38, 45, .85)); }
}

/* ---------- pause menu ---------- */
#game-menu .gm-inner { background: var(--c-chalk); }
#game-menu .menu-runes { display: none; }
#game-menu h2 { font: 800 30px var(--f-disp); }
#game-menu .ghost { border-color: var(--c-ink); }

/* ---------- install banner ---------- */
#install-banner { background: var(--c-chalk) !important; border: 0 !important; border-radius: 16px !important; font-family: var(--f-ui); }
#install-banner .ib-txt > b { font: 800 17px var(--f-disp); }
#install-banner .ib-go { background: var(--c-gold); color: var(--c-ink); box-shadow: inset 0 -3px 0 var(--c-gold-d); font: 700 14px var(--f-ui); letter-spacing: .08em; text-transform: uppercase; }

/* research: a labelled pill that lights up when something is affordable */
#screen-strategy #strat-topbar #btn-tech { width: auto; padding: 0 14px 0 12px; gap: 7px; font-size: 15px; position: relative; }
#screen-strategy #strat-topbar #btn-tech.ready { box-shadow: inset 0 0 0 2px #f0c050, 0 4px 14px rgba(0, 0, 0, .18); }
#screen-strategy #strat-topbar #btn-tech.ready svg.ic { color: #f0c050; }
.tb-badge { display: flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #f0c050; color: #1b2227; font: 700 12px/1 var(--f-ui); }
/* claiming towns */
.strat-label.army.claim { box-shadow: 0 0 0 2px #f0c050, 0 2px 6px rgba(0, 0, 0, .3); }
.strat-label.army .cl { display: flex; align-items: center; justify-content: center; width: 16px; height: 14px; color: #f0c050; font-style: normal; }
.strat-label.army .cl svg.ic { width: 13px; height: 13px; }
.strat-label.city .occ { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin: 0 -9px 0 4px; color: #fff; font-style: normal; animation: occPulse 1.4s infinite; }
.strat-label.city .occ svg.ic { width: 13px; height: 13px; }
@keyframes occPulse { 50% { filter: brightness(1.3); } }
.strat-label.city { transform: translate(-50%, -50%); }
.clan-tag { display: inline-block; margin-left: 3px; padding: 1px 5px; border-radius: 6px; background: var(--c-ink); color: var(--c-gold) !important; font-size: 9.5px !important; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; vertical-align: 1px; }

/* ---------- clan explorer (main menu) ---------- */
#clan-explorer { margin: 0 0 16px; padding: 16px; border-radius: 14px; background: var(--c-ink); color: var(--c-text); box-shadow: inset 4px 0 0 var(--clan, #f0c050); }
#clan-explorer:empty { display: none; }
#clan-explorer label { display: block; margin: 0 0 8px; font: 700 11px/1 var(--f-ui); letter-spacing: .16em; text-transform: uppercase; color: #aab3b8; }
.cx-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.cx-head h3 { margin: 0; font: 800 26px/1 var(--f-disp); color: var(--c-text); }
.cx-head em { display: block; margin: 3px 0 4px; font-size: 14px; color: #f0c050; }
.cx-head p { margin: 0; font-size: 13px; color: #c9d0d2; line-height: 1.35; }
.cx-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; margin-bottom: 14px; }
.cx-start { display: flex; gap: 8px; margin-bottom: 6px; }
.cx-start-txt { font-size: 13px; color: #c9d0d2; margin-bottom: 8px; }
.cx-perks { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-perks span { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 12px; background: #2c363c; font-size: 12.5px; font-weight: 600; color: #d9dcd6; }
.cx-perks svg.ic { width: 14px; height: 14px; color: #f0c050; }
.cx-unit { display: flex; gap: 12px; align-items: center; padding: 8px 10px; margin-bottom: 8px; border-radius: 12px; background: #2c363c; }
.cx-unit b { display: block; font: 800 18px/1.1 var(--f-disp); }
.cx-unit small { display: block; margin-top: 3px; font-size: 12.5px; color: #c9d0d2; line-height: 1.35; }
.cx-stats { display: flex; gap: 9px; margin-top: 3px; }
.cx-stats i { display: inline-flex; align-items: center; gap: 3px; font-style: normal; font-weight: 700; font-size: 14px; }
.cx-stats svg.ic { width: 13px; height: 13px; color: #8f989d; }
.pt.huge { width: 72px; height: 72px; }
#clan-explorer .pt { background: #3a454c; }
.cx-roster { display: flex; gap: 10px; flex-wrap: wrap; }
.cx-roster span { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 64px; }
.cx-roster .pt { width: 52px; height: 52px; }
.cx-roster small { font-size: 11.5px; font-weight: 600; color: #c9d0d2; text-align: center; }
@media (max-width: 860px), (max-height: 520px) {
  .cx-cols { grid-template-columns: 1fr; gap: 10px; }
  .pt.huge { width: 56px; height: 56px; }
}
.cx-stats em { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .08em; color: #8f989d; }

/* ---------- phones: the unit sheet starts as a compact bar; Info opens the rest ---------- */
html:not(.touch) #screen-strategy #strat-panel .sp-toggle { display: none !important; }
html.touch #screen-strategy #strat-panel button.sp-toggle { display: flex; margin: 0; padding: 0; text-align: center; flex-direction: column; align-items: center; justify-content: center; gap: 1px; flex-shrink: 0;
  width: 48px; height: 48px; border: 0; border-radius: 12px; background: var(--c-card); color: var(--c-ink); font: 700 10px/1 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
html.touch #strat-panel .sp-toggle svg.ic { width: 18px; height: 18px; transform: rotate(-90deg); transition: transform .2s; }
html.touch #strat-panel:not(.peek) .sp-toggle svg.ic { transform: rotate(90deg); }
html.touch #strat-panel .sp-head { cursor: pointer; }
html.touch #screen-strategy #strat-panel.peek { padding-top: 8px; padding-bottom: calc(var(--sb) + 10px); }
html.touch #strat-panel.peek .sp-more, html.touch #strat-panel.peek .sh-grab, html.touch #strat-panel.peek .sp-head small { display: none; }
html.touch #strat-panel.peek .pt.big { width: 44px; height: 44px; }
html.touch #screen-strategy #strat-panel.peek h3 { font-size: 20px; }
html.touch #screen-strategy #strat-panel.peek .sp-cta { margin-top: 8px; min-height: 44px; }

/* ---------- main menu: profile card, continue in the list, footer settings ---------- */
#screen-menu .profile-chip { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; min-height: 62px; border-radius: 14px; cursor: pointer; text-align: left;
  background: rgba(243, 238, 226, .12); border: 2px solid rgba(232, 196, 106, .55); color: var(--c-text); font-family: var(--f-ui); transition: background .15s; }
#screen-menu .profile-chip:hover { background: rgba(243, 238, 226, .2); }
#screen-menu .profile-chip.sel { background: var(--c-chalk); color: var(--c-ink); border-color: var(--c-chalk); }
#screen-menu .profile-chip.empty { border-style: dashed; border-color: rgba(243, 238, 226, .45); background: rgba(27, 34, 39, .35); }
#screen-menu .profile-chip.hidden { display: none; }
.pc-av { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--c-gold); color: var(--c-ink); }
.profile-chip.empty .pc-av { background: transparent; border: 2px dashed rgba(243, 238, 226, .5); color: var(--c-text); }
.profile-chip.sel .pc-av { border-color: var(--c-ink); color: var(--c-ink); }
.pc-av svg.ic { width: 20px; height: 20px; }
.pc-txt { flex: 1; min-width: 0; }
.pc-txt b { display: block; font: 700 17px/1.15 var(--f-ui); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-txt small { display: block; font-size: 12px; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-go { opacity: .6; display: flex; }
#screen-menu .menu-tabs .save-list { margin: -2px 0 2px; }
.foot-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .3); background: rgba(30, 26, 38, .4); color: #fbf6ea; backdrop-filter: blur(8px); }
.foot-btn:hover { background: rgba(30, 26, 38, .6); }
.foot-btn svg.ic { width: 16px; height: 16px; }
#game-menu.settings-only #gm-quit, #game-menu.settings-only #gm-flee { display: none !important; }
#game-menu { z-index: 80; }
#game-menu.settings-only { position: fixed; }
