:root {
    --token-badge-size: clamp(24px, 3.5vmin, 36px);
    --layout-pad: 0;
    --board-pad: clamp(6px, 1.8vmin, 14px);
    --board-max-cols: 7;
    --hex-gap: clamp(2px, 2.5vh, 24px);
    --hex-size: clamp(32px, 4.2vw, 72px);
    --vertex-marker-width: clamp(9px, calc(var(--hex-size) * 0.38), 28px);
    --vertex-marker-height: clamp(7px, calc(var(--hex-size) * 0.22), 18px);
    --row-gap: calc(var(--hex-size) * -0.25);
    --player1-color: #6a9da5;
    --player2-color: #f7b33f;
    --text-color: #ebebed;
    --danger-color: #d22e40;
}

@media (max-height: 820px) {
    :root {
        --vertex-marker-width: clamp(8px, calc(var(--hex-size) * 0.3), 22px);
        --vertex-marker-height: clamp(6px, calc(var(--hex-size) * 0.18), 14px);
    }
}

html {
    font-size: 16px;
    line-height: 1.2;
    height: 100%;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    height: 100dvh;
    min-height: 100dvh;
    font-size: 16px;
    font-family: "t26-carbon", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 400;
    font-style: normal;
    background: #31364d;
    color: #202534;
    overflow: hidden;
}

.intro-video-shell {
    position: fixed;
    inset: 0;
    z-index: 15;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 220ms ease, visibility 220ms ease;
    overflow: hidden;
}

.intro-video-shell.is-visible {
    opacity: 1;
    visibility: visible;
}

.intro-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: saturate(0.96) contrast(1.03) brightness(0.9);
}

.intro-video-scrim {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top, rgba(246, 247, 251, 0.04), rgba(32, 37, 52, 0.16) 55%, rgba(32, 37, 52, 0.3) 100%),
        linear-gradient(180deg, rgba(32, 37, 52, 0.16), rgba(32, 37, 52, 0.42));
}

.intro-gate-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 180ms ease;
    background: rgba(9, 12, 20, 0.96);
}

.intro-gate-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Keep game mode dialog backdrop fully transparent. */
#modeDialog::part(overlay),
#modeDialog::part(backdrop),
#modeDialog::part(base) {
    background: transparent !important;
    backdrop-filter: none !important;
}

.app-root {
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    position: relative;
    z-index: 1;
    background: linear-gradient(-45deg, var(--player1-color), var(--player2-color), #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: bgGradient 15s ease infinite;
}
@keyframes bgGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.app-banner {
    min-height: 64px;
}

.app-main-header {
    min-height: 0;
}

.app-main-footer {
    min-height: 0;
}

.app-body {
    min-height: 0;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    overflow: hidden;
}

.board-column {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
}

.layout {
    /* width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    padding: var(--layout-pad);
    display: grid; */
    /* grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); */
    /* align-items: stretch;
    justify-items: stretch;
    column-gap: 6px;
    overflow: hidden; */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    column-gap: 0;
}

.layout > .wa-stack {
    min-height: 0;
    overflow: hidden;
    width: 100%;
    gap: 2px;
    background-color: #31364d;
    /* display: none; */
}

.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px;
    border: 1px solid rgba(32, 37, 52, 0.12);
    border-radius: 12px;
    background: #ffffff;
}

.nav-title {
    margin: 0;
    font-size: 1.4rem;
    font-family: "jaf-mashine", sans-serif;
    font-weight: 400;
    font-style: normal;
    color: #ebebed;
    /* background-image: linear-gradient(
        120deg,
        var(--player1-color) 0%,
        color-mix(in srgb, var(--player1-color) 50%, var(--player2-color) 50%) 45%,
        var(--player2-color) 100%
    );
    background-size: 240% 240%;
    background-position: 0% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: navTitleGradientCycle 7.5s ease-in-out infinite; */
}

