:root {
    --bg-1: #101727;
    --bg-2: #223354;
    --accent-1: #f8c947;
    --accent-2: #f05d5e;
    --text: #17233b;
    --muted: #5b6880;
    --surface: rgba(16, 23, 39, 0.76);
    --border: rgba(248, 251, 255, 0.18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: #17233b;
    background: #f4f6fb;
}

.page {
    min-height: calc(100vh - 62px);
    padding: 18px;
    width: 100%;
}

.card {
    width: min(100%, 820px);
    margin: 0 auto;
    position: relative;
    border: 1px solid rgba(23, 35, 59, 0.12);
    border-radius: 24px;
    padding: clamp(20px, 4vw, 36px);
    background: #fff;
    box-shadow: 0 12px 30px rgba(23, 35, 59, 0.08);
}

.card-wide {
    width: 100%;
    max-width: none;
    margin: 0;
}

.badge {
    display: inline-block;
    margin: 0 0 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(248, 201, 71, 0.16);
    color: var(--accent-1);
}

h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3.9vw, 2.4rem);
}

.lead {
    margin: 10px 0 14px;
    color: #4f5e7b;
    line-height: 1.5;
}

.notes {
    margin: 0 0 24px;
    padding-left: 18px;
    color: #4f5e7b;
    line-height: 1.45;
}

.auth-form {
    display: grid;
    gap: 10px;
}

label {
    font-size: 0.9rem;
    color: #4f5e7b;
}

input,
button {
    width: 100%;
    border-radius: 12px;
    border: 0;
    font-size: 1rem;
}

input {
    padding: 13px 14px;
    color: #101727;
}

button {
    padding: 13px 14px;
    font-weight: 700;
    cursor: pointer;
    color: #101727;
    background: linear-gradient(90deg, var(--accent-1), #ffd76a);
}

button:hover {
    transform: none;
    box-shadow: none;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.stat-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    background: rgba(248, 251, 255, 0.06);
}

.stat-card h2 {
    margin: 0;
    font-size: 0.86rem;
    color: var(--muted);
}

.stat-card p {
    margin: 6px 0 0;
    font-size: 1.6rem;
    font-weight: 700;
}

.points-rule {
    margin: 14px 0 0;
    color: var(--muted);
}

.actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.link-button,
.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 12px;
    padding: 11px 14px;
    font-weight: 700;
    border: 1px solid var(--border);
    min-width: 150px;
}

.link-button {
    background: linear-gradient(90deg, var(--accent-2), #ff8f76);
    color: #101727;
}

.button-secondary {
    background: #eef2fb;
    color: #17233b;
}

.games-list {
    display: grid;
    gap: 12px;
    margin-top: 8px;
}

.game-item {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    background: rgba(248, 251, 255, 0.06);
}

.games-types-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.game-type-uno {
    border-color: rgba(217, 65, 65, 0.35);
    background: linear-gradient(145deg, rgba(217, 65, 65, 0.08), rgba(58, 128, 224, 0.08));
}

.game-item h2 {
    margin: 0;
}

.game-item p {
    margin: 7px 0 0;
    color: var(--muted);
}

.game-item-finished {
    opacity: 0.6;
    filter: grayscale(0.45);
    border-color: rgba(91, 104, 128, 0.35);
}

@media (max-width: 620px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.inline-form {
    display: inline-block;
}

.site-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
    background: rgba(8, 14, 26, 0.82);
    border-bottom: 1px solid var(--border);
}

.site-topbar-inner {
    width: min(100%, 1240px);
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.brand-link {
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.brand-logo {
    height: 34px;
    width: auto;
    display: block;
}

.site-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.site-nav a {
    color: #fff;
    text-decoration: none;
    padding: 7px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(248, 251, 255, 0.08);
    font-weight: 600;
}

.site-topbar .button-secondary,
.actions button,
.actions .button-secondary {
    width: auto;
}

.card-game {
    width: 100%;
    max-width: none;
    margin: 0;
    position: relative;
}

.card-game-my-turn {
    background: linear-gradient(180deg, #d9f6e4 0%, #eef9f1 42%, #ffffff 100%);
    border-color: rgba(20, 168, 78, 0.8);
    box-shadow: 0 0 0 3px rgba(20, 168, 78, 0.22), 0 14px 30px rgba(20, 168, 78, 0.18);
}

.card-game-waiting::before,
.card-waiting::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.58);
    z-index: 40;
}

.card-game-waiting::after,
.card-waiting::after {
    content: attr(data-wait-label);
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 2px solid rgba(23, 35, 59, 0.18);
    background: #ffffff;
    color: #17233b;
    font-weight: 800;
    letter-spacing: 0.01em;
    z-index: 41;
    animation: uno-wait-pulse 800ms ease-in-out infinite;
}

.card-game-waiting form[data-live="1"],
.card-game-waiting .hand-card-selectable,
.card-game-waiting .wild-color,
.card-game-waiting .table-action-form button,
.card-game-waiting .throw-btn,
.card-waiting form[data-live="1"],
.card-waiting .dots-cell,
.card-waiting .chess-square {
    pointer-events: none !important;
}

@keyframes uno-wait-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(23, 35, 59, 0);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 0 0 5px rgba(23, 35, 59, 0.08);
    }
}

