/* 5 Towers visual presentation & responsive layout (FW2v2BS, no :has()) */

#mainPage .playerData.color0, #mainPage .ft-player-tab.color0 { --theme-color: #1d6fd8; --theme-rgb: 29, 111, 216; }
#mainPage .playerData.color1, #mainPage .ft-player-tab.color1 { --theme-color: #d99b16; --theme-rgb: 217, 155, 22; }
#mainPage .playerData.color2, #mainPage .ft-player-tab.color2 { --theme-color: #c93535; --theme-rgb: 201, 53, 53; }
#mainPage .playerData.color3, #mainPage .ft-player-tab.color3 { --theme-color: #1d9a6c; --theme-rgb: 29, 154, 108; }
#mainPage .playerData.color4, #mainPage .ft-player-tab.color4 { --theme-color: #7b3fb8; --theme-rgb: 123, 63, 184; }
#mainPage .playerData.color5, #mainPage .ft-player-tab.color5 { --theme-color: #d4621c; --theme-rgb: 212, 98, 28; }

#game {
    background-color: #e6f5fd;
    background-image:
        radial-gradient(ellipse 36% 18% at 15% 14%, rgba(255, 255, 255, 0.35) 0%, transparent 70%),
        radial-gradient(ellipse 42% 20% at 82% 10%, rgba(255, 255, 255, 0.28) 0%, transparent 70%),
        linear-gradient(to bottom, #4b94d8 0%, #c8eafb 65%, #e6f5fd 100%);
    background-repeat: no-repeat;
    overflow-x: hidden;
}

#board {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 12px 4px;
    box-sizing: border-box;
}

.ft-final-round-banner {
    background: linear-gradient(135deg, #c62828 0%, #8e0000 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 5px 16px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 4px 12px rgba(142, 0, 0, 0.3);
    margin-bottom: 8px;
    text-align: center;
}

.centerArea {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 8px;
    box-sizing: border-box;
    width: 100%;
    max-width: min(1440px, 96%);
}

.deckContainer,
.discardContainer {
    flex: 0 0 auto;
    width: var(--center-card-width, 84px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ft-pile-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #0d2b45;
    text-align: center;
    line-height: 1.15;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.openCardsContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

.ft-card {
    width: var(--center-card-width, 84px);
    position: relative;
    display: inline-block;
    border-radius: 7px;
    cursor: default;
}

.cardImg {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 7px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ft-deck-empty,
.ft-discard-empty,
.ft-destroyed-empty,
.ft-empty-tower {
    opacity: 0.38;
}

#game .ft-pile-btn {
    padding: 0;
    border: none;
    background: transparent;
    position: relative;
    display: inline-block;
    cursor: default;
    border-radius: 7px;
}

#game .ft-pile-btn:focus-visible {
    outline: 2px solid #0284c7;
    outline-offset: 2px;
}

.deck {
    position: relative;
    display: inline-block;
    width: var(--center-card-width, 84px);
    line-height: 0;
}

.ft-pile-btn .ft-card {
    width: 100%;
}

.has-popover,
.active,
#game .ft-pile-btn.has-popover,
#game .ft-pile-btn.active {
    cursor: pointer;
}

/* Distinct static highlights for available targets vs selected partial step (U-03) */
.ft-card.active {
    outline: 3px solid #1565c0;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.85), 0 6px 14px rgba(21, 101, 192, 0.45);
}

.ft-card.active:hover .cardImg {
    transform: translateY(-4px);
}

.ft-card.is-selected {
    outline: 3px dashed #e65100;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(255, 243, 224, 0.95), 0 6px 14px rgba(230, 81, 0, 0.45);
}

.ft-pile-btn.active {
    outline: 3px solid #1565c0;
    outline-offset: 3px;
}

.deckSize {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: #fff;
    color: #111;
    font-weight: 700;
    font-size: 0.78rem;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 999px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    user-select: none;
    pointer-events: none;
}

.deck .deckSize,
.discard .deckSize {
    --pile-badge-size: clamp(22px, calc(var(--center-card-width, 84px) * 0.36), 38px);
    top: 19%;
    left: 50%;
    bottom: auto;
    right: auto;
    transform: translate(-50%, -50%);
    min-width: var(--pile-badge-size);
    height: var(--pile-badge-size);
    padding: 0 6px;
    font-size: clamp(13px, calc(var(--center-card-width, 84px) * 0.19), 20px);
    font-weight: 800;
    line-height: 1;
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
    border: 2px solid rgba(15, 23, 42, 0.16);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.32);
    z-index: 3;
}

