* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background:
        radial-gradient(ellipse at 50% -18%, rgba(124, 78, 255, 0.34), transparent 52%),
        linear-gradient(135deg, #080b1b 0%, #11172d 52%, #080b19 100%);
    color: #fff;
    min-height: 100vh;
}

#gameMenu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 48px 24px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(124, 78, 255, 0.28), transparent 48%),
        radial-gradient(ellipse at 15% 82%, rgba(0, 220, 255, 0.1), transparent 35%);
}

.game-menu-header {
    margin-bottom: 34px;
    text-align: center;
}

.game-menu-header .eyebrow {
    margin-bottom: 12px;
}

.game-menu-header h1 {
    margin-bottom: 10px;
    color: #fff;
    font-size: clamp(36px, 6vw, 62px);
    letter-spacing: -0.04em;
    text-shadow: 0 0 32px rgba(120, 231, 255, 0.2);
}

.game-menu-header > p:last-child {
    color: #aab7d8;
    font-size: 16px;
}

.game-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    width: min(1040px, 100%);
}

.game-menu-card {
    --game-accent: #78e7ff;
    display: flex;
    min-height: 228px;
    flex-direction: column;
    align-items: flex-start;
    padding: 22px;
    border: 1px solid color-mix(in srgb, var(--game-accent) 42%, transparent);
    border-radius: 16px;
    background:
        linear-gradient(145deg, color-mix(in srgb, var(--game-accent) 12%, #171c39), #0b1022 80%);
    color: #fff;
    cursor: pointer;
    text-align: left;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.24);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.game-menu-card:hover,
.game-menu-card:focus-visible {
    transform: translateY(-5px);
    border-color: var(--game-accent);
    outline: none;
    box-shadow: 0 18px 42px color-mix(in srgb, var(--game-accent) 15%, transparent);
}

.game-menu-card:focus-visible {
    outline: 2px solid var(--game-accent);
    outline-offset: 3px;
}

.end-all-games-button {
    margin-top: 24px;
    padding: 12px 18px;
    border: 1px solid #ff826d;
    border-radius: 10px;
    background: rgba(113, 37, 47, 0.42);
    color: #ffe0dc;
    cursor: pointer;
    font-weight: 700;
}

.end-all-games-button:hover,
.end-all-games-button:focus-visible {
    background: rgba(153, 48, 59, 0.68);
}

.end-all-games-button:focus-visible {
    outline: 2px solid #ffb0a3;
    outline-offset: 3px;
}

.server-admin-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    margin-top: 15px;
    padding: 0 13px;
    border: 1px solid rgba(159, 181, 210, 0.34);
    border-radius: 9px;
    background: rgba(19, 30, 49, 0.72);
    color: #b7c9e1;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.server-admin-link:hover,
.server-admin-link:focus-visible {
    color: #c6eaff;
    border-color: rgba(105, 220, 255, 0.72);
    background: rgba(26, 54, 76, 0.9);
}

.server-admin-link:focus-visible { outline: 2px solid #69dcff; outline-offset: 3px; }

.yugioh-menu-card {
    --game-accent: #ffd56a;
}

.robot-menu-card {
    --game-accent: #ff826d;
}

.uno-menu-card {
    --game-accent: #ff5d75;
}

.chess-menu-card {
    --game-accent: #b8a4ff;
}

.ludo-menu-card {
    --game-accent: #69e3b1;
}

.jesse-craft-menu-card {
    --game-accent: #83d17a;
}

.pokemon-menu-card {
    --game-accent: #53d7a0;
}

.game-menu-icon {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    margin-bottom: 18px;
    border: 1px solid color-mix(in srgb, var(--game-accent) 70%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--game-accent) 16%, transparent);
    color: var(--game-accent);
    font-size: 32px;
    font-weight: 800;
}

.uno-icon {
    font-size: 16px;
    font-style: italic;
    letter-spacing: -0.08em;
}

.ludo-icon {
    font-size: 44px;
    text-shadow: 13px -10px 0 #ffb758, -12px 7px 0 #78a8ff;
}

.jesse-craft-screen {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #101820;
}

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

.jesse-craft-toolbar {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: #18251f;
    color: #fff;
    font-weight: 700;
}

.jesse-craft-toolbar button {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.jesse-craft-toolbar button:hover,
.jesse-craft-toolbar button:focus-visible {
    border-color: #83d17a;
    outline: none;
    background: rgba(131, 209, 122, 0.16);
}

#jesseCraftFrame {
    width: 100%;
    min-height: 0;
    flex: 1;
    border: 0;
}

#pokemonFrame {
    width: 100%;
    min-height: 0;
    flex: 1;
    border: 0;
}

.pokemon-toolbar {
    background: #171e30;
}

.pokemon-toolbar button:hover,
.pokemon-toolbar button:focus-visible {
    border-color: #53d7a0;
    background: rgba(83, 215, 160, 0.16);
}

#ludoScreen {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 28px 18px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
    background:
        radial-gradient(ellipse at 12% 10%, rgba(37, 213, 168, 0.18), transparent 40%),
        radial-gradient(ellipse at 90% 85%, rgba(105, 121, 255, 0.2), transparent 42%),
        linear-gradient(145deg, #080d1c 0%, #111b32 52%, #0a1022 100%);
}

.ludo-panel {
    width: min(1100px, 100%);
    margin: 0 auto;
    padding: 24px;
    border: 1px solid rgba(142, 170, 218, 0.22);
    border-radius: 22px;
    background:
        linear-gradient(145deg, rgba(25, 37, 65, 0.96), rgba(12, 19, 39, 0.98));
    box-shadow: 0 24px 72px rgba(0, 0, 0, 0.38), inset 0 1px rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px);
}

#ludoSetup {
    display: flex;
    max-width: 540px;
    flex-direction: column;
    gap: 9px;
    padding: 30px;
    border-color: rgba(102, 235, 193, 0.26);
    background:
        radial-gradient(ellipse at 100% 0%, rgba(88, 214, 176, 0.13), transparent 42%),
        linear-gradient(150deg, #182642 0%, #111a30 58%, #10172b 100%);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.4), 0 0 44px rgba(38, 213, 166, 0.07),
        inset 0 1px rgba(255, 255, 255, 0.07);
}

#ludoSetup .back-to-menu {
    align-self: flex-start;
    margin: -3px 0 10px;
    padding: 9px 12px;
    border: 1px solid rgba(162, 184, 225, 0.2);
    border-radius: 9px;
    background: rgba(7, 14, 29, 0.4);
    color: #c4d0e8;
    font-weight: 700;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

#ludoSetup .back-to-menu:hover {
    border-color: rgba(102, 235, 193, 0.6);
    background: rgba(102, 235, 193, 0.1);
    color: #8af2cf;
}

#ludoSetup .eyebrow {
    margin: 0;
    color: #6cf0c4;
    letter-spacing: 0.2em;
}

#ludoSetup h1 {
    margin: 0;
    font-size: clamp(28px, 5vw, 40px);
    letter-spacing: -0.035em;
    line-height: 1.08;
    text-shadow: 0 4px 26px rgba(63, 236, 185, 0.12);
}

#ludoSetup .ludo-intro {
    max-width: 420px;
    margin: 1px 0 8px;
    color: #b9c8e1;
    font-size: 15px;
    line-height: 1.55;
}

#ludoSetup h1,
.ludo-game-header h1 {
    color: #fff;
    font-size: clamp(24px, 4vw, 36px);
}

.ludo-intro,
.ludo-hint,
.ludo-rules-hint {
    color: #b5c0db;
    line-height: 1.5;
}

.ludo-hint {
    margin: 0;
    padding: 11px 13px;
    border: 1px solid rgba(117, 151, 205, 0.18);
    border-left: 3px solid #697ff7;
    border-radius: 9px;
    background: rgba(77, 100, 177, 0.1);
    color: #c2cde4;
    font-size: 13px;
}

#ludoSetup label {
    margin: 3px 0 -3px;
    color: #e5edfa;
    font-weight: 700;
    letter-spacing: 0.01em;
}

#ludoSetup input,
#ludoSetup select {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid #3d4c6d;
    border-radius: 11px;
    outline: none;
    background: rgba(8, 15, 31, 0.72);
    color: #fff;
    font: inherit;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

#ludoSetup input::placeholder {
    color: #8190ad;
}

#ludoSetup input:focus,
#ludoSetup select:focus {
    border-color: #5ce4b7;
    background: #0b172a;
    box-shadow: 0 0 0 3px rgba(92, 228, 183, 0.16);
}

#ludoSetup select {
    cursor: pointer;
}

#ludoJoinBtn,
.ludo-controls button {
    min-height: 52px;
    margin-top: 5px;
    padding: 12px 16px;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(120deg, #57e5b2, #7bf0c5);
    color: #06271f;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 9px 22px rgba(54, 218, 165, 0.2), inset 0 1px rgba(255, 255, 255, 0.42);
    transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

#ludoJoinBtn:hover:not(:disabled),
.ludo-controls button:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.07);
    box-shadow: 0 12px 26px rgba(54, 218, 165, 0.28), inset 0 1px rgba(255, 255, 255, 0.5);
}

#ludoJoinBtn:active:not(:disabled),
.ludo-controls button:active:not(:disabled) {
    transform: translateY(1px) scale(0.99);
}

#ludoJoinBtn:disabled,
.ludo-controls button:disabled {
    background: linear-gradient(120deg, #49566c, #59667c);
    color: #d1d8e5;
    cursor: not-allowed;
    box-shadow: none;
}

#ludoSetupStatus {
    min-height: 20px;
    margin: 0;
    color: #ffd479;
    font-size: 14px;
}

.ludo-game-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.ludo-game-header h1 {
    font-size: clamp(20px, 3vw, 30px);
}

.ludo-turn-badge {
    padding: 10px 14px;
    border: 1px solid rgba(105, 227, 177, 0.45);
    border-radius: 10px;
    color: #a9f3d4;
    font-weight: 700;
}

.ludo-players {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.ludo-player-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--ludo-player-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
}

.ludo-player-card strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ludo-player-card span {
    color: #aab7d8;
    font-size: 12px;
}

.ludo-player-card.is-current {
    background: rgba(105, 227, 177, 0.12);
    box-shadow: 0 0 0 1px rgba(105, 227, 177, 0.4);
}