.turn-beacon {
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 2px solid rgba(20, 168, 78, 0.8);
    background: linear-gradient(90deg, rgba(20, 168, 78, 0.14), rgba(248, 201, 71, 0.2));
    color: #165f36;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.uno-penalty-banner {
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 2px solid rgba(240, 93, 94, 0.7);
    background: linear-gradient(90deg, rgba(240, 93, 94, 0.16), rgba(248, 201, 71, 0.2));
    color: #7a1f24;
    text-align: center;
    font-weight: 800;
}

.game-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.game-menu .link-button {
    min-width: 110px;
    padding: 8px 12px;
}

.game-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(248, 251, 255, 0.07);
    margin-bottom: 10px;
}

.game-strip span {
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(248, 251, 255, 0.12);
    font-size: 0.9rem;
}

.game-strip-main {
    margin-top: 2px;
}

.opponents-line {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    padding-bottom: 2px;
    margin-bottom: 12px;
    align-items: center;
}

.opponents-center {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 10px;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 2px;
}

.opponent-chip {
    min-width: 0;
    width: clamp(128px, 22vw, 190px);
    max-width: 190px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 10px;
    background: #ffffff;
    display: grid;
    gap: 2px;
    position: relative;
}

.opponent-chip strong {
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.opponent-chip small {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.opponent-chip-active {
    border-color: rgba(20, 168, 78, 0.95) !important;
    box-shadow: 0 0 0 2px rgba(20, 168, 78, 0.6) inset !important;
    background: #dff6e8 !important;
}

.opponent-chip-next {
    border-color: rgba(248, 201, 71, 0.6);
    background: rgba(248, 201, 71, 0.12);
}

.opponents-line-end {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 44px;
    flex: 0 0 auto;
}

.surrender-icon-btn {
    width: 40px !important;
    min-width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    font-size: 1.1rem;
}

.actions-top-right {
    justify-content: flex-end;
}

.potato-throw-form {
    position: absolute;
    z-index: 30;
    transform: translate(-50%, -50%);
}

.potato-throw-btn {
    width: clamp(62px, 12vw, 114px) !important;
    height: clamp(62px, 12vw, 114px);
    min-width: 0 !important;
    border-radius: 999px;
    padding: 0;
    font-size: clamp(1.6rem, 4.4vw, 2.4rem);
    line-height: 1;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.26);
}

.rule-hint {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(58, 128, 224, 0.35);
    background: rgba(58, 128, 224, 0.08);
}

.rule-hint p {
    margin: 0;
    color: #1f427a;
    font-weight: 700;
}

.icon-only {
    min-width: 44px;
    width: 44px !important;
    padding: 10px 0;
}

.table-center {
    margin: 8px 0 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
}

.pile-card {
    width: 126px;
    min-height: 164px;
}

.pile-back {
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: linear-gradient(145deg, #1a2744, #101727);
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
}

.pile-back p {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.pile-back small {
    font-size: 0.95rem;
    opacity: 0.9;
}

.table-action-form {
    margin-top: 8px;
    display: grid;
    place-items: center;
}

.table-action-btn {
    min-width: 44px;
    width: 44px !important;
    padding: 10px 0;
}

.uno-last-opponent-action {
    max-width: 210px;
    min-width: 140px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(23, 35, 59, 0.18);
    background: rgba(248, 251, 255, 0.86);
    color: #17233b;
}

.uno-last-opponent-action small {
    display: block;
    margin: 0 0 6px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #3a4e78;
}

.uno-last-opponent-action p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.25;
    word-break: break-word;
}

.players-list {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.player-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(248, 251, 255, 0.06);
}

.player-item h2 {
    margin: 0;
    font-size: 1rem;
}

.player-item p {
    margin: 6px 0 0;
    color: var(--muted);
}

.turn-box {
    margin: 8px 0 0;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(248, 201, 71, 0.12);
    color: var(--text);
}

.turn-box p {
    margin: 0;
    font-weight: 700;
}

.hand-block {
    margin-top: 18px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.hand-block-my-turn {
    border-top-color: rgba(20, 168, 78, 0.5);
    background: linear-gradient(180deg, rgba(20, 168, 78, 0.06), rgba(20, 168, 78, 0));
    border-radius: 12px;
    padding: 14px 10px 0;
}

.hand-block h2 {
    margin: 0 0 10px;
    font-size: 1.1rem;
}

.hand-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.hand-grid .hand-card {
    min-width: 126px;
}

.hand-card {
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 8px 8px 10px;
    min-height: 164px;
    overflow: hidden;
    background: rgba(248, 251, 255, 0.06);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
}

.hand-card-selectable {
    cursor: pointer;
}

.hand-card-blocked {
    opacity: 0.78;
    transform: scale(0.93);
    filter: none;
}

.hand-card-blocked::after {
    content: "";
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

.hand-card-selected {
    transform: none;
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.28), 0 0 0 3px rgba(248, 201, 71, 0.85) inset;
    z-index: 3;
}

.hand-card-is-throwing {
    pointer-events: none;
}

.hand-card-is-throwing .throw-btn {
    display: none !important;
}

.hand-card-optimistic-gone {
    opacity: 0.12;
    transform: scale(0.88);
    pointer-events: none;
}

.hand-card-optimistic-draw {
    opacity: 0.82;
    animation: uno-draw-ghost 220ms ease-out;
}

@keyframes uno-draw-ghost {
    0% {
        opacity: 0.2;
        transform: scale(0.85);
    }
    100% {
        opacity: 0.82;
        transform: scale(1);
    }
}

.hand-card p {
    margin: 0 0 8px;
}

.uno-card-symbol {
    height: 96px;
    margin: 14px 0 6px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 2.8rem;
    font-weight: 900;
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
}

.uno-card-label {
    margin: 0 0 6px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.92);
}

.uno-card-corner {
    font-weight: 900;
    font-size: 1rem;
    color: #fff;
    line-height: 1;
}

.uno-card-corner-bottom {
    position: absolute;
    right: 8px;
    bottom: 8px;
    transform: rotate(180deg);
}

.uno-card-red {
    background: linear-gradient(145deg, #d63e3e, #a81f1f);
}

.uno-card-yellow {
    background: linear-gradient(145deg, #e9c842, #c28f17);
}

.uno-card-green {
    background: linear-gradient(145deg, #34b868, #1f8449);
}

.uno-card-blue {
    background: linear-gradient(145deg, #3a80e0, #1d53a1);
}

.uno-card-wild {
    background: linear-gradient(145deg, #2f2f2f, #121212);
}

.wild-palette {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0;
    width: 100%;
    height: 74px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.6);
}

.wild-color {
    width: 100%;
    height: 100%;
    min-width: 0;
    border-radius: 0;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.wild-selected {
    box-shadow: inset 0 0 0 3px #fff;
}

.wild-red {
    background: #d63e3e;
}

.wild-yellow {
    background: #e9c842;
}

.wild-green {
    background: #34b868;
}

.wild-blue {
    background: #3a80e0;
}

.card-action-slot {
    min-height: 90px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
}

.card-action-slot .inline-form {
    width: 100%;
}

.card-action-slot .button-secondary {
    width: 100%;
}

.card-action-slot .wild-palette {
    min-height: 74px;
    margin-bottom: 0;
}

.card-throw-form {
    display: none;
}

.hand-card-selected .card-throw-form {
    display: block;
}

.throw-btn {
    width: auto !important;
    min-width: 44px;
    margin: 0;
    display: block;
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 1.15rem;
    font-weight: 700;
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    z-index: 2;
}

.throw-btn:hover {
    transform: translateX(-50%) !important;
    box-shadow: none !important;
}

.hidden {
    display: none !important;
}

.uno-chip-badge {
    position: absolute;
    top: -10px;
    right: -8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f8c947;
    color: #5a3f00;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    border: 1px solid rgba(90, 63, 0, 0.28);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
}

.potato-throwing {
    animation: potato-throw 280ms ease-in;
}

.potato-received {
    animation: potato-receive 420ms ease-out;
}

@keyframes potato-throw {
    0% {
        transform: scale(1);
    }
    45% {
        transform: translateX(8px) rotate(-4deg) scale(0.96);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes potato-receive {
    0% {
        transform: scale(0.94);
        box-shadow: 0 0 0 rgba(248, 201, 71, 0);
    }
    55% {
        transform: scale(1.05);
        box-shadow: 0 0 16px rgba(248, 201, 71, 0.45);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(248, 201, 71, 0);
    }
}

@media (max-width: 620px) {
    .card-game {
        padding: 14px;
    }

    .opponents-center {
        gap: 8px;
    }

    .opponent-chip {
        width: 132px;
        max-width: 132px;
        padding: 7px 8px;
    }

    .opponent-chip strong {
        font-size: 0.82rem;
    }

    .opponent-chip small {
        font-size: 0.74rem;
    }

    .table-center {
        gap: 10px;
        flex-wrap: wrap;
    }

    .pile-card {
        width: 108px;
        min-height: 148px;
    }

    .pile-back p {
        font-size: 1rem;
    }

    .pile-back small {
        font-size: 0.82rem;
    }

    .uno-last-opponent-action {
        width: 100%;
        max-width: 100%;
        order: 4;
    }

    .hand-grid {
        gap: 8px;
    }

    .hand-grid .hand-card {
        min-width: 108px;
        min-height: 148px;
    }

    .uno-card-symbol {
        height: 84px;
        font-size: 2.3rem;
    }

    .finish-stats {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1024px) {
    .hand-grid {
        flex-wrap: wrap;
        overflow-x: visible;
    }
}

.color-select {
    width: 100%;
    margin-bottom: 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(248, 251, 255, 0.1);
    color: var(--text);
    padding: 8px;
}

.error-banner {
    margin-bottom: 10px;
    border: 1px solid rgba(240, 93, 94, 0.55);
    background: rgba(240, 93, 94, 0.16);
    color: #ffd8d9;
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 600;
}

.realtime-banner {
    margin-bottom: 10px;
    border: 1px solid rgba(58, 128, 224, 0.4);
    background: rgba(58, 128, 224, 0.1);
    color: #1d3f79;
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 600;
}

.history-block {
    margin-top: 18px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.history-block h2 {
    margin: 0 0 10px;
    font-size: 1.1rem;
}

.history-list {
    display: grid;
    gap: 8px;
}

.history-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(248, 251, 255, 0.05);
}

.history-item p {
    margin: 0;
}

.history-item small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.finish-panel {
    margin-top: 14px;
    border-radius: 16px;
    padding: 14px;
    border: 1px solid rgba(23, 35, 59, 0.14);
    background: #fff;
}

.finish-panel h2 {
    margin: 0;
}

.finish-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.finish-win {
    background: linear-gradient(145deg, rgba(20, 168, 78, 0.13), rgba(255, 255, 255, 0.96));
    border-color: rgba(20, 168, 78, 0.45);
}

.finish-lose {
    background: linear-gradient(145deg, rgba(248, 201, 71, 0.14), rgba(255, 255, 255, 0.96));
    border-color: rgba(248, 201, 71, 0.5);
}

.dots-grid-wrap {
    margin-top: 14px;
    display: grid;
    gap: 4px;
    width: min(100%, 920px);
}

.dots-row {
    display: grid;
    grid-template-columns: repeat(var(--dots-dim, 8), 1fr);
    gap: 4px;
}

.dots-cell-form {
    margin: 0;
}

.dots-cell {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 999px;
    border: 1px solid rgba(23, 35, 59, 0.2);
    background: #ffffff;
    padding: 0;
    transition: transform 180ms ease, background-color 180ms ease;
    transform: scale(0.62);
}

.dots-create-form {
    display: grid;
    gap: 8px;
    max-width: 360px;
    margin-bottom: 10px;
}

.dots-create-form select {
    border-radius: 10px;
    border: 1px solid rgba(23, 35, 59, 0.2);
    padding: 10px 12px;
    font-size: 0.95rem;
}

.dots-cell:disabled {
    cursor: not-allowed;
}

.dots-cell:not(:disabled):hover {
    transform: scale(0.68);
}

.dots-cell-filled {
    animation: none;
}

.dots-cell-optimistic {
    background: color-mix(in srgb, var(--dot-owner-color) 85%, white 15%);
    transform: scale(0.68);
}

.cross-grid-wrap {
    width: min(100%, 420px);
    margin: 14px auto 8px;
}

.cross-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.cross-cell-form {
    margin: 0;
}

.cross-cell {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    border: 2px solid rgba(23, 35, 59, 0.2);
    background: #ffffff;
    color: #17233b;
    font-size: clamp(2rem, 7vw, 3rem);
    font-weight: 900;
    line-height: 1;
    display: grid;
    place-items: center;
    padding: 0;
}

.cross-cell:disabled {
    cursor: not-allowed;
}

.cross-cell.cross-cell-filled {
    border-color: rgba(23, 35, 59, 0.34);
}

.cross-cell.cross-cell-x {
    color: #1f63bf;
}

.cross-cell.cross-cell-o {
    color: #d63e3e;
}

.cross-cell.cross-cell-last-opponent {
    box-shadow: 0 0 0 3px rgba(248, 201, 71, 0.95);
}

.cross-cell.cross-cell-optimistic {
    opacity: 0.95;
}

.dots-cell-owned {
    background: var(--dot-owner-color);
}

.dots-cell-owned[style*="#ffffff"],
.dots-cell-owned[style*="#fff"] {
    border-color: rgba(23, 35, 59, 0.55);
}

.dots-cell-owned[style*="#111111"] {
    border-color: rgba(255, 255, 255, 0.45);
}

.dots-cell-captured {
    opacity: 0.58;
}

.dots-cell-captured-owned {
    background: color-mix(in srgb, var(--dot-captured-color) 50%, white 50%);
}

.dots-cell-captured.dots-cell-filled {
    opacity: 0.48 !important;
    background: color-mix(in srgb, var(--dot-owner-color) 42%, white 58%) !important;
}

.dots-cap-edge-top {
    box-shadow: inset 0 3px 0 color-mix(in srgb, var(--dot-captured-color) 80%, black 20%);
}

.dots-cap-edge-bottom {
    box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--dot-captured-color) 80%, black 20%);
}

.dots-cap-edge-left {
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--dot-captured-color) 80%, black 20%);
}

.dots-cap-edge-right {
    box-shadow: inset -3px 0 0 color-mix(in srgb, var(--dot-captured-color) 80%, black 20%);
}

.dots-cap-edge-top.dots-cap-edge-left { box-shadow: inset 0 3px 0 color-mix(in srgb, var(--dot-captured-color) 80%, black 20%), inset 3px 0 0 color-mix(in srgb, var(--dot-captured-color) 80%, black 20%); }
.dots-cap-edge-top.dots-cap-edge-right { box-shadow: inset 0 3px 0 color-mix(in srgb, var(--dot-captured-color) 80%, black 20%), inset -3px 0 0 color-mix(in srgb, var(--dot-captured-color) 80%, black 20%); }
.dots-cap-edge-bottom.dots-cap-edge-left { box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--dot-captured-color) 80%, black 20%), inset 3px 0 0 color-mix(in srgb, var(--dot-captured-color) 80%, black 20%); }
.dots-cap-edge-bottom.dots-cap-edge-right { box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--dot-captured-color) 80%, black 20%), inset -3px 0 0 color-mix(in srgb, var(--dot-captured-color) 80%, black 20%); }

.dots-cell-last-opponent {
    box-shadow: 0 0 0 4px rgba(248, 201, 71, 1), 0 0 22px rgba(248, 201, 71, 0.9);
    animation: none;
    transform: scale(0.7);
    opacity: 1 !important;
    position: relative;
    z-index: 2;
}

.dots-cell-last-opponent::after {
    content: "LAST";
    position: absolute;
    top: -12px;
    right: -8px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.55rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    color: #5a3f00;
    background: #f8c947;
    border: 1px solid rgba(90, 63, 0, 0.25);
}

.opponent-chip[style*="--dot-player-color"] {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--dot-player-color) 55%, white 45%) inset;
}