.deckPassBadge {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    padding: 1px 6px;
    min-height: 18px;
    border-radius: 999px;
    background: rgba(224, 242, 254, 0.96);
    color: #0c4a6e;
    border: 1.5px solid #38bdf8;
    font-weight: 800;
    font-size: clamp(9.5px, calc(var(--center-card-width, 84px) * 0.135), 12.5px);
    line-height: 1.2;
    white-space: nowrap;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.32);
    z-index: 3;
    user-select: none;
    pointer-events: none;
}

.deckPassBadge.is-second-pass {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
}

.ft-pile-sublabel {
    font-size: clamp(9.5px, calc(var(--center-card-width, 84px) * 0.13), 11.5px);
    font-weight: 700;
    color: #0c4a6e;
    background: rgba(224, 242, 254, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.65);
    border-radius: 999px;
    padding: 1px 6px;
    line-height: 1.2;
    white-space: nowrap;
    text-align: center;
}

.ft-pile-sublabel.is-second-pass {
    color: #92400e;
    background: rgba(254, 243, 199, 0.95);
    border-color: #f59e0b;
}

/* Fixed-height Action Tray prevents vertical layout shift ("Gezappel") */
.actionTray {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 6px;
    width: 100%;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    padding: 0 8px;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
}

.actionTray > :first-child {
    margin-left: auto;
}

.actionTray > :last-child {
    margin-right: auto;
}

#game.ft-narrow .actionTray {
    flex-wrap: wrap;
    justify-content: center;
    height: auto;
    min-height: 44px;
    max-height: none;
    overflow-x: visible;
    gap: 5px;
    padding: 4px 4px;
}

#game.ft-narrow .actionTray > :first-child {
    margin-left: 0;
}

#game.ft-narrow .actionTray > :last-child {
    margin-right: 0;
}

#game.ft-narrow .bidButton {
    min-width: 36px;
    height: 36px;
    padding: 0 11px;
    font-size: 0.88rem;
}

#game.ft-narrow .ft-rebuild-chip {
    padding: 2px 10px 2px 6px;
}

#game.ft-narrow .ft-powers-btn,
#game.ft-narrow .ft-final-pill {
    height: 30px;
    padding: 0 9px;
    font-size: 0.76rem;
}

#game.ft-narrow .ft-tray-idle {
    max-width: 100%;
    height: auto;
    min-height: 32px;
    padding: 4px 12px;
    white-space: normal;
    text-align: center;
}

.ft-powers-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 11px;
    border-radius: 999px;
    background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(76, 29, 149, 0.28);
    flex: 0 0 auto;
}

.ft-powers-btn:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
}

.ft-tutorial-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 11px;
    border-radius: 999px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(3, 105, 161, 0.28);
    flex: 0 0 auto;
    cursor: pointer;
}

.ft-tutorial-link:hover,
.ft-tutorial-link:focus-visible {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: #fff;
    text-decoration: none;
}

@media (max-width: 440px) {
    .ft-tutorial-link {
        padding: 0 9px;
    }

    .ft-tutorial-link-lbl {
        display: none;
    }
}

.ft-tray-idle {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.14);
    color: #0f172a;
    font-weight: 600;
    font-size: 0.86rem;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.ft-final-pill {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #c62828 0%, #8e0000 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(142, 0, 0, 0.28);
    flex: 0 0 auto;
}