.ludo-player-card.color-yellow { --ludo-player-color: #f4b52f; }
.ludo-player-card.color-green { --ludo-player-color: #34c759; }
.ludo-player-card.color-red { --ludo-player-color: #ed4a4a; }
.ludo-player-card.color-blue { --ludo-player-color: #367df4; }

.ludo-game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 230px;
    align-items: center;
    gap: 24px;
}

.ludo-board-wrap {
    width: min(100%, 680px);
    justify-self: center;
    overflow: hidden;
    border: 5px solid #cad1df;
    border-radius: 8px;
    background: #f5f6f8;
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.35);
}

.ludo-board-wrap svg {
    display: block;
    width: 100%;
    height: auto;
    touch-action: manipulation;
    user-select: none;
}

.ludo-track-cell {
    fill: #fff;
    stroke: #6a707a;
    stroke-width: .06;
}

.ludo-safe-star {
    fill: #aeb5bf;
    font-size: .72px;
}

.ludo-piece {
    cursor: default;
    touch-action: manipulation;
    transform-box: fill-box;
    transform-origin: center;
    outline: none;
}

.ludo-piece:focus-visible {
    filter: drop-shadow(0 0 .2px #fff);
}

.ludo-piece.is-legal {
    cursor: pointer;
    filter: drop-shadow(0 0 .16px #fff);
    animation: ludo-piece-ready 900ms ease-in-out infinite alternate;
}

.ludo-piece.is-legal path {
    stroke: #fff;
    stroke-width: .1;
}

.ludo-piece-shadow {
    fill: rgba(13, 22, 40, .28);
}

.ludo-piece-hit-area {
    fill: transparent;
    stroke: none;
    pointer-events: all;
}

.ludo-piece-number {
    fill: #fff;
    font-size: .16px;
    font-weight: 800;
    paint-order: stroke;
    stroke: rgba(20, 32, 49, .7);
    stroke-width: .035px;
    pointer-events: none;
}

@keyframes ludo-piece-ready {
    from { filter: drop-shadow(0 0 .08px #fff); }
    to { filter: drop-shadow(0 0 .24px #fff) brightness(1.15); }
}

.ludo-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.ludo-die {
    position: relative;
    display: grid;
    width: 76px;
    height: 76px;
    place-items: center;
    align-self: center;
}

.ludo-die::before {
    position: absolute;
    right: 15px;
    bottom: 7px;
    left: 15px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .38);
    content: "";
    filter: blur(4px);
}

.ludo-die-face-2d {
    display: grid;
    width: 54px;
    height: 54px;
    grid-template: repeat(3, 1fr) / repeat(3, 1fr);
    place-items: center;
    padding: 7px;
    border: 1px solid #c5cbd7;
    border-radius: 10px;
    background: linear-gradient(145deg, #fff, #e4e8ef);
    box-shadow: 0 4px 7px rgba(0, 0, 0, .24), inset 1px 1px 2px #fff,
        inset -2px -2px 4px rgba(88, 102, 126, .2);
}

.ludo-die-face-2d i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, #53617a, #172238 74%);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .45);
    opacity: 0;
}

.ludo-die-face-2d i:nth-child(1) { grid-area: 1 / 1; }
.ludo-die-face-2d i:nth-child(2) { grid-area: 1 / 2; }
.ludo-die-face-2d i:nth-child(3) { grid-area: 1 / 3; }
.ludo-die-face-2d i:nth-child(4) { grid-area: 2 / 1; }
.ludo-die-face-2d i:nth-child(5) { grid-area: 2 / 2; }
.ludo-die-face-2d i:nth-child(6) { grid-area: 2 / 3; }
.ludo-die-face-2d i:nth-child(7) { grid-area: 3 / 1; }
.ludo-die-face-2d i:nth-child(8) { grid-area: 3 / 2; }
.ludo-die-face-2d i:nth-child(9) { grid-area: 3 / 3; }

.ludo-die-face-2d[data-value="1"] i:nth-child(5),
.ludo-die-face-2d[data-value="2"] i:nth-child(1),
.ludo-die-face-2d[data-value="2"] i:nth-child(9),
.ludo-die-face-2d[data-value="3"] i:nth-child(1),
.ludo-die-face-2d[data-value="3"] i:nth-child(5),
.ludo-die-face-2d[data-value="3"] i:nth-child(9),
.ludo-die-face-2d[data-value="4"] i:nth-child(1),
.ludo-die-face-2d[data-value="4"] i:nth-child(3),
.ludo-die-face-2d[data-value="4"] i:nth-child(7),
.ludo-die-face-2d[data-value="4"] i:nth-child(9),
.ludo-die-face-2d[data-value="5"] i:nth-child(1),
.ludo-die-face-2d[data-value="5"] i:nth-child(3),
.ludo-die-face-2d[data-value="5"] i:nth-child(5),
.ludo-die-face-2d[data-value="5"] i:nth-child(7),
.ludo-die-face-2d[data-value="5"] i:nth-child(9),
.ludo-die-face-2d[data-value="6"] i:nth-child(1),
.ludo-die-face-2d[data-value="6"] i:nth-child(3),
.ludo-die-face-2d[data-value="6"] i:nth-child(4),
.ludo-die-face-2d[data-value="6"] i:nth-child(6),
.ludo-die-face-2d[data-value="6"] i:nth-child(7),
.ludo-die-face-2d[data-value="6"] i:nth-child(9) {
    opacity: 1;
}

.ludo-die.is-rolling .ludo-die-face-2d {
    animation: ludo-dice-roll 700ms cubic-bezier(.2, .75, .28, 1) both;
}

@keyframes ludo-dice-roll {
    0% { transform: rotate(0) scale(.8); }
    55% { transform: rotate(190deg) scale(1.14); }
    100% { transform: rotate(360deg) scale(1); }
}

#ludoMovePrompt {
    min-height: 42px;
    color: #d9e2f4;
    line-height: 1.5;
    text-align: center;
}

.ludo-rules-hint {
    font-size: 12px;
}

#snakesLaddersScreen {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 28px 18px calc(28px + env(safe-area-inset-bottom));
    background:
        radial-gradient(ellipse at 8% 5%, rgba(92, 211, 153, .16), transparent 38%),
        radial-gradient(ellipse at 90% 90%, rgba(239, 111, 118, .16), transparent 42%),
        linear-gradient(145deg, #09191a 0%, #142b2b 52%, #0b1720 100%);
}

.sl-panel {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 24px;
    border: 1px solid rgba(135, 211, 167, .23);
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(25, 52, 49, .97), rgba(12, 29, 34, .99));
    box-shadow: 0 24px 72px rgba(0, 0, 0, .4), inset 0 1px rgba(255, 255, 255, .06);
}

#snakesLaddersSetup {
    display: flex;
    max-width: 540px;
    flex-direction: column;
    gap: 9px;
    padding: 30px;
}

.sl-panel .back-to-menu {
    align-self: flex-start;
    margin: -3px 0 10px;
    padding: 9px 12px;
    border: 1px solid rgba(162, 184, 225, .2);
    border-radius: 9px;
    background: rgba(7, 14, 29, .4);
    color: #d5dfef;
    font-weight: 700;
    cursor: pointer;
}

.sl-panel .back-to-menu:hover {
    border-color: rgba(137, 222, 165, .7);
    background: rgba(137, 222, 165, .1);
    color: #d7ffe0;
}

#snakesLaddersSetup .eyebrow,
.sl-game-header .eyebrow {
    margin: 0;
    color: #a5edbd;
    letter-spacing: .18em;
}

#snakesLaddersSetup h1,
.sl-game-header h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(28px, 5vw, 40px);
    letter-spacing: -.035em;
    line-height: 1.08;
}

.sl-intro {
    max-width: 430px;
    margin: 1px 0 8px;
    color: #c0d9d0;
    font-size: 15px;
    line-height: 1.55;
}

#snakesLaddersSetup label {
    margin: 3px 0 -3px;
    color: #e5f4e9;
    font-weight: 700;
}

#snakesLaddersSetup input {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid #46665a;
    border-radius: 11px;
    outline: none;
    background: rgba(8, 25, 24, .72);
    color: #fff;
    font: inherit;
}

#snakesLaddersSetup input:focus,
#snakesLaddersSetup select:focus {
    border-color: #8ed9a1;
    box-shadow: 0 0 0 3px rgba(142, 217, 161, .16);
}

#snakesLaddersSetup select {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid #46665a;
    border-radius: 11px;
    background: rgba(8, 25, 24, .72);
    color: #fff;
    font: inherit;
}

#snakesLaddersJoinBtn {
    min-height: 52px;
    margin-top: 5px;
    padding: 12px 16px;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(120deg, #88d79a, #c1ef9c);
    color: #17291e;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

#snakesLaddersJoinBtn:disabled {
    background: #657086;
    color: #e0e6ef;
    cursor: not-allowed;
}

.sl-hint {
    margin: 0;
    padding: 11px 13px;
    border: 1px solid rgba(117, 205, 143, .18);
    border-left: 3px solid #78be87;
    border-radius: 9px;
    background: rgba(127, 99, 58, .1);
    color: #cbded1;
    font-size: 13px;
    line-height: 1.5;
}

#snakesLaddersSetupStatus {
    min-height: 20px;
    margin: 0;
    color: #b9f1bc;
    font-size: 14px;
}

.sl-game-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
}

.sl-game-header h1 {
    font-size: clamp(20px, 3vw, 30px);
}

.sl-game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    align-items: start;
    gap: 22px;
}

.snakes-ladders-board {
    position: relative;
    display: grid;
    width: min(100%, 720px);
    aspect-ratio: 1;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    grid-template-rows: repeat(10, minmax(0, 1fr));
    overflow: hidden;
    border: 7px solid #397d42;
    border-radius: 12px;
    background: #ba6826;
    box-shadow: 0 0 0 3px #74431e, 0 18px 44px rgba(0, 0, 0, .38);
}

.sl-cell {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    padding: clamp(1px, .45vw, 5px);
    border: 1px solid rgba(76, 43, 20, .42);
    color: #fff9dc;
    font-size: clamp(8px, 1.2vw, 13px);
}