@keyframes navTitleGradientCycle {
    0% {
        background-position: 0% 50%;
        filter: saturate(1);
    }
    25% {
        background-position: 100% 50%;
        filter: saturate(1.08);
    }
    50% {
        background-position: 100% 0%;
        filter: saturate(1.14);
    }
    75% {
        background-position: 0% 100%;
        filter: saturate(1.08);
    }
    100% {
        background-position: 0% 50%;
        filter: saturate(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-title {
        animation: none;
        background-position: 50% 50%;
    }
}

.nav-player {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-label {
    font-size: 0.86rem;
    color: var(--wa-color-neutral-on-quiet);
}

.player-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 2px solid rgba(32, 37, 52, 0.26);
    background: #f3f5fb;
    font-size: 0.86rem;
    font-weight: 700;
}

.player-chip[data-player="player1"] {
    border-color: var(--player1-color);
    color: var(--text-color);
    background: rgba(106, 157, 165, 0.2);
}

.player-chip[data-player="player2"] {
    border-color: var(--player2-color);
    color: var(--text-color);
    background: rgba(247, 179, 63, 0.22);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-actions wa-button {
    font-size: 0.9rem;
}

.player-stack-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border-right: 1px solid rgba(32, 37, 52, 0.12);
    min-width: 0;
    width: 220px;
    max-width: 220px;
    max-height: 100%;
    overflow: auto;
}

.app-main-header,
.app-main-footer {
    overflow: hidden;
}

.turn-stack-status {
    font-size: 0.86rem;
    font-weight: 700;
}

.player-stack-card {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1.5px solid rgba(32, 37, 52, 0.2);
    border-radius: 12px;
    padding: 10px;
    background: #434554;
    opacity: 0.72;
    transition: border-color 120ms ease, opacity 120ms ease, box-shadow 120ms ease;
}

.player-stack-card.is-active {
    opacity: 1;
    box-shadow: 0 6px 16px rgba(32, 37, 52, 0.12);
}

.player-stack-card.p1-card.is-active {
    border-color: var(--player1-color);
}

.player-stack-card.p2-card.is-active {
    border-color: var(--player2-color);
}

.player-stack-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    background: #ffffff;
    flex: 0 0 auto;
}

.p1-card .player-stack-avatar {
    color: var(--player1-color);
}

.p2-card .player-stack-avatar {
    color: var(--player2-color);
}

.player-stack-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player-stack-label {
    font-size: 0.88rem;
    font-weight: 700;
}

.player-stack-turn {
    font-size: 0.76rem;
    color: rgba(235, 235, 237, 0.7);
}

.future-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 2px;
}

.new-game-split {
    display: flex;
    gap: 6px;
}

.new-game-split wa-button:first-child {
    flex: 1 1 auto;
}

.new-game-split wa-button:last-child {
    flex: 0 0 auto;
    min-width: 42px;
}

.future-actions wa-button {
    position: relative;
    justify-content: flex-start;
}

.future-actions wa-button.has-unread-chat::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 8px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #d92d20;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95);
    pointer-events: none;
}

.moves-preview {
    border: 1px solid rgba(32, 37, 52, 0.18);
    border-radius: 10px;
    background: rgba(66, 69, 84, 1);
    padding: 8px;
}

.moves-preview-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(249, 250, 252, 0.75);
    margin-bottom: 6px;
}

.last-moves-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.last-moves-list li {
    font-size: 0.76rem;
    line-height: 1.2;
    padding: 2px 0;
}

.last-moves-list .move-player1 {
    color: var(--player1-color);
    font-weight: 700;
}

.last-moves-list .move-player2 {
    color: var(--player2-color);
    font-weight: 700;
}

.last-move-empty {
    color: rgba(235, 235, 237, 0.56);
}

.instructions-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
}

.instructions-body p {
    margin: 0;
}

