.battle-demo {
    --player-accent: #62d0a3;
    --player-rgb: 98, 208, 163;
    --enemy-accent: #d35b68;
    --enemy-rgb: 211, 91, 104;
    scroll-margin-top: calc(var(--header-height) + 1.25rem);
    margin-top: clamp(3rem, 7vw, 6.5rem);
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity 420ms ease,
        transform 520ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.battle-demo[hidden] {
    display: none;
}

.battle-demo.is-open {
    opacity: 1;
    transform: translateY(0);
}

.battle-demo[data-player-faction="high"] {
    --player-accent: #68c9da;
    --player-rgb: 104, 201, 218;
}

.battle-demo[data-player-faction="radiants"] {
    --player-accent: #d8b85f;
    --player-rgb: 216, 184, 95;
}

.battle-demo__frame {
    position: relative;
    padding: clamp(1.25rem, 3.5vw, 3.25rem);
    overflow: hidden;
    border: 1px solid rgba(231, 218, 171, 0.58);
    background:
        radial-gradient(circle at 30% 0%, rgba(var(--player-rgb), 0.13), transparent 34rem),
        linear-gradient(145deg, rgba(16, 28, 30, 0.98), rgba(4, 8, 10, 0.99) 64%);
    box-shadow:
        inset 0 0 0 6px rgba(2, 7, 8, 0.75),
        inset 0 0 0 7px rgba(231, 218, 171, 0.12),
        0 38px 80px rgba(0, 0, 0, 0.45);
    clip-path: polygon(
        18px 0,
        calc(100% - 18px) 0,
        100% 18px,
        100% calc(100% - 18px),
        calc(100% - 18px) 100%,
        18px 100%,
        0 calc(100% - 18px),
        0 18px
    );
}

.battle-demo__frame::before,
.battle-demo__frame::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

.battle-demo__frame::before {
    inset: 12px;
    border: 1px solid rgba(231, 218, 171, 0.1);
    clip-path: polygon(
        10px 0,
        calc(100% - 10px) 0,
        100% 10px,
        100% calc(100% - 10px),
        calc(100% - 10px) 100%,
        10px 100%,
        0 calc(100% - 10px),
        0 10px
    );
}

.battle-demo__frame::after {
    top: 0;
    right: 15%;
    width: 34%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--player-accent), transparent);
    box-shadow: 0 0 24px var(--player-accent);
}

.battle-demo__header {
    position: relative;
    z-index: 1;
    margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
    padding-bottom: 1.4rem;
    border-bottom: 1px solid rgba(231, 218, 171, 0.15);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
}

.battle-demo__header .eyebrow {
    margin-bottom: 0.35rem;
    color: var(--player-accent);
}

.battle-demo__header h3 {
    margin-bottom: 0.35rem;
    font-size: clamp(1.9rem, 4.2vw, 3.5rem);
    font-weight: 600;
    line-height: 1;
}

.battle-demo__header p:last-child {
    max-width: 52ch;
    margin-bottom: 0;
    color: rgba(245, 237, 217, 0.62);
}

.battle-demo__actions {
    display: flex;
    flex: 0 0 auto;
    gap: 0.65rem;
}

.battle-text-button {
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(231, 218, 171, 0.24);
    color: rgba(245, 237, 217, 0.72);
    background: rgba(3, 8, 10, 0.55);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    cursor: pointer;
    transition:
        border-color 180ms ease,
        color 180ms ease,
        background-color 180ms ease;
}

.battle-text-button:hover {
    border-color: var(--player-accent);
    color: var(--ivory);
    background: rgba(var(--player-rgb), 0.09);
}

.battle-demo__layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    align-items: start;
    gap: clamp(1.5rem, 4vw, 3.5rem);
}

.battle-arena {
    min-width: 0;
}

.battle-status {
    width: min(100%, 650px);
    min-height: 52px;
    margin: 0 auto 0.9rem;
    padding: 0.7rem 0.9rem;
    border-left: 2px solid var(--player-accent);
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(90deg, rgba(var(--player-rgb), 0.1), transparent 72%);
}