.sl-cell::before {
    position: absolute;
    z-index: 0;
    inset: 0;
    background: linear-gradient(145deg, #c77a34, #a85b27);
    content: '';
}

.sl-cell:nth-child(4n + 2)::before,
.sl-cell:nth-child(4n + 3)::before {
    background: linear-gradient(145deg, #d39146, #b96a2e);
}

.sl-cell.is-endpoint {
    font-weight: 900;
}

.sl-cell.is-endpoint::before {
    background: linear-gradient(145deg, #ffe071, #e7a934);
}

.sl-cell-number {
    position: relative;
    z-index: 3;
    text-shadow: 0 1px 2px rgba(43, 24, 13, .8);
}

.sl-routes {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.sl-ladder-rail {
    fill: none;
    stroke: #613819;
    stroke-linecap: round;
    stroke-width: .12;
}

.sl-ladder-rung {
    fill: none;
    stroke: #ecc273;
    stroke-linecap: round;
    stroke-width: .08;
}

.sl-snake-shadow,
.sl-snake-body {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sl-snake-shadow {
    stroke: #153923;
    stroke-width: .27;
}

.sl-snake-body {
    stroke: #68c650;
    stroke-width: .16;
}

.sl-snake-head {
    fill: #88df59;
    stroke: #173a25;
    stroke-width: .06;
}

.sl-token {
    position: absolute;
    right: 2px;
    bottom: 2px;
    display: grid;
    width: clamp(13px, 2.4vw, 24px);
    height: clamp(13px, 2.4vw, 24px);
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-size: clamp(8px, 1.2vw, 12px);
    font-weight: 900;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .38);
    z-index: 4;
}

.sl-token + .sl-token {
    right: auto;
    left: 2px;
}

.sl-token.color-red,
.sl-player-marker.color-red {
    background: #e53e55;
}

.sl-token.color-blue,
.sl-player-marker.color-blue {
    background: #3478da;
}

.sl-token.color-green,
.sl-player-marker.color-green {
    background: #299d59;
}

.sl-token.color-yellow,
.sl-player-marker.color-yellow {
    background: #e6a800;
    color: #322400;
}

.sl-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.sl-players {
    display: grid;
    gap: 8px;
}

.sl-player-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(180, 209, 193, .18);
    border-radius: 10px;
    background: rgba(6, 19, 24, .48);
}

.sl-player-card.is-current {
    border-color: #98dfa4;
    box-shadow: 0 0 0 2px rgba(152, 223, 164, .12);
}

.sl-player-card strong,
.sl-player-card div > span {
    display: block;
}

.sl-player-card div > span {
    margin-top: 3px;
    color: #b8cfc1;
    font-size: 12px;
}

.sl-player-marker {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.sl-die {
    display: grid;
    width: 76px;
    height: 76px;
    place-items: center;
    align-self: center;
    border: 3px solid #e1eadc;
    border-radius: 17px;
    background: linear-gradient(145deg, #fff, #dbe9dc);
    color: #183226;
    font-size: 38px;
    font-weight: 900;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .28);
}

#snakesLaddersRollBtn {
    min-height: 52px;
    padding: 12px 16px;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(120deg, #88d79a, #c1ef9c);
    color: #17291e;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

#snakesLaddersRollBtn:disabled {
    background: #596b62;
    color: #d0dad3;
    cursor: not-allowed;
}

#snakesLaddersTurnStatus {
    min-height: 42px;
    color: #d9e9dc;
    line-height: 1.5;
    text-align: center;
}

#unoScreen {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 28px 18px calc(28px + env(safe-area-inset-bottom));
    background:
        radial-gradient(ellipse at 12% 10%, rgba(255, 87, 104, .2), transparent 36%),
        radial-gradient(ellipse at 90% 90%, rgba(47, 111, 221, .18), transparent 40%),
        linear-gradient(145deg, #10101d 0%, #1d1e2c 52%, #101522 100%);
}

.uno-panel {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(39, 40, 55, .97), rgba(20, 23, 35, .99));
    box-shadow: 0 24px 72px rgba(0, 0, 0, .4), inset 0 1px rgba(255, 255, 255, .06);
}

#unoSetup {
    display: flex;
    max-width: 540px;
    flex-direction: column;
    gap: 9px;
    padding: 30px;
}

.uno-panel .back-to-menu {
    align-self: flex-start;
    margin: -3px 0 10px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 9px;
    background: rgba(7, 14, 29, .4);
    color: #eee;
    font-weight: 700;
    cursor: pointer;
}

.uno-panel .back-to-menu:hover {
    border-color: #ffcf32;
    color: #ffdf69;
}

#unoSetup .eyebrow,
.uno-game-header .eyebrow {
    margin: 0;
    color: #ffd43b;
    letter-spacing: .18em;
}

#unoSetup h1,
.uno-game-header h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(28px, 5vw, 40px);
    letter-spacing: -.035em;
    line-height: 1.08;
}

.uno-intro {
    max-width: 430px;
    margin: 1px 0 8px;
    color: #c9c9d4;
    font-size: 15px;
    line-height: 1.55;
}

#unoSetup label {
    margin: 3px 0 -3px;
    color: #f1f1f5;
    font-weight: 700;
}

#unoSetup input,
#unoSetup select {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid #585a6d;
    border-radius: 11px;
    background: rgba(12, 13, 24, .75);
    color: #fff;
    font: inherit;
}

#unoSetup input:focus,
#unoSetup select:focus {
    border-color: #ffd43b;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 212, 59, .16);
}

#unoJoinBtn,
#unoDrawBtn,
#unoPassBtn {
    min-height: 48px;
    padding: 10px 16px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(120deg, #f4c423, #ffe36a);
    color: #251e05;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

#unoJoinBtn {
    min-height: 52px;
    margin-top: 5px;
}

#unoJoinBtn:disabled,
#unoDrawBtn:disabled,
#unoPassBtn:disabled {
    background: #626270;
    color: #dedee4;
    cursor: not-allowed;
}

.uno-hint {
    margin: 0;
    padding: 11px 13px;
    border: 1px solid rgba(255, 212, 59, .2);
    border-left: 3px solid #ffd43b;
    border-radius: 9px;
    background: rgba(255, 212, 59, .06);
    color: #ceced7;
    font-size: 13px;
    line-height: 1.5;
}

#unoSetupStatus {
    min-height: 20px;
    margin: 0;
    color: #ffe27a;
    font-size: 14px;
}

.uno-game-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.uno-game-header .back-to-menu {
    flex: 0 0 auto;
    margin: 0;
}

.uno-heading {
    min-width: 0;
}

.uno-heading h1 {
    margin: 3px 0 0;
    color: #fff;
    font-size: clamp(21px, 3vw, 28px);
    letter-spacing: -.035em;
    line-height: 1;
}

.uno-session-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px 9px;
    color: #ffd43b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .09em;
    line-height: 1.3;
}

.uno-room-badge {
    overflow-wrap: anywhere;
    color: #c4c7d2;
    letter-spacing: .035em;
}

.uno-room-badge > span {
    color: #f1f1f5;
    letter-spacing: 0;
}