.bidButton {
    flex: 0 0 auto;
    min-width: 42px;
    height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    background: linear-gradient(135deg, #1976d2 0%, #0d47a1 100%);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: default;
    white-space: nowrap;
}

.bidButton.active {
    cursor: pointer;
}

.bidButton.active:hover {
    background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
    transform: translateY(-1px);
}

.bidButton.buttonPass {
    background: linear-gradient(135deg, #e64a19 0%, #bf360c 100%);
}

.bidButton.buttonPass.active:hover {
    background: linear-gradient(135deg, #ff5722 0%, #d84315 100%);
}

.ft-rebuild-chip {
    padding: 2px 12px 2px 6px;
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
}

.ft-rebuild-chip.active:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
}

.ft-rebuild-chip.is-selected {
    outline: 2px solid #f59e0b;
    outline-offset: 1px;
}

.ft-rebuild-thumb {
    width: 22px;
    height: 34px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* Player Panels */
#game .playerData {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    margin: 0;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-top: 5px solid var(--theme-color);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0.5) 100%);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
    width: var(--player-panel-width, calc(5 * var(--tower-card-width, 64px) + 4 * var(--tower-gap, 10px) + 2 * var(--tower-padding, 16px)));
    max-width: calc(100vw - 24px);
    overflow: hidden;
}

#game .playerData.isOnTurn,
#game .playerData.isOnTurnAbsolute {
    border-color: var(--theme-color);
    box-shadow: 0 0 0 2px #fff, 0 0 14px 2px var(--theme-color);
}

#game.ft-tab-mode #playerData {
    flex: 0 0 auto;
    padding-bottom: 6px;
}

#game.ft-tab-mode #playerData > .playerData.ft-tab-hidden {
    display: none;
}

#game.ft-tab-mode .towerArea {
    min-height: 0;
}

.ft-player-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 6px;
    padding: 2px 10px 12px;
    width: 100%;
    box-sizing: border-box;
}

.ft-player-tab {
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1 1 92px;
    max-width: 180px;
    min-width: 0;
    min-height: 40px;
    padding: 5px 8px;
    border-radius: 10px;
    border: 1.5px solid rgba(15, 23, 42, 0.16);
    border-top: 4px solid var(--theme-color, #1d6fd8);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.62) 100%);
    color: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.1);
    cursor: pointer;
    text-align: center;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.ft-player-tab:hover {
    background: rgba(255, 255, 255, 0.94);
    transform: translateY(-1px);
}

.ft-player-tab:focus-visible {
    outline: 2px solid #0284c7;
    outline-offset: 2px;
}

.ft-player-tab.is-active-tab {
    background: linear-gradient(135deg, rgba(var(--theme-rgb, 29, 111, 216), 0.16) 0%, #ffffff 70%);
    border-color: var(--theme-color, #1d6fd8);
    box-shadow: 0 0 0 2px var(--theme-color, #1d6fd8), 0 4px 10px rgba(15, 23, 42, 0.16);
    font-weight: 700;
}

.ft-player-tab-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    max-width: 100%;
    min-width: 0;
}

.ft-player-tab-star {
    color: #b45309;
    font-size: 0.72rem;
    flex: 0 0 auto;
}

.ft-player-tab-name {
    font-size: 0.78rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.ft-player-tab-score {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0 5px;
    border-radius: 999px;
    background: #0f172a;
    color: #fff;
    flex: 0 0 auto;
    line-height: 1.4;
}

.ft-player-tab-status {
    font-size: 0.67rem;
    font-weight: 700;
    color: #0c4a6e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

#game .playerDataBasic {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    min-height: 68px;
    background: linear-gradient(135deg, rgba(var(--theme-rgb, 29, 111, 216), 0.16) 0%, rgba(255, 255, 255, 0.9) 65%), rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

.ft-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 10px;
    border: 2px solid var(--theme-color);
    background: linear-gradient(rgba(var(--theme-rgb, 29, 111, 216), 0.18), rgba(var(--theme-rgb, 29, 111, 216), 0.18)), #ffffff;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.ft-avatar.is-bot {
    font-size: 1.25rem;
    color: var(--theme-color);
}

.ft-avatar-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ft-player-ident {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
}

#game .playerDataBasic .basicDesc {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding-left: 0;
    float: none;
}

#game .playerDataBasic .flag {
    width: 21px;
    flex: 0 0 21px;
    display: inline-block;
    line-height: 0;
}

#game .playerDataBasic .flag .fflag {
    width: 100%;
    margin: 0;
    border-radius: 2px;
}

.ft-bot-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 5px;
    border-radius: 4px;
    background: #e2e8f0;
    color: #334155;
    border: 1px solid #cbd5e1;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    flex: 0 0 auto;
}