.battle-status__turn {
    flex: 0 0 auto;
    padding-right: 1rem;
    border-right: 1px solid rgba(231, 218, 171, 0.17);
    color: var(--player-accent);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.battle-status__turn.is-enemy {
    color: var(--enemy-accent);
}

.battle-status p {
    margin: 0;
    color: rgba(245, 237, 217, 0.73);
    font-size: 0.84rem;
    line-height: 1.4;
}

.battle-board {
    position: relative;
    width: min(100%, 650px);
    aspect-ratio: 1;
    margin: 0 auto;
    padding: clamp(0.4rem, 1vw, 0.7rem);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(0.35rem, 0.9vw, 0.65rem);
    background:
        linear-gradient(145deg, rgba(231, 218, 171, 0.3), rgba(35, 44, 44, 0.7) 45%, rgba(231, 218, 171, 0.18)),
        #060b0c;
    box-shadow:
        inset 0 0 0 1px rgba(231, 218, 171, 0.35),
        0 26px 52px rgba(0, 0, 0, 0.35);
    clip-path: polygon(
        13px 0,
        calc(100% - 13px) 0,
        100% 13px,
        100% calc(100% - 13px),
        calc(100% - 13px) 100%,
        13px 100%,
        0 calc(100% - 13px),
        0 13px
    );
}

.battle-cell {
    --owner-accent: rgba(231, 218, 171, 0.42);
    position: relative;
    min-width: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    color: var(--ivory);
    background:
        radial-gradient(circle at 50% 36%, rgba(62, 88, 85, 0.24), transparent 56%),
        linear-gradient(160deg, #102022, #081012);
    box-shadow:
        inset 0 0 0 1px rgba(231, 218, 171, 0.2),
        inset 0 0 24px rgba(0, 0, 0, 0.36);
    clip-path: polygon(
        7px 0,
        calc(100% - 7px) 0,
        100% 7px,
        100% calc(100% - 7px),
        calc(100% - 7px) 100%,
        7px 100%,
        0 calc(100% - 7px),
        0 7px
    );
}

.battle-cell::after {
    content: "";
    position: absolute;
    inset: 5px;
    z-index: 4;
    border: 1px solid var(--owner-accent);
    opacity: 0.45;
    pointer-events: none;
    clip-path: polygon(
        4px 0,
        calc(100% - 4px) 0,
        100% 4px,
        100% calc(100% - 4px),
        calc(100% - 4px) 100%,
        4px 100%,
        0 calc(100% - 4px),
        0 4px
    );
}

.battle-cell--empty {
    cursor: default;
}

.battle-cell--empty > span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(231, 218, 171, 0.22);
    background: rgba(231, 218, 171, 0.04);
    transform: translate(-50%, -50%) rotate(45deg);
    transition:
        border-color 180ms ease,
        background-color 180ms ease,
        box-shadow 180ms ease,
        transform 180ms ease;
}

.battle-cell--empty.is-target {
    cursor: pointer;
    background:
        radial-gradient(circle at 50% 50%, rgba(var(--player-rgb), 0.14), transparent 52%),
        linear-gradient(160deg, #102022, #081012);
}

.battle-cell--empty.is-target::after {
    border-color: rgba(var(--player-rgb), 0.58);
}

.battle-cell--empty.is-target:hover > span,
.battle-cell--empty.is-target:focus-visible > span {
    border-color: var(--player-accent);
    background: rgba(var(--player-rgb), 0.26);
    box-shadow: 0 0 24px rgba(var(--player-rgb), 0.55);
    transform: translate(-50%, -50%) rotate(45deg) scale(1.25);
}

.battle-cell--empty:focus-visible {
    outline: 2px solid var(--player-accent);
    outline-offset: -4px;
}

.battle-cell.is-player {
    --owner-accent: var(--player-accent);
    background:
        radial-gradient(circle at 50% 42%, rgba(var(--player-rgb), 0.2), transparent 58%),
        linear-gradient(160deg, rgba(var(--player-rgb), 0.1), #071112 75%);
}

.battle-cell.is-enemy {
    --owner-accent: var(--enemy-accent);
    background:
        radial-gradient(circle at 50% 42%, rgba(var(--enemy-rgb), 0.18), transparent 58%),
        linear-gradient(160deg, rgba(var(--enemy-rgb), 0.09), #150b0e 75%);
}

.battle-unit-face {
    position: relative;
    display: block;
    isolation: isolate;
}

.battle-unit-face::before {
    content: "";
    position: absolute;
    inset: 15%;
    z-index: -1;
    border-radius: 50%;
    background: var(--owner-accent, var(--player-accent));
    filter: blur(32px);
    opacity: 0.12;
}

.battle-unit-face--board {
    width: 100%;
    height: 100%;
}

.battle-unit-face img {
    position: absolute;
    z-index: 1;
    object-fit: contain;
    object-position: center bottom;
    filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.62));
    pointer-events: none;
    user-select: none;
}

.battle-unit-face--board img {
    inset: 12% 9% 9%;
    width: 82%;
    height: 79%;
}

.battle-unit-value {
    position: absolute;
    z-index: 3;
    width: clamp(22px, 3.2vw, 31px);
    height: clamp(22px, 3.2vw, 31px);
    border: 1px solid rgba(231, 218, 171, 0.5);
    display: grid;
    place-items: center;
    color: var(--ivory);
    background: rgba(3, 8, 10, 0.91);
    font-family: "Cinzel", Georgia, serif;
    font-size: clamp(0.65rem, 1.4vw, 0.9rem);
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.34);
    clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px);
}

