/* static/css/game.css */

/* ================================
   Game Layout & Board
   ================================ */

.board {
    width: min(88vh, 900px);
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(15, minmax(0, 1fr));
    grid-template-rows: repeat(15, minmax(0, 1fr));
    border-radius: 0.75rem;
    border: 1px solid #d4af37;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.25);
}

/* ================================
   Board Cells
   ================================ */

.cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.cell i {
    position: absolute;
    pointer-events: none;
    z-index: 2;
}

/* Cell backgrounds */
.red { background: #e8303080; border: 1px solid #e8303026; }
.green { background: #22c35880; border: 1px solid #22c35826; }
.blue { background: #308ce880; border: 1px solid #308ce826; }
.yellow { background: #f9d51f80; border: 1px solid #f9d51f26; }

.red-inner { background: #e830304d; border: 1px solid #e8303026; }
.green-inner { background: #22c3584d; border: 1px solid #22c35826; }
.blue-inner { background: #308ce84d; border: 1px solid #308ce826; }
.yellow-inner { background: #f9d51f4d; border: 1px solid #f9d51f26; }

.path {
    background: #f2f2f2;
    border: 1px solid #2b303b33;
}

.center {
    background: transparent;
}

.center-zone {
    border-color: transparent;
    background: transparent;
}

.center-middle {
    position: relative;
    overflow: visible;
    z-index: 3;
}

.center-middle::before {
    content: "";
    position: absolute;
    width: 300%;
    height: 300%;
    top: -100%;
    left: -100%;
    background: conic-gradient(
        from -45deg,
        #22c35880 0deg 90deg,
        #f9d51f80 90deg 180deg,
        #308ce880 180deg 270deg,
        #e8303080 270deg 360deg
    );
    z-index: 0;
    pointer-events: none;
}

.center-middle::after {
    content: "";
    position: absolute;
    width: 300%;
    height: 300%;
    top: -100%;
    left: -100%;
    background:
        linear-gradient(45deg, transparent 49.7%, rgba(0, 0, 0, 0.35) 50%, transparent 50.3%),
        linear-gradient(-45deg, transparent 49.7%, rgba(0, 0, 0, 0.35) 50%, transparent 50.3%);
    z-index: 1;
    pointer-events: none;
}

/* ================================
   Cell Icons
   ================================ */

.home-icon {
    opacity: 0.92;
    font-size: clamp(14px, 1.65vw, 30px);
    line-height: 1;
}

.red .home-icon { color: #e83030; }
.green .home-icon { color: #22c358; }
.yellow .home-icon { color: #f9d51f; }
.blue .home-icon { color: #308ce8; }

.star-icon {
    color: #e0b84f;
}

.trophy-icon {
    width: clamp(50px, 82%, 66px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 45%), #1a1f29;
    color: #ffcf40;
    text-shadow: 0 0 10px rgba(255, 196, 0, 0.6);
    border: 2px solid rgba(214, 175, 55, 0.95);
    box-shadow: 0 0 14px rgba(0, 0, 0, 0.6), inset 0 0 14px rgba(0, 0, 0, 0.5);
    font-size: clamp(1.2rem, 2.6vw, 2rem);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 4;
}

.home-arrow {
    opacity: 0.7;
}

.red-arrow { color: #ff5c5c; }
.green-arrow { color: #6bff9c; }
.yellow-arrow { color: #ffe066; }
.blue-arrow { color: #66aaff; }

/* ================================
   Tokens
   ================================ */

.tokens {
    display: flex;
    position: relative;
    z-index: 2;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 1px;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
}

.token {
    position: relative;
    z-index: 1;
    width: clamp(12px, 56%, 24px);
    aspect-ratio: 1 / 1;
    height: auto;
    min-width: 10px;
    border-radius: var(--radius-full);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.18);
}

.token .core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: clamp(5px, 42%, 10px);
    aspect-ratio: 1 / 1;
    height: auto;
    transform: translate(-50%, -50%);
    border-radius: var(--radius-full);
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.5) 56%, rgba(255, 255, 255, 0.16) 100%);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.35);
}

/* Token colors */
.red-token {
    background: radial-gradient(circle at 30% 30%, #ff5a5a, #d62828);
    border: 2px solid #ffd6d6;
}

.green-token {
    background: radial-gradient(circle at 30% 30%, #3ee081, #1f9d55);
    border: 2px solid #d4ffe8;
}

.blue-token {
    background: radial-gradient(circle at 30% 30%, #5aa9ff, #1f6ed4);
    border: 2px solid #d6e9ff;
}

.yellow-token {
    background: radial-gradient(circle at 30% 30%, #ffd84d, #d4a017);
    border: 2px solid #fff5cc;
}

/* Token states */
.token.movable {
    cursor: pointer;
    animation: pulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22), 0 0 12px rgba(255, 255, 255, 0.28), 0 2px 6px rgba(0, 0, 0, 0.38);
}

.token.not-movable {
    opacity: 0.95;
    cursor: not-allowed;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

/* Token sizing based on count */
.tokens > .token:first-child:nth-last-child(2),
.tokens > .token:first-child:nth-last-child(2) ~ .token {
    width: clamp(10px, 44%, 20px);
    min-width: 9px;
}

.tokens > .token:first-child:nth-last-child(n + 3),
.tokens > .token:first-child:nth-last-child(n + 3) ~ .token {
    width: clamp(8px, 30%, 14px);
    min-width: 7px;
}

/* Give 3-token stacks a bit more presence on larger screens */
.tokens > .token:first-child:nth-last-child(3),
.tokens > .token:first-child:nth-last-child(3) ~ .token {
    width: clamp(10px, 35%, 17px);
    min-width: 8px;
}

.tokens > .token:first-child:nth-last-child(4),
.tokens > .token:first-child:nth-last-child(4) ~ .token {
    width: clamp(8px, 26%, 12px);
    min-width: 6px;
}

.tokens > .token:only-child {
    width: clamp(16px, 84%, 36px);
    min-width: 14px;
}

/* Core sizing */
.tokens > .token:first-child:nth-last-child(2) .core,
.tokens > .token:first-child:nth-last-child(2) ~ .token .core {
    width: clamp(4px, 38%, 9px);
}

.tokens > .token:first-child:nth-last-child(n + 3) .core,
.tokens > .token:first-child:nth-last-child(n + 3) ~ .token .core {
    width: clamp(3px, 34%, 6px);
}

.tokens > .token:first-child:nth-last-child(3) .core,
.tokens > .token:first-child:nth-last-child(3) ~ .token .core {
    width: clamp(3px, 32%, 6px);
}

.tokens > .token:first-child:nth-last-child(4) .core,
.tokens > .token:first-child:nth-last-child(4) ~ .token .core {
    width: clamp(2px, 28%, 4px);
}

/* 3-token stack: triangular layout */
.tokens > .token:first-child:nth-last-child(3),
.tokens > .token:first-child:nth-last-child(3) ~ .token {
    position: absolute;
}

.tokens > .token:first-child:nth-last-child(3) {
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
}

.tokens > .token:first-child:nth-last-child(3) + .token {
    bottom: 4%;
    left: 4%;
}

.tokens > .token:first-child:nth-last-child(3) + .token + .token {
    bottom: 4%;
    right: 4%;
}

/* 4-token stack: square layout */
.tokens > .token:first-child:nth-last-child(4),
.tokens > .token:first-child:nth-last-child(4) ~ .token {
    position: absolute;
}

.tokens > .token:first-child:nth-last-child(4) {
    top: 4%;
    left: 8%;
}

.tokens > .token:first-child:nth-last-child(4) + .token {
    top: 4%;
    right: 8%;
}

.tokens > .token:first-child:nth-last-child(4) + .token + .token {
    bottom: 4%;
    left: 8%;
}

.tokens > .token:first-child:nth-last-child(4) + .token + .token + .token {
    bottom: 4%;
    right: 8%;
}

.tokens > .token:only-child .core {
    width: clamp(7px, 54%, 18px);
}

/* ================================
   Players Panel
   ================================ */

.player-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    border-radius: 14px;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: var(--border-light);
    transition: all var(--transition-base);
    gap: 0.4rem;
}

.active-player {
    background: rgba(220, 53, 69, 0.08);
}

.player-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
}

.player-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-primary);
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-score {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0.4rem;
    color: var(--color-accent);
    font-weight: 600;
}

.player-score i {
    font-size: 0.9rem;
}

.player-color {
    width: 18px;
    height: 18px;
    border-radius: 6px;
}

.score-pop {
    animation: score-pop 1s ease;
}

@keyframes score-pop {
    0% { transform: scale(1); color: inherit; }
    50% { transform: scale(1.6); color: var(--color-accent); }
    100% { transform: scale(1); color: inherit; }
}

/* ================================
   Dice Controls
   ================================ */

.dice-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.turn-indicator {
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
}

/* Turn indicator colors */
.turn-indicator.red-turn {
    color: var(--color-red-light);
    background: rgba(220, 53, 69, 0.15);
    box-shadow: 0 0 25px rgba(220, 53, 69, 0.2);
}

.turn-indicator.green-turn {
    color: var(--color-green-light);
    background: rgba(46, 204, 113, 0.12);
    box-shadow: 0 0 18px rgba(46, 204, 113, 0.2);
}

.turn-indicator.blue-turn {
    color: var(--color-blue-light);
    background: rgba(13, 110, 253, 0.12);
    box-shadow: 0 0 20px rgba(13, 110, 253, 0.2);
}

.turn-indicator.yellow-turn {
    color: var(--color-yellow-light);
    background: rgba(241, 196, 15, 0.15);
    box-shadow: 0 0 22px rgba(241, 196, 15, 0.2);
}

.dice-box {
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.dice-gif {
    width: 140px;
    height: 140px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    object-fit: contain;
}

.dice-button {
    width: 110px;
    height: 110px;
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    padding: 0;
    position: relative;
    margin: 0 auto;
}

.dice-button i {
    font-size: 66px;
    line-height: 1;
    display: block;
    position: relative;
    z-index: 1;
    color: var(--color-text-primary);
}

.dice-button:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.05);
}

.dice-button:active:not(:disabled) {
    transform: translateY(2px) scale(0.96);
}

.dice-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.dice-button:disabled:hover {
    transform: none;
}

/* Dice button gradients */
.dice-button.yellow-turn {
    background: linear-gradient(145deg, #ffe566 0%, #f5c518 45%, #c8890a 100%);
    box-shadow:
        0 8px 24px rgba(241, 196, 15, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}

.dice-button.red-turn {
    background: linear-gradient(145deg, #ff7070 0%, #e83030 45%, #a01010 100%);
    box-shadow:
        0 8px 24px rgba(220, 53, 69, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}

.dice-button.green-turn {
    background: linear-gradient(145deg, #5df5a0 0%, #22c358 45%, #0e7a38 100%);
    box-shadow:
        0 8px 24px rgba(46, 204, 113, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}

.dice-button.blue-turn {
    background: linear-gradient(145deg, #7ec8ff 0%, #308ce8 45%, #1245a0 100%);
    box-shadow:
        0 8px 24px rgba(13, 110, 253, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}

/* Dice result message animation */
#dice-roll-result.animate {
    animation: waiting-pulse 1.5s ease infinite;
}

/* ================================
   Game Overlays
   ================================ */

.game-overlay {
    position: absolute;
    inset: 0;
    background: var(--color-bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    z-index: 10;
}

/* Winner colors */
#winner-name {
    font-weight: 700;
}

.winner-red {
    color: var(--color-red-light);
    text-shadow: 0 0 20px rgba(220, 53, 69, 0.6);
}

.winner-green {
    color: var(--color-green-light);
    text-shadow: 0 0 20px rgba(46, 204, 113, 0.6);
}

.winner-blue {
    color: var(--color-blue-light);
    text-shadow: 0 0 20px rgba(13, 110, 253, 0.6);
}

.winner-yellow {
    color: var(--color-yellow-light);
    text-shadow: 0 0 20px rgba(241, 196, 15, 0.7);
}

.finished-card {
    width: 100%;
    max-width: 420px;
    padding: 1.8rem;
}

.standing-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    margin-bottom: 0.4rem;
    background: var(--bg-glass);
    border: var(--border-subtle);
}

.standing-row.standing-winner {
    background: rgba(245, 197, 66, 0.08);
    border-color: rgba(245, 197, 66, 0.25);
}

.standing-row.standing-you {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Waiting overlay */
.waiting-card {
    width: 100%;
    max-width: 420px;
    padding: var(--space-xl);
}

.waiting-slots {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.waiting-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    font-size: var(--text-sm);
}

.waiting-slot.joined {
    background: var(--bg-glass-hover);
    border: var(--border-light);
}

.waiting-slot.empty {
    background: var(--bg-glass);
    border: 1px dashed rgba(255, 255, 255, 0.08);
}

.waiting-dot-pulse {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--color-text-muted);
    display: inline-block;
    animation: waiting-pulse 1.5s ease infinite;
}

@keyframes waiting-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

.cancel-game-link {
    color: var(--color-danger);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.cancel-game-link:hover {
    text-decoration: underline;
}

#game-link {
    font-size: 0.8rem;
    color: var(--color-text-primary);
    margin-bottom: 0;
    font-family: monospace;
}

/* ================================
   Connection Status
   ================================ */

#connection-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    z-index: 9999;
    transition: opacity 0.5s ease, all var(--transition-slow);
    backdrop-filter: blur(10px);
}

#connection-status.hidden {
    opacity: 0;
    pointer-events: none;
}

#connection-status .bi-circle-fill {
    font-size: 12px;
}

#connection-status .bi-arrow-repeat {
    font-size: 20px;
}

#connection-status.connected {
    background: rgba(46, 204, 113, 0.12);
    color: var(--color-success);
    border: 1px solid rgba(46, 204, 113, 0.2);
}

#connection-status.reconnecting {
    background: rgba(231, 76, 60, 0.12);
    color: var(--color-danger);
    border: 1px solid rgba(231, 76, 60, 0.2);
}

/* ================================
   Responsive: Game Page
   ================================ */

@media (max-width: 1024px) {
    :root {
        --mobile-controls-height: 170px;
        --mobile-top-bar-height: 86px;
        --mobile-players-height: 68px;
        --mobile-board-gap: 0.5rem;
    }

    .page-wrapper {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .top-bar {
        padding-inline: 1rem !important;
    }

    .top-bar .title {
        font-size: 1.7rem;
        letter-spacing: 0.12em;
    }

    .top-bar .subtitle {
        font-size: 0.72rem;
    }

    .page-wrapper > .flex-grow-1 {
        align-items: flex-start !important;
    }

    .game-layout {
        padding-inline: 0 !important;
        padding-top: 0.15rem;
        padding-bottom: calc(
            var(--mobile-controls-height) +
            var(--mobile-board-gap) +
            env(safe-area-inset-bottom)
        );
    }

    .game-row {
        align-items: start !important;
        row-gap: 0.05rem;
        --bs-gutter-y: 0.35rem;
    }

    .board-col {
        padding-inline: 0.5rem;
        margin-top: 0;
        margin-bottom: var(--mobile-board-gap);
    }

    .board {
        width: min(
            96vw,
            760px,
            calc(
                100dvh - var(--mobile-top-bar-height) -
                var(--mobile-players-height) -
                var(--mobile-controls-height) -
                (var(--mobile-board-gap) * 2) -
                env(safe-area-inset-bottom) - 1rem
            )
        );
        max-width: 100%;
    }

    .players-col {
        justify-content: center !important;
    }

    .players-panel {
        width: min(96vw, 780px);
        margin-bottom: var(--mobile-board-gap);
    }

    .players-panel .glass-card {
        max-width: none;
        padding: 0.75rem !important;
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.45rem;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .players-panel .glass-card h6 {
        display: none;
    }

    .player-card {
        margin-bottom: 0;
        padding: 0.48rem 0.6rem;
        min-width: max-content;
        flex: 0 0 auto;
        border-radius: 11px;
    }

    .player-name {
        font-size: 0.82rem;
    }

    .controls-col {
        justify-content: center !important;
    }

    .game-controls {
        position: fixed;
        left: 0.8rem;
        right: 0.8rem;
        bottom: calc(0.75rem + env(safe-area-inset-bottom));
        width: auto !important;
        padding: 0.6rem 0.9rem;
        border-radius: 18px;
        background: rgba(16, 19, 24, 0.92);
        border: var(--border-light);
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(6px);
        z-index: 20;
        min-height: var(--mobile-controls-height);
        gap: 0.15rem;
    }

    .turn-indicator {
        font-size: 0.86rem;
        margin-bottom: 0.25rem !important;
        padding: 0.35rem 0.8rem;
    }

    .dice-box {
        width: 74px;
        height: 74px;
    }

    .dice-button {
        width: 70px;
        height: 70px;
        border-radius: 14px;
    }

    .dice-button i {
        font-size: 40px;
    }

    .dice-gif {
        width: 80px;
        height: 80px;
    }

    #dice-roll-result {
        margin-top: 0.1rem !important;
        font-size: 0.78rem;
    }

    #connection-status {
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        font-size: 0.85rem;
        padding: 8px 12px;
        z-index: 35;
    }
}

@media (max-width: 767px) {
    :root {
        --mobile-controls-height: 154px;
        --mobile-top-bar-height: 78px;
        --mobile-players-height: 58px;
        --mobile-board-gap: 0.45rem;
    }

    .top-bar .title {
        font-size: 1.35rem;
    }

    .top-bar .subtitle {
        font-size: 0.68rem;
    }

    .board-col {
        padding-inline: max(0rem, env(safe-area-inset-left))
                        max(0.4rem, env(safe-area-inset-right));
    }

    .board {
        width: min(
            calc(100vw - 0.4rem - env(safe-area-inset-left) - env(safe-area-inset-right)),
            560px,
            calc(
                100dvh - var(--mobile-top-bar-height) -
                var(--mobile-players-height) -
                var(--mobile-controls-height) -
                (var(--mobile-board-gap) * 2) -
                env(safe-area-inset-bottom) - 0.75rem
            )
        );
    }

    .players-panel .glass-card {
        gap: 0.35rem;
        padding-block: 0.58rem !important;
    }

    .player-card {
        padding: 0.42rem 0.46rem;
        border-radius: 10px;
    }

    .player-color {
        width: 12px;
        height: 12px;
        border-radius: var(--radius-full);
    }

    .player-left {
        gap: 0.45rem;
    }

    .player-name {
        font-size: 0.75rem;
    }

    .player-score {
        gap: 0.15rem;
        font-size: 0.74rem;
    }

    .player-score i {
        display: none;
    }

    .you-tag {
        display: none;
    }

    .turn-indicator {
        font-size: 0.78rem;
        margin-bottom: 0.1rem !important;
        padding: 0.24rem 0.52rem;
    }

    .dice-box {
        width: 68px;
        height: 68px;
    }

    .dice-button {
        width: 64px;
        height: 64px;
        border-radius: 13px;
    }

    .dice-button i {
        font-size: 36px;
    }

    .dice-gif {
        width: 74px;
        height: 74px;
    }

    #dice-roll-result {
        font-size: 0.72rem;
    }

    /* Mobile tune: give larger shared stacks a bit more room */
    .tokens > .token:first-child:nth-last-child(2),
    .tokens > .token:first-child:nth-last-child(2) ~ .token {
        width: clamp(9px, 42%, 18px);
        min-width: 8px;
    }

    .tokens > .token:first-child:nth-last-child(3) {
        width: clamp(9px, 34%, 16px);
        min-width: 7px;
        top: 7%;
    }

    .tokens > .token:first-child:nth-last-child(3) + .token {
        bottom: 5%;
        left: 5%;
    }

    .tokens > .token:first-child:nth-last-child(3) + .token + .token {
        bottom: 5%;
        right: 5%;
    }

    .tokens > .token:first-child:nth-last-child(3) .core,
    .tokens > .token:first-child:nth-last-child(3) ~ .token .core {
        width: clamp(3px, 32%, 6px);
    }

    .tokens > .token:first-child:nth-last-child(4),
    .tokens > .token:first-child:nth-last-child(4) ~ .token {
        width: clamp(7px, 24%, 11px);
        min-width: 6px;
    }

    .tokens > .token:first-child:nth-last-child(4) {
        top: 3%;
        left: 7%;
    }

    .tokens > .token:first-child:nth-last-child(4) + .token {
        top: 3%;
        right: 7%;
    }

    .tokens > .token:first-child:nth-last-child(4) + .token + .token {
        bottom: 3%;
        left: 7%;
    }

    .tokens > .token:first-child:nth-last-child(4) + .token + .token + .token {
        bottom: 3%;
        right: 7%;
    }

    .tokens > .token:first-child:nth-last-child(4) .core,
    .tokens > .token:first-child:nth-last-child(4) ~ .token .core {
        width: clamp(2px, 27%, 4px);
    }
}