#game .playerDataBasic .playerInfoLogin {
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: normal;
    font-weight: 700;
    font-size: 0.96rem;
    color: #0f172a;
}

.ft-round-star {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.2;
    flex: 0 0 auto;
    white-space: nowrap;
}

.ft-status-row {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    min-height: 22px;
}

.ft-bid-badge,
.ft-pair-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0c4a6e;
    border: 1px solid #7dd3fc;
    white-space: nowrap;
}

.ft-bid-badge.is-passed {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

.ft-bid-badge.is-leading {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
}

.ft-bid-badge.is-building {
    background: #dcfce7;
    color: #166534;
    border-color: #4ade80;
}

.ft-pair-badge {
    background: #fce7f3;
    color: #9d174d;
    border-color: #f9a8d4;
}

.ft-player-right {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    flex: 0 0 auto;
    margin-left: auto;
}

#game .playerDataBasic .ft-score-plaque {
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 4px 10px;
    border-radius: 10px;
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
    color: #fff;
    user-select: none;
    line-height: 1.05;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

#game .playerDataBasic .ft-score-plaque:hover {
    border-color: rgba(255, 255, 255, 0.55);
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.3);
    transform: translateY(-1px);
}

#game .playerDataBasic .ft-score-plaque:focus-visible {
    outline: 2px solid #0284c7;
    outline-offset: 2px;
}

.ft-score-val {
    font-size: 1.05rem;
    font-weight: 800;
}

.ft-score-lbl {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    opacity: 0.82;
    text-transform: uppercase;
}

.destroyedContainer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.1);
}

.destroyedContainer .ft-pile-btn {
    width: 30px;
    min-width: 28px;
}

.destroyedContainer .deckSize {
    top: -5px;
    right: -5px;
    bottom: auto;
    left: auto;
    min-width: 18px;
    height: 18px;
    font-size: 0.68rem;
    padding: 0 4px;
}

.destroyedContainer .deckSize.minus {
    color: #b91c1c;
}

/* 5 Towers Grid */
#game .playerDataDetail {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 0;
    min-height: 0;
}

.towerArea {
    flex: 1 1 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--tower-gap, 10px);
    padding: 14px var(--tower-padding, 16px) 28px;
    box-sizing: border-box;
    min-height: calc(var(--tower-card-width, 64px) * 1.54 * (1 + var(--tower-step, 0.48) * (var(--max-tower-cards, 3) - 1)) + 46px);
}

.tower {
    position: relative;
    width: var(--tower-card-width, 64px);
    flex: 0 0 auto;
    --card-height: calc(var(--tower-card-width, 64px) * 1.54);
    height: calc(var(--card-height) + (var(--num-cards, 1) - 1) * var(--card-height) * var(--tower-step, 0.48));
}

.towerCards {
    position: relative;
    width: 100%;
    height: 100%;
}

.towerCard {
    position: absolute;
    left: 0;
    bottom: 0;
    transform: translateY(calc(-100% * var(--tower-step, 0.48) * var(--index, 0)));
    z-index: var(--index, 0);
    width: 100%;
}

.towerScore {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 24px;
    text-align: center;
    font-weight: 700;
    font-size: 0.78rem;
    color: #fff;
    background: rgba(15, 23, 42, 0.85);
    border-radius: 999px;
    padding: 1px 6px;
    user-select: none;
    pointer-events: none;
}