.uno-players {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.uno-player-card {
    position: relative;
    display: grid;
    min-width: 145px;
    gap: 4px;
    padding: 10px 12px 34px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 11px;
    background: rgba(10, 12, 22, .58);
}

.uno-player-card.is-current {
    border-color: #ffd43b;
    box-shadow: 0 0 0 2px rgba(255, 212, 59, .14);
}

.uno-player-card > span:nth-child(2) {
    color: #b8bac7;
    font-size: 12px;
}

.uno-opponent-cards {
    position: absolute;
    bottom: 5px;
    left: 12px;
    display: flex;
    height: 24px;
}

.uno-opponent-cards i {
    width: 14px;
    height: 22px;
    margin-left: -5px;
    border: 1px solid #fff;
    border-radius: 3px;
    background: linear-gradient(135deg, #e8434e, #bf1d36 55%, #202033 56%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

.uno-table {
    display: grid;
    justify-items: center;
    gap: 14px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 18px;
    background:
        radial-gradient(ellipse at center, rgba(43, 133, 89, .46), transparent 68%),
        #171c25;
}

.uno-deck-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(24px, 7vw, 70px);
    min-height: 185px;
}

.uno-pile,
.uno-top-card-wrap {
    display: grid;
    justify-items: center;
    gap: 8px;
    color: #dedee5;
    font-size: 12px;
}

.uno-pile {
    cursor: default;
}

.uno-top-card-wrap > span {
    text-align: center;
}

.uno-color-name {
    font-weight: 900;
    text-transform: uppercase;
}

.uno-color-name.color-red { color: #ff6871; }
.uno-color-name.color-yellow { color: #ffdc4e; }
.uno-color-name.color-green { color: #60d48a; }
.uno-color-name.color-blue { color: #74b6ff; }

.uno-card {
    position: relative;
    display: flex;
    width: 82px;
    height: 124px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 5px;
    border: 3px solid #fff;
    border-radius: 12px;
    background: #222;
    --uno-symbol-color: #151515;
    color: #fff;
    box-shadow: 0 5px 12px rgba(0, 0, 0, .34);
    isolation: isolate;
}

button.uno-card {
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.uno-card::before {
    position: absolute;
    z-index: 0;
    inset: 13% -15%;
    border: 1px solid rgba(255, 255, 255, .95);
    border-radius: 50%;
    background: #fff;
    content: '';
    transform: rotate(-28deg);
}

.uno-card.color-red { background: #ed2638; }
.uno-card.color-yellow { background: #f3c52b; color: #171717; }
.uno-card.color-green { background: #188c50; }
.uno-card.color-blue { background: #1669bd; }
.uno-card.is-wild { background: #20202c; color: #fff; }

.uno-card-corner {
    position: absolute;
    z-index: 2;
    font-size: 14px;
    font-style: italic;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}

.uno-card .is-top {
    top: 6px;
    left: 7px;
}

.uno-card .is-bottom {
    right: 7px;
    bottom: 6px;
    transform: rotate(180deg);
}

.uno-card-symbol {
    position: relative;
    z-index: 1;
    display: grid;
    min-width: 1em;
    min-height: 1em;
    place-items: center;
    color: var(--uno-symbol-color);
    font-size: 48px;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    -webkit-text-stroke: 1px #fff;
    text-shadow: none;
}

.uno-card-symbol.type-number {
    font-size: 66px;
    font-style: italic;
    letter-spacing: -.06em;
    padding-right: .06em;
}

.uno-card-symbol.type-draw2,
.uno-card-symbol.type-wildDraw4,
.uno-card-symbol.type-draw6,
.uno-card-symbol.type-wildDraw6,
.uno-card-symbol.type-draw10,
.uno-card-symbol.type-wildDraw10 {
    font-size: 35px;
    letter-spacing: -.04em;
}

.uno-card-symbol.type-skip {
    font-size: 60px;
}

.uno-card-symbol.type-reverse {
    font-size: 48px;
}

.uno-card-symbol.type-discardAll,
.uno-card-symbol.type-skipEveryone {
    font-size: 21px;
    letter-spacing: -.04em;
}

.uno-card-symbol.type-wild {
    font-size: 12px;
    -webkit-text-stroke: 0;
}

.uno-wild-penalty {
    position: absolute;
    right: -13px;
    bottom: -11px;
    display: grid;
    width: 25px;
    height: 25px;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #171717;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    -webkit-text-stroke: 0;
}

.uno-card-label {
    position: absolute;
    z-index: 2;
    bottom: 17px;
    left: 50%;
    max-width: calc(100% - 14px);
    overflow: hidden;
    color: #171717;
    font-size: 9px;
    font-weight: 900;
    line-height: 1.1;
    text-overflow: ellipsis;
    text-transform: uppercase;
    transform: translateX(-50%);
    white-space: nowrap;
}

.uno-card.is-wild .uno-card-label {
    bottom: 17px;
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .92);
}

.uno-wild-wheel {
    position: relative;
    z-index: 1;
    display: grid;
    width: 42px;
    height: 42px;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: rotate(-12deg);
    box-shadow: 0 0 0 1px #171717;
}

.uno-wild-wheel i.color-red { background: #ed2638; }
.uno-wild-wheel i.color-yellow { background: #f3c52b; }
.uno-wild-wheel i.color-green { background: #188c50; }
.uno-wild-wheel i.color-blue { background: #1669bd; }

.uno-card-back {
    border-color: #fff;
    background: linear-gradient(135deg, #e8434e 0 48%, #222537 49% 100%);
    transform: rotate(-7deg);
}

.uno-card-back::before {
    background: #20202c;
    border-color: #fff;
    opacity: .05;
}

.uno-card-back > span {
    z-index: 1;
    padding: 3px 6px;
    border-radius: 12px;
    background: #fff;
    color: #e52539;
    font-size: 16px;
    font-style: italic;
    font-weight: 1000;
    transform: rotate(-18deg);
}

.uno-empty-card {
    display: grid;
    width: 82px;
    height: 124px;
    place-items: center;
    border: 2px dashed rgba(255, 255, 255, .45);
    border-radius: 12px;
    color: #d2d2dc;
    font-size: 12px;
}

.uno-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

#unoColorLabel[hidden],
#unoColorChoice[hidden] {
    display: none;
}

#unoColorChoice {
    min-height: 44px;
    padding: 8px;
    border: 1px solid #76788a;
    border-radius: 8px;
    background: #171a25;
    color: #fff;
    font: inherit;
}

.uno-controls .resign-button {
    min-height: 48px;
}

#unoTurnStatus {
    min-height: 22px;
    color: #f2e6c1;
    line-height: 1.45;
    text-align: center;
}

.uno-hand-section {
    margin-top: 20px;
}

.uno-hand-section h2 {
    margin-bottom: 10px;
    color: #fff;
    font-size: 18px;
}

.uno-hand {
    display: flex;
    min-height: 145px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 4px 16px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
    touch-action: pan-y;
    user-select: none;
}

.uno-hand .uno-card {
    width: 72px;
    height: 110px;
    scroll-snap-align: center;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-drag: none;
}

.uno-hand .uno-card.is-playable {
    box-shadow: 0 0 0 2px #ffe071, 0 0 18px rgba(255, 218, 72, .55);
}

.uno-hand .uno-card.is-selected {
    transform: translateY(-10px);
    box-shadow: 0 0 0 3px #fff, 0 0 22px rgba(255, 224, 113, .75);
}

.uno-hand button:hover {
    filter: brightness(1.1);
    transform: translateY(-5px);
}

#chessScreen {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 28px 18px calc(28px + env(safe-area-inset-bottom));
    background:
        radial-gradient(ellipse at 8% 5%, rgba(195, 158, 89, .16), transparent 38%),
        radial-gradient(ellipse at 90% 90%, rgba(92, 123, 255, .16), transparent 42%),
        linear-gradient(145deg, #090e1c 0%, #142139 52%, #0b1223 100%);
}

.chess-panel {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 24px;
    border: 1px solid rgba(162, 183, 218, .2);
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(25, 38, 63, .97), rgba(12, 20, 38, .99));
    box-shadow: 0 24px 72px rgba(0, 0, 0, .4), inset 0 1px rgba(255, 255, 255, .06);
}

#chessSetup {
    display: flex;
    max-width: 540px;
    flex-direction: column;
    gap: 9px;
    padding: 30px;
    border-color: rgba(226, 191, 123, .26);
    background:
        radial-gradient(ellipse at 100% 0%, rgba(206, 174, 111, .15), transparent 42%),
        linear-gradient(150deg, #1c2b43 0%, #121d32 58%, #10182b 100%);
}

#chessSetup .back-to-menu,
.chess-game-header .back-to-menu {
    align-self: flex-start;
    margin: -3px 0 10px;
    padding: 9px 12px;
    border: 1px solid rgba(162, 184, 225, .2);
    border-radius: 9px;
    background: rgba(7, 14, 29, .4);
    color: #d5dfef;
    font-weight: 700;
    cursor: pointer;
}

#chessSetup .back-to-menu:hover,
.chess-game-header .back-to-menu:hover {
    border-color: rgba(224, 190, 127, .65);
    background: rgba(224, 190, 127, .1);
    color: #f1d7a5;
}

#chessSetup .eyebrow {
    margin: 0;
    color: #f0c779;
    letter-spacing: .2em;
}

#chessSetup h1,
.chess-game-header h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(28px, 5vw, 40px);
    letter-spacing: -.035em;
    line-height: 1.08;
}

.chess-intro {
    max-width: 430px;
    margin: 1px 0 8px;
    color: #c0cce0;
    font-size: 15px;
    line-height: 1.55;
}

#chessSetup label {
    margin: 3px 0 -3px;
    color: #e5edfa;
    font-weight: 700;
}

#chessSetup input {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid #46536c;
    border-radius: 11px;
    outline: none;
    background: rgba(8, 15, 31, .72);
    color: #fff;
    font: inherit;
}

#chessSetup input:focus {
    border-color: #e2bd7b;
    box-shadow: 0 0 0 3px rgba(226, 189, 123, .16);
}

#chessJoinBtn,
#chessPromotionConfirm {
    min-height: 52px;
    margin-top: 5px;
    padding: 12px 16px;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(120deg, #e3bd78, #f3d99d);
    color: #282013;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 9px 22px rgba(211, 172, 101, .18), inset 0 1px rgba(255, 255, 255, .5);
}

#chessJoinBtn:disabled {
    background: #657086;
    color: #e0e6ef;
    cursor: not-allowed;
}

.chess-hint {
    margin: 0;
    padding: 11px 13px;
    border: 1px solid rgba(117, 151, 205, .18);
    border-left: 3px solid #b6915a;
    border-radius: 9px;
    background: rgba(127, 99, 58, .1);
    color: #cbd4e5;
    font-size: 13px;
    line-height: 1.5;
}

#chessSetupStatus {
    min-height: 20px;
    margin: 0;
    color: #ffd479;
    font-size: 14px;
}

.chess-game-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.chess-game-header .back-to-menu {
    margin: 0;
}

.chess-heading .eyebrow {
    margin: 0 0 6px;
    color: #f0c779;
    letter-spacing: .16em;
}

.chess-game-header h1 {
    font-size: clamp(20px, 3vw, 30px);
}

.chess-turn-badge {
    padding: 10px 14px;
    border: 1px solid rgba(226, 191, 123, .35);
    border-radius: 10px;
    background: rgba(226, 191, 123, .08);
    color: #f4d9a6;
    font-weight: 700;
}

.chess-game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    align-items: start;
    gap: 24px;
}

.chess-board-area {
    width: min(100%, 760px);
    margin: 0 auto;
}

.chess-player-strip {
    display: flex;
    min-height: 52px;
    align-items: center;
    gap: 10px;
    margin: 0 4px 10px;
    padding: 8px 12px;
    border: 1px solid rgba(168, 185, 218, .16);
    border-radius: 11px;
    background: rgba(255, 255, 255, .045);
    color: #e8edf6;
}

.chess-player-strip:last-child {
    margin: 10px 4px 0;
}

.chess-player-piece {
    display: grid;
    width: 34px;
    height: 40px;
    flex: 0 0 34px;
    place-items: center;
}

.chess-player-piece .chess-piece-model {
    width: 100%;
    height: 100%;
}

.chess-player-name {
    overflow: hidden;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chess-player-color {
    margin-left: auto;
    color: #aab7d0;
    font-size: 12px;
    white-space: nowrap;
}

.chess-board-frame {
    position: relative;
    z-index: 0;
    perspective: 1100px;
    padding: 10px;
    border: 1px solid rgba(242, 216, 167, .48);
    border-radius: 15px;
    background: linear-gradient(145deg, #8b633d, #46301f 72%, #281b15);
    box-shadow: 0 22px 42px rgba(0, 0, 0, .5), inset 0 2px rgba(255, 230, 183, .28);
}

.chess-board {
    display: grid;
    width: 100%;
    aspect-ratio: 1;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-template-rows: repeat(8, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid rgba(36, 27, 21, .8);
    border-radius: 5px;
    background: #1c1a18;
    transform: rotateX(4deg);
    transform-origin: center top;
    transform-style: preserve-3d;
    box-shadow: 0 12px 0 #4f3624, 0 20px 28px rgba(0, 0, 0, .42);
}

.chess-square {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 0;
    place-items: center;
    padding: 0;
    border: 0;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
}

.chess-square.is-light {
    background: linear-gradient(145deg, #f1dfbd, #d9bd8f);
}

.chess-square.is-dark {
    background: linear-gradient(145deg, #8d6547, #69482f);
}

.chess-square.is-last-move {
    background-image: linear-gradient(rgba(251, 209, 103, .42), rgba(251, 209, 103, .42));
}

.chess-square.is-selected {
    background-image: linear-gradient(rgba(89, 220, 175, .64), rgba(89, 220, 175, .64));
}

.chess-square.is-check {
    background-image: radial-gradient(circle, rgba(250, 52, 62, .82), rgba(222, 45, 61, .2) 72%);
}

.chess-square:focus-visible {
    z-index: 2;
    outline: 3px solid #fff1c9;
    outline-offset: -4px;
}

.chess-piece {
    position: relative;
    z-index: 1;
    display: grid;
    width: 91%;
    height: 92%;
    place-items: center;
    transform: translateY(-2%) translateZ(16px);
    transform-style: preserve-3d;
    transition: transform 120ms ease, filter 120ms ease;
}

.chess-piece-model {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    filter: drop-shadow(0 3px 2px rgba(22, 17, 12, .48));
}

.chess-piece.piece-white .chess-piece-model {
    filter: drop-shadow(0 3px 2px rgba(22, 17, 12, .44)) drop-shadow(0 -1px 1px rgba(255, 250, 231, .48));
}

.chess-piece.piece-black .chess-piece-model {
    filter: drop-shadow(0 3px 2px rgba(22, 17, 12, .58)) drop-shadow(0 -1px 1px rgba(185, 202, 228, .3));
}

.chess-square:hover .chess-piece {
    transform: translateY(-8%) translateZ(20px);
    filter: brightness(1.08);
}

.chess-rank-label,
.chess-file-label {
    position: absolute;
    z-index: 2;
    color: rgba(38, 36, 31, .72);
    font: 700 clamp(8px, 1.3vw, 12px)/1 Arial, sans-serif;
    pointer-events: none;
}

.chess-rank-label {
    top: 3px;
    left: 4px;
}

.chess-file-label {
    right: 4px;
    bottom: 3px;
}

.is-dark .chess-rank-label,
.is-dark .chess-file-label {
    color: rgba(255, 239, 207, .78);
}

.chess-legal-dot {
    position: absolute;
    width: 24%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(29, 44, 35, .34);
}

.chess-capture-ring {
    position: absolute;
    inset: 4%;
    border: clamp(3px, .7vw, 7px) solid rgba(39, 196, 140, .78);
    border-radius: 50%;
    pointer-events: none;
}

.chess-sidebar {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border: 1px solid rgba(163, 183, 216, .18);
    border-radius: 14px;
    background: rgba(7, 14, 29, .35);
}

.chess-room-label {
    margin: 0;
    color: #9eacc6;
    font-size: 11px;
    letter-spacing: .14em;
}

.chess-room-label strong {
    display: block;
    overflow-wrap: anywhere;
    margin-top: 5px;
    color: #e3c388;
    font-size: 15px;
    letter-spacing: normal;
}

.chess-turn-status {
    margin: 0;
    padding: 12px;
    border-radius: 9px;
    background: rgba(92, 228, 183, .1);
    color: #a7f0d3;
    font-weight: 700;
    line-height: 1.45;
}

.chess-sidebar h2 {
    margin: 4px 0 0;
    color: #eef2fa;
    font-size: 17px;
}

.chess-move-history {
    display: flex;
    max-height: 260px;
    flex-direction: column;
    gap: 2px;
    overflow: auto;
    padding: 0;
    list-style: none;
}

.chess-move-history li {
    display: grid;
    grid-template-columns: 30px 1fr 1fr;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 5px;
    color: #d5deee;
    font-size: 13px;
}

.chess-move-history li:nth-child(odd) {
    background: rgba(255, 255, 255, .045);
}

.chess-move-history li span {
    color: #8f9db6;
}

.chess-rules-hint {
    margin: auto 0 0;
    color: #9eacc6;
    font-size: 12px;
    line-height: 1.5;
}

.chess-promotion {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(226, 191, 123, .28);
    border-radius: 10px;
    background: rgba(226, 191, 123, .08);
}

.chess-promotion[hidden] {
    display: none;
}

.chess-promotion label {
    color: #e7d5b4;
    font-size: 13px;
    font-weight: 700;
}

.chess-promotion select {
    min-height: 42px;
    padding: 8px;
    border: 1px solid #58637a;
    border-radius: 8px;
    background: #111b2e;
    color: #fff;
    font: inherit;
}

#chessPromotionConfirm {
    min-height: 42px;
    margin: 0;
    padding: 8px 12px;
}

.game-menu-name {
    margin-bottom: 7px;
    font-size: 22px;
    font-weight: 800;
}

.game-menu-description {
    min-height: 40px;
    color: #aab7d8;
    font-size: 13px;
    line-height: 1.5;
}

.game-menu-action {
    margin-top: auto;
    padding-top: 16px;
    color: var(--game-accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.game-menu-status {
    min-height: 22px;
    margin-top: 20px;
    color: #ffe27a;
    text-align: center;
}

#loginScreen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px 18px;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 15% 72%, rgba(0, 220, 255, 0.14), transparent 34%),
        radial-gradient(ellipse at 85% 30%, rgba(255, 190, 55, 0.12), transparent 32%);
}

#loginScreen::before,
#loginScreen::after {
    content: "";
    position: absolute;
    z-index: -1;
    width: min(42vw, 430px);
    aspect-ratio: 0.72;
    border: 1px solid rgba(255, 215, 0, 0.16);
    border-radius: 22px;
    box-shadow: 0 0 75px rgba(86, 72, 255, 0.18), inset 0 0 65px rgba(0, 218, 255, 0.08);
    transform: rotate(-22deg);
}

#loginScreen::before {
    left: 5%;
    top: 16%;
}

#loginScreen::after {
    right: 3%;
    bottom: 7%;
    transform: rotate(18deg);
    border-color: rgba(0, 220, 255, 0.17);
    box-shadow: 0 0 75px rgba(255, 176, 53, 0.12), inset 0 0 65px rgba(255, 215, 0, 0.06);
}

.setup-panel {
    width: min(100%, 450px);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 13px;
    padding: 36px clamp(22px, 6vw, 44px);
    border: 1px solid rgba(255, 215, 0, 0.48);
    border-radius: 20px;
    background: linear-gradient(150deg, rgba(23, 28, 57, 0.94), rgba(9, 13, 30, 0.95));
    box-shadow: 0 24px 90px rgba(0, 0, 0, 0.55), 0 0 50px rgba(86, 72, 255, 0.12);
    backdrop-filter: blur(12px);
}

.back-to-menu {
    align-self: flex-start;
    padding: 6px 0;
    border: 0;
    background: transparent;
    color: #78e7ff;
    cursor: pointer;
    font-size: 13px;
}

.duel-emblem {
    align-self: center;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 1px solid rgba(255, 215, 0, 0.6);
    border-radius: 50%;
    color: #ffe77a;
    font-size: 28px;
    text-shadow: 0 0 18px rgba(255, 215, 0, 0.9);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.17), inset 0 0 15px rgba(255, 215, 0, 0.12);
}

.eyebrow {
    color: #78e7ff;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.23em;
    text-align: center;
    text-transform: uppercase;
}

#loginScreen h1 {
    color: #ffe27a;
    font-size: clamp(23px, 5vw, 32px);
    letter-spacing: 0.03em;
    text-align: center;
    text-shadow: 0 0 28px rgba(255, 215, 0, 0.22);
}

#loginScreen h1 span {
    display: block;
    margin-top: 5px;
    color: #fff;
    font-size: 0.52em;
    letter-spacing: 0.34em;
}

.setup-intro,
.setup-footnote {
    color: #bdc8e6;
    line-height: 1.5;
    text-align: center;
}

.setup-footnote {
    color: #8e9ab9;
    font-size: 12px;
}

.setup-panel label {
    margin: 3px 0 -7px;
    color: #c9d4ef;
    font-size: 13px;
}

#loginScreen input,
#loginScreen select {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    border: 1px solid rgba(161, 174, 216, 0.4);
    border-radius: 8px;
    background: rgba(5, 9, 25, 0.78);
    color: #fff;
    outline: none;
}

#loginScreen input:focus,
#loginScreen select:focus {
    border-color: #78e7ff;
    box-shadow: 0 0 0 3px rgba(120, 231, 255, 0.15);
}

#loginScreen select option {
    background: #11172d;
    color: #fff;
}

