body.fdb-page { background: #e6dfc9; }
.fdb-page #gamePage #content, .fdb-page #gamePage #game, .fdb-page #gamePage { background: #e6dfc9; }
.fdb-game { background: #e6dfc9; }
.fdb-game #board { background: #e6dfc9; min-width: 0; }
.fdb-game #logo { position: absolute; width: 0; height: 0; overflow: visible; }
.fdb-game #logo > a { display: none; }
#FDB2 { position: relative; --piece: 48px; box-sizing: border-box; color: #25271a; background: radial-gradient(ellipse at center, #d2d6af, #b6bd8d); padding: 5px; width: 100%; max-width: calc(var(--piece) * 9.5 + 238px); margin-inline: auto; min-width: 0; border-radius: 6px; }
#FDB2 button { color: inherit; font: inherit; cursor: default; }
#FDB2 button.active, #FDB2 .fdb-info, #FDB2 .fdb-setup button:not(:disabled) { cursor: pointer; }
#FDB2 button:disabled { opacity: 1; }
#FDB2 .fdb-tools { position: absolute; top: 5px; right: 5px; z-index: 2; display: flex; justify-content: flex-end; white-space: nowrap; }
#FDB2 .fdb-right { position: relative; }
#FDB2 .fdb-tutorial-link { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; font-size: 19px; }
#FDB2 .fdb-zones { display: flex; flex-direction: column; justify-content: center; gap: 3px; flex: 1; }
#FDB2 .fdb-target { border: 2px solid transparent; border-radius: 4px; padding: 0; background: transparent; box-sizing: border-box; }
#FDB2 .fdb-target.active { border: 2px dashed #674800; background: #fff3b966; }
#FDB2 .fdb-target.active:focus-visible { outline: 3px solid #191900; outline-offset: 2px; }
#FDB2 .fdb-selected > .fdb-target, #FDB2 .fdb-selected .fdb-card { border: 3px solid #2359a5; background: #c4e1ff; }
#FDB2 .fdb-used { opacity: .45; }
#FDB2 img { display: block; max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
#FDB2 .fdb-field { display: grid; grid-template-columns: 76px minmax(0, 1fr) 154px; gap: 3px; }
#FDB2 .fdb-identity { display: flex; align-items: center; min-height: 25px; min-width: 0; overflow-wrap: anywhere; border-left: 5px solid var(--player-color); background: #ffffff80; padding: 1px 6px; }
#FDB2 .fdb-field:not(.fdb-own) > .fdb-battalions, #FDB2 .fdb-field:not(.fdb-own) > .fdb-left, #FDB2 .fdb-field:not(.fdb-own) > .fdb-right { grid-row: 1; }
#FDB2 .playerDataBasic { margin: 0; padding: 0; border: 0; background: transparent; width: 100%; font-size: .9rem; }
#FDB2 .playerData { margin: 0; padding: 0; border: 0; width: 100%; background: transparent; }
#FDB2 .basicDesc { margin: 0; padding: 0; }
#FDB2 .fdb-battalions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; }
#FDB2 .fdb-triangle { width: calc(var(--piece) * 3); height: calc(var(--piece) * 3); position: relative; margin: auto; }
#FDB2 .fdb-cell { position: absolute; left: calc(var(--x) * var(--piece)); top: calc(var(--y) * var(--piece)); width: var(--piece); height: var(--piece); }
#FDB2 .fdb-own .fdb-cell { top: calc((2 - var(--y)) * var(--piece)); }
#FDB2 .fdb-unit { width: 100%; height: 100%; position: relative; }
.fdb-combat-die { box-sizing: border-box; display: inline-grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); gap: 1px; padding: 2px; background: #d3d4cd; color: #31372a; border: 1px solid #636a58; border-radius: 3px; box-shadow: inset 1px 1px 0 #ffffffb0, 0 1px 1px #0004; width: 22px; height: 22px; vertical-align: middle; line-height: 1; }
.fdb-combat-die > span { border-radius: 50%; background: currentColor; min-width: 1px; min-height: 1px; }
.fdb-combat-die.type1 { background: #f2cd53; color: #3e3012; }
.fdb-combat-die.type2 { background: #d35c4d; color: #fff7dd; }
.fdb-combat-die.type3 { background: #8cbd4d; color: #243517; }
#FDB2 .fdb-unit-marks { position: absolute; inset: 0; pointer-events: none; }
#FDB2 .fdb-heart-anchor, #FDB2 .fdb-shield-anchor, #FDB2 .fdb-poison-anchor { position: absolute; width: 31%; height: 31%; }
#FDB2 .fdb-shield-anchor { top: 1%; right: 1%; }
#FDB2 .fdb-poison-anchor { top: 32%; left: 2%; }
#FDB2 .fdb-unit-marks .fdb-combat-die { width: 100%; height: 100%; }
#FDB2 .fdb-shield-anchor.spent::after { content: ''; position: absolute; inset: 3%; border-bottom: 2px solid #a52219; transform: rotate(-40deg); }
#FDB2 .fdb-redirect { position: absolute; bottom: 4%; color: #626b49; width: 25%; height: 25%; }
#FDB2 .fdb-redirect svg { display: block; width: 100%; height: 100%; }
#FDB2 .fdb-redirect.left svg { transform: scaleX(-1); }
#FDB2 .fdb-redirect.left { left: 4%; }
#FDB2 .fdb-redirect.right { right: 4%; }
#FDB2 .fdb-field:not(.fdb-own) .fdb-redirect { top: 4%; bottom: auto; transform: scaleY(-1); }
#FDB2 .fdb-target-path { outline: 2px solid #7c5511; outline-offset: -2px; }
#FDB2 .fdb-animation-landing { position: absolute; inset: 0; pointer-events: none; }
#FDB2 .fdb-empty { display: grid; place-items: center; width: 100%; height: 100%; box-sizing: border-box; border: 1px solid #46553644; border-radius: 4px; }
#FDB2 .fdb-info-wrap { position: absolute; right: 1px; bottom: 1px; }
#FDB2 .fdb-cell > .fdb-info-wrap { bottom: 32%; }
#FDB2 .fdb-info, .fdb-log .fdb-info, .fdb-discard-cards .fdb-info { display: grid; place-items: center; border-radius: 5px; border: 1px solid #ffffffb0; color: #fffdf2; background: #303a22e6; box-shadow: 0 1px 3px #0004; width: 22px; height: 22px; padding: 0; line-height: 1; font-size: 14px; position: absolute; right: 1px; bottom: 1px; }
#FDB2 .fdb-info:hover, .fdb-log .fdb-info:hover { color: #ffe19a; background: #253019; }
#FDB2 .fdb-info:focus-visible, .fdb-log .fdb-info:focus-visible { outline: 2px solid #e7b547; outline-offset: 2px; }
#FDB2 .fdb-cell .fdb-info { width: clamp(14px, calc(var(--piece) * .23), 22px); height: clamp(14px, calc(var(--piece) * .23), 22px); font-size: clamp(10px, calc(var(--piece) * .16), 14px); }
#FDB2 .fdb-cell .fdb-info::after { content: ''; position: absolute; inset: -3px; }
#FDB2 .fdb-wounds, #FDB2 .fdb-poison { position: absolute; left: 0; bottom: 0; background: #f4f4f4; color: #333; font-size: clamp(11px, calc(var(--piece) * .27), 24px); border-radius: 3px; line-height: 1; }
#FDB2 .fdb-poison { left: auto; right: 0; top: 0; bottom: auto; color: #075d1f; background: #bbf3b8; }
#FDB2 .fdb-left, #FDB2 .fdb-right { display: flex; flex-direction: column; justify-content: center; gap: 3px; font-size: .75rem; min-width: 0; }
#FDB2 .fdb-left { justify-content: flex-start; }
#FDB2 .fdb-field:not(.fdb-own) > .fdb-left { flex-direction: column-reverse; }
#FDB2 .fdb-piles { display: flex; flex: 1; flex-direction: column; justify-content: center; gap: 3px; }
#FDB2 .fdb-piles > div { display: flex; flex-direction: column; align-items: center; }
#FDB2 .fdb-zone > span { display: block; text-align: center; }
#FDB2 .fdb-small-units { gap: 2px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
#FDB2 .fdb-reserve, #FDB2 .fdb-fleeing { position: relative; aspect-ratio: 1; min-height: 48px; }
#FDB2 .fdb-reserve > button { width: 100%; height: 100%; }
#FDB2 .fdb-small-units .fdb-info { width: 20px; height: 20px; font-size: 12px; }
#FDB2 .fdb-order { position: absolute; left: 0; bottom: 0; width: calc(var(--piece) * .9); height: calc(var(--piece) * 1.35); }
#FDB2 .fdb-own .fdb-order { top: 0; bottom: auto; }
#FDB2 .fdb-order-target { width: 100%; height: 100%; border: 1px solid #4b542966; background: #eee8d477; font-size: .75rem; }
#FDB2 .fdb-regroup { position: relative; inset: auto; align-self: center; width: calc(var(--piece) * .7333); height: calc(var(--piece) * 1.1); }
#FDB2 .fdb-card-piece { display: inline-block; position: relative; height: 100%; aspect-ratio: 2 / 3; max-width: 100%; }
#FDB2 .fdb-card { display: block; width: 100%; height: 100%; }
#FDB2 .fdb-discard .fdb-card-piece { height: calc(var(--piece) * 1.1); }
#FDB2 .fdb-dice-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin: 2px 157px 2px 79px; text-align: center; font-size: clamp(12px, calc(var(--piece) * .35), 24px); line-height: 1.05; border-block: 1px solid #35441a55; }
#FDB2 .fdb-target-lanes { display: grid; grid-template-columns: repeat(6, 1fr); width: calc(var(--piece) * 3); margin: auto; padding-block: 3px; }
#FDB2 .fdb-lane-die { border: 0; padding: 0; background: transparent; cursor: pointer; justify-self: center; }
#FDB2 .fdb-lane-die .fdb-combat-die { width: clamp(12px, calc(var(--piece) * .23), 23px); height: clamp(12px, calc(var(--piece) * .23), 23px); }
#FDB2 .fdb-card-attack-anchor { position: absolute; top: 2%; right: 4%; width: 22%; height: 15%; pointer-events: none; }
#FDB2 .fdb-order-dice { position: absolute; top: 24%; left: 5%; width: 90%; display: flex; flex-wrap: wrap; gap: 2px; pointer-events: none; z-index: 3; }
#FDB2 .fdb-order-dice .fdb-combat-die { width: clamp(12px, calc(var(--piece) * .23), 25px); height: clamp(12px, calc(var(--piece) * .23), 25px); padding: 2px; }
#FDB2 .fdb-pile { gap: 2px; }
#FDB2 .fdb-stack { position: relative; border: 1px solid #6b7256; border-radius: 3px; padding: 0; width: clamp(32px, calc(var(--piece) * .65), 72px); height: clamp(48px, calc(var(--piece) * .975), 108px); background: #d3d8b5; cursor: pointer; }
.fdb-card-back { display: grid; place-items: center; width: 100%; height: 100%; border: 3px double #d6d9bf; color: #e9ebda; background: repeating-linear-gradient(45deg, #394732 0 4px, #516146 4px 8px); font-size: 24px; }
#FDB2 .fdb-card-back.empty { background: #cbd0ab; color: #87916d; }
#FDB2 .fdb-pile-count { position: absolute; right: -4px; bottom: -3px; border-radius: 4px; background: #f9faef; color: #2c3423; padding: 1px 5px; border: 1px solid #798365; font-size: 12px; }
.fdb-pile-help { padding: 12px; width: min(340px, calc(100vw - 30px)); max-height: 65vh; overflow-y: auto; }
.fdb-discard-cards { display: flex; flex-wrap: wrap; gap: 6px; }
.fdb-discard-cards .fdb-card-piece { position: relative; display: inline-block; width: 58px; height: 87px; }
.fdb-discard-cards .fdb-card { border: 0; padding: 0; width: 100%; height: 100%; }
.fdb-discard-cards img { width: 100%; height: 100%; object-fit: contain; }
#FDB2 .fdb-hand { display: flex; gap: 4px; justify-content: center; height: calc(var(--piece) * 1.6); margin-bottom: 3px; }
#FDB2 .fdb-hand:empty { display: none; }
#FDB2 .fdb-hand .fdb-card-piece { min-width: 0; }
#FDB2 .fdb-setup { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; margin-bottom: 4px; }
#FDB2 .fdb-setup:empty { display: none; }
#FDB2 .fdb-points { margin-left: auto; font-weight: bold; }
#FDB2 .fdb-unit-choices { display: flex; flex-wrap: wrap; justify-content: center; width: 100%; gap: 2px; }
#FDB2 .fdb-palette-piece { width: 36px; height: 36px; }
#FDB2 .fdb-palette-piece button { width: 100%; height: 100%; }
#FDB2.fdb-building .fdb-field:not(.fdb-own), #FDB2.fdb-building .fdb-dice-strip { display: none; }
#FDB2.fdb-building .fdb-order { display: none; }
#FDB2 .fdb-identity .symbol { display: none; }
#FDB2 .fdb-identity .basicDesc { display: flex; align-items: center; gap: 5px; }
#FDB2 .fdb-identity .playerInfoLogin { font-size: 13px; font-style: normal; white-space: normal; min-width: 0; }
#FDB2.fdb-building { max-width: 1180px; margin-inline: auto; padding: 16px; background: #e3ddc6; }
#FDB2.fdb-building .fdb-setup { justify-content: center; gap: 8px; margin-bottom: 18px; }
#FDB2.fdb-building .fdb-setup .btn { color: #faf7eb; background: #344538; border: 1px solid #344538; padding: 7px 16px; }
#FDB2.fdb-building .fdb-setup .btn:hover { background: #4e654f; }
#FDB2.fdb-building .fdb-points { color: #344538; padding: 6px 12px; background: #fffdf4; border-radius: 5px; }
#FDB2.fdb-building .fdb-unit-choices { gap: 7px; padding: 12px; background: #f6f2e5; border-radius: 8px; }
#FDB2.fdb-building .fdb-palette-piece { width: 56px; height: 56px; }
#FDB2.fdb-building .fdb-identity { margin-bottom: 12px; border-radius: 4px; padding: 6px 10px; }
#FDB2.fdb-building .fdb-triangle { background: #ffffff20; border-radius: 8px; }
@media (max-width: 700px) {
    #FDB2.fdb-building { padding: 6px; }
    #FDB2.fdb-building .fdb-palette-piece { width: 40px; height: 40px; }
}
#FDB2.fdb-narrow { max-width: calc(var(--piece) * 9.5 + 20px); }
#FDB2.fdb-narrow .fdb-field { grid-template-columns: minmax(0, 1fr); }
#FDB2.fdb-narrow .fdb-own > .fdb-left { grid-row: 2; }
#FDB2.fdb-narrow .fdb-own > .fdb-right { grid-row: 3; }
#FDB2.fdb-narrow .fdb-own > .fdb-battalions { grid-row: 4; }
#FDB2.fdb-narrow .fdb-field:not(.fdb-own) > .fdb-battalions { grid-row: 1; }
#FDB2.fdb-narrow .fdb-field:not(.fdb-own) > .fdb-right { grid-row: 2; }
#FDB2.fdb-narrow .fdb-field:not(.fdb-own) > .fdb-left { grid-row: 3; }
#FDB2.fdb-narrow .fdb-field > .fdb-left { flex-direction: row; align-items: center; gap: 6px; }
#FDB2.fdb-narrow .fdb-identity { max-width: 85px; }
#FDB2.fdb-narrow .fdb-piles { flex-direction: row; align-items: center; justify-content: space-around; }
#FDB2.fdb-narrow .fdb-right { grid-row: 4; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
#FDB2.fdb-narrow .fdb-small-units { grid-template-columns: repeat(3, 48px); justify-content: center; }
#FDB2.fdb-narrow .fdb-left .fdb-discard { flex-direction: row; gap: 3px; }
#FDB2.fdb-narrow .fdb-discard .fdb-card-piece { height: 32px; }
#FDB2.fdb-narrow .fdb-regroup { height: 40px; width: 60px; }
#FDB2.fdb-narrow .fdb-dice-strip { margin-inline: 0; }
.fdb-popover { --bs-popover-max-width: min(370px, calc(100vw - 24px)); --bs-popover-border-color: #a6ad8c; --bs-popover-body-color: #293021; }
.fdb-popover .popover-body { padding: 0; }
.fdb-unit-help { width: min(360px, calc(100vw - 26px)); max-height: min(560px, 68vh); overflow-y: auto; background: #fff; font: 13px/1.35 system-ui, sans-serif; }
.fdb-help-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 9px; padding: 10px; background: #eef0e2; border-bottom: 1px solid #d9ddcc; }
.fdb-help-header > img { width: 36px; height: 36px; object-fit: contain; }
.fdb-help-title { flex: 1; font-size: 13px; }
.fdb-help-title > strong, .fdb-help-title > small { display: block; }
.fdb-help-title > small { color: #68715a; font-size: 11px; margin-top: 3px; }
.fdb-help-header > .fdb-help-unit-image { width: 64px; height: 64px; }
.fdb-help-switch { border-top: 1px solid #edf0e6; padding: 3px 8px; }
.fdb-help-switch .btn { font-size: 12px; padding: 3px; }
.fdb-help-header .btn-close { flex: 0 0 auto; font-size: 10px; }
.fdb-help-rows { padding: 3px 10px; }
.fdb-help-row { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid #edf0e6; }
.fdb-help-row:last-child { border-bottom: 0; }
.fdb-help-description > small { display: block; margin-top: 3px; color: #6b735f; font-size: 11px; }
.fdb-help-icon { display: flex; justify-content: center; align-items: center; min-height: 32px; color: #657050; font-size: 24px; }
.fdb-help-icon img { width: 34px; height: 34px; object-fit: contain; }
.fdb-help-icon .bi-heart-fill { color: #bc5863; }
.fdb-help-icon .golden { color: #ac811b; }
.fdb-help-formation { position: relative; width: 40px; height: 30px; }
.fdb-help-formation > span { position: absolute; width: 8px; height: 8px; border: 1px solid #7b8569; border-radius: 1px; }
.fdb-help-formation .filled { background: #657050; }
.fdb-help-regroups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.fdb-help-regroups > span { display: flex; gap: 4px; align-items: center; font-size: 10px; }
.fdb-help-regroups img { width: 25px; height: 25px; object-fit: contain; }
.fdb-unit-help > footer { padding: 8px 10px; background: #f6f7f1; color: #68715a; font-size: 11px; }
/* Framework log styles target generic img/button rules; keep game graphics scoped and explicit. */
#log .fdb-log .fdb-card-piece { display: inline-block; position: relative; width: 45px; height: 68px; vertical-align: middle; margin: 1px 3px; }
#log .fdb-log .fdb-card { width: 100%; height: 100%; background: transparent; border: 0; padding: 0; }
#log .fdb-log .fdb-card img { display: block; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; margin: 0; }
#log .fdb-log .fdb-coord { padding: 0 3px; border: 0; color: #214b6b; background: #e9f2f6; text-decoration: underline; cursor: pointer; }
#log .fdb-log .fdb-die { display: inline-block; font-size: 22px; line-height: 1; padding: 1px; color: #544100; }
#log .fdb-log .fdb-die.type2 { color: #a82520; }
#log .fdb-log .fdb-die.type3 { color: #167438; }
#log .fdb-battle { display: block; container-type: inline-size; margin-top: 8px; padding: 8px; background: #f5f2e6; color: #25271a; border: 1px solid #939779; border-radius: 4px; }
#log .fdb-battle-title { display: block; padding-bottom: 6px; }
#log .fdb-battle-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
#log .fdb-battle-section { display: block; min-width: 0; margin-block: 4px; padding: 6px; background: #ffffffa0; border: 1px solid #c4c6b1; }
#log .fdb-battle-section > strong { display: block; }
#log .fdb-battle-rows { display: block; }
#log .fdb-battle-rows > .fdb-log { display: block; padding-block: 4px; overflow-wrap: anywhere; }
@container (max-width: 540px) { #log .fdb-battle-columns { grid-template-columns: minmax(0, 1fr); } }
.fdb-page #log .move.color0 { background: #35669d; color: white; }
.fdb-page #log .move.color1 { background: #b34437; color: white; }
#FDB2 .fdb-location { outline: 3px solid #1c344a; outline-offset: 2px; z-index: 3; }
@media (prefers-reduced-motion: reduce) { #FDB2 * { transition: none; } }

#log .fdb-card-resolution { display: block; padding: 5px 0; border-bottom: 1px solid #d9ddc9; }
#log .fdb-card-resolution > .fdb-log { display: block; padding-block: 3px; }
#log .fdb-dice-calculation { display: block; font-weight: 600; font-size: 12px; }
#log .fdb-rolled-dice, #log .fdb-hit-roll { display: block; }
#log .fdb-hit-roll { padding-block: 3px; }
#log .fdb-hit-roll > small { margin-left: 5px; }
#log.fdb-log-narrow .fdb-battle-columns { grid-template-columns: minmax(0, 1fr); }

#FDB2.fdb-narrow .fdb-own > .fdb-right { padding-top: 0; }

#FDB2.fdb-narrow .fdb-zones { display: contents; }

#FDB2 .fdb-small-units .fdb-empty { border: 1px solid #667049; background: #e8e4cd55; }
#FDB2.fdb-narrow .fdb-right { grid-template-columns: 1fr 1fr; }
#FDB2.fdb-narrow .fdb-right .fdb-zone:first-child { grid-column: 1; grid-row: 2; }
#FDB2.fdb-narrow .fdb-right .fdb-zone:last-child { grid-column: 2; grid-row: 2; }
#FDB2.fdb-narrow .fdb-regroup { grid-column: 1 / -1; grid-row: 3; justify-self: center; }

#log .fdb-log .fdb-unit-tile { display: inline-block; position: relative; width: 45px; height: 45px; vertical-align: middle; margin: 1px 3px; }
#log .fdb-log .fdb-unit-tile > img { display: block; width: 100%; height: 100%; margin: 0; }

#FDB2:has(.fdb-tools) > .fdb-hand { padding-right: 36px; box-sizing: border-box; }
#FDB2.fdb-landscape .fdb-regroup { width: 60px; height: 40px; }
#FDB2.fdb-landscape .fdb-zones { gap: 2px; }
#FDB2.fdb-landscape .fdb-identity { min-height: 20px; padding-inline: 3px; }
#FDB2.fdb-landscape .fdb-stack { width: 32px; height: 48px; }
#FDB2.fdb-landscape .fdb-discard .fdb-card-piece { height: 48px; }

#FDB2 .fdb-triangle { margin-block: 0; }
#FDB2 .fdb-own > .fdb-battalions { align-items: end; }
#FDB2 .fdb-field:not(.fdb-own) > .fdb-battalions { align-items: start; }
#FDB2.fdb-landscape { max-width: calc(var(--piece) * 12.5 + 88px); }
#FDB2.fdb-landscape .fdb-field { grid-template-columns: 76px minmax(0, 1fr) calc(var(--piece) * 3 + 4px); }
#FDB2.fdb-landscape .fdb-reserve, #FDB2.fdb-landscape .fdb-fleeing { min-height: 0; height: var(--piece); }
#FDB2.fdb-landscape .fdb-dice-strip { margin-right: calc(var(--piece) * 3 + 7px); }
#FDB2:has(.fdb-hand:empty) .fdb-own > .fdb-right { padding-top: 32px; }

/* Keep one battlefield scroll owner, including short landscape viewports. */
.fdb-page #gamePage #content { overflow-y: hidden; }
.fdb-page #gamePage #game { min-height: 0; flex: 1 1 auto; overscroll-behavior-y: contain; }

/* Keep hand and formation together even when side rails are taller. */
#FDB2 .fdb-own > .fdb-battalions { align-content: end; }
#FDB2 .fdb-hand { grid-column: 1 / -1; grid-row: 1; }
#FDB2 .fdb-own .fdb-battalion { grid-row: 2; }
#FDB2 .fdb-battalions > .fdb-hand { padding-right: 0; }
#FDB2 .fdb-fleeing-zone { position: relative; padding-top: 3px; }
#FDB2 .fdb-fleeing-zone > .fdb-small-units { margin-top: 4px; }
#FDB2 .fdb-fleeing-zone > .fdb-regroup { position: relative; display: inline-block; width: 28px; height: 42px; vertical-align: middle; margin: 2px 0; }
#FDB2 .fdb-fleeing-zone > span:first-child { display: inline-block; vertical-align: middle; margin-right: 5px; }
#FDB2.fdb-narrow .fdb-fleeing-zone > .fdb-regroup { grid-column: auto; grid-row: auto; }
#FDB2.fdb-compact-info .fdb-info, #log .fdb-log .fdb-info { opacity: 0; width: 14px; height: 14px; font-size: 10px; }
#FDB2.fdb-compact-info :is(.fdb-card-piece, .fdb-unit-tile, .fdb-cell, .fdb-reserve, .fdb-fleeing):is(:hover, :focus-within) .fdb-info,
#log .fdb-log :is(.fdb-card-piece, .fdb-unit-tile):is(:hover, :focus-within) .fdb-info,
#FDB2.fdb-compact-info .fdb-info[aria-expanded="true"] { opacity: 1; }
#FDB2 .fdb-card-piece > .fdb-info, .fdb-log .fdb-card-piece > .fdb-info, .fdb-discard-cards .fdb-card-piece > .fdb-info { top: 50%; bottom: auto; right: 1px; transform: translateY(-50%); }
#FDB2 .fdb-card-piece:is(:hover, :focus-within) { z-index: 4; }

#FDB2.fdb-narrow { min-width: calc(var(--piece) * 9 + 20px); }
#FDB2 .fdb-fleeing-zone { display: grid; grid-template-columns: repeat(3, minmax(0, 3fr)) minmax(0, 2fr); column-gap: 2px; align-items: center; }
#FDB2 .fdb-fleeing-zone > span:first-child { grid-column: 1 / -1; text-align: center; margin: 0; }
#FDB2 .fdb-fleeing-zone > .fdb-small-units { grid-column: 1 / 4; grid-row: 2; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
#FDB2 .fdb-fleeing-zone > .fdb-regroup,
#FDB2.fdb-narrow .fdb-fleeing-zone > .fdb-regroup { grid-column: 4; grid-row: 2; width: 100%; height: auto; aspect-ratio: 2 / 3; align-self: stretch; margin: 0; }
#FDB2 .fdb-fleeing-zone .fdb-fleeing { min-height: 0; height: auto; }
#FDB2 .fdb-lane-die .fdb-combat-die { width: clamp(16px, calc(var(--piece) * .27), 26px); height: clamp(16px, calc(var(--piece) * .27), 26px); }
/* Army selection keeps names readable and groups the construction palette by cost. */
#FDB2 .fdb-matchup { display: flex; width: 100%; justify-content: center; gap: 32px; padding: 12px; background: #344538; color: #fffdf4; border-radius: 8px; }
#FDB2 .fdb-matchup > div { display: flex; flex-direction: column; text-align: center; gap: 3px; }
#FDB2.fdb-building .fdb-army { font-family: system-ui, sans-serif; font-size: 18px; font-weight: 400; background: #fffdf4; color: #26372c; border-color: #a69b77; }

#FDB2 .fdb-unit-group h3 { font-size: 14px; margin: 0 0 8px; color: #344538; }
#FDB2 .fdb-unit-group > div { display: flex; flex-wrap: wrap; gap: 8px; }
#FDB2 .fdb-unit-group { flex: 1 1 130px; }
#FDB2.fdb-building .fdb-palette-piece { position: relative; display: inline-block; width: 64px; height: 82px; padding-bottom: 18px; }
#FDB2 .fdb-copy-count { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; font-size: 12px; }
#FDB2 .fdb-palette-piece > .fdb-target:disabled { opacity: .55; }
#FDB2 .fdb-palette-piece > .fdb-info { width: 22px; height: 22px; }
#FDB2.fdb-building .fdb-army[aria-pressed="true"] { box-shadow: inset 0 -4px #b77b27; }
#FDB2.fdb-building .fdb-palette-piece > .fdb-info { bottom: 20px; opacity: 1; font-size: 14px; z-index: 1; }

#FDB2.fdb-building.fdb-narrow { min-width: 0; max-width: 100%; }
#FDB2.fdb-building .fdb-own > .fdb-left, #FDB2.fdb-building .fdb-fleeing-zone { display: none; }
#FDB2.fdb-building .fdb-field { grid-template-columns: minmax(0, 1fr) 154px; }
#FDB2.fdb-building.fdb-narrow .fdb-field { grid-template-columns: minmax(0, 1fr); }
#FDB2.fdb-building .fdb-matchup { box-sizing: border-box; min-width: 0; }

/* Match the original card-and-description help while retaining touch access. */
#FDB2.fdb-building .fdb-build, #FDB2.fdb-building .fdb-clear { font-family: system-ui, sans-serif; font-size: 18px; font-weight: 400; }
.fdb-popover { --bs-popover-max-width: min(440px, calc(100vw - 16px)); --bs-popover-border-color: #82755d; }
.fdb-unit-help { display: grid; grid-template-columns: 116px minmax(0, 1fr); width: min(430px, calc(100vw - 18px)); background: #fae3c1; color: #2d271d; padding: 8px; gap: 0 10px; box-sizing: border-box; }
.fdb-help-header { display: contents; }
.fdb-help-header > img, .fdb-help-header > .fdb-help-unit-image { grid-column: 1; grid-row: 1 / span 3; align-self: start; position: sticky; top: 0; width: 116px; height: auto; max-height: none; border-radius: 4px; box-shadow: 0 2px 5px #392a2055; }
.fdb-help-title { grid-column: 2; padding-right: 20px; font-size: 13px; }
.fdb-help-title > strong { font-family: Georgia, serif; font-size: 15px; }
.fdb-help-title > small { color: #65533c; }
.fdb-help-header .btn-close { position: absolute; top: 9px; right: 9px; }
.fdb-help-rows { grid-column: 2; padding: 3px 0; min-width: 0; }
.fdb-help-row { grid-template-columns: 27px minmax(0, 1fr); gap: 6px; padding: 5px 0; border-color: #cdb590; }
.fdb-help-icon { min-height: 24px; font-size: 20px; }
.fdb-help-icon img { width: 26px; height: 26px; }
.fdb-help-description > small { color: #65533c; }
.fdb-unit-help > footer, .fdb-help-switch { grid-column: 1 / -1; background: transparent; border-top: 1px solid #cdb590; color: #65533c; }
@media (max-width: 460px) {
    .fdb-unit-help { grid-template-columns: 96px minmax(0, 1fr); gap: 0 8px; font-size: 12px; }
    .fdb-help-header > img { width: 96px; }
}

/* Legacy content: plain class/attack lines followed by named powers. */
.fdb-help-power { margin-top: 12px; }
.fdb-help-power > strong { display: block; }
.fdb-help-regroups { display: block; }
.fdb-help-regroups > img { display: inline-block; width: 45px; height: 45px; margin: 5px 4px 0 0; }
.fdb-help-title > strong { font-family: inherit; font-size: 13px; }
.fdb-help-header > img { grid-row: 1 / span 2; }
.fdb-unit-help { grid-template-rows: min-content 1fr; }

#FDB2.fdb-building .fdb-faction { font-family: system-ui, sans-serif; font-weight: 400; }

/* Align the tutorial entry with the inset matchup header during army selection. */
#FDB2.fdb-building .fdb-tools { top: 22px; right: 22px; }
#FDB2.fdb-building .fdb-matchup { padding-inline: 42px; }
#FDB2.fdb-building .fdb-tutorial-link { color: #fffdf4; border-color: #ffffff80; }
@media (max-width: 700px) {
    #FDB2.fdb-building .fdb-tools { top: 12px; right: 12px; }
}