.battle-unit-value--top,
.battle-unit-value--bottom {
    left: 50%;
    transform: translateX(-50%);
}

.battle-unit-value--top {
    top: 4%;
}

.battle-unit-value--right {
    top: 50%;
    right: 4%;
    transform: translateY(-50%);
}

.battle-unit-value--bottom {
    bottom: 4%;
}

.battle-unit-value--left {
    top: 50%;
    left: 4%;
    transform: translateY(-50%);
}

.has-chain-top .battle-unit-value--top,
.has-chain-right .battle-unit-value--right,
.has-chain-bottom .battle-unit-value--bottom,
.has-chain-left .battle-unit-value--left {
    border-color: var(--player-accent);
    color: var(--player-accent);
    box-shadow:
        0 5px 12px rgba(0, 0, 0, 0.34),
        0 0 13px rgba(var(--player-rgb), 0.26);
}

.battle-cell.is-enemy .has-chain-top .battle-unit-value--top,
.battle-cell.is-enemy .has-chain-right .battle-unit-value--right,
.battle-cell.is-enemy .has-chain-bottom .battle-unit-value--bottom,
.battle-cell.is-enemy .has-chain-left .battle-unit-value--left {
    border-color: var(--enemy-accent);
    color: var(--enemy-accent);
    box-shadow:
        0 5px 12px rgba(0, 0, 0, 0.34),
        0 0 13px rgba(var(--enemy-rgb), 0.24);
}

.battle-cell.is-attacking {
    z-index: 3;
    animation: battle-attack 420ms ease;
}

.battle-cell.is-attacking::before {
    content: "";
    position: absolute;
    z-index: 5;
    background: var(--owner-accent);
    box-shadow: 0 0 16px var(--owner-accent);
    opacity: 0;
    pointer-events: none;
    animation: battle-strike-line 420ms ease;
}

.battle-cell.is-attacking.attack-top::before,
.battle-cell.is-attacking.attack-bottom::before {
    left: calc(50% - 2px);
    width: 4px;
    height: 52%;
}

.battle-cell.is-attacking.attack-top::before {
    top: 0;
}

.battle-cell.is-attacking.attack-bottom::before {
    bottom: 0;
}

.battle-cell.is-attacking.attack-right::before,
.battle-cell.is-attacking.attack-left::before {
    top: calc(50% - 2px);
    width: 52%;
    height: 4px;
}

.battle-cell.is-attacking.attack-right::before {
    right: 0;
}

.battle-cell.is-attacking.attack-left::before {
    left: 0;
}

.battle-cell.is-captured {
    z-index: 2;
    animation: battle-capture 430ms ease;
}