.instructions-body ul {
    margin: 0;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.instructions-cta-copy {
    margin-top: 6px;
    border: 1px solid rgba(32, 37, 52, 0.14);
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(63, 123, 132, 0.1);
    color: rgba(32, 37, 52, 0.84);
    font-weight: 600;
}

.move-visuals-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.move-visuals-body p {
    margin: 0;
    color: rgba(32, 37, 52, 0.84);
}

.moves-demo-wrap {
    border: 1px solid rgba(32, 37, 52, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    display: grid;
    grid-template-columns: minmax(170px, 220px) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.moves-demo-tab-group {
    --track-color: rgba(32, 37, 52, 0.08);
    --indicator-color: rgba(63, 123, 132, 0.18);
    width: 100%;
    min-height: 280px;
}

.moves-demo-tab-group::part(base) {
    background: transparent;
}

.moves-demo-tab-group::part(nav) {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.moves-demo-tab-group::part(tab) {
    justify-content: flex-start;
    text-align: left;
    padding: 8px 10px;
    border-radius: 10px;
}

.moves-demo-tab-group::part(active-tab) {
    background: rgba(63, 123, 132, 0.12);
    border-color: rgba(63, 123, 132, 0.28);
}

.moves-demo-visual-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.moves-demo-status {
    min-height: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #202534;
}

.moves-demo-board {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    padding: 12px;
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(234, 235, 227, 0.8), rgba(217, 218, 211, 0.9)),
        linear-gradient(135deg, rgba(32, 37, 52, 0.05), rgba(32, 37, 52, 0.01));
    border: 1px solid rgba(32, 37, 52, 0.12);
    user-select: none;
}

.moves-demo-row {
    display: flex;
    gap: 3px;
    align-items: center;
    justify-content: center;
}

.moves-demo-row.is-short {
    margin-left: 12px;
}

.moves-demo-cell {
    --cell-fill: rgba(109, 128, 163, 0.85);
    width: var(--hex-size);
    height: calc(var(--hex-size) * 1.1);
    position: relative;
    display: block;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    transform: none;
    box-shadow: none;
}

.moves-demo-cell::before {
    content: "";
    position: absolute;
    inset: 3px;
    background: var(--cell-fill);
    clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%);
    z-index: 1;
    pointer-events: none;
}

.moves-demo-cell::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(32, 37, 52, 0.16);
    clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%);
    z-index: 0;
    pointer-events: none;
}

.moves-demo-cell[data-start-for]::before {
    background:
        linear-gradient(135deg, var(--cell-fill) 0%, rgba(32, 37, 52, 0.04) 100%),
        repeating-linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.12),
            rgba(255, 255, 255, 0.12) 3px,
            transparent 3px,
            transparent 8px
        );
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18), 0 0 0 2px rgba(255, 255, 255, 0.04);
}

.moves-demo-cell[data-start-for="player1"] {
    --cell-fill: rgba(105, 156, 164, 0.9);
}

.moves-demo-cell[data-start-for="player2"] {
    --cell-fill: rgba(247, 180, 63, 0.92);
}

.moves-demo-cell.is-highlight {
    --cell-fill: rgba(123, 215, 228, 0.8);
    filter: drop-shadow(0 0 0 rgba(63, 123, 132, 0.24));
}

.moves-demo-cell.is-protected {
    box-shadow: inset 0 0 0 2px rgba(47, 94, 102, 0.28);
}

.moves-demo-cell .cell-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transform: rotate(-90deg);
    z-index: -1;
    overflow: visible;
}

.moves-demo-cell .vertex-guides {
    position: absolute;
    inset: 0;
    overflow: visible;
}

.moves-demo-cell .vertex-marker {
    --marker-color: var(--player1-color);
    position: absolute;
    width: var(--vertex-marker-width);
    height: var(--vertex-marker-height);
    background: var(--marker-color);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    border-radius: 0.18em;
    z-index: 4;
    transform-origin: 50% 100%;
    box-shadow: inset 0 -1px 0 rgba(26, 30, 38, 0.18), 0 0 0 1px rgba(26, 30, 38, 0.08);
}

