.forts-screen {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    min-height: 100vh;
    min-height: 100dvh;
    margin: auto;
    padding: 18px 12px 24px;
    background:
        radial-gradient(circle at 50% 31%, #9d6d2630, transparent 30%),
        linear-gradient(180deg, #111722, #0a0e15 72%);
}

.forts-screen[hidden] {
    display: none;
}

.forts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.forts-eyebrow {
    color: #d5a65a;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.17em;
}

.forts-header h1 {
    margin: 3px 0 0;
    font: 700 clamp(24px, 7vw, 34px) Georgia, serif;
}

.forts-leave {
    padding: 8px 11px;
    border: 1px solid #c99c5366;
    border-radius: 9px;
    color: #ead3a7;
    background: #0b1018d9;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.forts-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    overflow: hidden;
    border: 1px solid #ffffff12;
    border-radius: 12px;
    background: #ffffff0a;
}

.forts-summary div {
    display: grid;
    gap: 2px;
    padding: 7px 4px;
    text-align: center;
}

.forts-summary div + div {
    border-left: 1px solid #ffffff0d;
}

.forts-summary small {
    color: #8f99a6;
    font-size: 11px;
}

.forts-summary strong {
    color: #f0d18b;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.forts-summary p {
    grid-column: 1 / -1;
    margin: 0;
    padding: 6px 8px;
    border-top: 1px solid #ffffff0d;
    color: #d9d2c4;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.fort-map {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, 108px);
    gap: 10px;
    margin-top: 10px;
    padding: 8px;
    overflow: hidden;
    border: 1px solid #94703d55;
    border-radius: 16px;
    background:
        radial-gradient(circle at center, #c6923c1f, transparent 32%),
        linear-gradient(135deg, #131a23e8, #090d14f2);
    box-shadow: inset 0 0 45px #00000066;
}

.fort-map::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.16;
    pointer-events: none;
    background-image:
        linear-gradient(30deg, #ffffff0d 12%, transparent 12.5%, transparent 87%, #ffffff0d 87.5%),
        linear-gradient(150deg, #ffffff0d 12%, transparent 12.5%, transparent 87%, #ffffff0d 87.5%);
    background-size: 26px 44px;
}

.fort-road {
    position: absolute;
    z-index: 0;
    border-radius: 99px;
    background: #9a774825;
    box-shadow: 0 0 14px #d9a55212;
}

.road-vertical {
    top: 54px;
    bottom: 54px;
    left: calc(50% - 3px);
    width: 6px;
}

.road-horizontal {
    top: calc(50% - 3px);
    right: 54px;
    left: 54px;
    height: 6px;
}

.fort-target {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    align-content: center;
    min-width: 0;
    padding: 6px;
    border-radius: 13px;
}

.fort-target {
    border: 1px solid #6f7c8d88;
    color: #f1eadf;
    background: linear-gradient(145deg, #202936f2, #101620f2);
    box-shadow: 0 8px 20px #0000004d;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.fort-target:active {
    transform: scale(0.96);
}

.fort-target:disabled {
    cursor: default;
}

.fort-target.north {
    grid-column: 3;
    grid-row: 1;
    border-color: #c4573e99;
}

.fort-target.west {
    grid-column: 1;
    grid-row: 1;
    border-color: #9a815899;
}

.fort-target.citadel {
    grid-column: 2;
    grid-row: 2;
    border-color: #e0ae568f;
}

.fort-target.east {
    grid-column: 3;
    grid-row: 3;
    border-color: #86aebb99;
}

.fort-target.south {
    grid-column: 1;
    grid-row: 3;
    border-color: #559fc599;
}

.fort-target.is-citadel {
    transform: scale(1.06);
    background: linear-gradient(145deg, #392d1e, #171713);
    box-shadow: 0 0 22px #d09a3940;
}

.fort-icon {
    display: grid;
    place-items: center;
    width: 47px;
    height: 47px;
    line-height: 1;
}

.fort-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px #0008);
    user-select: none;
    pointer-events: none;
}

.fort-target.is-citadel .fort-icon {
    width: 51px;
    height: 51px;
}

.fort-target b {
    display: block;
    max-width: 100%;
    overflow: hidden;
    font: 700 13px Georgia, serif;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fort-target small {
    color: #adb5c0;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.fort-target em {
    position: absolute;
    top: auto;
    bottom: 4px;
    left: 50%;
    right: auto;
    color: #d7b979;
    font-size: 10px;
    font-style: normal;
    font-weight: 900;
    transform: translateX(-50%);
}

.fort-hp-bar {
    width: 82%;
    height: 3px;
    margin-top: 3px;
    overflow: hidden;
    border-radius: 99px;
    background: #05070a;
    transform: translateY(-4px);
}

.fort-hp-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #b44238, #df8250);
    transition: width 0.22s ease;
}

.fort-map-decor {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.fort-map-decor span {
    position: absolute;
    opacity: 0.16;
    filter: grayscale(0.45) saturate(0.65);
}

.decor-mountains {
    top: 13%;
    left: 43%;
    font-size: 26px;
}

.decor-forest-left {
    top: 42%;
    left: 13%;
    font-size: 23px;
}

.decor-forest-right {
    right: 13%;
    bottom: 40%;
    font-size: 22px;
}

.decor-ruins {
    bottom: 12%;
    left: 44%;
    font-size: 24px;
}

.decor-mist {
    top: 50%;
    left: 50%;
    color: #b9c4cd;
    font-size: 50px;
    opacity: 0.08 !important;
    transform: translate(-50%, -50%) rotate(-18deg);
}

.fort-impact {
    position: absolute;
    top: 12%;
    left: 50%;
    z-index: 5;
    width: max-content;
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    opacity: 0;
    pointer-events: none;
    text-shadow: 0 2px 5px #000;
    white-space: nowrap;
    transform: translate(-50%, 0);
}

.fort-target.destroyed-player {
    border-color: #f0c15c;
    box-shadow:
        0 0 12px #f0bd4caa,
        0 0 32px #d894285e;
}

.fort-target.destroyed-player .fort-impact {
    color: #ffe099;
    font-size: 10px;
    animation-duration: 1.1s;
}

.fort-target.destroyed-enemy {
    border-color: #c9524b;
    box-shadow:
        0 0 10px #c4484488,
        0 0 25px #7d272752;
}

.fort-target.destroyed-enemy .fort-impact {
    color: #ff9b94;
    font-size: 9px;
    animation-duration: 1.1s;
}

.fort-target.is-hit {
    animation: fort-hit 0.65s ease;
}

.fort-target.is-hit .fort-impact {
    animation: fort-impact 0.65s ease both;
}

.fort-target.is-attacking {
    animation: fort-attacker 0.35s ease;
}

#fortsScreen.fast-forts-animation .fort-target.is-hit,
#fortsScreen.fast-forts-animation .fort-target.is-hit .fort-impact {
    animation-duration: 0.325s;
}

#fortsScreen.fast-forts-animation .fort-target.is-attacking {
    animation-duration: 0.175s;
}

#fortsScreen.fast-forts-animation .fort-target.destroyed-player .fort-impact,
#fortsScreen.fast-forts-animation .fort-target.destroyed-enemy .fort-impact {
    animation-duration: 0.55s;
}

.forts-log-panel {
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid #ffffff12;
    border-radius: 13px;
    background: #101620e8;
}

.forts-log-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid #ffffff0d;
}

.forts-log-panel header div {
    display: grid;
}

.forts-log-panel header span {
    color: #ddb66d;
    font-size: 13px;
    letter-spacing: 0.12em;
}

.forts-log-panel .animation-speed-toggle {
    flex: 0 0 auto;
    min-width: 70px;
    padding: 5px 7px;
    font-size: 12px;
}

.forts-log-panel header small {
    color: #8e99a7;
    font-size: 10px;
}

.forts-log {
    display: grid;
    align-content: start;
    min-height: 116px;
    padding: 9px 10px;
    color: #d4d9e0;
    font-size: 10px;
    line-height: 1.4;
}

.fort-log-row {
    display: grid;
    grid-template-columns: max-content 1fr;
    align-items: center;
    gap: 4px;
    min-height: 20px;
    border-bottom: 1px solid #ffffff09;
}

.fort-log-row:last-child {
    border-bottom: 0;
}

.fort-log-row b,
.fort-log-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fort-log-row b {
    color: #c8d2df;
    font-size: 12px;
}

.fort-log-row.player b {
    color: #efc36f;
}

.fort-log-row span {
    color: #aeb8c5;
    font-size: 12px;
}

@keyframes fort-hit {
    45% {
        filter: brightness(1.65);
        transform: scale(0.95);
    }
}

@keyframes fort-impact {
    0% {
        opacity: 0;
        transform: translate(-50%, 7px) scale(0.8);
    }

    30% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -18px) scale(1.08);
    }
}

@keyframes fort-attacker {
    50% {
        filter: brightness(1.45);
        transform: translateY(-3px);
    }
}

@media (max-width: 380px) {
    .forts-screen {
        padding-right: 8px;
        padding-left: 8px;
    }

    .fort-map {
        grid-template-rows: repeat(3, 101px);
        gap: 5px;
        padding: 6px;
    }

    .fort-target b {
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fort-target,
    .fort-hp-bar i {
        transition: none;
    }

    .fort-target.is-hit,
    .fort-target.is-hit .fort-impact,
    .fort-target.is-attacking {
        animation: none;
    }
}
