/* FE: Border War's in-game screens in the Friendship Enders look (the title screen's: Lilita One,
   Nunito Bold, white-edged stickers and panels, gold and slate green; tokens in fe-menu.css and
   the site's menu-look.css), and gathered towards the middle of the screen rather than its edges
   (user, Nov 9: "most of the buttons appear on the far edges rather than near the middle").
   - The top bar gives way to a small centred toolbar (Sound, Controls, Menu: fe-menu.js).
   - The castle shop: one dock at the bottom centre holds the hire cards; the resource count and
     Begin Battle sit just above it; How to win and Your purchases frame the view inside a
     centred column, not at the screen's edges.
   Selectors start at body.playing (or are game-only ids) so they win over the DK-ported
   style.css and fe-onboarding.css, which stay as they are. */
:root {
  --bw-frame: max(24px, calc(50vw - 640px));   /* side panels sit inside a centred 1280 px frame */
  --bw-dock-bottom: 18px;
  --bw-hud-panel: linear-gradient(180deg, rgba(36, 62, 57, .9), rgba(20, 38, 35, .92));
}

/* --- the top bar: replaced by the centred toolbar ------------------------------------------- */
body.playing > header { display: none; }
.bw-game-tools { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 6; display: none; gap: 10px; }
body.playing .bw-game-tools { display: flex; }
body.playing.match-ended .bw-game-tools { display: none; }
.bw-game-tools .fe-tool-button { width: 42px; height: 42px; background: var(--bw-fill); }
.bw-game-tools .fe-tool-button svg { width: 20px; height: 20px; }
.bw-game-tools .fe-tool-button:hover:not(:disabled), .bw-game-tools .fe-tool-button:focus-visible { background: var(--bw-gold-fill); color: var(--bw-dark-text); }
.bw-game-tools .fe-tool-button::after { bottom: auto; top: calc(100% + 10px); background: var(--bw-fill); }
/* Its panels open under it, in the middle. */
.fe-tool-backdrop.bw-ingame { place-items: start center; padding: 70px 18px 0; }