#loginScreen button {
    margin-top: 5px;
    padding: 13px 24px;
    font-size: 16px;
    background: linear-gradient(115deg, #ffe77a, #ffbd43);
    color: #14162a;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 0.03em;
    transition: transform 0.2s, box-shadow 0.2s;
}

#loginScreen button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 198, 66, 0.24);
}

#gameScreen {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

#gameInfo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px 16px;
}

#lobbyStatus {
    flex: 1 1 240px;
    color: #ffe27a;
    line-height: 1.45;
    text-align: center;
}

#gameInfo button {
    padding: 8px 16px;
    background: #ffd700;
    color: #1a1a2e;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

#gameInfo button:hover {
    background: #ffed4a;
}

#gameInfo button:disabled {
    background: #666;
    cursor: not-allowed;
}

#gameInfo .back-to-menu {
    border: 1px solid rgba(162, 184, 225, .28);
    background: rgba(7, 14, 29, .7);
    color: #d5dfef;
}

#gameInfo .back-to-menu:hover {
    border-color: rgba(224, 190, 127, .65);
    background: rgba(224, 190, 127, .1);
    color: #f1d7a5;
}

#gameInfo .resign-button {
    background: linear-gradient(135deg, #a92b42, #7e1e36);
    color: #fff;
}

#gameInfo .resign-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #c53a53, #92243d);
}

#actionStatus {
    min-height: 1.5em;
    margin: -12px 0 8px;
    color: #ffd700;
    text-align: center;
}

#actionStatus:empty {
    display: none;
}

#cancelActionBtn {
    display: block;
    margin: 0 auto 10px;
    padding: 6px 12px;
    color: #fff;
    background: rgba(105, 114, 145, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 6px;
    cursor: pointer;
}