.moves-demo-cell .vertex-marker.v1,
.moves-demo-cell .vertex-marker.v3,
.moves-demo-cell .vertex-marker.v5 {
    --marker-color: var(--player2-color);
}

.moves-demo-cell .vertex-marker.v2,
.moves-demo-cell .vertex-marker.v4,
.moves-demo-cell .vertex-marker.v6 {
    --marker-color: var(--player1-color);
}

.moves-demo-cell .vertex-marker.v1 {
    top: 15%;
    left: 50%;
    transform: translate(-50%, -100%) rotate(0deg);
}

.moves-demo-cell .vertex-marker.v2 {
    top: 34%;
    left: 86%;
    transform: translate(-50%, -100%) rotate(60deg);
}

.moves-demo-cell .vertex-marker.v3 {
    top: 66%;
    left: 85%;
    transform: translate(-50%, -100%) rotate(120deg);
}

.moves-demo-cell .vertex-marker.v4 {
    top: 85%;
    left: 50%;
    transform: translate(-50%, -100%) rotate(180deg);
}

.moves-demo-cell .vertex-marker.v5 {
    top: 67%;
    left: 14%;
    transform: translate(-50%, -100%) rotate(240deg);
}

.moves-demo-cell .vertex-marker.v6 {
    top: 35%;
    left: 14%;
    transform: translate(-50%, -100%) rotate(300deg);
}

.moves-demo-piece {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 3px rgba(32, 37, 52, 0.26);
    z-index: 6;
}

.moves-demo-piece.player1 {
    background: var(--player1-color);
}

.moves-demo-piece.player2 {
    background: var(--player2-color);
}

.moves-demo-controls {
    display: flex;
    justify-content: flex-end;
}

#introGateDialog {
    --width: 60dvw;
}
@media (max-width: 860px) and (orientation: portrait) {
    #introGateDialog {
        --width: 90dvw;
    }
}

.mode-dialog-body,
.intro-gate-body,
.online-setup-body,
.lobby-body,
.invite-body,
.chat-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mode-dialog-body p,
.intro-gate-body p,
.dialog-help-text,
.invite-body p {
    margin: 0;
    color: rgba(32, 37, 52, 0.82);
}

.mode-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.mode-audio-toggle-button {
    justify-self: center;
    margin-bottom: 2px;
}

.mode-actions wa-button {
    justify-content: flex-start;
}

.intro-volume-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 0 2px;
}

.intro-volume-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(32, 37, 52, 0.85);
}

.intro-volume-value {
    color: var(--wa-color-brand-fill-loud, #3f7b84);
    font-variant-numeric: tabular-nums;
}

.intro-volume-slider {
    width: 100%;
    accent-color: var(--wa-color-brand-fill-loud, #3f7b84);
}

.lobby-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.lobby-self-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(32, 37, 52, 0.84);
}

.lobby-players-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 120px;
    max-height: 300px;
    overflow: auto;
}

.lobby-player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid rgba(32, 37, 52, 0.16);
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.92);
}

.lobby-player-name {
    font-size: 0.84rem;
    font-weight: 700;
    color: #202534;
}

.lobby-challenge-button {
    border: 1px solid #2f5e66;
    border-radius: 8px;
    background: #3f7b84;
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    padding: 7px 10px;
    cursor: pointer;
}

.lobby-challenge-button:hover {
    background: #2f5e66;
}

.lobby-challenge-button:active {
    transform: translateY(1px);
}

.lobby-empty {
    border: 1px dashed rgba(32, 37, 52, 0.22);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    font-size: 0.82rem;
    color: rgba(32, 37, 52, 0.68);
}

.chat-messages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 180px;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid rgba(32, 37, 52, 0.16);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    padding: 10px;
}

.chat-empty {
    border: 1px dashed rgba(32, 37, 52, 0.22);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    font-size: 0.82rem;
    color: rgba(32, 37, 52, 0.65);
}

.chat-message-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    border-radius: 8px;
    padding: 8px;
}

.chat-self {
    background: rgba(106, 157, 165, 0.16);
}

