/* =====================================================================
   LifeForge → Games: the board games (Gomoku, Snakes and Ladders,
   Chinese Checkers, Aeroplane Chess, Jungle Chess). Served by the Portal
   from this library (_content/Martysoft.Studio.LifeForge.Games/css/).
   Classes start with gb- (never Bootstrap names such as btn-check).
   Boards keep the prototypes' colours; the panel around them uses the
   Portal's: white cards, gray lines, purple #6b5fe6 for the active choice.
   ===================================================================== */

.gb-game {
    --gb-fg: #1f2330;
    --gb-muted: #6b7280;
    --gb-panel: #fff;
    --gb-line: #e5e7eb;
    --gb-accent: #6b5fe6;
    --gb-accent-dark: #5a4fd4;
    --gb-soft: #f1effd;
    --gb-p0: #dc3d2c;   /* red    */
    --gb-p1: #2d6fd1;   /* blue   */
    --gb-p2: #2a9d5b;   /* green  */
    --gb-p3: #eeb11a;   /* yellow */
    --gb-p4: #7b4fc9;   /* purple */
    --gb-p5: #e07a1f;   /* orange */
    display: grid;
    grid-template-columns: minmax(0, 620px) minmax(280px, 1fr);
    gap: 28px;
    align-items: start;
    color: var(--gb-fg);
}