.extra-deck-entry {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.extra-deck-entry p {
    margin: 8px 0;
    color: #c3cbe0;
    font-size: 13px;
    line-height: 1.45;
}

.extra-deck-entry button {
    margin: 4px 6px 4px 0;
}

.fusion-material-selected {
    outline: 3px solid #ffe27a;
    outline-offset: 2px;
    filter: drop-shadow(0 0 7px rgba(255, 226, 122, 0.8));
}

.card.available-zone {
    outline: 2px dashed #ffe27a;
    outline-offset: 2px;
}

#gameBoard {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.player-field {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    border: 2px solid #ffd700;
}

.player-field.opponent {
    border-color: #ff6b6b;
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: bold;
}

.life-points {
    position: relative;
    color: #ffd700;
}

.field-zones {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.zone-row {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.zone {
    width: 100px;
    height: 140px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.zone:hover {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.zone.available-zone {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.3);
    cursor: pointer;
}

.zone.monster-zone {
    border-color: #4ecdc4;
}

.zone.spell-trap-zone {
    border-color: #ff6b6b;
}

.zone.field-zone {
    border-color: #a8e6cf;
}

.zone.battle-attacker {
    z-index: 2;
}

.battle-attacker .card {
    z-index: 3;
    animation-duration: 760ms;
    animation-timing-function: cubic-bezier(.2, .75, .25, 1);
    animation-fill-mode: both;
}

.battle-attacker-own .card {
    animation-name: yugioh-attack-lunge-up;
}

.battle-attacker-opponent .card {
    animation-name: yugioh-attack-lunge-down;
}

.battle-target .card {
    animation: yugioh-battle-hit 680ms ease-out both;
}

.battle-impact {
    position: absolute;
    z-index: 5;
    top: 50%;
    left: 50%;
    display: grid;
    width: min(124px, 135%);
    min-height: 42px;
    place-items: center;
    padding: 7px 10px;
    border: 2px solid rgba(255, 244, 186, .96);
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255, 240, 156, .95), rgba(255, 92, 45, .65) 46%, transparent 74%);
    color: #fff;
    font-size: clamp(10px, 1.4vw, 16px);
    font-weight: 1000;
    letter-spacing: .08em;
    text-align: center;
    text-shadow: 0 2px 5px #5d160d, 0 0 12px #ff4b1f;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(.2) rotate(-8deg);
    animation: yugioh-battle-impact 880ms cubic-bezier(.16, .78, .28, 1) both;
}

.life-points.battle-damage {
    animation: yugioh-life-point-hit 780ms ease-out both;
}

@keyframes yugioh-attack-lunge-up {
    0%, 100% { transform: translateY(0) scale(1); }
    38% { transform: translateY(-26px) scale(1.12); }
    72% { transform: translateY(-9px) scale(1.07); }
}

@keyframes yugioh-attack-lunge-down {
    0%, 100% { transform: translateY(0) scale(1); }
    38% { transform: translateY(26px) scale(1.12); }
    72% { transform: translateY(9px) scale(1.07); }
}

@keyframes yugioh-battle-hit {
    0%, 100% { filter: brightness(1); }
    28% { filter: brightness(2.4) saturate(1.7); }
    48% { filter: brightness(.65); }
    68% { filter: brightness(1.8); }
}

@keyframes yugioh-battle-impact {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(-8deg); }
    28% { opacity: 1; transform: translate(-50%, -50%) scale(1.18) rotate(5deg); }
    62% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.24) rotate(2deg); }
}

@keyframes yugioh-life-point-hit {
    0%, 100% { filter: none; }
    35% { filter: brightness(2.4) drop-shadow(0 0 12px #ff5449); }
    70% { filter: brightness(.72); }
}

@media (prefers-reduced-motion: reduce) {
    .battle-attacker .card,
    .battle-target .card,
    .battle-impact,
    .life-points.battle-damage {
        animation-duration: .01ms;
    }
}

.card-effect-overlay {
    position: fixed;
    z-index: 3000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(14px, 4vw, 34px);
    padding: 24px;
    overflow: hidden;
    background:
        radial-gradient(ellipse at center, rgba(255, 212, 99, .2), transparent 55%),
        rgba(5, 8, 20, .78);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.card-effect-overlay[hidden] {
    display: none;
}

.card-effect-overlay.is-visible {
    opacity: 1;
}

.card-effect-overlay::before {
    position: absolute;
    width: min(78vw, 650px);
    aspect-ratio: 1;
    border: 2px solid rgba(255, 221, 130, .66);
    border-radius: 50%;
    box-shadow: 0 0 45px rgba(255, 176, 52, .42), inset 0 0 45px rgba(255, 176, 52, .18);
    content: "";
    animation: yugioh-effect-circle 1250ms ease-out both;
}

.card-effect-cinematic-card {
    position: relative;
    z-index: 1;
    display: grid;
    width: clamp(120px, 25vw, 230px);
    aspect-ratio: 0.72;
    place-items: center;
    overflow: hidden;
    border: 3px solid #ffe08a;
    border-radius: 13px;
    background: linear-gradient(145deg, #392340, #101a35);
    box-shadow: 0 0 22px rgba(255, 229, 149, .85), 0 0 70px rgba(255, 169, 49, .5);
    animation: yugioh-effect-card-reveal 1800ms cubic-bezier(.16, .82, .23, 1) both;
}

.card-effect-cinematic-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-effect-fallback {
    color: #ffe08a;
    font-size: clamp(20px, 5vw, 38px);
    font-weight: 1000;
    letter-spacing: .12em;
    text-shadow: 0 0 20px currentColor;
}

.card-effect-overlay.is-trap .card-effect-cinematic-card {
    border-color: #ff91bb;
    box-shadow: 0 0 22px rgba(255, 145, 187, .85), 0 0 70px rgba(209, 63, 132, .48);
}

.card-effect-cinematic-text {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(420px, 52vw);
    flex-direction: column;
    gap: 12px;
    color: #fff;
    text-shadow: 0 2px 9px rgba(0, 0, 0, .9);
    animation: yugioh-effect-text-reveal 1500ms ease-out both;
}

.card-effect-cinematic-text strong {
    color: #ffe08a;
    font-size: clamp(21px, 4vw, 38px);
    line-height: 1.1;
}

.card-effect-overlay.is-trap .card-effect-cinematic-text strong {
    color: #ffacd0;
}

.card-effect-cinematic-text span {
    font-size: clamp(15px, 2.2vw, 23px);
    line-height: 1.4;
}

@keyframes yugioh-effect-circle {
    from { opacity: 0; transform: scale(.35) rotate(-45deg); }
    35% { opacity: 1; }
    to { opacity: 0; transform: scale(1.15) rotate(45deg); }
}

@keyframes yugioh-effect-card-reveal {
    from { opacity: 0; transform: translateX(-55px) rotateY(68deg) scale(.65); }
    18% { opacity: 1; }
    38%, 78% { transform: translateX(0) rotateY(0) scale(1.04); }
    to { opacity: 0; transform: translateX(8px) rotateY(-8deg) scale(.96); }
}

@keyframes yugioh-effect-text-reveal {
    from { opacity: 0; transform: translateX(24px); }
    22%, 76% { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(10px); }
}

@media (max-width: 600px) {
    .card-effect-overlay {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .card-effect-cinematic-card {
        width: clamp(115px, 38vw, 175px);
    }

    .card-effect-cinematic-text {
        width: min(100%, 420px);
        align-items: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .card-effect-overlay::before,
    .card-effect-cinematic-card,
    .card-effect-cinematic-text {
        animation-duration: .01ms;
    }
}

.deck-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 14px;
    gap: 10px;
}

.deck-visual,
.graveyard-visual {
    width: clamp(30px, 4vw, 40px);
    aspect-ratio: 5 / 7;
    height: auto;
    flex: 0 0 auto;
    border-radius: 4px;
    border: 2px solid #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.deck-visual {
    background: url("img/back.png") center / 100% 100% no-repeat;
    box-shadow: 2px 2px 0 #704b22, 4px 4px 0 #3b2816;
}

.deck-visual:hover {
    transform: scale(1.1);
}

.graveyard-visual {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    color: #e74c3c;
}

.graveyard-visual:hover {
    transform: scale(1.1);
}

.graveyard-cards {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(6px, 1.5vw, 12px);
    justify-content: center;
    margin-top: 15px;
}

.graveyard-card {
    width: auto;
    height: auto;
    flex: 0 1 clamp(56px, 11vw, 100px);
    aspect-ratio: 5 / 7;
    font-size: clamp(7px, 1vw, 11px);
}

.deck {
    background: rgba(139, 69, 19, 0.8);
    padding: 5px 10px;
    border-radius: 5px;
}

.hand-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 5px;
}

.graveyard-count {
    background: rgba(231, 76, 60, 0.8);
    padding: 5px 10px;
    border-radius: 5px;
}

#hand {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    border: 2px solid #ffd700;
}

#hand h3 {
    margin-bottom: 10px;
    color: #ffd700;
}

#handCards {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.card {
    width: 100px;
    height: 140px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0;
    font-size: 11px;
    overflow: hidden;
    border: 2px solid #ffd700;
    position: relative;
}

.card-details-button {
    position: absolute;
    top: 3px;
    right: 3px;
    z-index: 12;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid #fff0a6;
    border-radius: 50%;
    background: rgba(18, 24, 40, 0.94);
    color: #fff0a6;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.card-details-button:hover,
.card-details-button:focus-visible {
    background: #ffd700;
    color: #1a1a2e;
    outline: 2px solid #fff;
    outline-offset: 1px;
}

.card:hover {
    transform: translateY(-10px);
}

.card.monster {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.card.spell {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.card.trap {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.card.face-down {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card.position-defense {
    transform: rotate(90deg) scale(0.75);
}

.zone.available-zone .card.position-defense {
    transform: rotate(90deg) scale(0.75);
}

.card-name {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 10px;
}

.card-stats {
    font-size: 9px;
    margin-top: 5px;
}

.card-attribute {
    font-size: 18px;
    margin-bottom: 5px;
}

.card-description {
    font-size: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    position: absolute;
    top: 0;
    left: 0;
}

.card-text-overlay {
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5px;
    font-size: 11px;
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 6px;
    z-index: 10;
}

.card:hover .card-text-overlay {
    display: flex;
}

.card.no-image .card-text-overlay {
    display: flex;
    position: static;
    background: none;
}

.card .atk-def {
    font-weight: bold;
    color: #ffd700;
}

@media (max-width: 768px) {
    #unoScreen {
        padding: 14px 10px calc(14px + env(safe-area-inset-bottom));
    }

    .uno-panel {
        padding: 16px;
        border-radius: 16px;
    }

    #unoSetup {
        gap: 8px;
        padding: 22px;
    }

    .uno-game-header {
        gap: 10px;
        margin-bottom: 12px;
    }

    .uno-game-header .back-to-menu {
        padding: 8px 9px;
        font-size: 12px;
        white-space: nowrap;
    }

    .uno-heading {
        flex: 1 1 auto;
    }

    .uno-session-meta {
        gap: 3px 7px;
        font-size: 9px;
    }

    .uno-players {
        gap: 8px;
    }

    .sl-players {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .uno-player-card {
        min-width: calc(50% - 8px);
        flex: 1 1 calc(50% - 8px);
    }

    .uno-table {
        gap: 10px;
        padding: 14px;
    }

    .uno-controls {
        display: grid;
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .uno-controls > * {
        min-width: 0;
    }

    .uno-controls label,
    .uno-controls #unoColorChoice {
        grid-column: 1 / -1;
    }

    .uno-hand {
        justify-content: flex-start;
    }

    #snakesLaddersScreen {
        padding: 14px 10px calc(14px + env(safe-area-inset-bottom));
    }

    .sl-panel {
        padding: 16px;
        border-radius: 16px;
    }

    #snakesLaddersSetup {
        gap: 8px;
        padding: 22px;
    }

    .sl-game-header {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        margin-bottom: 14px;
    }

    .sl-game-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .snakes-ladders-board {
        justify-self: center;
        border-width: 3px;
    }

    .sl-controls {
        display: grid;
        grid-template-columns: 76px minmax(0, 1fr);
        align-items: center;
        gap: 10px;
    }

    .sl-players,
    #snakesLaddersTurnStatus,
    .sl-controls .sl-hint {
        grid-column: 1 / -1;
    }

    .sl-die {
        grid-row: span 2;
        width: 68px;
        height: 68px;
    }

    #snakesLaddersRollBtn,
    .sl-controls .resign-button {
        min-height: 48px;
        margin: 0;
    }

    #chessScreen {
        padding: 14px 10px calc(14px + env(safe-area-inset-bottom));
    }

    .chess-panel {
        padding: 16px;
        border-radius: 16px;
    }

    #chessSetup {
        gap: 8px;
        padding: 22px;
    }

    .chess-game-header {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
        margin-bottom: 14px;
    }

    .chess-heading {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .chess-game-header .back-to-menu {
        grid-column: 1;
        grid-row: 2;
    }

    .chess-turn-badge {
        grid-column: 2;
        grid-row: 2;
        padding: 8px 10px;
        font-size: 12px;
    }

    .chess-game-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .chess-board-frame {
        padding: 7px;
        border-radius: 12px;
    }

    .chess-board {
        transform: rotateX(2deg);
        box-shadow: 0 7px 0 #4f3624, 0 13px 20px rgba(0, 0, 0, .36);
    }

    .chess-sidebar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(110px, .75fr);
        align-items: start;
        gap: 10px;
        padding: 12px;
    }

    .chess-room-label,
    .chess-turn-status,
    .chess-promotion,
    .chess-sidebar h2,
    .chess-move-history,
    .chess-rules-hint {
        grid-column: 1 / -1;
    }

    .chess-move-history {
        max-height: 170px;
    }
}

@media (max-width: 480px) {
    #unoScreen {
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    }

    .uno-panel {
        padding: 12px;
        border-radius: 13px;
    }

    #unoSetup {
        gap: 8px;
        padding: 20px;
        border-radius: 16px;
    }

    .uno-deck-info {
        min-height: 150px;
    }

    .uno-card {
        width: 70px;
        height: 106px;
    }

    .uno-empty-card {
        width: 70px;
        height: 106px;
    }

    .uno-hand .uno-card {
        width: 72px;
        height: 108px;
        border-width: 2px;
    }

    .uno-hand .uno-card-symbol {
        font-size: 40px;
    }

    .uno-hand .uno-card-symbol.type-number {
        font-size: 52px;
    }

    .uno-hand .uno-card-symbol.type-skip {
        font-size: 48px;
    }

    .uno-hand .uno-card-symbol.type-reverse {
        font-size: 42px;
    }

    .uno-hand .uno-card-symbol.type-draw2,
    .uno-hand .uno-card-symbol.type-wildDraw4,
    .uno-hand .uno-card-symbol.type-draw6,
    .uno-hand .uno-card-symbol.type-wildDraw6,
    .uno-hand .uno-card-symbol.type-draw10,
    .uno-hand .uno-card-symbol.type-wildDraw10 {
        font-size: 30px;
    }

    .uno-hand .uno-card-symbol.type-discardAll,
    .uno-hand .uno-card-symbol.type-skipEveryone {
        font-size: 18px;
    }

    .uno-hand .uno-card-label {
        bottom: 15px;
        font-size: 8px;
    }

    .uno-hand .uno-card.is-wild .uno-card-label {
        bottom: 15px;
    }

    #snakesLaddersScreen {
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    }

    .sl-panel {
        padding: 12px;
        border-radius: 13px;
    }

    #snakesLaddersSetup {
        gap: 8px;
        padding: 20px;
        border-radius: 16px;
    }

    .sl-cell {
        padding: 1px;
    }

    .sl-token {
        right: 1px;
        bottom: 1px;
        border-width: 1px;
    }

    #chessScreen {
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    }

    .chess-panel {
        padding: 12px;
        border-radius: 13px;
    }

    #chessSetup {
        gap: 8px;
        padding: 20px;
        border-radius: 16px;
    }

    #chessSetup input {
        min-height: 48px;
    }

    #chessJoinBtn {
        min-height: 52px;
        font-size: 16px;
    }

    .chess-board-frame {
        padding: 5px;
    }

    .chess-board {
        transform: none;
    }

    .chess-piece {
        width: 94%;
        height: 94%;
        transform: translateY(-1%);
    }

    .chess-square:hover .chess-piece {
        transform: translateY(-1%);
    }

    .chess-rank-label {
        top: 2px;
        left: 2px;
    }

    .chess-file-label {
        right: 2px;
        bottom: 2px;
    }

    .chess-player-strip {
        min-height: 44px;
        margin: 0 2px 8px;
        padding: 6px 9px;
    }

    .chess-player-strip:last-child {
        margin: 8px 2px 0;
    }
}