.towerScore.highest {
    background: linear-gradient(135deg, #ffd54f 0%, #f59e0b 100%);
    color: #3e2723;
    border: 1px solid rgba(255, 255, 255, 0.8);
    font-weight: 800;
}

.ft-sand-target {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
    border: 2px solid #fff;
    background: #1565c0;
    color: #fff;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.ft-sand-target-top {
    top: -10px;
}

.ft-sand-target-bottom {
    bottom: -2px;
}

.tower.ft-log-highlight {
    outline: 3px solid #f59e0b;
    outline-offset: 4px;
    border-radius: 6px;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.7);
}

/* Bootstrap Popover Styling (U-13) */
.ft-popover {
    max-width: min(400px, 94vw);
    border: 2px solid #0284c7;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.25);
}

.ft-popover.ft-popover-deck {
    max-width: min(680px, 94vw);
}

.ft-popover-deck .ft-pile-grid {
    max-height: 55vh;
}

.ft-popover-deck .ft-pile-row {
    gap: 3px;
}

.ft-popover-deck .ft-pile-card {
    width: 36px;
}

.ft-powers-overview {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ft-powers-overview-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.ft-powers-overview-thumbs {
    display: flex;
    gap: 3px;
    flex: 0 0 auto;
}

.ft-powers-overview-img {
    width: 24px;
    height: auto;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.ft-powers-overview-text {
    font-size: 0.8rem;
    line-height: 1.3;
    color: #0f172a;
}

.ft-popover .popover-header {
    background: #e0f2fe;
    color: #0c4a6e;
    font-weight: 700;
    padding: 6px 10px;
}

.ft-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ft-popover-close {
    font-size: 0.7rem;
}

.ft-pile-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 60vh;
    overflow-y: auto;
}

.ft-pile-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.ft-pile-card {
    width: 48px;
}

.ft-score-breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: min(236px, 78vw);
    font-variant-numeric: tabular-nums;
}

.ft-score-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.82rem;
    line-height: 1.3;
    color: #0f172a;
}

.ft-score-row-main {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.ft-score-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 9px;
    border: 1px solid rgba(15, 23, 42, 0.25);
}

.ft-score-dot-0 { background: #16a34a; }
.ft-score-dot-1 { background: #64748b; }
.ft-score-dot-2 { background: #d97706; }
.ft-score-dot-3 { background: #7c3aed; }
.ft-score-dot-4 { background: #db2777; }

.ft-score-row-label {
    font-weight: 600;
}

.ft-score-row-meta {
    font-size: 0.74rem;
    color: #475569;
}

.ft-score-row-val {
    font-weight: 700;
    flex: 0 0 auto;
    text-align: right;
}

.ft-score-row-val.is-bonus {
    color: #15803d;
}

.ft-score-row-val.is-minus {
    color: #b91c1c;
}

.ft-score-row-val.is-zero {
    color: #64748b;
    font-weight: 600;
}

.ft-score-divider {
    height: 1px;
    background: rgba(15, 23, 42, 0.12);
    margin: 3px 0;
}

.ft-score-row-total {
    margin-top: 3px;
    padding-top: 5px;
    border-top: 2px solid rgba(15, 23, 42, 0.22);
    font-size: 0.9rem;
    font-weight: 800;
}

.ft-score-row-total .ft-score-row-label,
.ft-score-row-total .ft-score-row-val {
    font-weight: 800;
}

@media (max-width: 520px) {
    #board {
        padding: 6px 6px 2px;
    }

    .centerArea {
        gap: 6px;
        padding: 4px;
    }

    .openCardsContainer {
        gap: 4px;
    }

    #playerData {
        padding: 4px 6px 10px;
        gap: 8px;
    }

    #game .playerDataBasic {
        padding: 6px 8px;
        gap: 6px;
        min-height: 58px;
    }

    .ft-avatar {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    .ft-player-right {
        gap: 12px;
    }

    #game .playerDataBasic .ft-score-plaque {
        padding: 3px 7px;
        min-width: 38px;
    }
}