.gb-q0 { --pc: var(--gb-p0); --pg: #fff; }
.gb-q1 { --pc: var(--gb-p1); --pg: #fff; }
.gb-q2 { --pc: var(--gb-p2); --pg: #fff; }
.gb-q3 { --pc: var(--gb-p3); --pg: #2a1d00; }
.gb-q4 { --pc: var(--gb-p4); --pg: #fff; }
.gb-q5 { --pc: var(--gb-p5); --pg: #fff; }

.gb-boardcol {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.gb-side {
    display: grid;
    gap: 18px;
    min-width: 0;
}

/* Status bar above the board: one sentence, whose turn and what to do. */
.gb-status {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 8px 14px;
    border-radius: 12px;
    background: var(--gb-panel);
    border: 1px solid var(--gb-line);
}

    .gb-status p {
        margin: 0;
        font-weight: 600;
        font-size: 16px;
        line-height: 1.3;
        flex: 1;
        min-width: 0;
    }

.gb-counter {
    font-size: 13px;
    color: var(--gb-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.gb-swatch {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex: none;
    background: var(--pc, #999);
    border: 1px solid rgba(0, 0, 0, 0.15);
}

    .gb-swatch.gb-stone-1 { background: radial-gradient(circle at 35% 30%, #5b6068, #0c0e11 70%); }
    .gb-swatch.gb-stone-2 { background: radial-gradient(circle at 35% 30%, #fff, #d2d3cf 80%); border-color: #8c9299; }

/* Every board fits the window's height (never under 300px wide): its width is capped at the height left under the
   page header and the status bar (--gb-chrome; the play page sets less in full screen) times the board's own shape
   (--gb-ratio, width over height of its viewBox). Wider windows centre it in its column. */
.gb-game { --gb-ratio: 1; }
.gb-snakes { --gb-ratio: 104 / 117; }
.gb-checkers { --gb-ratio: 136 / 154; }
.gb-jungle { --gb-ratio: 76 / 96; }

/* Full screen (the play page puts its .board-host in full screen): the board's column is no longer held to 620px. On a
   screen wider than a tablet it is as wide as the screen's height allows (less --gb-chrome: the title row, the status
   bar and the padding) for the board's shape; the side panel keeps a readable width beside it; both are centred.
   At 900px and under the one-column layout below still applies. */
@media (min-width: 901px) {
    :fullscreen .gb-game {
        grid-template-columns: minmax(0, calc((100vh - var(--gb-chrome, 150px)) * var(--gb-ratio))) minmax(280px, 380px);
        justify-content: center;
    }
}

.gb-board {
    width: 100%;
    height: auto;
    display: block;
    max-width: max(300px, calc((100vh - var(--gb-chrome, 230px)) * var(--gb-ratio)));
    margin: 0 auto;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    border-radius: 10px;
}

    .gb-board:focus-visible, .gb-board [tabindex]:focus-visible {
        outline: 3px solid var(--gb-accent);
        outline-offset: 2px;
    }

/* Side panel cards. */
.gb-card {
    background: var(--gb-panel);
    border: 1px solid var(--gb-line);
    border-radius: 12px;
    padding: 14px 16px;
    display: grid;
    gap: 14px;
}

.gb-label {
    margin: 0 0 7px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gb-muted);
}

.gb-seg {
    display: inline-flex;
    flex-wrap: wrap;
    border: 1px solid #d6d9e0;
    border-radius: 9px;
    overflow: hidden;
    background: #fff;
}

    .gb-seg button {
        font-size: 14px;
        font-weight: 600;
        padding: 8px 13px;
        background: transparent;
        color: var(--gb-fg);
        border: 0;
        border-right: 1px solid #e5e7eb;
        cursor: pointer;
    }

        .gb-seg button:last-child {
            border-right: 0;
        }

        .gb-seg button[aria-pressed="true"] {
            background: var(--gb-accent);
            color: #fff;
        }

.gb-select {
    font-size: 14px;
    padding: 7px 10px;
    border-radius: 9px;
    border: 1px solid #d6d9e0;
    background: #fff;
    color: var(--gb-fg);
}

.gb-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.gb-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gb-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 9px;
    border: 1px solid #d6d9e0;
    background: #fff;
    color: var(--gb-fg);
    cursor: pointer;
}

    .gb-btn:hover:not(:disabled) {
        background: #f5f6f8;
    }

    .gb-btn.gb-primary {
        background: var(--gb-accent);
        border-color: var(--gb-accent);
        color: #fff;
    }

        .gb-btn.gb-primary:hover:not(:disabled) {
            background: var(--gb-accent-dark);
        }

    .gb-btn:disabled {
        opacity: 0.45;
        cursor: default;
    }

.gb-rules > summary {
    cursor: pointer;
    font-weight: 600;
}

.gb-rules ul {
    margin: 10px 0 0;
    padding-left: 1.2em;
    display: grid;
    gap: 6px;
    color: var(--gb-muted);
    font-size: 14px;
}

/* Players and the move log. */
.gb-players {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

    .gb-players li {
        display: grid;
        grid-template-columns: 16px minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        padding: 7px 10px;
        border-radius: 9px;
        border: 1px solid transparent;
        font-size: 14px;
    }

        .gb-players li.gb-on {
            border-color: var(--pc);
            background: color-mix(in srgb, var(--pc) 10%, #fff);
        }

.gb-player-sw {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--pc);
}

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

.gb-player-detail {
    color: var(--gb-muted);
    font-size: 13px;
    white-space: nowrap;
}

.gb-player-state {
    font-size: 12px;
    font-weight: 700;
    color: var(--pc);
    grid-column: 3;
}

.gb-log {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
    font-size: 13px;
    color: var(--gb-muted);
    max-height: 170px;
    overflow-y: auto;
}

    .gb-log li:first-child {
        color: var(--gb-fg);
        font-weight: 600;
    }

/* The die: a square with pips, coloured for the player whose turn it is. */
.gb-turn {
    display: flex;
    align-items: center;
    gap: 16px;
}

.gb-die {
    --s: 72px;
    width: var(--s);
    height: var(--s);
    border-radius: 16px;
    border: 3px solid var(--pc, #999);
    background: #fff;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 10px;
    cursor: default;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    flex: none;
}

    .gb-die i {
        width: 12px;
        height: 12px;
        margin: auto;
        border-radius: 50%;
        background: transparent;
    }

        .gb-die i.gb-pip {
            background: var(--gb-fg);
        }

    .gb-die.gb-ready {
        cursor: pointer;
        animation: gb-nudge 1.4s ease-in-out infinite;
    }

    .gb-die:disabled {
        opacity: 1;
    }

    .gb-die.gb-rolling {
        animation: gb-shake 0.42s linear;
    }

.gb-turn-text {
    font-size: 14px;
    color: var(--gb-muted);
}

@keyframes gb-nudge {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pc, #6b5fe6) 45%, transparent); }
    50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--pc, #6b5fe6) 0%, transparent); }
}

@keyframes gb-shake {
    0% { transform: rotate(0); }
    25% { transform: rotate(-14deg); }
    50% { transform: rotate(10deg); }
    75% { transform: rotate(-6deg); }
    100% { transform: rotate(0); }
}

/* ============ Gomoku ============ */
.gb-gomoku .wood { fill: #d6ae6b; }
.gb-gomoku .gl { stroke: #5d4524; stroke-width: 0.3; }
.gb-gomoku .gl.edge { stroke-width: 0.7; }
.gb-gomoku .star { fill: #5d4524; }
.gb-gomoku .pt { fill: transparent; cursor: pointer; }
.gb-gomoku .gb-can-play.gb-turn-1 .pt:hover { fill: rgba(12, 14, 17, 0.45); }
.gb-gomoku .gb-can-play.gb-turn-2 .pt:hover { fill: rgba(255, 255, 255, 0.7); }
.gb-gomoku .cursor { fill: none; stroke: #d63a2a; stroke-width: 0.7; stroke-dasharray: 1.4 1; opacity: 0; pointer-events: none; }
.gb-gomoku .gb-board:focus .cursor { opacity: 1; }
.gb-gomoku .gb-board:focus { outline: none; }
.gb-gomoku .ghost { opacity: 0.45; pointer-events: none; }
.gb-gomoku .lm { fill: #d63a2a; pointer-events: none; }
.gb-gomoku .winline { stroke: #e23a2c; stroke-width: 1.3; stroke-linecap: round; opacity: 0.9; pointer-events: none; }
.gb-gomoku .winring { fill: none; stroke: #e23a2c; stroke-width: 0.9; pointer-events: none; }
.gb-gomoku .st { filter: drop-shadow(0 0.4px 0.5px rgba(0, 0, 0, 0.45)); pointer-events: none; }
.gb-gomoku .st.drop { animation: gb-drop 0.18s ease-out; transform-box: fill-box; transform-origin: center; }

@keyframes gb-drop {
    from { transform: scale(1.35); opacity: 0.2; }
    to { transform: scale(1); opacity: 1; }
}

/* ============ Snakes and Ladders ============ */
.gb-snakes .frame { fill: #26443c; }
.gb-snakes .tile { stroke: #26443c; stroke-width: 0.25; }
.gb-snakes .tl0 { fill: #f8d7cc; }
.gb-snakes .tl1 { fill: #fbe9b4; }
.gb-snakes .tl2 { fill: #cde7d6; }
.gb-snakes .tl3 { fill: #cddff2; }
.gb-snakes .num { font: 600 2.7px system-ui, sans-serif; fill: #6a5d52; }
.gb-snakes .finish { font: 700 2.9px system-ui, sans-serif; fill: #6a5d52; }
.gb-snakes .pad { fill: none; stroke: #cde7d6; stroke-width: 0.4; stroke-dasharray: 1.4 1.1; }
.gb-snakes .padlab { font: 700 2.8px system-ui, sans-serif; fill: #cde7d6; }
.gb-snakes .rail { stroke: #8a5a2b; stroke-width: 0.75; stroke-linecap: round; }
.gb-snakes .rung { stroke: #8a5a2b; stroke-width: 0.55; stroke-linecap: round; }
.gb-snakes .snake { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.gb-snakes .sbody { stroke-width: 2.4; }
.gb-snakes .sstripe { stroke-width: 1.2; stroke: rgba(255, 255, 255, 0.55); stroke-dasharray: 1.2 2.4; }
.gb-snakes .eye { fill: #fff; }
.gb-snakes .pupil { fill: #111; }
.gb-snakes .tongue { stroke: #d63a2a; stroke-width: 0.45; stroke-linecap: round; fill: none; }
.gb-snakes .pawn { transition: transform 0.15s ease; filter: drop-shadow(0 0.4px 0.5px rgba(0, 0, 0, 0.5)); }
.gb-snakes .pawn.slide { transition: transform 0.75s cubic-bezier(0.5, 0, 0.3, 1); }
.gb-snakes .pawn .pc { fill: var(--pc); stroke: #fff; stroke-width: 0.6; }
.gb-snakes .pawn .pl { fill: var(--pg); font: 700 2.3px system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; }

/* ============ Chinese Checkers ============ */
.gb-cc0 { --mc: #e0402f; --mr: #8c1f15; --pc: #e0402f; }
.gb-cc1 { --mc: #f2b51a; --mr: #946700; --pc: #e6a400; }
.gb-cc2 { --mc: #2fa35f; --mr: #155f35; --pc: #2fa35f; }
.gb-cc3 { --mc: #2f72d4; --mr: #17458f; --pc: #2f72d4; }
.gb-cc4 { --mc: #20252e; --mr: #9aa6b6; --pc: #20252e; }
.gb-cc5 { --mc: #f3f5f7; --mr: #8995a4; --pc: #8995a4; }
.gb-swatch[class*="gb-cc"] { background: var(--mc); border: 1.5px solid var(--mr); }
.gb-checkers .shape { fill: #4b3a2d; stroke: #4b3a2d; stroke-width: 11; stroke-linejoin: round; }
.gb-checkers .hole { fill: #2c2219; stroke: transparent; stroke-width: 0.9; }
.gb-checkers .cs0 { stroke: #e0402f; } .gb-checkers .cs1 { stroke: #f2b51a; } .gb-checkers .cs2 { stroke: #2fa35f; }
.gb-checkers .cs3 { stroke: #2f72d4; } .gb-checkers .cs4 { stroke: #8d98a8; } .gb-checkers .cs5 { stroke: #f3f5f7; }
.gb-checkers .goalring { fill: none; stroke: #f5b800; stroke-width: 0.6; stroke-dasharray: 1.2 1.2; opacity: 0.7; }
.gb-checkers .lastring { fill: none; stroke: #f5b800; stroke-width: 0.9; }
.gb-checkers .lastring.from { stroke-dasharray: 1.4 1.1; opacity: 0.8; }
.gb-checkers .mb { transition: transform 0.17s ease; outline: none; filter: drop-shadow(0 0.5px 0.6px rgba(0, 0, 0, 0.55)); }
.gb-checkers .mb .mc { fill: var(--mc); stroke: var(--mr); stroke-width: 0.7; }
.gb-checkers .mb .hl { fill: #fff; opacity: 0.5; }
.gb-checkers .mb .halo { fill: none; stroke: #f5b800; stroke-width: 1.1; opacity: 0; }
.gb-checkers .mb.moving { filter: drop-shadow(0 1.6px 1.4px rgba(0, 0, 0, 0.6)); }
.gb-checkers .mb:not(.can) { pointer-events: none; }
.gb-checkers .mb.can { cursor: pointer; }
.gb-checkers .mb.can .halo { opacity: 0.5; }
.gb-checkers .mb.sel .halo { opacity: 1; stroke-width: 1.5; }
.gb-checkers .mb:focus-visible .halo { opacity: 1; stroke: #1f2330; }
.gb-checkers .hint { cursor: pointer; outline: none; }
.gb-checkers .hint .hit { fill: transparent; }
.gb-checkers .hint .dm { fill: #f5b800; stroke: #2c2219; stroke-width: 0.4; }
.gb-checkers .hint:focus-visible .dm { stroke: #1f2330; stroke-width: 1; }

/* ============ Aeroplane Chess ============ */
.gb-ap0 { --pc: #f0ad00; --gl: #2a1d00; }   /* Yellow, top */
.gb-ap1 { --pc: #2561c4; --gl: #fff; }      /* Blue, right */
.gb-ap2 { --pc: #dc3a2b; --gl: #fff; }
.gb-ap3 { --pc: #1c9a60; --gl: #fff; }
.gb-aeroplane .bg { fill: #d3dee6; stroke: #c7d2da; stroke-width: 0.4; }
.gb-aeroplane .yard { fill: var(--pc); fill-opacity: 0.16; stroke: var(--pc); stroke-opacity: 0.8; stroke-width: 0.7; }
.gb-aeroplane .stand { fill: none; stroke: var(--pc); stroke-width: 0.6; stroke-dasharray: 1.4 1.2; }
.gb-aeroplane .ylab { fill: #0f1d28; fill-opacity: 0.7; font: 700 3.8px system-ui, sans-serif; letter-spacing: 0.3px; text-anchor: middle; }
.gb-aeroplane .cell { fill: var(--pc); fill-opacity: 0.88; }
.gb-aeroplane .rw { fill: #3e4b57; }
.gb-aeroplane .cl { stroke: #f3f6f8; stroke-width: 0.7; stroke-dasharray: 2.6 2.4; opacity: 0.75; }
.gb-aeroplane .lake { fill: #a9d4ee; stroke: #8fc2e2; stroke-width: 0.4; }
.gb-aeroplane .flight { stroke: var(--pc); stroke-width: 0.9; stroke-dasharray: 2.2 1.8; stroke-linecap: round; opacity: 0.95; }
.gb-aeroplane .flight-plane { fill: var(--pc); stroke: #fff; stroke-width: 1.2; paint-order: stroke; }
.gb-aeroplane .mark { fill: var(--gl); opacity: 0.9; }
.gb-aeroplane .mark-ring { fill: none; stroke: var(--gl); stroke-width: 0.7; opacity: 0.85; }
.gb-aeroplane .start { fill: #f8fafb; stroke: var(--pc); stroke-width: 1.1; }
.gb-aeroplane .start-arrow { fill: var(--pc); }
.gb-aeroplane .core { fill: #f8fafb; }
.gb-aeroplane .tri { fill: var(--pc); fill-opacity: 0.92; stroke: #f8fafb; stroke-width: 0.5; }
.gb-aeroplane .tok { transition-property: transform; transition-timing-function: ease; outline: none; filter: drop-shadow(0 0.4px 0.5px rgba(0, 0, 0, 0.4)); }
.gb-aeroplane .tok .disc { fill: var(--pc); stroke: #fff; stroke-width: 0.9; }
.gb-aeroplane .tok path { fill: var(--gl); }
.gb-aeroplane .tok .hit { fill: transparent; }
.gb-aeroplane .tok .ring { fill: none; stroke: #0f1d28; stroke-width: 0.9; stroke-dasharray: 1.6 1.2; opacity: 0; transform-origin: center; transform-box: fill-box; }
.gb-aeroplane .tok:not(.can) { pointer-events: none; }
.gb-aeroplane .tok.can { cursor: pointer; }
.gb-aeroplane .tok.can .ring { opacity: 1; animation: gb-spin 3s linear infinite; }
.gb-aeroplane .tok.can .disc { stroke-width: 1.4; }
.gb-aeroplane .tok:focus-visible .disc { stroke: #0f1d28; stroke-width: 1.8; }

@keyframes gb-spin {
    to { transform: rotate(360deg); }
}

/* ============ Jungle Chess ============ */
.gb-js0 { --pc: #c9372c; --ink: #b3261b; }
.gb-js1 { --pc: #2860b8; --ink: #1d4d9c; }
.gb-jungle .frame { fill: #2f4a38; }
.gb-jungle .land { stroke: #7f9a69; stroke-width: 0.25; }
.gb-jungle .l0 { fill: #bfd3a6; }
.gb-jungle .l1 { fill: #b4cb9a; }
.gb-jungle .water { fill: #72b4d0; stroke: #72b4d0; stroke-width: 0.3; }
.gb-jungle .wave { fill: none; stroke: #d9f1f9; stroke-width: 0.5; stroke-linecap: round; opacity: 0.85; }
.gb-jungle .trap { fill: none; stroke: var(--pc); stroke-width: 0.6; stroke-dasharray: 1.2 0.9; }
.gb-jungle .trapx { stroke: var(--pc); stroke-width: 0.6; opacity: 0.7; stroke-linecap: round; }
.gb-jungle .den { fill: var(--pc); }
.gb-jungle .denin { fill: #2f4a38; }
.gb-jungle .mk { fill: none; pointer-events: none; }
.gb-jungle .mk.last { fill: #f2b100; fill-opacity: 0.26; }
.gb-jungle .mk.selc { stroke: #f2b100; stroke-width: 1; fill: #f2b100; fill-opacity: 0.18; }
.gb-jungle .pc { transition: transform 0.2s ease, opacity 0.25s ease; outline: none; filter: drop-shadow(0 0.5px 0.6px rgba(0, 0, 0, 0.45)); }
.gb-jungle .pc .disc { fill: #f5f1e6; stroke: var(--ink); stroke-width: 0.9; }
.gb-jungle .pc .inner { fill: none; stroke: var(--ink); stroke-width: 0.3; opacity: 0.55; }
.gb-jungle .pc .ch { font: 700 5.6px "Noto Sans TC", "PingFang HK", "Microsoft JhengHei", sans-serif; text-anchor: middle; dominant-baseline: central; fill: var(--ink); }
.gb-jungle .pc .bd { fill: var(--ink); }
.gb-jungle .pc .bt { font: 700 2.4px system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; fill: #fff; }
.gb-jungle .pc .halo { fill: none; stroke: #f2b100; stroke-width: 1.2; opacity: 0; }
.gb-jungle .pc.weak .disc { stroke-dasharray: 1.4 0.8; }
.gb-jungle .pc.weak { opacity: 0.78; }
.gb-jungle .pc.gone { opacity: 0; pointer-events: none; }
.gb-jungle .pc:not(.can) { pointer-events: none; }
.gb-jungle .pc.can { cursor: pointer; }
.gb-jungle .pc.can .halo { opacity: 0.55; }
.gb-jungle .pc.sel .halo { opacity: 1; stroke-width: 1.6; }
.gb-jungle .pc:focus-visible .disc { stroke-width: 1.8; }
.gb-jungle .hint { cursor: pointer; outline: none; }
.gb-jungle .hint rect { fill: transparent; }
.gb-jungle .hint .dotm { fill: #f2b100; stroke: #2f4a38; stroke-width: 0.35; }
.gb-jungle .hint .capm { fill: none; stroke: #f2b100; stroke-width: 1.3; }
.gb-jungle .hint:focus-visible .dotm, .gb-jungle .hint:focus-visible .capm { stroke: #1f2330; stroke-width: 1.6; }
.gb-swatch.gb-js0, .gb-swatch.gb-js1 { background: var(--pc); }

.gb-graves {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.gb-graves-label {
    min-width: 4.2em;
    font-size: 13px;
    font-weight: 600;
    color: var(--gb-muted);
}

.gb-none {
    font-size: 13px;
    color: var(--gb-muted);
}

.gb-chip {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: #f5f1e6;
    border: 1.5px solid var(--ink);
    color: var(--ink);
    font: 700 14px/1 "Noto Sans TC", "PingFang HK", "Microsoft JhengHei", sans-serif;
}

.gb-ranks {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 12px;
    font-size: 14px;
}

    .gb-ranks li {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .gb-ranks small {
        color: var(--gb-muted);
    }

/* Tablets and phones: the panel goes under the board. */
@media (max-width: 900px) {
    .gb-game {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    /* Dice games: the die is what you tap every turn, so its card comes straight under the board (settings next,
       rules last) and the board leaves room for it on screen (a taller --gb-chrome). */
    .gb-snakes, .gb-aeroplane { --gb-chrome: 380px; }

    .gb-snakes .gb-side > .gb-card:first-child,
    .gb-aeroplane .gb-side > .gb-card:first-child { order: 1; }

    .gb-snakes .gb-side > .gb-card:has(.gb-rules),
    .gb-aeroplane .gb-side > .gb-card:has(.gb-rules) { order: 2; }
}

/* ---------------------------------------------------------------------
   Start screen (GameIntro): the arcade games' title-card look. A themed
   backdrop per game with a dark glass panel: big bright title, tagline,
   how to play, players, keys, Play and Full screen.
   --------------------------------------------------------------------- */
.gb-intro {
    --gb-intro-bg: linear-gradient(135deg, #3b3f6b, #1f2240);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: min(640px, calc(100vh - 230px));
    padding: 28px 16px;
    border-radius: 16px;
    background:
        radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.16), transparent 45%),
        radial-gradient(circle at 85% 90%, rgba(255, 255, 255, 0.10), transparent 40%),
        var(--gb-intro-bg);
    box-shadow: 0 10px 30px rgba(20, 22, 40, 0.18);
}

.gb-intro[data-game="gomoku"] { --gb-intro-bg: linear-gradient(135deg, #c98f45, #7a4d1e); }
.gb-intro[data-game="snakes"] { --gb-intro-bg: linear-gradient(135deg, #3f9a55, #1d5a33); }
.gb-intro[data-game="checkers"] { --gb-intro-bg: linear-gradient(135deg, #7b4fc9, #3a236b); }
.gb-intro[data-game="aeroplane"] { --gb-intro-bg: linear-gradient(135deg, #3d8fd8, #1b4d86); }
.gb-intro[data-game="jungle"] { --gb-intro-bg: linear-gradient(135deg, #4f8f5b, #26533a); }

.gb-intro-panel {
    width: min(560px, 100%);
    padding: 28px 30px 26px;
    border-radius: 18px;
    background: rgba(18, 20, 36, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    color: #eef0f8;
    text-align: center;
}

.gb-intro-icon {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 6px;
}

.gb-intro-title {
    margin: 0;
    font-size: clamp(28px, 6vw, 46px);
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #ffd54a;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
    line-height: 1.05;
}

.gb-intro-native {
    margin-top: 4px;
    font-size: 18px;
    color: #ffe9a3;
    letter-spacing: 4px;
}

.gb-intro-tagline {
    margin: 10px 0 18px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.gb-intro-how {
    text-align: left;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
}

    .gb-intro-how h3 {
        margin: 0 0 4px;
        font-size: 12px;
        letter-spacing: 1.2px;
        text-transform: uppercase;
        color: #b9bfd8;
    }

    .gb-intro-how p {
        margin: 0;
        font-size: 14px;
        line-height: 1.5;
        color: #e3e6f2;
    }

.gb-intro-players {
    margin: 12px 0 0;
    font-size: 14px;
    color: #cfd4ea;
}

.gb-intro-keys {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 14px;
    font-size: 13px;
    color: #cfd4ea;
}

    .gb-intro-keys kbd {
        display: inline-block;
        min-width: 20px;
        margin-right: 3px;
        padding: 1px 6px;
        border-radius: 5px;
        background: rgba(255, 255, 255, 0.14);
        border: 1px solid rgba(255, 255, 255, 0.22);
        color: #fff;
        font-size: 12px;
        font-weight: 600;
        line-height: 1.6;
        font-family: inherit;
    }

.gb-intro-touch {
    margin: 8px 0 0;
    font-size: 13px;
    color: #9aa1c0;
}

.gb-intro-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.gb-intro-play, .gb-intro-fullscreen {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.gb-intro-play {
    border: none;
    background: #7ce26b;
    color: #10230c;
    box-shadow: 0 4px 0 #4a9c3c;
}

    .gb-intro-play:hover { background: #8cec7b; }

    .gb-intro-play:focus-visible, .gb-intro-fullscreen:focus-visible {
        outline: 3px solid #ffd54a;
        outline-offset: 2px;
    }

.gb-intro-fullscreen {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: transparent;
    color: #fff;
}

    .gb-intro-fullscreen:hover { background: rgba(255, 255, 255, 0.1); }

@media (max-width: 520px) {
    .gb-intro {
        padding: 14px 10px;
        min-height: 0;
    }

    .gb-intro-panel {
        padding: 20px 16px 18px;
    }

    .gb-intro-tagline {
        font-size: 16px;
        margin-bottom: 14px;
    }

    /* Phones are tapped, not typed on: the touch line says what to do. */
    .gb-intro-keys { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .gb-gomoku .st.drop, .gb-die.gb-ready, .gb-die.gb-rolling { animation: none; }
    .gb-snakes .pawn, .gb-snakes .pawn.slide, .gb-checkers .mb, .gb-aeroplane .tok, .gb-jungle .pc { transition: none !important; }
    .gb-aeroplane .tok.can .ring { animation: none; }
}

/* ── 天下太平: a sheet of lined paper drawn in pencil. The other side at the top, yours at the bottom. ── */
.gb-tianxia { --gb-ratio: 4 / 5; --tx-pencil: #3b3f4a; --tx-faint: #c4c7cf; }

.tx-paper {
    width: 100%;
    max-width: max(300px, calc((100vh - var(--gb-chrome, 230px)) * var(--gb-ratio)));
    margin: 0 auto;
    padding: 14px 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--tx-pencil);
    background:
        linear-gradient(90deg, transparent 38px, #f2b8b8 38px, #f2b8b8 40px, transparent 40px),
        repeating-linear-gradient(#fdfcf7 0 27px, #dbe4f3 27px 28px);
    border: 1px solid #e2dfd3;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
    font-family: "Segoe Print", "Comic Sans MS", "Bradley Hand", cursive;
    user-select: none;
    -webkit-user-select: none;
}

    .tx-paper:focus-visible { outline: 3px solid var(--gb-accent); outline-offset: 2px; }

.tx-side {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto 1fr;
    align-items: center;
    gap: 6px 12px;
}

    .tx-side .tx-name { grid-column: 1 / -1; margin: 0; font-weight: 700; font-size: 15px; }
    .tx-theirs .tx-name { text-align: right; }
    .tx-won .tx-name::after { content: " 🏆"; }

.tx-flags { display: flex; gap: 6px; justify-content: flex-end; font-size: 22px; }
.tx-flag { color: var(--tx-faint); }
    .tx-flag i { -webkit-text-stroke: 1px var(--tx-faint); color: transparent; }
    .tx-flag.up { color: #d23c2f; }
    .tx-flag.up i { color: #d23c2f; -webkit-text-stroke: 1px var(--tx-pencil); }

/* Shields: up to three pencil rings round the fortress; one not built is a faint dashed outline. */
.tx-shield {
    padding: 5px;
    border: 2px dashed var(--tx-faint);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .tx-shield.up { border: 2.5px solid #2d6fd1; background: rgba(45, 111, 209, .05); }

.tx-fortress {
    width: 64px;
    height: 64px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    place-items: center;
    border: 2.5px solid var(--tx-pencil);
    border-radius: 4px;
    background: #fffdf5;
    font-family: "Kaiti TC", "KaiTi", "STKaiti", "Microsoft JhengHei", serif;
    font-size: 22px;
    line-height: 1;
    position: relative;
}

    .tx-fortress.down { color: var(--tx-faint); border-color: var(--tx-faint); }
    .tx-fortress.down::before, .tx-fortress.down::after {
        content: "";
        position: absolute;
        left: -6px;
        right: -6px;
        top: 50%;
        border-top: 3px solid #d23c2f;
        transform: rotate(45deg);
    }
    .tx-fortress.down::after { transform: rotate(-45deg); }

.tx-weapons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 28px; font-size: 22px; }
.tx-weapon svg { width: 30px; height: 20px; fill: var(--tx-pencil); display: block; }
.tx-plane { color: var(--tx-pencil); transform: rotate(-45deg); }
.tx-theirs .tx-plane { transform: rotate(135deg); }
.tx-none { font-size: 13px; color: var(--gb-muted); }

.tx-middle {
    border-top: 2px dashed var(--tx-faint);
    border-bottom: 2px dashed var(--tx-faint);
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    font-family: system-ui, "Segoe UI", sans-serif;
}

.tx-throws { margin: 0; font-size: 15px; font-weight: 600; }
.tx-hidden, .tx-thinking { margin: 0; color: var(--gb-muted); font-size: 14px; }

.tx-hands, .tx-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.tx-hand, .tx-action {
    border: 1.5px solid var(--gb-line);
    background: #fff;
    border-radius: 10px;
    padding: 8px 14px;
    font: inherit;
    font-size: 15px;
    cursor: pointer;
    color: var(--gb-fg);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .tx-hand:hover, .tx-action:hover { border-color: var(--gb-accent); background: var(--gb-soft); }
    .tx-hand:focus-visible, .tx-action:focus-visible { outline: 3px solid var(--gb-accent); outline-offset: 2px; }
    .tx-hand-icon { font-size: 26px; line-height: 1; }
    .tx-action kbd { font-size: 11px; padding: 1px 5px; border: 1px solid var(--gb-line); border-radius: 4px; background: var(--gb-soft); }
    .tx-attack { border-color: #f0b5ae; }
    .tx-attack:hover { border-color: #d23c2f; background: #fdf0ee; }

@media (max-width: 520px) {
    .tx-paper { padding: 10px; }
    .tx-fortress { width: 52px; height: 52px; font-size: 18px; }
    .tx-flags, .tx-weapons { font-size: 18px; }
    .tx-hand, .tx-action { padding: 7px 10px; font-size: 14px; }
}