.chat-opponent {
    background: rgba(247, 179, 63, 0.14);
}

.chat-message-meta {
    font-size: 0.74rem;
    font-weight: 700;
    color: rgba(32, 37, 52, 0.72);
}

.chat-message-text {
    font-size: 0.88rem;
    line-height: 1.28;
    color: #202534;
    white-space: pre-wrap;
    word-break: break-word;
}
.board-row {
    display: flex;
    width: max-content;
    min-width: 0;
    justify-content: center;
    gap: var(--hex-gap);
}

/* Mobile status bar — hidden on desktop, shown in portrait media query */
.mobile-status-bar {
    display: none;
}

.board {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--row-gap);
    width: max-content;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    min-width: 0;
    min-height: 0;
    padding: var(--board-pad);
    /* background-color: var(--wa-color-gray-40); */
    background-color: #31364d7a;

    overflow: hidden;
    justify-self: center;
    border-radius: var(--wa-border-radius-l);
    /* box-shadow: inset var(--wa-shadow-s); */
}

@media (max-width: 900px) and (orientation: portrait) {
    :root {
        --token-badge-size: 18px;
        --board-pad: 2px;
        --hex-gap: clamp(2px, 1vw, 6px);
        --row-gap: calc(var(--hex-size) * -0.12);
    }

    .app-banner {
        min-height: 44px;
    }

    .nav-title {
        font-size: 1.05rem;
    }

    .player-chip {
        min-width: 84px;
        padding: 3px 8px;
        font-size: 0.78rem;
    }

    .app-body {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .board-column {
        grid-column: 1;
        grid-row: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .app-main-header,
    .app-main-footer,
    .layout > .wa-stack {
        display: none;
    }

    .layout {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        column-gap: 0;
    }

    .board {
        width: 100%;
        justify-self: stretch;
        align-self: center;
        padding: 1rem;
    }

    .mobile-status-bar {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        padding: 5px 8px;
        border-bottom: 1px solid rgba(32, 37, 52, 0.12);
        background: rgba(246, 247, 251, 0.96);
        position: relative;
        flex: 0 0 auto;
        min-height: 0;
    }

    .mobile-player-chip {
        display: flex;
        align-items: center;
        gap: 5px;
        flex: 1;
        min-width: 0;
        border: 1.5px solid rgba(32, 37, 52, 0.18);
        border-radius: 10px;
        padding: 4px 7px;
        background: #ffffff;
        transition: border-color 120ms ease;
    }

    .mobile-player-chip.is-active.p1-chip {
        border-color: var(--player1-color);
    }

    .mobile-player-chip.is-active.p2-chip {
        border-color: var(--player2-color);
    }

    .mobile-player-avatar {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        border: 1.5px solid currentColor;
        flex: 0 0 auto;
        font-size: 0.78rem;
    }

    .p1-chip .mobile-player-avatar {
        color: var(--player1-color);
    }

    .p2-chip .mobile-player-avatar {
        color: var(--player2-color);
    }

    .mobile-player-meta {
        display: flex;
        flex-direction: column;
        gap: 1px;
        min-width: 0;
        flex: 1;
    }

    .mobile-player-meta--right {
        text-align: right;
    }

    .mobile-player-label {
        font-size: 0.74rem;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-player-status {
        font-size: 0.65rem;
        color: rgba(32, 37, 52, 0.6);
    }

    .mobile-history-btn {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 32px;
        min-height: 32px;
        padding: 4px 7px;
        border: 1px solid rgba(32, 37, 52, 0.2);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.9);
        color: rgba(32, 37, 52, 0.7);
        cursor: pointer;
        font-size: 0.9rem;
    }

    .mobile-history-btn:hover {
        background: rgba(32, 37, 52, 0.06);
    }

    .mobile-history-panel {
        position: absolute;
        top: calc(100% + 4px);
        left: 50%;
        transform: translateX(-50%);
        z-index: 50;
        background: #ffffff;
        border: 1px solid rgba(32, 37, 52, 0.18);
        border-radius: 12px;
        box-shadow: 0 6px 20px rgba(32, 37, 52, 0.16);
        padding: 12px;
        min-width: 180px;
        max-width: 280px;
        width: max-content;
    }

    .mobile-history-panel-title {
        font-size: 0.74rem;
        font-weight: 700;
        color: rgba(32, 37, 52, 0.75);
        margin-bottom: 8px;
    }

    .player-stack-nav {
        grid-column: 1;
        grid-row: 2;
        width: 100%;
        max-width: none;
        /* height: 7rem; */
        padding: 6px 6px 8px;
        border-right: none;
        border-top: 1px solid rgba(32, 37, 52, 0.12);
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
        align-content: center;
        overflow: hidden;
        background: rgba(246, 247, 251, 0.96);
    }

    /* .player-stack-nav wa-callout {
        height: 4rem;

    } */

    .turn-stack-status,
    .future-actions {
        grid-column: 1 / -1;
    }

    .player-stack-card,
    .moves-preview {
        display: none;
    }

    .turn-stack-status {
        justify-self: center;
        font-size: 0.76rem;
    }

    .future-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        margin-top: 0;
    }

    .future-actions wa-button {
        min-width: 0;
        font-size: 0.74rem;
        min-height: 34px;
    }
    .board-row {
        gap: 2vh;
    }
}

.slot-content {
    /* background-color: var(--wa-color-gray-05); */
    color: var(--text-color);
    min-height: 0;
}
.board-row.is-short {
    margin-left: 0;
}

#board button.hex-cell {
    -webkit-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
    width: var(--hex-size) !important;
    height: calc(var(--hex-size) * 1.1) !important;
    aspect-ratio: 1 / 1.1 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: inherit !important;
    font: inherit !important;
    line-height: 1 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    white-space: normal !important;
    display: grid !important;
    place-items: center !important;
    position: relative !important;
    flex: 0 0 auto !important;
    vertical-align: middle !important;
}