.battle-cell.is-placed {
    animation: battle-place 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.battle-hand-heading {
    width: min(100%, 760px);
    margin: 1.3rem auto 0.7rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.battle-hand-heading > div {
    display: flex;
    flex-direction: column;
}

.battle-hand-heading span:first-child {
    color: var(--ivory);
    font-family: "Cinzel", Georgia, serif;
    font-size: 0.95rem;
    font-weight: 700;
}

.battle-hand-heading small,
.battle-hand-heading__chain {
    color: rgba(245, 237, 217, 0.48);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.battle-hand-heading__chain {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.battle-hand-heading__chain i {
    width: 9px;
    height: 9px;
    border: 1px solid var(--player-accent);
    background: rgba(var(--player-rgb), 0.22);
    transform: rotate(45deg);
}

.battle-hand {
    width: min(100%, 760px);
    min-height: 190px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.55rem;
}

.battle-card {
    position: relative;
    min-width: 0;
    min-height: 190px;
    padding: 0 0 0.65rem;
    border: 1px solid rgba(231, 218, 171, 0.38);
    overflow: hidden;
    color: var(--ivory);
    background:
        radial-gradient(circle at 50% 30%, rgba(var(--player-rgb), 0.13), transparent 52%),
        linear-gradient(165deg, #132326, #071011);
    box-shadow: 0 14px 22px rgba(0, 0, 0, 0.25);
    clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
    cursor: pointer;
    transform: translateY(0);
    transition:
        border-color 180ms ease,
        box-shadow 180ms ease,
        transform 180ms ease,
        opacity 180ms ease;
}

.battle-card:hover:not(:disabled),
.battle-card:focus-visible,
.battle-card.is-selected {
    z-index: 2;
    border-color: var(--player-accent);
    box-shadow:
        0 18px 30px rgba(0, 0, 0, 0.38),
        0 0 24px rgba(var(--player-rgb), 0.15);
    transform: translateY(-6px);
}

.battle-card.is-selected {
    background:
        radial-gradient(circle at 50% 30%, rgba(var(--player-rgb), 0.24), transparent 56%),
        linear-gradient(165deg, #173033, #081416);
}

.battle-card:disabled {
    cursor: default;
    opacity: 0.64;
}

.battle-card.is-selected::after {
    content: "Selected";
    position: absolute;
    top: 0.45rem;
    left: 0.45rem;
    z-index: 5;
    padding: 0.2rem 0.35rem;
    color: #03100c;
    background: var(--player-accent);
    font-size: 0.5rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.battle-unit-face--hand {
    width: 100%;
    height: 136px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent);
}

.battle-unit-face--hand img {
    inset: 12% 10% 4%;
    width: 80%;
    height: 84%;
}

.battle-unit-face--hand .battle-unit-value {
    width: 22px;
    height: 22px;
    font-size: 0.62rem;
}

.battle-unit-face--hand .battle-unit-value--top {
    top: 4px;
}

.battle-unit-face--hand .battle-unit-value--right {
    right: 5px;
}

.battle-unit-face--hand .battle-unit-value--bottom {
    bottom: 2px;
}

.battle-unit-face--hand .battle-unit-value--left {
    left: 5px;
}

.battle-card__name,
.battle-card__chain {
    position: relative;
    z-index: 3;
    display: block;
    text-align: center;
}

.battle-card__name {
    padding: 0.35rem 0.25rem 0;
    font-family: "Cinzel", Georgia, serif;
    font-size: clamp(0.67rem, 1vw, 0.82rem);
    font-weight: 700;
    line-height: 1.1;
}

.battle-card__chain {
    margin-top: 0.3rem;
    color: var(--player-accent);
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.battle-card__chain.is-empty {
    color: rgba(245, 237, 217, 0.34);
}

.battle-hand__empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 3rem 1rem;
    border: 1px dashed rgba(231, 218, 171, 0.18);
    color: rgba(245, 237, 217, 0.48);
    text-align: center;
}

.battle-sidebar {
    display: grid;
    gap: 1rem;
}

.battle-matchup,
.battle-rules,
.battle-result {
    border: 1px solid rgba(231, 218, 171, 0.19);
    background: rgba(3, 8, 10, 0.62);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.23);
}

.battle-matchup {
    padding: 0.75rem;
}

.battle-matchup__side {
    min-width: 0;
    padding: 0.7rem;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.7rem;
}

.battle-matchup__side img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.42));
}

.battle-matchup__side div {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.battle-matchup__side small {
    color: rgba(245, 237, 217, 0.4);
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.battle-matchup__side strong {
    overflow: hidden;
    color: var(--ivory);
    font-family: "Cinzel", Georgia, serif;
    font-size: 0.85rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.battle-matchup__side > span {
    min-width: 36px;
    color: var(--player-accent);
    font-family: "Cinzel", Georgia, serif;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    text-align: right;
}

.battle-matchup__side--enemy > span {
    color: var(--enemy-accent);
}

.battle-matchup__divider {
    position: relative;
    height: 1px;
    margin: 0.15rem 0;
    background: linear-gradient(90deg, transparent, rgba(231, 218, 171, 0.25), transparent);
}

.battle-matchup__divider span {
    position: absolute;
    top: 50%;
    left: 50%;
    padding: 0.2rem 0.45rem;
    color: rgba(245, 237, 217, 0.32);
    background: #050b0c;
    font-size: 0.52rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    transform: translate(-50%, -50%);
}

.battle-opponent-hand {
    margin-top: 0.5rem;
    padding: 0.65rem 0.7rem 0.15rem;
    border-top: 1px solid rgba(231, 218, 171, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: rgba(245, 237, 217, 0.38);
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.battle-opponent-hand div {
    display: flex;
    gap: 0.35rem;
}

.battle-opponent-hand i {
    width: 8px;
    height: 8px;
    border: 1px solid var(--enemy-accent);
    background: rgba(var(--enemy-rgb), 0.2);
    transform: rotate(45deg);
}

.battle-rules {
    padding: 1.25rem;
}

.battle-sidebar__label {
    margin-bottom: 0.9rem;
    color: var(--gold-bright);
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.battle-rules ol {
    padding: 0;
    margin: 0;
    list-style: none;
}

.battle-rules li {
    padding: 0.65rem 0;
    border-top: 1px solid rgba(231, 218, 171, 0.09);
    display: grid;
    grid-template-columns: 26px 1fr;
    align-items: start;
    gap: 0.65rem;
}

.battle-rules li > span {
    width: 23px;
    height: 23px;
    border: 1px solid rgba(231, 218, 171, 0.3);
    display: grid;
    place-items: center;
    color: var(--player-accent);
    font-family: "Cinzel", Georgia, serif;
    font-size: 0.64rem;
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.battle-rules li p {
    margin: 0;
    color: rgba(245, 237, 217, 0.58);
    font-size: 0.76rem;
    line-height: 1.45;
}

.battle-rules li strong {
    color: rgba(245, 237, 217, 0.86);
}

.battle-rule-example {
    margin-top: 0.8rem;
    padding: 0.8rem;
    display: grid;
    grid-template-columns: 32px 1fr 32px auto;
    align-items: center;
    gap: 0.6rem;
    background: linear-gradient(90deg, rgba(var(--player-rgb), 0.08), rgba(var(--enemy-rgb), 0.05));
}

.battle-rule-example span {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(231, 218, 171, 0.36);
    display: grid;
    place-items: center;
    color: var(--ivory);
    background: #071011;
    font-family: "Cinzel", Georgia, serif;
    font-weight: 700;
}

.battle-rule-example i {
    color: var(--player-accent);
    font-size: 1.25rem;
    font-style: normal;
    text-align: center;
}

.battle-rule-example strong {
    color: var(--player-accent);
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.battle-result {
    padding: 1.35rem;
    border-color: rgba(var(--player-rgb), 0.35);
    background:
        radial-gradient(circle at 50% 0%, rgba(var(--player-rgb), 0.12), transparent 70%),
        rgba(3, 8, 10, 0.78);
}

.battle-result[hidden] {
    display: none;
}

.battle-result[data-outcome="loss"] {
    border-color: rgba(var(--enemy-rgb), 0.4);
    background:
        radial-gradient(circle at 50% 0%, rgba(var(--enemy-rgb), 0.12), transparent 70%),
        rgba(3, 8, 10, 0.78);
}

.battle-result h4 {
    margin: 0 0 0.5rem;
    font-family: "Cinzel", Georgia, serif;
    font-size: 1.35rem;
    line-height: 1.2;
}

.battle-result > p:not(.battle-sidebar__label) {
    margin-bottom: 1.1rem;
    color: rgba(245, 237, 217, 0.62);
    font-size: 0.8rem;
    line-height: 1.5;
}

.battle-result .button {
    width: 100%;
    min-height: 44px;
    border: 0;
    cursor: pointer;
}

.battle-demo__noscript {
    margin: 2rem 0 0;
    padding: 1rem;
    border: 1px solid var(--line);
    color: var(--ivory-muted);
    text-align: center;
}

@keyframes battle-place {
    from {
        opacity: 0;
        transform: scale(0.72);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes battle-attack {
    0%,
    100% {
        filter: brightness(1);
        transform: scale(1);
    }

    50% {
        filter: brightness(1.5);
        transform: scale(1.045);
    }
}

@keyframes battle-capture {
    0% {
        filter: saturate(0.4) brightness(1.8);
        transform: scale(0.92) rotate(-1deg);
    }

    55% {
        filter: saturate(1.35) brightness(1.4);
        transform: scale(1.055) rotate(1deg);
    }

    100% {
        filter: saturate(1) brightness(1);
        transform: scale(1) rotate(0);
    }
}

@keyframes battle-strike-line {
    0%,
    100% {
        opacity: 0;
        transform: scale(0.25);
    }

    45% {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 980px) {
    .battle-demo__layout {
        grid-template-columns: minmax(0, 1fr) 250px;
        gap: 1.5rem;
    }

    .battle-card {
        min-height: 172px;
    }

    .battle-unit-face--hand {
        height: 120px;
    }

    .battle-matchup__side {
        grid-template-columns: 36px minmax(0, 1fr) auto;
        gap: 0.5rem;
    }

    .battle-matchup__side img {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 820px) {
    .battle-demo__layout {
        grid-template-columns: 1fr;
    }

    .battle-board {
        width: min(100%, 620px);
    }

    .battle-sidebar {
        grid-template-columns: 1fr 1fr;
    }

    .battle-result {
        grid-column: 1 / -1;
    }
}

@media (max-width: 620px) {
    .battle-demo {
        margin-top: 3rem;
    }

    .battle-demo__frame {
        padding: 1.1rem;
    }

    .battle-demo__header {
        align-items: flex-start;
        flex-direction: column;
        gap: 1rem;
    }

    .battle-demo__actions {
        width: 100%;
    }

    .battle-text-button {
        flex: 1;
    }

    .battle-status {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.35rem;
    }

    .battle-status__turn {
        padding-right: 0;
        border-right: 0;
    }

    .battle-board {
        padding: 0.35rem;
        gap: 0.3rem;
    }

    .battle-unit-value {
        width: clamp(20px, 7vw, 27px);
        height: clamp(20px, 7vw, 27px);
        font-size: clamp(0.58rem, 3vw, 0.76rem);
    }

    .battle-unit-face--board img {
        inset: 15% 11% 10%;
        width: 78%;
        height: 75%;
    }

    .battle-hand-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.45rem;
    }

    .battle-hand {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(118px, 34vw);
        min-height: 182px;
        padding: 0.4rem 0.15rem 0.8rem;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scroll-snap-type: inline mandatory;
        scrollbar-color: var(--player-accent) rgba(255, 255, 255, 0.05);
    }

    .battle-card {
        min-height: 170px;
        scroll-snap-align: start;
    }

    .battle-unit-face--hand {
        height: 118px;
    }

    .battle-sidebar {
        grid-template-columns: 1fr;
    }

    .battle-result {
        grid-column: auto;
    }
}

@media (max-width: 390px) {
    .battle-demo__frame {
        margin-right: -0.4rem;
        margin-left: -0.4rem;
        padding: 0.85rem;
    }

    .battle-rule-example {
        grid-template-columns: 28px 1fr 28px auto;
        gap: 0.4rem;
    }
}