#cardModal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid #ffd700;
    max-width: 520px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #ffd700;
}

.close:hover {
    color: #fff;
}

#cardDetails {
    margin-bottom: 20px;
    text-align: center;
}

.modal-card-image {
    width: min(100%, 320px);
    max-height: 55vh;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 2px solid #ffd700;
}

#cardActions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#cardActions button {
    padding: 10px 20px;
    background: #ffd700;
    color: #1a1a2e;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

#cardActions button:hover {
    background: #ffed4a;
}

#cardActions button:disabled {
    background: #666;
    cursor: not-allowed;
}

.card-action-hint {
    margin: 0;
    text-align: center;
    color: #d3d3d3;
}

.not-your-turn {
    opacity: 0.5;
    pointer-events: none;
}

.can-attack {
    box-shadow: 0 0 10px #ffd700;
}

.game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border-radius: 15px;
    border: 3px solid #ffd700;
    text-align: center;
    z-index: 2000;
}

.game-over h2 {
    color: #ffd700;
    font-size: 36px;
    margin-bottom: 20px;
}

.game-over button {
    padding: 15px 30px;
    font-size: 18px;
}

.resign-button {
    min-height: 40px;
    padding: 9px 15px;
    border: 1px solid rgba(255, 124, 139, .48);
    border-radius: 9px;
    background: linear-gradient(135deg, #a92b42, #7e1e36);
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(126, 30, 54, .22);
    transition: transform 150ms ease, filter 150ms ease;
}

.resign-button:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.12);
}

.resign-button:disabled {
    cursor: not-allowed;
    opacity: .65;
}