.hex-cell {
    -webkit-appearance: none;
    appearance: none;
    width: var(--hex-size);
    aspect-ratio: 1 / 1.1;
    border: none;
    --cell-fill: var(--wa-color-gray-30);
    background: transparent;
    transform: rotate(90deg);
    cursor: pointer;
    transition: transform 120ms ease;
    display: grid;
    place-items: center;
    padding: 0;
    margin: 0;
    min-width: 0;
    min-height: 0;
    border-radius: 0;
    outline: none;
    line-height: 1;
    font: inherit;
    color: inherit;
    flex: 0 0 auto;
    position: relative;
    overflow: visible;
}

.hex-cell::before {
    content: "";
    position: absolute;
    inset: 3px;
    background: var(--cell-fill);
    clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%);
    z-index: 1;
    pointer-events: none;
}

.hex-cell::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #3a4261;
    clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%);
    z-index: 0;
    pointer-events: none;
}

.hex-cell[data-start-for]::before {
    background:
        linear-gradient(135deg, var(--cell-fill) 0%, rgba(32, 37, 52, 0.04) 100%),
        repeating-linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.12),
            rgba(255, 255, 255, 0.12) 3px,
            transparent 3px,
            transparent 8px
        );
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18), 0 0 0 2px rgba(255, 255, 255, 0.04);
}

.hex-cell[data-start-for]::after {
    background: rgba(32, 37, 52, 0.18);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.hex-cell[data-start-for="player1"] {
    --cell-fill: rgba(105, 156, 164, 0.9);
}

.hex-cell[data-start-for="player2"] {
    --cell-fill: rgba(247, 180, 63, 0.92);
}

.hex-cell:hover {
    --cell-fill: rgba(106, 157, 165, 0.16);
}

.hex-cell.is-legal-move {
    --cell-fill: var(--wa-color-warning-95);
}

.hex-cell.is-legal-move::after {
    background: #4d7f86;
}

.hex-cell.is-selected {
    --cell-fill: rgba(106, 157, 165, 0.32);
}

.hex-cell.is-selected::after {
    background: #2f5e66;
}

.cell-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transform: rotate(-90deg);
    z-index: 0;
    overflow: visible;
}