/* --- the scoreboard: two sticker panels round the round counter ---------------------------- */
body.playing #hud { top: 68px; width: min(860px, 88vw); gap: 18px; align-items: flex-start; text-shadow: none; font-family: var(--fe-sub); font-weight: 700; }
body.playing .fighter-info { padding: 9px 14px 11px; border: 2.5px solid #fff; border-radius: 14px; background: var(--bw-hud-panel); box-shadow: 0 3px 0 rgba(6, 16, 14, .5), 0 8px 18px rgba(0, 0, 0, .25); }
body.playing .fighter-info > div:first-child { margin-bottom: 4px; }
body.playing .fighter-label { font: 400 17px/1 var(--fe-head); letter-spacing: .04em; color: #fff; }
body.playing .resource-count, body.playing .fighter-health > div:first-child, body.playing .city-health > div:first-child {
  display: flex; justify-content: space-between; margin: 6px 0 4px; font: 700 12px/1.2 var(--fe-sub); letter-spacing: .03em; text-transform: uppercase; color: var(--bw-soft);
}
body.playing .resource-count strong, body.playing .fighter-health strong, body.playing .city-health strong { font: 400 15px/1 var(--fe-head); letter-spacing: .02em; color: #fff; }
body.playing :is(.health-track, .city-track) { height: 8px; border-radius: 99px; overflow: hidden; background: rgba(5, 18, 16, .6); }
body.playing :is(.health-track, .city-track) i { border-radius: 99px; }
body.playing .round-info { align-self: center; padding: 8px 16px 10px; border: 2.5px solid #fff; border-radius: 14px; background: var(--bw-fill); box-shadow: var(--fe-lift); }
body.playing .round-info span { font: 700 11px/1.1 var(--fe-sub); letter-spacing: .08em; color: var(--bw-gold); }
body.playing .round-info strong { margin-top: 3px; font: 400 26px/1 var(--fe-head); letter-spacing: .03em; color: #fff; }
body.playing .stand-label { font: 400 14px/1.1 var(--fe-head); letter-spacing: .05em; }

/* --- the castle shop ------------------------------------------------------------------------- */
/* The hire cards: one row, bottom centre. */
body.playing .hire-row {
  left: 50%; right: auto; top: auto; bottom: var(--bw-dock-bottom); transform: translateX(-50%);
  flex-direction: row; align-items: flex-start; gap: 10px; width: max-content; max-width: calc(100vw - 32px);
  padding: 10px 12px 8px; border: 3px solid #fff; border-radius: 18px; background: var(--bw-panel); box-shadow: var(--fe-panel-lift);
}
body.playing .hire-card { width: 168px; }
body.playing .hire-button {
  padding: 9px 11px; border: 2.5px solid #fff; border-radius: 12px; background: var(--bw-fill); color: #fff; box-shadow: 0 3px 0 rgba(6, 16, 14, .55);
  font: 400 14px/1.05 var(--fe-head); letter-spacing: .03em; text-align: left; transition: background .15s, transform .15s;
}
body.playing .hire-button span small { margin-top: 3px; font: 700 10.5px/1.2 var(--fe-sub); letter-spacing: 0; text-transform: none; opacity: .85; }
body.playing .hire-button strong { font: 400 24px/1 var(--fe-head); color: var(--bw-gold); }
body.playing .hire-button strong small { font: 700 9.5px/1 var(--fe-sub); color: var(--bw-soft); }
body.playing .hire-button:hover:not(:disabled) { background: var(--bw-fill-hover); border-color: #fff; transform: translateY(-2px); }
body.playing .hire-status { margin-top: 5px; font: 700 11px/1.2 var(--fe-sub); color: var(--bw-soft); }
/* Above it: what you have to spend, and (before the battle) Begin Battle beside it. */
body.playing #city-inventory {
  bottom: calc(var(--bw-dock-bottom) + 112px); flex-direction: row; align-items: baseline; gap: 8px;
  padding: 6px 18px 8px; border: 3px solid #fff; border-radius: 999px; background: var(--bw-fill); box-shadow: var(--fe-lift);
}
body.playing #city-inventory strong { font: 400 40px/1 var(--fe-head); color: var(--bw-gold); }
body.playing #city-inventory span { font: 700 14px/1 var(--fe-sub); letter-spacing: .02em; color: #fff; }
body.playing #city-hud:has(#prematch:not([hidden])) #city-inventory { transform: translateX(calc(-100% - 8px)); }
/* The opening panel's parts each take their own place (its box no longer groups them). */
body.playing #prematch { display: contents; }
body.playing #prematch[hidden] { display: none; }
body.playing #begin-battle {
  position: absolute; left: calc(50% + 8px); bottom: calc(var(--bw-dock-bottom) + 112px); width: auto; margin: 0; padding: 14px 26px 15px;
  border: var(--fe-edge); border-radius: 999px; background: var(--bw-gold-fill); color: var(--bw-dark-text); box-shadow: var(--fe-lift);
  font: 400 24px/1 var(--fe-head); letter-spacing: .03em; pointer-events: auto;
}
body.playing #begin-battle:hover:not(:disabled) { background: var(--bw-gold-hover); transform: translateY(-2px); }
body.playing #begin-battle span { display: none; }
body.playing #prematch-status {
  position: absolute; left: 50%; bottom: calc(var(--bw-dock-bottom) + 182px); transform: translateX(-50%); width: max-content; max-width: min(520px, 90vw);
  margin: 0; padding: 7px 16px 8px; border: 2px solid #fff; border-radius: 999px; background: var(--bw-fill); box-shadow: var(--fe-lift);
  font: 700 13px/1.35 var(--fe-sub); color: #fff; text-align: center;
}
body.playing #prematch-status:empty { display: none; }
/* How to win (right) and Your purchases (left), inside the centred frame, under the scoreboard. */
body.playing #fe-how-to {
  position: absolute; right: var(--bw-frame); top: 220px; width: 300px; max-height: calc(100dvh - 470px);
  padding: 12px 14px; border: 3px solid #fff; border-radius: 16px; background: var(--bw-panel); box-shadow: var(--fe-panel-lift);
  color: var(--bw-soft); font: 700 13px/1.4 var(--fe-sub);
}
body.playing #fe-how-to summary { font: 400 16px/1.1 var(--fe-head); letter-spacing: .03em; text-transform: none; color: #fff; }
body.playing #fe-how-to summary small { font: 700 11px/1 var(--fe-sub); color: var(--bw-gold); }
body.playing #fe-how-to strong { color: #fff; }
body.playing #prematch-purchases {
  position: absolute; left: var(--bw-frame); top: 220px; width: 240px; pointer-events: auto;
  padding: 12px 14px; border: 3px solid #fff; border-radius: 16px; background: var(--bw-panel); box-shadow: var(--fe-panel-lift); color: #fff;
}
body.playing #prematch-purchases h3 { margin: 0 0 6px; font: 400 16px/1.1 var(--fe-head); letter-spacing: .03em; text-transform: none; color: #fff; }
body.playing #prematch-bought { font: 700 13px/1.45 var(--fe-sub); color: var(--bw-soft); }
/* Back to the battle (during it, from the castle). */
body.playing #return-to-battle kbd { border: 3px solid #fff; border-bottom-width: 7px; border-radius: 16px; background: var(--bw-gold-fill); color: var(--bw-dark-text); font-family: var(--fe-head); font-weight: 400; }
body.playing #return-to-battle > span { padding: 7px 16px 8px; border: 2px solid #fff; border-radius: 999px; background: var(--bw-fill); font: 400 18px/1 var(--fe-head); letter-spacing: .03em; color: #fff; }

/* --- the weapon menu over a platform, and the platform markers ------------------------------ */
#weapon-panel { padding: 16px; border: 3px solid #fff; border-radius: 18px; background: var(--bw-panel); box-shadow: var(--fe-panel-lift); color: #fff; font-family: var(--fe-sub); font-weight: 700; }
#weapon-panel h3 { font: 400 20px/1.1 var(--fe-head); letter-spacing: .02em; color: #fff; }
#weapon-panel #weapon-level { font: 700 13px/1.3 var(--fe-sub); color: var(--bw-soft); }
#weapon-panel .weapon-option { border: 2.5px solid rgba(255, 255, 255, .85); border-radius: 12px; background: var(--bw-fill); color: #fff; font: 400 16px/1.1 var(--fe-head); letter-spacing: .02em; box-shadow: 0 3px 0 rgba(6, 16, 14, .5); }
#weapon-panel .weapon-option small, #weapon-panel .weapon-option span span { font-family: var(--fe-sub); font-weight: 700; }
#weapon-panel .weapon-option:hover:not(:disabled) { background: var(--bw-fill-hover); border-color: #fff; }
#weapon-panel .weapon-option strong { color: var(--bw-gold); font-family: var(--fe-head); font-weight: 400; }
#weapon-panel button[aria-pressed=true] { background: var(--bw-gold-fill); color: var(--bw-dark-text); border-color: #fff; }
.platform-marker { border: 2.5px solid #fff; background: var(--bw-fill); color: #fff; font: 400 18px/1 var(--fe-head); box-shadow: 0 3px 0 rgba(6, 16, 14, .55); }
.platform-marker:hover, .platform-marker[aria-pressed=true] { background: var(--bw-gold-fill); color: var(--bw-dark-text); }
.platform-marker[data-ammo]:not([data-ammo=""])::after { border: 2px solid #fff; border-radius: 999px; background: var(--bw-fill); font: 700 11px/1 var(--fe-sub); padding: 3px 7px; }

/* --- notices, prompts and bars ---------------------------------------------------------------- */
body.playing #announcement { font: 400 60px/1.05 var(--fe-head); letter-spacing: .02em; text-shadow: 0 4px 0 rgba(8, 18, 16, .55), 0 10px 26px rgba(0, 0, 0, .45); }
body.playing #announcement.city-fallen { padding: 14px 32px 18px; border: 3px solid #fff; border-radius: 18px; background: var(--bw-panel); box-shadow: var(--fe-panel-lift); }
body.playing :is(#capture, #crossbow-hud, #archer-warning, #mining-panel, #fe-hint) {
  border: 2.5px solid #fff; border-radius: 16px; background: var(--bw-panel); box-shadow: var(--fe-lift); color: #fff; font: 700 14px/1.4 var(--fe-sub); text-shadow: none;
}
body.playing :is(#capture, #crossbow-hud, #archer-warning) { border-radius: 999px; padding: 8px 18px 9px; }
body.playing #vault-warning { border: 2.5px solid #fff; border-radius: 999px; padding: 8px 18px 9px; font: 400 16px/1.2 var(--fe-head); letter-spacing: .03em; box-shadow: var(--fe-lift); }
body.playing #archer-warning[data-range=true] { border-color: #fff; }
body.playing #mining-progress { height: 9px; border-radius: 99px; overflow: hidden; background: rgba(5, 18, 16, .6); }
body.playing #mining-bar { background: var(--bw-gold-fill); }
body.playing #crossbow-hud { right: auto; left: 50%; transform: translateX(-50%); bottom: 64px; }
body.playing #fe-hint { bottom: 250px; }
body.playing #fe-hint kbd, body.playing #fe-how-to kbd { padding: 0 5px 1px; border: 2px solid #fff; border-radius: 6px; background: var(--bw-well); color: #fff; font: 700 11px/1.3 var(--fe-sub); }
/* The connection line (online): top left, now the top bar is gone. */
body.playing #network-panel { left: 18px; right: auto; top: 18px; bottom: auto; border: 2px solid #fff; border-radius: 12px; background: var(--bw-panel); font: 700 12px/1.35 var(--fe-sub); }
/* The key strip: centred along the bottom, in the menus' keycaps. */
body.playing > footer { left: 50%; right: auto; transform: translateX(-50%); justify-content: center; width: max-content; max-width: calc(100vw - 32px); }
body.playing > footer .controls { gap: 16px; font: 700 11px/1 var(--fe-sub); letter-spacing: .04em; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
body.playing > footer kbd { padding: 2px 6px 3px; border: 2px solid #fff; border-radius: 6px; background: var(--bw-well); font: 700 10.5px/1.2 var(--fe-sub); color: #fff; }
body.playing > footer .mouse-help { display: none; }

/* --- coins: this game's pickups in the round box, and what the game earned on the result card */
body.playing .round-info .bw-coins { display: inline-flex; align-items: center; justify-content: center; gap: 5px; margin-top: 5px; font: 400 17px/1 var(--fe-head); letter-spacing: .02em; color: var(--bw-gold); }
body.playing .round-info .bw-coins[hidden] { display: none; }
body.playing .round-info .bw-coins svg { width: 18px; height: 18px; }
.bw-coin-pop { animation: bw-coin-pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bw-coin-pop { 40% { transform: scale(1.35); } }
#result .fe-result-coins:empty { display: none; }
#result .fe-result-coins { margin-top: 8px; }
#result .fe-coins-head { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
#result .fe-coins-head b { font: 400 24px/1 var(--fe-head); letter-spacing: .02em; color: #ffd166; text-shadow: 0 3px 0 rgba(6, 16, 34, .55); }
#result .fe-coins-icon svg { display: block; width: 24px; height: 24px; }
#result .fe-coins-parts, #result .fe-coins-next { margin: 4px 0 0; font: 700 12.5px/1.35 var(--fe-sub); color: var(--bw-soft); }
#result .fe-coins-next { color: #7ee08f; }
#result .fe-coins-keep { display: flex; align-items: center; gap: 10px; margin-top: 8px; font: 700 13px/1.3 var(--fe-sub); }
@media (prefers-reduced-motion: reduce) { .bw-coin-pop { animation: none; } }

/* --- before the battle: a calmer shop (user, Nov 9: "too busy") ------------------------------
   No scoreboard: "Pre Game Purchases" and what you have to spend take its place at the top; no
   "Spend up to 10 resources..." line (game.js) and no status lines under the hire cards; the dock sits
   higher, with Begin Battle above it. */
body.playing:has(#city-hud:not([hidden]) #prematch:not([hidden])) #hud,
body.playing #city-hud:has(#prematch:not([hidden])) .hire-status { display: none; }
/* Only "Waiting for your opponent…" (online, after Begin Battle) still shows, in place of Begin Battle. */
body.playing #prematch-status { bottom: 168px; }
body.playing #prematch:has(#begin-battle:disabled) #begin-battle { display: none; }
#bw-prematch-title { display: none; }
body.playing #prematch:not([hidden]) #bw-prematch-title {
  display: block; position: absolute; left: 50%; top: 66px; transform: translateX(-50%); margin: 0; white-space: nowrap;
  font: 400 clamp(30px, 3.2vw, 42px)/1 var(--fe-head); letter-spacing: .02em; color: #fff;
  text-shadow: 0 3px 0 rgba(8, 18, 16, .6), 0 8px 20px rgba(0, 0, 0, .45);
}
body.playing #city-hud:has(#prematch:not([hidden])) #city-inventory { top: 118px; bottom: auto; transform: translateX(-50%); }
body.playing #city-hud:has(#prematch:not([hidden])) .hire-row { bottom: 64px; padding-bottom: 10px; }
body.playing #begin-battle { left: 50%; transform: translateX(-50%); bottom: 168px; }
body.playing #begin-battle:hover:not(:disabled) { transform: translate(-50%, -2px); }

@media (max-width: 1100px) {
  body.playing .hire-card { width: 140px; }
  body.playing .hire-button span small { display: none; }
  body.playing #fe-how-to { width: 260px; }
  body.playing #prematch-purchases { width: 200px; }
}

/* The wallet, top right through the game (fe-menu.js); the title and Choose your knight have their own. */
.fe-title-wallet.bw-play-wallet { position: fixed; top: 12px; right: 16px; z-index: 40; display: none; transform: scale(.82); transform-origin: top right; }
body.playing .fe-title-wallet.bw-play-wallet { display: flex; }