.resign-button[hidden] {
    display: none !important;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    #gameMenu {
        padding: 38px 16px;
    }

    .game-menu-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .game-menu-card {
        min-height: 205px;
        padding: 17px;
    }

    .game-menu-name {
        font-size: 19px;
    }

    #loginScreen h1 {
        font-size: 24px;
    }

    #loginScreen input {
        width: 250px;
        padding: 10px 15px;
        font-size: 14px;
    }

    #loginScreen button {
        padding: 10px 20px;
        font-size: 14px;
    }

    #gameScreen {
        padding: 10px;
    }

    #gameInfo {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        gap: 8px;
        margin-bottom: 12px;
        padding: 10px;
    }

    #roomInfo,
    #lobbyStatus {
        grid-column: 1 / -1;
        text-align: center;
    }

    #lobbyStatus {
        flex: none;
        width: 100%;
        padding-bottom: 2px;
    }

    #turnInfo,
    #phaseInfo {
        align-self: center;
        text-align: center;
    }

    #gameInfo button {
        width: 100%;
        min-height: 36px;
        margin: 0;
        padding: 8px 12px;
        font-size: 12px;
    }

    #actionStatus {
        margin: 0 0 6px;
        line-height: 1.35;
    }

    #gameBoard {
        gap: 10px;
        margin-bottom: 12px;
    }

    .player-field {
        padding: 8px;
    }

    .player-info {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .field-zones {
        gap: 5px;
    }

    .zone {
        width: 60px;
        height: 84px;
    }

    .zone-row {
        gap: 5px;
    }

    .card {
        width: 60px;
        height: 84px;
        font-size: 8px;
    }

    .card-name {
        font-size: 7px;
    }

    .card-stats {
        font-size: 6px;
    }

    .card-attribute {
        font-size: 12px;
    }

    .card-description {
        font-size: 6px;
    }

    .atk-def {
        font-size: 7px;
    }

    .deck-info {
        font-size: 12px;
        gap: 5px;
    }

    .deck-visual,
    .graveyard-visual {
        width: clamp(28px, 8vw, 35px);
        font-size: 10px;
    }

    #hand {
        padding: 10px;
    }

    #hand h3 {
        font-size: 14px;
    }

    #handCards {
        gap: 5px;
        overflow-x: auto;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
    }

    .modal-content {
        padding: 20px;
        max-width: 90%;
    }

    .modal-card-image {
        max-width: min(65vw, 320px);
        max-height: 45vh;
    }

    #cardDetails {
        font-size: 12px;
    }

    #cardDetails h3 {
        font-size: 16px;
    }

    #cardActions button {
        padding: 8px 15px;
        font-size: 12px;
    }

    .game-over {
        padding: 20px;
        max-width: 90%;
    }

    .game-over h2 {
        font-size: 24px;
    }

    .game-over button {
        padding: 10px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .game-menu-grid {
        grid-template-columns: minmax(0, 1fr);
        width: min(360px, 100%);
    }

    .game-menu-card {
        min-height: 170px;
    }

    #loginScreen h1 {
        font-size: 20px;
    }

    #loginScreen input {
        width: 100%;
    }

    .zone {
        width: 50px;
        height: 70px;
    }

    .card {
        width: 50px;
        height: 70px;
        font-size: 7px;
    }

    .card-name {
        font-size: 6px;
    }

    .card-attribute {
        font-size: 10px;
    }

    .player-info {
        font-size: 12px;
    }

    .deck-info {
        font-size: 10px;
    }

    #gameInfo {
        font-size: 12px;
    }

    #gameInfo button {
        min-height: 34px;
        padding: 6px 8px;
        font-size: 11px;
    }

    #gameInfo,
    .player-field {
        border-radius: 8px;
    }

    .deck-info {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 6px;
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    .card:hover {
        transform: none;
    }

    .card:active {
        transform: scale(0.95);
    }

    .card-text-overlay {
        display: none !important;
    }

    .card-image {
        position: absolute;
        opacity: 1;
        top: 0;
        left: 0;
    }

    .card.no-image .card-text-overlay {
        display: flex !important;
        position: static;
    }

    .zone:hover {
        border-color: rgba(255, 255, 255, 0.3);
        background: rgba(255, 255, 255, 0.1);
    }

    .zone:active {
        border-color: #ffd700;
        background: rgba(255, 215, 0, 0.2);
    }

    #cardModal {
        align-items: flex-end;
        justify-content: center;
    }

    .modal-content {
        border-radius: 15px 15px 0 0;
        max-height: 80vh;
        overflow-y: auto;
    }
}

@media (max-width: 768px) {
    #ludoScreen {
        padding: 14px 10px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }

    .ludo-panel {
        padding: 16px;
    }

    .ludo-game-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .ludo-board-wrap {
        width: min(100%, 600px);
    }

    .ludo-controls {
        display: grid;
        grid-template-columns: 76px minmax(120px, 1fr);
        align-items: center;
        gap: 10px;
    }

    .ludo-controls {
        grid-row: 1;
    }

    .ludo-board-wrap {
        grid-row: 2;
    }

    .ludo-die {
        grid-row: span 2;
    }

    #ludoMovePrompt,
    .ludo-rules-hint {
        grid-column: 1 / -1;
    }

    .ludo-players {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    #ludoScreen {
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    }

    .ludo-panel {
        padding: 12px;
        border-radius: 12px;
    }

    #ludoSetup {
        gap: 8px;
        padding: 20px;
        border-radius: 16px;
    }

    #ludoSetup .back-to-menu {
        margin-bottom: 7px;
    }

    #ludoSetup .ludo-intro {
        margin-bottom: 3px;
        font-size: 14px;
    }

    #ludoSetup input,
    #ludoSetup select {
        min-height: 48px;
    }

    .ludo-game-header {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
    }

    .ludo-game-header > div:nth-child(2) {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .ludo-game-header .back-to-menu {
        grid-column: 1;
        grid-row: 2;
        justify-self: start;
    }

    .ludo-turn-badge {
        grid-column: 2;
        grid-row: 2;
        padding: 8px;
        font-size: 12px;
    }

    .ludo-board-wrap {
        border-width: 3px;
    }

    .ludo-controls button,
    #ludoJoinBtn {
        min-height: 52px;
        font-size: 16px;
    }

    .ludo-player-card {
        padding: 8px;
    }
}

.pacman-menu-card {
    --game-accent: #ffe05c;
}

.angry-birds-menu-card {
    --game-accent: #ff826d;
}

.rts-menu-card {
    --game-accent: #a9d889;
}

.arcade-game-screen {
    min-height: 100vh;
    padding: 22px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(124, 78, 255, 0.22), transparent 52%),
        #090d1c;
}

.pacman-panel,
.angry-birds-panel,
.rts-panel {
    width: min(100%, 1080px);
    margin: 0 auto;
    padding: clamp(18px, 4vw, 36px);
    border: 1px solid rgba(164, 183, 218, 0.18);
    border-radius: 20px;
    background: rgba(15, 22, 42, 0.94);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.pacman-panel h1,
.angry-birds-panel h1,
.rts-panel h1 {
    margin: 8px 0;
    font-size: clamp(28px, 4vw, 44px);
}

.pacman-panel label,
.angry-birds-panel label,
.rts-panel label {
    display: grid;
    gap: 7px;
    margin-top: 14px;
    color: #d1d8e7;
    font-size: 13px;
    font-weight: 700;
}

.pacman-panel input,
.pacman-panel select,
.angry-birds-panel input,
.rts-panel input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #3d4965;
    border-radius: 9px;
    background: #0b1121;
    color: #fff;
    font: inherit;
}

#pacmanJoinBtn,
#angryBirdsJoinBtn,
#angryBirdsLaunchBtn,
#rtsJoinBtn {
    min-height: 46px;
    margin-top: 17px;
    padding: 10px 16px;
    border: 0;
    border-radius: 10px;
    background: #ffe05c;
    color: #171729;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

#angryBirdsJoinBtn,
#angryBirdsLaunchBtn {
    background: #ff826d;
    color: #24130f;
}

#pacmanJoinBtn:disabled,
#angryBirdsJoinBtn:disabled,
#angryBirdsLaunchBtn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.pacman-hint,
.angry-birds-hint,
.pacman-controls-hint,
.angry-birds-turn-status {
    color: #aab7d8;
    line-height: 1.5;
}

#pacmanSetupStatus,
#angryBirdsSetupStatus {
    min-height: 24px;
    margin-top: 10px;
    color: #ffe05c;
}

.rts-hint,
.rts-controls-hint,
.rts-turn-status {
    color: #b3c5ab;
    line-height: 1.5;
}

#rtsJoinBtn {
    background: #a9d889;
    color: #172315;
}

#rtsSetupStatus {
    min-height: 24px;
    margin-top: 10px;
    color: #b9e49d;
}

.pacman-game-panel,
.angry-birds-game-panel,
.rts-game-panel {
    width: min(100%, 1120px);
}

.pacman-game-header,
.angry-birds-game-header,
.rts-game-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin-bottom: 16px;
}

.pacman-game-header h1,
.angry-birds-game-header h1,
.rts-game-header h1 {
    margin: 3px 0 0;
    font-size: clamp(20px, 3vw, 30px);
}

.pacman-score {
    color: #ffe05c;
    font-weight: 800;
    white-space: nowrap;
}

.pacman-board {
    display: block;
    width: min(100%, 720px);
    max-height: calc(100vh - 240px);
    margin: 0 auto;
    border: 2px solid #36405f;
    border-radius: 12px;
    background: #050817;
    image-rendering: pixelated;
}

.pacman-controls-hint {
    margin-top: 12px;
    text-align: center;
}

.angry-birds-game-header .resign-button {
    padding: 9px 13px;
}

.angry-birds-board {
    display: block;
    width: 100%;
    aspect-ratio: 2 / 1;
    border: 1px solid #3d4965;
    border-radius: 12px;
    background: linear-gradient(#a8dcff, #f4d49e 77%, #81603b 77%);
}

.angry-birds-controls {
    display: grid;
    grid-template-columns: minmax(100px, 1fr) minmax(100px, 1fr) auto;
    align-items: end;
    gap: 16px;
    margin-top: 14px;
}

.angry-birds-controls label {
    margin: 0;
}

.angry-birds-controls output {
    color: #ffb19f;
}

.angry-birds-controls input {
    min-height: 24px;
    padding: 0;
    accent-color: #ff826d;
}

.angry-birds-controls button {
    margin: 0;
}

.angry-birds-turn-status {
    min-height: 24px;
    margin-top: 10px;
}

.rts-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

#rtsResources {
    margin: 0;
    color: #c9e5b8;
    font-weight: 800;
}

.rts-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rts-actions button {
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid #60794f;
    border-radius: 8px;
    background: #263b2a;
    color: #eaf2e4;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
}

.rts-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.rts-board {
    display: block;
    width: 100%;
    aspect-ratio: 5 / 3;
    border: 1px solid #596b4e;
    border-radius: 12px;
    background: #9eb779;
    touch-action: manipulation;
}

.rts-controls-hint,
.rts-turn-status {
    margin: 10px 0 0;
}

@media (max-width: 640px) {
    .arcade-game-screen {
        padding: 10px;
    }

    .pacman-panel,
    .angry-birds-panel,
    .rts-panel {
        padding: 16px;
        border-radius: 14px;
    }

    .pacman-game-header,
    .angry-birds-game-header,
    .rts-game-header {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
    }

    .pacman-game-header > div,
    .angry-birds-game-header > div,
    .rts-game-header > div {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .pacman-game-header .back-to-menu,
    .angry-birds-game-header .back-to-menu,
    .rts-game-header .back-to-menu {
        grid-column: 1;
        grid-row: 2;
        justify-self: start;
    }

    .pacman-score,
    .angry-birds-game-header .resign-button,
    .rts-game-header .resign-button {
        grid-column: 2;
        grid-row: 2;
    }

    .pacman-board {
        max-height: calc(100vh - 230px);
    }

    .angry-birds-controls {
        grid-template-columns: 1fr 1fr;
    }

    .angry-birds-controls button {
        grid-column: 1 / -1;
        min-height: 48px;
    }

    .rts-toolbar {
        align-items: stretch;
    }

    #rtsResources {
        width: 100%;
    }

    .rts-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }
}