.hex-cell[data-protected-by] .cell-overlay {
    z-index: 2;
}

.vertex-guides {
    position: absolute;
    inset: 0;
    overflow: visible;
    z-index: 0;
}

.vertex-marker {
    --marker-color: var(--player1-color);
    position: absolute;
    width: var(--vertex-marker-width);
    height: var(--vertex-marker-height);
    background: var(--marker-color);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    border-radius: 0.18em;
    z-index: 0;
    transform-origin: 50% 100%;
    box-shadow: inset 0 -1px 0 rgba(26, 30, 38, 0.18), 0 0 0 1px rgba(26, 30, 38, 0.08);
    opacity: 0.78;
}

.hex-cell[data-protected-by][data-occupied-by] .vertex-guides,
.hex-cell[data-protected-by][data-occupied-by] .vertex-marker {
    z-index: 0;
}

.vertex-marker.is-hidden {
    display: none;
}

.vertex-marker.v1,
.vertex-marker.v3,
.vertex-marker.v5 {
    --marker-color: var(--player2-color);
}

.vertex-marker.v2,
.vertex-marker.v4,
.vertex-marker.v6 {
    --marker-color: var(--player1-color);
}

.vertex-marker.v1 {
    top: 15%;
    left: 50%;
    transform: translate(-50%, -100%) rotate(0deg);
}

.vertex-marker.v2 {
    top: 34%;
    left: 86%;
    transform: translate(-50%, -100%) rotate(60deg);
}

.vertex-marker.v3 {
    top: 66%;
    left: 85%;
    transform: translate(-50%, -100%) rotate(120deg);
}

.vertex-marker.v4 {
    top: 85%;
    left: 50%;
    transform: translate(-50%, -100%) rotate(180deg);
}

.vertex-marker.v5 {
    top: 67%;
    left: 14%;
    transform: translate(-50%, -100%) rotate(240deg);
}

.vertex-marker.v6 {
    top: 35%;
    left: 14%;
    transform: translate(-50%, -100%) rotate(300deg);
}

.hex-cell[data-protected-by="player1"]:not([data-occupied-by]) {
    --cell-fill: rgba(105, 156, 164, 0.92);
}

.hex-cell[data-protected-by="player2"]:not([data-occupied-by]) {
    --cell-fill: rgba(247, 180, 63, 0.94);
}

.hex-cell[data-protected-by]::after {
    content: "";
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    transform: none;
    pointer-events: none;
    z-index: 2;
    background: linear-gradient(135deg, var(--cell-fill) 0%, rgba(32, 37, 52, 0.04) 100%),
            repeating-linear-gradient(135deg,
                rgba(255, 255, 255, 0.12),
                rgba(255, 255, 255, 0.12) 3px,
                transparent 3px,
                transparent 8px);
    /* background: rgba(255, 255, 255, 0.08); */
    animation: pulseProtect 2000ms ease-in-out infinite;
}

.hex-cell[data-protected-by="player1"]::after {
    border: 2px dashed rgba(105, 156, 164, 1);
}

.hex-cell[data-protected-by="player2"]::after {
    border: 2px dashed rgba(247, 180, 63, 1);
}

.hex-cell[data-protected-by][data-occupied-by]::after {
    inset: 15%;
    border-width: 2px;
    border-style: dashed;
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(32, 37, 52, 0.08);
    animation: pulseProtect 2000ms ease-in-out infinite;
}

.hex-cell[data-protected-by="player1"][data-occupied-by]::after {
    border-color: rgba(105, 156, 164, 1);
}

.hex-cell[data-protected-by="player2"][data-occupied-by]::after {
    border-color: rgba(247, 180, 63, 1);
}

.hex-cell[data-occupied-by]::after {
    inset: 12%;
    border-style: solid;
    opacity: 0.35;
}