.opponent-chip[style*="#ffffff"],
.opponent-chip[style*="#fff"] {
    color: #17233b;
}

.opponent-chip[style*="#111111"] {
    color: #eef2fb;
}

.opponent-chip[style*="#111111"] small {
    color: #d8deee;
}

.rule-hint-toggle {
    margin: 8px 0 10px;
}


.chess-board-wrap {
    margin-top: 14px;
    width: min(100%, 640px);
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    border: 2px solid rgba(23, 35, 59, 0.24);
    border-radius: 12px;
    overflow: hidden;
}

.chess-square {
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 0;
    padding: 0;
    width: 100%;
    min-width: 0;
    background-image: none;
    box-shadow: none;
    cursor: pointer;
    transition: none;
}

.chess-square:hover {
    transform: none;
    box-shadow: none;
}

.chess-square-light {
    background: #f0d9b5;
}

.chess-square-dark {
    background: #b58863;
}

.chess-piece {
    font-size: clamp(1.1rem, 4.2vw, 2.05rem);
    line-height: 1;
    user-select: none;
}

.chess-square-selected {
    box-shadow: inset 0 0 0 4px rgba(248, 201, 71, 0.95);
    transform: none;
}

.chess-square-legal-target {
    box-shadow: inset 0 0 0 3px rgba(52, 184, 104, 0.95);
    position: relative;
}

.chess-square-legal-target-quiet::after {
    content: "";
    position: absolute;
    width: 20%;
    height: 20%;
    border-radius: 999px;
    background: rgba(52, 184, 104, 0.98);
}

.chess-square-legal-target-capture::before {
    content: "";
    position: absolute;
    inset: 13%;
    border: 3px solid rgba(209, 67, 67, 0.98);
    border-radius: 10px;
}

.chess-guided .chess-square {
    opacity: 0.35;
}

.chess-guided .chess-square-selected,
.chess-guided .chess-square-legal-target {
    opacity: 1;
}

.chess-square-last-from {
    box-shadow: inset 0 0 0 3px rgba(246, 173, 85, 0.95);
}

.chess-square-last-to {
    box-shadow: inset 0 0 0 3px rgba(52, 184, 104, 0.98);
}

@media (max-width: 620px) {
    .chess-board-wrap {
        width: 100%;
    }
}