.hex-cell:focus-visible {
    outline: 3px solid #4d7f86;
    outline-offset: 2px;
}

.player-token {
    width: var(--token-size-px, 56%);
    max-width: calc(var(--hex-size) * 0.76);
    min-width: 18px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--token-color, #999999);
    border: 2px solid rgba(32, 37, 52, 0.65);
    box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.32);
    transform: rotate(-90deg);
    pointer-events: none;
    position: relative;
    z-index: 4;
}

.hex-cell.is-capturable-target[data-occupied-by] .player-token {
    border-color: #d84242;
    box-shadow:
        0 0 0 2px rgba(216, 66, 66, 0.45),
        0 0 12px rgba(216, 66, 66, 0.88),
        inset 0 2px 6px rgba(255, 255, 255, 0.32);
    animation: attackPulse 900ms ease-in-out infinite;
}

.hex-cell.is-selected .player-token {
    box-shadow:
    0 0 0 3px rgba(77, 127, 134, 0.28),
        inset 0 2px 6px rgba(255, 255, 255, 0.32);
}

.hex-cell.is-vulnerable .player-token {
    outline: 3px dashed rgba(220, 68, 68, 0.55);
    outline-offset: 2px;
}

.status-toast {
    border-radius: 10px;
    border: 1px solid rgba(32, 37, 52, 0.18);
    background: rgba(255, 255, 255, 0.97);
    color: #202534;
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.3;
    box-shadow: 0 10px 26px rgba(32, 37, 52, 0.15);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 150ms ease, transform 150ms ease;
}

.status-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.status-toast.is-win {
    border-color: rgba(46, 119, 73, 0.45);
    background: rgba(234, 255, 238, 0.97);
}

@keyframes attackPulse {
    0%,
    100% {
        filter: brightness(0.92);
    }

    50% {
        filter: brightness(1.16);
    }
}

@keyframes capturePulse {
    0% {
        background: var(--cell-fill);
        box-shadow: none;
    }

    25% {
        background: rgba(210, 46, 64, 0.28);
        box-shadow: 0 0 0 4px rgba(210, 46, 64, 0.16);
    }

    50% {
        background: rgba(210, 46, 64, 0.42);
        box-shadow: 0 0 12px rgba(210, 46, 64, 0.48), inset 0 0 8px rgba(210, 46, 64, 0.24);
    }

    75% {
        background: rgba(210, 46, 64, 0.28);
        box-shadow: 0 0 0 2px rgba(210, 46, 64, 0.24);
    }

    100% {
        background: var(--cell-fill);
        box-shadow: none;
    }
}

@keyframes captureRemove {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.95);
    }

    100% {
        opacity: 0;
        transform: scale(0.3);
    }
}

@keyframes captureRespawn {
    0% {
        opacity: 0;
        transform: scale(0.1);
        filter: hue-rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.15);
    }

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

@keyframes pulseProtect {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

.hex-cell.is-capturing {
    animation: capturePulse 600ms ease-out;
}

.player-token.is-captured {
    animation: captureRemove 500ms ease-in-out forwards;
}

.player-token.is-respawning {
    animation: captureRespawn 500ms cubic-bezier(0.6, 0.2, 0.4, 1.2);
}

@media (max-width: 860px) {
    .top-nav {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 8px;
    }
}

/* ── Token badge rows ── */

.token-badge-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    padding: 3px 8px;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 0;
    overflow: visible;
}

.token-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--token-badge-size);
    height: var(--token-badge-size);
    border-radius: 999px;
    border: 1.5px solid currentColor;
    font-size: calc(var(--token-badge-size) * 0.52);
    background: transparent;
    transition: opacity 120ms ease;
}

.token-badge.is-captured {
    opacity: 0.22;
}

.p1-badge {
    color: var(--player1-color);
}

.p2-badge {
    color: var(--player2-color);
}

.p0-badge {
    color: var(--danger-color);
}

.hexposition-header-icon{
    height: 2.5rem;
}