/* BizSuite free-games hub & pages
   Self-contained visual language so games feel distinct from the tools.
   All colours come from CSS variables so a future dark-mode toggle is easy. */

:root {
    --bz-games-bg: #0f172a;
    --bz-games-bg-soft: #111c35;
    --bz-games-surface: #162041;
    --bz-games-surface-2: #1e2a54;
    --bz-games-border: #2a3a72;
    --bz-games-text: #e6ecff;
    --bz-games-text-dim: #aab5db;
    --bz-games-accent: #6aa6ff;
    --bz-games-accent-2: #ffd166;
    --bz-games-good: #4ade80;
    --bz-games-bad: #f87171;
    --bz-games-radius: 14px;
    --bz-games-radius-sm: 10px;
    --bz-games-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --bz-games-shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
}

body.bz-games-body {
    background: radial-gradient(1200px 600px at 10% -10%, #1d2a5a 0%, transparent 60%),
                radial-gradient(1200px 600px at 100% 100%, #25355f 0%, transparent 55%),
                var(--bz-games-bg);
    color: var(--bz-games-text);
    min-height: 100vh;
}

.bz-games-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px 18px 60px;
}

.bz-games-crumbs {
    font-size: 0.9rem;
    color: var(--bz-games-text-dim);
    margin-bottom: 10px;
}
.bz-games-crumbs a { color: var(--bz-games-accent); text-decoration: none; }
.bz-games-crumbs a:hover { text-decoration: underline; }

.bz-games-hero {
    background: linear-gradient(135deg, #1b2a5c 0%, #2a1f5a 100%);
    border: 1px solid var(--bz-games-border);
    border-radius: var(--bz-games-radius);
    padding: 28px 28px 32px;
    margin-bottom: 24px;
    box-shadow: var(--bz-games-shadow);
}
.bz-games-hero-tool { padding: 22px 24px 24px; }
.bz-games-hero-inner { display: grid; grid-template-columns: 1fr; gap: 16px; }
.bz-games-hero-copy h1 {
    margin: 6px 0 10px;
    font-size: clamp(1.5rem, 2.4vw + 1rem, 2.3rem);
    line-height: 1.15;
}
.bz-games-hero-copy p { color: var(--bz-games-text-dim); margin: 0 0 14px; max-width: 65ch; }
.bz-games-eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    color: var(--bz-games-accent-2);
    background: rgba(255, 209, 102, 0.1);
    border: 1px solid rgba(255, 209, 102, 0.25);
    border-radius: 999px;
    padding: 4px 10px;
}
.bz-games-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.bz-games-badge {
    background: rgba(106, 166, 255, 0.12);
    border: 1px solid rgba(106, 166, 255, 0.3);
    color: var(--bz-games-text);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.8rem;
}
.bz-games-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.bz-games-btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: var(--bz-games-radius-sm);
    border: 1px solid transparent;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
    font-size: 0.95rem;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.bz-games-btn-primary {
    background: var(--bz-games-accent);
    color: #0b1330;
    box-shadow: var(--bz-games-shadow-sm);
}
.bz-games-btn-primary:hover { transform: translateY(-1px); }
.bz-games-btn-secondary {
    background: transparent;
    color: var(--bz-games-text);
    border-color: var(--bz-games-border);
}
.bz-games-btn-secondary:hover { background: rgba(255, 255, 255, 0.04); }
.bz-games-btn-ghost {
    background: transparent;
    color: var(--bz-games-text-dim);
    border-color: transparent;
    padding: 6px 10px;
}

.bz-games-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 16px;
}
@media (min-width: 1000px) {
    .bz-games-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}

.bz-games-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.bz-games-side { display: flex; flex-direction: column; gap: 16px; }

.bz-games-card,
.bz-games-side-card {
    background: var(--bz-games-surface);
    border: 1px solid var(--bz-games-border);
    border-radius: var(--bz-games-radius);
    padding: 20px;
    box-shadow: var(--bz-games-shadow-sm);
}
.bz-games-card h2 { margin-top: 0; }
.bz-games-card h3 { color: var(--bz-games-accent); margin-bottom: 6px; }
.bz-games-card ul { padding-left: 1.1em; color: var(--bz-games-text-dim); }
.bz-games-card li { margin: 6px 0; }
.bz-games-card p { color: var(--bz-games-text-dim); }
.bz-games-card a { color: var(--bz-games-accent); }
.bz-games-card code {
    background: rgba(255,255,255,0.07);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.bz-games-side-card { padding: 16px; }
.bz-games-side-card h2 { margin-top: 0; font-size: 1.05rem; }
.bz-games-side-card p { margin: 6px 0; color: var(--bz-games-text-dim); }
.bz-games-side-card a { color: var(--bz-games-accent); }

/* Hub grid */
.bz-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 12px;
}
.bz-games-tile {
    background: var(--bz-games-surface-2);
    border: 1px solid var(--bz-games-border);
    border-radius: var(--bz-games-radius);
    overflow: hidden;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.bz-games-tile:hover { transform: translateY(-2px); border-color: var(--bz-games-accent); }
.bz-games-tile-link {
    display: block;
    color: var(--bz-games-text);
    text-decoration: none;
    height: 100%;
}
.bz-games-tile-art {
    height: 110px;
    background: linear-gradient(135deg, #233466 0%, #3a256b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--bz-games-accent-2);
    text-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.bz-games-tile-body { padding: 12px 14px 14px; }
.bz-games-tile-cat {
    display: inline-block;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bz-games-accent);
    margin-bottom: 6px;
}
.bz-games-tile h3 { margin: 0 0 4px; font-size: 1.05rem; }
.bz-games-tile-body p { color: var(--bz-games-text-dim); font-size: 0.88rem; margin: 0 0 8px; }
.bz-games-tile-score {
    display: block;
    font-size: 0.78rem;
    color: var(--bz-games-accent-2);
}

/* Ad wrappers */
.bz-games-ad {
    display: flex;
    justify-content: center;
    background: rgba(255,255,255,0.03);
    border: 1px dashed var(--bz-games-border);
    border-radius: var(--bz-games-radius);
    padding: 10px;
    margin: 8px 0;
    min-height: 100px;
}
.bz-games-ad-top, .bz-games-ad-footer { margin: 16px 0; }
.bz-games-ad-inline { margin: 4px 0; }
.bz-games-adbox { width: 100%; max-width: 100%; }

/* Stage card (the playing area) */
.bz-games-stage-card { padding: 18px; }
.bz-games-stage-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 14px;
}
.bz-games-stage-head h2 { margin: 0; font-size: 1.15rem; }
.bz-games-stage-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.bz-games-stat {
    background: var(--bz-games-surface-2);
    border: 1px solid var(--bz-games-border);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.85rem;
    color: var(--bz-games-text-dim);
}
.bz-games-stat strong { color: var(--bz-games-text); margin-left: 4px; }
.bz-games-stage {
    position: relative;
    background: var(--bz-games-bg-soft);
    border: 1px solid var(--bz-games-border);
    border-radius: var(--bz-games-radius);
    padding: 14px;
    min-height: 320px;
    /* overflow hidden would clip absolutely-positioned overlays, but we do
       need to make sure nothing leaks sideways on small screens. */
    overflow: hidden;
    max-width: 100%;
}
/* Every in-stage game should shrink to fit narrow screens. Individual games
   still set their own max-width for aesthetics but this stops any stray
   element from forcing horizontal scroll on phones. */
.bz-games-stage > * { max-width: 100%; }
.bz-games-fineprint {
    color: var(--bz-games-text-dim);
    font-size: 0.8rem;
    margin: 8px 2px 0;
}
.bz-games-noscript { color: var(--bz-games-bad); }

.bz-games-related { list-style: disc; }
.bz-games-related li { color: var(--bz-games-text-dim); }
.bz-games-related a { color: var(--bz-games-text); text-decoration: none; }
.bz-games-related a:hover { text-decoration: underline; }

/* Shared in-game controls */
.bz-g-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0 6px;
}
.bz-g-controls label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--bz-games-text-dim);
}
.bz-g-controls select,
.bz-g-controls input[type="range"] {
    background: var(--bz-games-surface-2);
    color: var(--bz-games-text);
    border: 1px solid var(--bz-games-border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.85rem;
}
.bz-g-btn {
    background: var(--bz-games-accent);
    color: #0b1330;
    border: 0;
    border-radius: 8px;
    padding: 8px 14px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.bz-g-btn:hover { filter: brightness(1.05); }
.bz-g-btn-alt {
    background: transparent;
    color: var(--bz-games-text);
    border: 1px solid var(--bz-games-border);
}
.bz-g-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(7, 12, 30, 0.78);
    text-align: center;
    padding: 24px;
    backdrop-filter: blur(2px);
    z-index: 2;
}
.bz-g-overlay h3 { margin: 0; font-size: 1.4rem; }
.bz-g-overlay p { margin: 0; color: var(--bz-games-text-dim); max-width: 36ch; }
.bz-g-hidden { display: none !important; }

/* ==== Crumble Clicker ==== */
.bz-g-cl-wrap { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 700px) { .bz-g-cl-wrap { grid-template-columns: 1fr 260px; } }
.bz-g-cl-click {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.bz-g-cl-target {
    width: 220px; height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffe7a0 0%, #e29a3a 45%, #744612 100%);
    border: 6px solid #3c2106;
    box-shadow: inset -15px -20px 40px rgba(0,0,0,0.45), 0 10px 25px rgba(0,0,0,0.45);
    cursor: pointer;
    position: relative;
    transition: transform 0.08s ease;
    user-select: none;
}
.bz-g-cl-target:active { transform: scale(0.96); }
.bz-g-cl-target::before,
.bz-g-cl-target::after {
    content: "";
    position: absolute;
    background: #3c2106;
    border-radius: 50%;
}
.bz-g-cl-target::before { width: 18px; height: 18px; top: 30%; left: 35%; box-shadow: 50px 10px 0 #3c2106, 20px 60px 0 #3c2106, 80px 60px 0 #3c2106, 30px 100px 0 #3c2106; }
.bz-g-cl-target::after  { width: 10px; height: 10px; top: 20%; left: 70%; box-shadow: 10px 80px 0 #3c2106, 50px 120px 0 #3c2106; }
.bz-g-cl-score { font-size: 1.4rem; font-weight: 700; color: var(--bz-games-accent-2); }
.bz-g-cl-rate { color: var(--bz-games-text-dim); font-size: 0.9rem; }
.bz-g-cl-shop { display: flex; flex-direction: column; gap: 8px; }
.bz-g-cl-shop h3 { margin: 0 0 6px; font-size: 1rem; }
.bz-g-cl-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: var(--bz-games-surface-2);
    border: 1px solid var(--bz-games-border);
    border-radius: var(--bz-games-radius-sm);
    padding: 8px 10px;
}
.bz-g-cl-item button { font-size: 0.85rem; padding: 5px 10px; }
.bz-g-cl-item button:disabled { opacity: 0.5; cursor: not-allowed; }
.bz-g-cl-item-name { font-weight: 600; }
.bz-g-cl-item-meta { color: var(--bz-games-text-dim); font-size: 0.8rem; }
.bz-g-cl-float {
    position: absolute;
    pointer-events: none;
    font-weight: 700;
    color: var(--bz-games-accent-2);
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
    animation: bz-g-cl-float-up 0.9s ease-out forwards;
}
@keyframes bz-g-cl-float-up {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-48px); opacity: 0; }
}

/* ==== Tile Fusion 2048 ==== */
.bz-g-tf-board {
    background: var(--bz-games-surface-2);
    border-radius: var(--bz-games-radius-sm);
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 480px;
    margin: 0 auto;
    aspect-ratio: 1/1;
    touch-action: none;
}
.bz-g-tf-cell {
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: clamp(1rem, 4vw, 1.8rem);
    color: #fffbe7;
    transition: background 0.1s ease;
}
.bz-g-tf-cell[data-v="2"]    { background: #eee4da; color: #776e65; }
.bz-g-tf-cell[data-v="4"]    { background: #ede0c8; color: #776e65; }
.bz-g-tf-cell[data-v="8"]    { background: #f2b179; color: #fff; }
.bz-g-tf-cell[data-v="16"]   { background: #f59563; color: #fff; }
.bz-g-tf-cell[data-v="32"]   { background: #f67c5f; color: #fff; }
.bz-g-tf-cell[data-v="64"]   { background: #f65e3b; color: #fff; }
.bz-g-tf-cell[data-v="128"]  { background: #edcf72; color: #fff; }
.bz-g-tf-cell[data-v="256"]  { background: #edcc61; color: #fff; }
.bz-g-tf-cell[data-v="512"]  { background: #edc850; color: #fff; }
.bz-g-tf-cell[data-v="1024"] { background: #edc53f; color: #fff; font-size: clamp(0.9rem, 3.5vw, 1.5rem); }
.bz-g-tf-cell[data-v="2048"] { background: #edc22e; color: #fff; font-size: clamp(0.9rem, 3.5vw, 1.5rem); }

/* ==== Pixel Serpent ==== */
.bz-g-snake-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.bz-g-snake-canvas {
    background: #05081a;
    border: 2px solid var(--bz-games-border);
    border-radius: var(--bz-games-radius-sm);
    width: 100%;
    max-width: 480px;
    image-rendering: pixelated;
    touch-action: none;
}

/* On-screen D-pad (primarily for touch, also usable with mouse / keyboard). */
.bz-g-dpad {
    display: grid;
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(2, 56px);
    gap: 8px;
    margin-top: 8px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.bz-g-dpad-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    line-height: 1;
    background: var(--bz-games-surface-2);
    color: var(--bz-games-text);
    border: 1px solid var(--bz-games-border);
    border-radius: 12px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.bz-g-dpad-btn:active {
    background: var(--bz-games-accent);
    color: #0b1330;
    transform: scale(0.96);
}
.bz-g-dpad-up    { grid-column: 2; grid-row: 1; }
.bz-g-dpad-left  { grid-column: 1; grid-row: 2; }
.bz-g-dpad-down  { grid-column: 2; grid-row: 2; }
.bz-g-dpad-right { grid-column: 3; grid-row: 2; }

@media (max-width: 380px) {
    .bz-g-dpad {
        grid-template-columns: repeat(3, 48px);
        grid-template-rows: repeat(2, 48px);
        gap: 6px;
    }
    .bz-g-dpad-btn { font-size: 1.15rem; border-radius: 10px; }
}

/* ==== Tap-a-Critter ==== */
.bz-g-critter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 420px;
    margin: 0 auto;
}
.bz-g-critter-hole {
    aspect-ratio: 1/1;
    background: radial-gradient(circle at 50% 60%, #1a2040 0%, #0b0f24 70%);
    border: 2px solid var(--bz-games-border);
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.1s ease;
    user-select: none;
}
.bz-g-critter-hole:active { transform: scale(0.95); }
.bz-g-critter {
    position: absolute;
    bottom: -60%;
    left: 50%;
    transform: translateX(-50%);
    width: 75%;
    aspect-ratio: 1/1;
    background: radial-gradient(circle at 50% 40%, #b98652 0%, #7a4b22 80%);
    border-radius: 50% 50% 45% 45%;
    transition: bottom 0.2s ease;
    pointer-events: none;
}
.bz-g-critter::before,
.bz-g-critter::after {
    content: ""; position: absolute;
    width: 14%; height: 14%;
    background: #0f172a; border-radius: 50%;
    top: 32%;
}
.bz-g-critter::before { left: 28%; }
.bz-g-critter::after  { right: 28%; }
.bz-g-critter-hole.up .bz-g-critter { bottom: 5%; }
.bz-g-critter-hole.hit .bz-g-critter {
    background: radial-gradient(circle at 50% 40%, #4ade80 0%, #166534 80%);
}

/* ==== Three in a row ==== */
.bz-g-ttt-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-width: 360px;
    margin: 0 auto;
    background: var(--bz-games-surface-2);
    padding: 6px;
    border-radius: var(--bz-games-radius-sm);
}
.bz-g-ttt-cell {
    aspect-ratio: 1/1;
    background: var(--bz-games-bg-soft);
    border: 0;
    border-radius: 8px;
    color: var(--bz-games-text);
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 700;
    cursor: pointer;
    transition: background 0.1s ease;
}
.bz-g-ttt-cell:hover:not(:disabled) { background: var(--bz-games-surface); }
.bz-g-ttt-cell[data-mark="X"] { color: var(--bz-games-accent); }
.bz-g-ttt-cell[data-mark="O"] { color: var(--bz-games-accent-2); }
.bz-g-ttt-cell[data-win="1"] { background: rgba(74, 222, 128, 0.18); }

/* ==== Hand Duel (RPS) ==== */
.bz-g-rps-arena {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    text-align: center;
    margin: 8px 0;
}
.bz-g-rps-side { background: var(--bz-games-surface-2); border-radius: var(--bz-games-radius-sm); padding: 14px; }
.bz-g-rps-side .bz-g-rps-throw { font-size: 3rem; margin: 6px 0; }
.bz-g-rps-side h3 { margin: 0; color: var(--bz-games-accent); font-size: 0.9rem; letter-spacing: 0.1em; text-transform: uppercase; }
.bz-g-rps-picks { display: flex; justify-content: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.bz-g-rps-pick {
    background: var(--bz-games-surface-2);
    border: 2px solid var(--bz-games-border);
    border-radius: 14px;
    padding: 10px 16px;
    font-size: 1.8rem;
    cursor: pointer;
    transition: border-color 0.1s ease, transform 0.1s ease;
}
.bz-g-rps-pick:hover { border-color: var(--bz-games-accent); transform: translateY(-2px); }
.bz-g-rps-log { min-height: 24px; margin-top: 8px; text-align: center; color: var(--bz-games-text-dim); }

/* ==== Match Pairs (Memory) ==== */
.bz-g-mem-board {
    display: grid;
    gap: 8px;
    max-width: 480px;
    margin: 0 auto;
    touch-action: manipulation;
}
.bz-g-mem-board[data-size="4"] { grid-template-columns: repeat(4, 1fr); }
.bz-g-mem-board[data-size="6"] { grid-template-columns: repeat(6, 1fr); max-width: 560px; }
.bz-g-mem-card {
    aspect-ratio: 3/4;
    background: var(--bz-games-surface-2);
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    perspective: 600px;
    border: 0;
    padding: 0;
}
.bz-g-mem-inner {
    position: absolute; inset: 0;
    transform-style: preserve-3d;
    transition: transform 0.4s ease;
    border-radius: 8px;
}
.bz-g-mem-card.flipped .bz-g-mem-inner,
.bz-g-mem-card.matched .bz-g-mem-inner { transform: rotateY(180deg); }
.bz-g-mem-face {
    position: absolute; inset: 0;
    backface-visibility: hidden;
    display: flex; align-items: center; justify-content: center;
    font-size: clamp(1.4rem, 5vw, 2rem);
    border-radius: 8px;
}
.bz-g-mem-back {
    background: linear-gradient(135deg, #2a3a72, #3a256b);
    color: var(--bz-games-accent-2);
}
.bz-g-mem-front {
    background: #0f172a;
    color: var(--bz-games-accent-2);
    transform: rotateY(180deg);
}
.bz-g-mem-card.matched .bz-g-mem-front { background: #10351e; color: var(--bz-games-good); }

/* ==== Slide 15 ==== */
.bz-g-slide-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    max-width: 360px;
    margin: 0 auto;
    background: var(--bz-games-surface-2);
    padding: 6px;
    border-radius: var(--bz-games-radius-sm);
}
.bz-g-slide-tile {
    aspect-ratio: 1/1;
    background: linear-gradient(135deg, #3a4b8c, #27306a);
    border: 0;
    border-radius: 8px;
    color: var(--bz-games-text);
    font-size: clamp(1.1rem, 5vw, 1.7rem);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.08s ease;
}
.bz-g-slide-tile:hover { transform: scale(1.03); }
.bz-g-slide-tile[data-empty="1"] { background: transparent; cursor: default; pointer-events: none; }

/* Mobile tweaks */
@media (max-width: 520px) {
    .bz-games-hero { padding: 20px 18px 22px; }
    .bz-g-cl-target { width: 180px; height: 180px; }
}


/* Phase 2 ? featured ribbon + embedded game surfaces */
.bz-games-ribbon {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 6px;
    border-radius: 999px;
    background: #f59e0b;
    color: #111827;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.bz-games-tile-featured { box-shadow: 0 0 0 2px #f59e0b inset, 0 6px 20px rgba(245, 158, 11, 0.18); }
.bz-games-stage[data-bz-embed="1"] {
    padding: 0;
    background: transparent;
    min-height: 0;
}
.bz-games-stage[data-bz-embed="1"] .bz-games-noscript { padding: 16px; }

/* ==== Phase 2 games ==== */

/* Flag Sweeper */
.bz-fs-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; margin-bottom: 10px; }
.bz-fs-diff {
    background: var(--bz-games-surface-2);
    color: var(--bz-games-text);
    border: 1px solid var(--bz-games-border);
    border-radius: 6px;
    padding: 6px 10px;
}
.bz-fs-stat { font-weight: 600; padding: 4px 10px; background: var(--bz-games-surface-2); border-radius: 6px; }
.bz-fs-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 9), minmax(0, 1fr));
    gap: 2px;
    background: var(--bz-games-surface-2);
    padding: 4px;
    border-radius: var(--bz-games-radius-sm);
    touch-action: manipulation;
    margin: 0 auto;
    max-width: min(100%, calc(var(--cols, 9) * 34px + 10px));
    width: 100%;
}
.bz-fs-cell {
    aspect-ratio: 1/1;
    width: 100%;
    height: auto;
    background: linear-gradient(135deg, #3a4b8c, #27306a);
    color: var(--bz-games-text);
    border: 0;
    border-radius: 4px;
    font-weight: 700;
    font-size: clamp(0.7rem, 2.8vw, 0.95rem);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.bz-fs-cell:hover { filter: brightness(1.1); }
.bz-fs-cell.bz-fs-rev { background: #0f172a; cursor: default; }
.bz-fs-cell.bz-fs-flag { background: linear-gradient(135deg, #b45309, #7c2d12); }
.bz-fs-cell.bz-fs-mine { background: #7f1d1d; color: #fecaca; }
.bz-fs-cell.bz-fs-n1 { color: #93c5fd; }
.bz-fs-cell.bz-fs-n2 { color: #86efac; }
.bz-fs-cell.bz-fs-n3 { color: #fca5a5; }
.bz-fs-cell.bz-fs-n4 { color: #c4b5fd; }
.bz-fs-cell.bz-fs-n5 { color: #fcd34d; }
.bz-fs-cell.bz-fs-n6 { color: #67e8f9; }
.bz-fs-cell.bz-fs-n7 { color: #f9a8d4; }
.bz-fs-cell.bz-fs-n8 { color: #e5e7eb; }
.bz-fs-msg { min-height: 22px; margin: 10px 0 0; color: var(--bz-games-text-dim); text-align: center; }

/* Block Fall */
.bz-bf-wrap { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.bz-bf-canvas {
    background: #0b1226;
    border: 2px solid var(--bz-games-border);
    border-radius: var(--bz-games-radius-sm);
    max-width: 100%;
    height: auto;
    display: block;
    touch-action: none;
}
.bz-bf-side { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
.bz-bf-help { font-size: 0.85rem; color: var(--bz-games-text-dim); text-align: center; }
.bz-bf-msg { min-height: 22px; margin: 0; color: var(--bz-games-text-dim); text-align: center; }

/* On-screen control pad for Block Fall: rotate / left / soft-drop / right / hard-drop. */
.bz-bf-pad {
    display: grid;
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(3, 56px);
    gap: 8px;
    margin-top: 8px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.bz-bf-pad-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
    background: var(--bz-games-surface-2);
    color: var(--bz-games-text);
    border: 1px solid var(--bz-games-border);
    border-radius: 12px;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.bz-bf-pad-btn:active {
    background: var(--bz-games-accent);
    color: #0b1330;
    transform: scale(0.96);
}
.bz-bf-pad-rot   { grid-column: 2; grid-row: 1; }
.bz-bf-pad-left  { grid-column: 1; grid-row: 2; }
.bz-bf-pad-down  { grid-column: 2; grid-row: 2; }
.bz-bf-pad-right { grid-column: 3; grid-row: 2; }
.bz-bf-pad-drop  { grid-column: 1 / span 3; grid-row: 3; font-size: 1rem; letter-spacing: 0.05em; }
@media (max-width: 380px) {
    .bz-bf-pad {
        grid-template-columns: repeat(3, 48px);
        grid-template-rows: repeat(3, 48px);
        gap: 6px;
    }
    .bz-bf-pad-btn { font-size: 1.05rem; border-radius: 10px; }
}

/* Four in a Line (Connect-4-style) */
.bz-c4-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; margin-bottom: 10px; }
.bz-c4-board {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    background: #1e3a8a;
    padding: 8px;
    border-radius: var(--bz-games-radius-sm);
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
}
.bz-c4-cell {
    aspect-ratio: 1/1;
    background: #0f172a;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: transform 0.05s ease;
}
.bz-c4-cell:hover { transform: scale(1.04); }
.bz-c4-cell.bz-c4-p { background: radial-gradient(circle at 30% 30%, #fca5a5, #dc2626); }
.bz-c4-cell.bz-c4-a { background: radial-gradient(circle at 30% 30%, #fcd34d, #b45309); }
.bz-c4-cell.bz-c4-win { outline: 3px solid #22d3ee; }
.bz-c4-msg { min-height: 22px; margin: 10px 0 0; color: var(--bz-games-text-dim); text-align: center; }

/* Fleet Hunter */
.bz-fh-wrap { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.bz-fh-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }

/* Placement tray */
.bz-fh-tray {
    display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; justify-content: center;
    padding: 8px; background: var(--bz-games-surface-2);
    border-radius: var(--bz-games-radius-sm);
    max-width: 760px; width: 100%;
    touch-action: none; /* allow pointer-drag without browser scroll hijack */
}
.bz-fh-tray-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 8px 12px; background: var(--bz-games-surface);
    border: 2px solid transparent; border-radius: 8px;
    cursor: grab; font-size: 0.72rem; color: var(--bz-games-text);
    transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
    user-select: none; -webkit-user-select: none;
    touch-action: none;
    min-height: 52px; /* comfortable tap target on phones */
}
.bz-fh-tray-item:hover { border-color: var(--bz-games-accent); }
.bz-fh-tray-item:active { cursor: grabbing; transform: translateY(1px); }
.bz-fh-tray-item.bz-fh-selected {
    border-color: #38bdf8;
    background: rgba(56,189,248,0.16);
    box-shadow: 0 0 0 3px rgba(56,189,248,0.25), 0 6px 16px rgba(2,132,199,0.25);
}
.bz-fh-tray-item.bz-fh-placed { opacity: 0.28; cursor: default; }
.bz-fh-tray-item.bz-fh-placed:hover { border-color: transparent; }
.bz-fh-tray-item.bz-fh-dragging { opacity: 0.5; }
.bz-fh-tray-art {
    height: 22px; display: flex; align-items: center; justify-content: center;
    pointer-events: none;
    transition: width 0.15s ease, height 0.15s ease;
}
.bz-fh-tray-art.bz-fh-tray-art-vert { height: auto; }
.bz-fh-tray-art svg { width: 100%; height: 100%; display: block; }
.bz-fh-tray-label { white-space: nowrap; letter-spacing: 0.02em; }

/* ---------- Placement HUD (mobile-friendly controls) ---------- */
.bz-fh-hud {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 760px;
    padding: 8px 10px;
    border: 1px solid var(--bz-games-border);
    background: linear-gradient(180deg, var(--bz-games-surface-2), var(--bz-games-surface));
    border-radius: 10px;
    box-shadow: var(--bz-games-shadow-sm);
    box-sizing: border-box;
}
.bz-fh-hud-btn {
    flex: 0 0 auto;
    min-width: 44px; min-height: 44px; /* 44px touch target */
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--bz-games-border);
    background: var(--bz-games-surface);
    color: var(--bz-games-text);
    font-size: 1.1rem; line-height: 1;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    transition: background 0.15s, border-color 0.15s, transform 0.08s, box-shadow 0.15s;
}
.bz-fh-hud-btn:hover:not(:disabled) { border-color: var(--bz-games-accent); }
.bz-fh-hud-btn:active:not(:disabled) { transform: translateY(1px); }
.bz-fh-hud-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.bz-fh-hud-rotate {
    background: linear-gradient(180deg, #38bdf8, #0ea5e9);
    border-color: #0284c7;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 0 0 3px rgba(56,189,248,0.18), 0 6px 14px rgba(2,132,199,0.35);
    padding: 6px 14px;
}
.bz-fh-hud-rotate:hover:not(:disabled) {
    background: linear-gradient(180deg, #7dd3fc, #0284c7);
    border-color: #075985;
}
.bz-fh-hud-rotate span[aria-hidden] {
    display: inline-block;
    font-size: 1.35rem;
    line-height: 1;
    transform: translateY(-1px);
}
.bz-fh-hud-btn-label { font-size: 0.85rem; letter-spacing: 0.02em; }
.bz-fh-hud-preview {
    flex: 1 1 auto;
    min-width: 0;
    display: flex; align-items: center; gap: 10px;
    padding: 4px 8px;
    background: var(--bz-games-surface-3, rgba(15,23,42,0.35));
    border-radius: 8px;
    min-height: 44px;
}
.bz-fh-hud-art {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    min-width: 32px; min-height: 18px;
}
.bz-fh-hud-art-inner { display: flex; align-items: center; justify-content: center; }
.bz-fh-hud-art-inner svg { display: block; width: 100%; height: 100%; }
.bz-fh-hud-meta {
    display: flex; flex-direction: column; min-width: 0; line-height: 1.15;
}
.bz-fh-hud-name {
    font-weight: 600; font-size: 0.9rem;
    color: var(--bz-games-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bz-fh-hud-orient { font-size: 0.72rem; color: var(--bz-games-text-dim); letter-spacing: 0.04em; text-transform: uppercase; }
.bz-fh-hud-empty .bz-fh-hud-art { display: none; }
.bz-fh-hud-done { opacity: 0.8; }
.bz-fh-hud-done .bz-fh-hud-preview { background: rgba(34,197,94,0.12); }
.bz-fh-hud-done .bz-fh-hud-name { color: #34d399; }

/* Placed ships become interactive during the placement phase so the
   player can pick one up (without resetting the whole fleet). */
.bz-fh-ship.bz-fh-pickable {
    pointer-events: auto;
    cursor: pointer;
}
.bz-fh-ship.bz-fh-pickable:hover {
    filter: drop-shadow(0 0 6px rgba(56,189,248,0.9)) drop-shadow(0 1px 1px rgba(0,0,0,0.35));
}
.bz-fh-ship.bz-fh-pickable:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Boards — friendly (green) and enemy (red) joined side-by-side */
.bz-fh-boards {
    display: flex; flex-wrap: wrap; gap: 0;
    justify-content: center; align-items: flex-start;
}
.bz-fh-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 0 0 auto; }
.bz-fh-col h3 { margin: 0; font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; }
.bz-fh-col-friendly h3 { color: #166534; }
.bz-fh-col-enemy h3 { color: #991b1b; }

.bz-fh-board {
    position: relative;
    width: min(340px, 44vw);
    aspect-ratio: 1 / 1;
    padding: 4px;
    box-sizing: border-box;
    border-radius: var(--bz-games-radius-sm);
}
.bz-fh-col-friendly .bz-fh-board {
    background: #bfe6c1; /* light green water */
    border: 2px solid #4d9458;
    border-top-right-radius: 0; border-bottom-right-radius: 0;
    border-right-width: 1px;
}
.bz-fh-col-enemy .bz-fh-board {
    background: #f3c7c7; /* light red water */
    border: 2px solid #c85251;
    border-top-left-radius: 0; border-bottom-left-radius: 0;
    border-left-width: 1px;
}

.bz-fh-cells,
.bz-fh-ships-layer,
.bz-fh-markers-layer,
.bz-fh-preview-layer {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 2px;
}
.bz-fh-cells { height: 100%; }
.bz-fh-ships-layer,
.bz-fh-markers-layer,
.bz-fh-preview-layer {
    position: absolute; inset: 4px;
    pointer-events: none;
}
.bz-fh-ships-layer { z-index: 2; }
.bz-fh-markers-layer { z-index: 3; }
.bz-fh-preview-layer { z-index: 4; }

.bz-fh-cell {
    border: 0; padding: 0;
    background: rgba(255,255,255,0.48);
    border-radius: 2px;
    cursor: pointer;
    color: transparent;
    transition: background 0.12s;
}
.bz-fh-col-enemy .bz-fh-cell { background: rgba(255,255,255,0.55); }
.bz-fh-cell:hover:not(:disabled) { background: rgba(255,255,255,0.88); }
.bz-fh-cell:disabled { cursor: default; }

/* Ship sprites in the overlay grid */
.bz-fh-ship {
    position: relative;
    display: block;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.35));
    transform-origin: 50% 50%;
    pointer-events: none;
}
.bz-fh-ship-svg { display: block; width: 100%; height: 100%; }

/* Placement ghost */
.bz-fh-preview.bz-fh-valid {
    opacity: 0.55;
    filter: drop-shadow(0 0 6px rgba(34,197,94,0.9));
}
.bz-fh-preview.bz-fh-invalid {
    opacity: 0.45;
    filter: drop-shadow(0 0 8px rgba(239,68,68,0.95));
}
.bz-fh-preview.bz-fh-invalid .bz-fh-ship-svg { filter: saturate(0.4) hue-rotate(320deg); }

/* Per-cell hit slots for fire animation */
.bz-fh-hit-slot { position: absolute; pointer-events: none; }
.bz-fh-hit-slot.bz-fh-on-fire {
    background: radial-gradient(circle at 50% 60%, rgba(254,215,170,0.35) 0%, rgba(0,0,0,0) 70%);
    border-radius: 40%;
}
.bz-fh-hit-slot.bz-fh-on-fire::before,
.bz-fh-hit-slot.bz-fh-on-fire::after {
    content: ""; position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%); border-radius: 50%;
    filter: blur(1px);
    pointer-events: none;
}
.bz-fh-hit-slot.bz-fh-on-fire::before {
    width: 72%; height: 72%;
    background: radial-gradient(circle at 50% 60%, #fff4b8 0%, #fde047 28%, #f97316 55%, #7f1d1d 92%);
    animation: bz-fh-flicker 0.45s infinite alternate;
}
.bz-fh-hit-slot.bz-fh-on-fire::after {
    width: 38%; height: 38%;
    background: radial-gradient(circle at 50% 55%, #ffffff 0%, #fde047 45%, rgba(249,115,22,0) 85%);
    animation: bz-fh-flicker 0.32s infinite alternate-reverse;
}
@keyframes bz-fh-flicker {
    0%   { transform: translate(-50%, -50%) scale(0.82); opacity: 0.85; }
    50%  { transform: translate(-52%, -58%) scale(1.08); opacity: 1; }
    100% { transform: translate(-48%, -46%) scale(0.92); opacity: 0.88; }
}

/* Sinking animations — surface ship tilts & slides, submarine dives nose-down */
.bz-fh-ship.bz-fh-sinking { animation: bz-fh-sink 1.4s ease-in forwards; }
.bz-fh-ship.bz-fh-sinking.bz-fh-ship-submarine { animation: bz-fh-sink-sub 1.4s ease-in forwards; }
@keyframes bz-fh-sink {
    0%   { transform: rotate(0deg) translateY(0); opacity: 1; }
    40%  { transform: rotate(-12deg) translateY(4%); opacity: 0.95; }
    100% { transform: rotate(-28deg) translateY(30%); opacity: 0; }
}
@keyframes bz-fh-sink-sub {
    0%   { transform: rotate(0deg) translateY(0) scale(1); opacity: 1; filter: none; }
    40%  { transform: rotate(22deg) translateY(8%) scale(0.98); opacity: 0.9; filter: blur(0.3px); }
    100% { transform: rotate(40deg) translateY(55%) scale(0.88); opacity: 0; filter: blur(1.2px); }
}

/* Shot markers */
.bz-fh-marker {
    align-self: center; justify-self: center;
    width: 55%; height: 55%;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0,0,0,0.45);
}
/* Enemy miss on your friendly water — red (enemy colour). */
.bz-fh-m-miss-enemy { background: #dc2626; border: 1px solid #7f1d1d; }
/* Your miss on enemy water — green (your friendly colour). */
.bz-fh-m-miss-friendly { background: #16a34a; border: 1px solid #14532d; }
/* Hit crosshair shown on enemy water until the ship is revealed. */
.bz-fh-m-hit-pending {
    background: transparent; border: 2px solid #b91c1c;
    width: 52%; height: 52%; position: relative;
    box-shadow: 0 0 4px rgba(185,28,28,0.7);
}
.bz-fh-m-hit-pending::before,
.bz-fh-m-hit-pending::after {
    content: ""; position: absolute; left: 12%; right: 12%; top: 45%; height: 10%;
    background: #dc2626; border-radius: 2px;
}
.bz-fh-m-hit-pending::after { transform: rotate(90deg); }

/* Ship list + message */
.bz-fh-shiplist { list-style: none; padding: 0; margin: 0; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; font-size: 0.8rem; }
.bz-fh-shiplist li { padding: 4px 8px; background: var(--bz-games-surface-2); border-radius: 6px; }
.bz-fh-shiplist li.bz-fh-s-sunk { background: #450a0a; color: #fca5a5; text-decoration: line-through; }
.bz-fh-msg { min-height: 22px; margin: 0; color: var(--bz-games-text-dim); text-align: center; }

/* End-of-match overlay (victory / defeat / stalemate) */
.bz-fh-wrap { position: relative; }
.bz-fh-end {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(3, 7, 18, 0.78);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 40;
    border-radius: 12px;
    padding: 18px;
    animation: bz-fh-end-fade 260ms ease-out;
}
@keyframes bz-fh-end-fade { from { opacity: 0; } to { opacity: 1; } }
.bz-fh-end[hidden] { display: none; }
.bz-fh-end-card {
    max-width: 520px;
    width: 100%;
    padding: 28px 26px 22px;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.08) inset;
    transform: scale(0.85);
    animation: bz-fh-end-pop 420ms cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
    outline: none;
    color: #f8fafc;
}
@keyframes bz-fh-end-pop {
    0% { transform: scale(0.7); opacity: 0; }
    60% { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.bz-fh-end-icon {
    font-size: 3.6rem;
    line-height: 1;
    margin-bottom: 6px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
    animation: bz-fh-end-icon 1.4s ease-in-out infinite alternate;
}
@keyframes bz-fh-end-icon {
    from { transform: translateY(0) scale(1); }
    to { transform: translateY(-6px) scale(1.08); }
}
.bz-fh-end-title {
    font-size: clamp(2rem, 6vw, 3.1rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 4px 0 2px;
    text-shadow: 0 4px 20px rgba(0,0,0,0.6);
}
.bz-fh-end-sub {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 14px;
}
.bz-fh-end-stats {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
}
.bz-fh-end-stats li {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.bz-fh-end-stats b {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.7;
}
.bz-fh-end-stats span {
    font-size: 1.25rem;
    font-weight: 700;
}
.bz-fh-end-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.bz-fh-end-actions .bz-games-btn { min-width: 140px; }

/* Victory theme — green/gold, sparkle pulse */
.bz-fh-end-win .bz-fh-end-card {
    background: linear-gradient(160deg, #064e3b 0%, #166534 55%, #14532d 100%);
    box-shadow: 0 30px 60px rgba(0,0,0,0.6), 0 0 0 2px rgba(250, 204, 21, 0.55) inset, 0 0 60px rgba(34, 197, 94, 0.35);
}
.bz-fh-end-win .bz-fh-end-title { color: #fde68a; text-shadow: 0 0 18px rgba(250, 204, 21, 0.55), 0 4px 20px rgba(0,0,0,0.6); animation: bz-fh-end-glow 1.6s ease-in-out infinite alternate; }
@keyframes bz-fh-end-glow {
    from { text-shadow: 0 0 12px rgba(250, 204, 21, 0.4), 0 4px 20px rgba(0,0,0,0.6); }
    to { text-shadow: 0 0 30px rgba(250, 204, 21, 0.9), 0 4px 20px rgba(0,0,0,0.6); }
}
.bz-fh-end-win .bz-fh-end-icon { color: #fde68a; }

/* Defeat theme — red, shake */
.bz-fh-end-lose .bz-fh-end-card {
    background: linear-gradient(160deg, #450a0a 0%, #7f1d1d 55%, #450a0a 100%);
    box-shadow: 0 30px 60px rgba(0,0,0,0.6), 0 0 0 2px rgba(239, 68, 68, 0.55) inset, 0 0 60px rgba(239, 68, 68, 0.35);
    animation: bz-fh-end-pop 420ms cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards, bz-fh-end-shake 520ms ease-in-out 420ms;
}
@keyframes bz-fh-end-shake {
    0%, 100% { transform: translateX(0) scale(1); }
    20% { transform: translateX(-8px) scale(1); }
    40% { transform: translateX(8px) scale(1); }
    60% { transform: translateX(-5px) scale(1); }
    80% { transform: translateX(5px) scale(1); }
}
.bz-fh-end-lose .bz-fh-end-title { color: #fecaca; text-shadow: 0 0 18px rgba(239, 68, 68, 0.6), 0 4px 20px rgba(0,0,0,0.6); }
.bz-fh-end-lose .bz-fh-end-icon { color: #fca5a5; }

/* Stalemate theme — slate */
.bz-fh-end-draw .bz-fh-end-card {
    background: linear-gradient(160deg, #1e293b 0%, #334155 55%, #1e293b 100%);
    box-shadow: 0 30px 60px rgba(0,0,0,0.6), 0 0 0 2px rgba(148, 163, 184, 0.45) inset;
}
.bz-fh-end-draw .bz-fh-end-title { color: #e2e8f0; }

@media (max-width: 520px) {
    .bz-fh-end-card { padding: 22px 18px 16px; }
    .bz-fh-end-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
    .bz-fh-end, .bz-fh-end-card, .bz-fh-end-icon, .bz-fh-end-title { animation: none !important; }
    .bz-fh-end-card { transform: none; opacity: 1; }
}

/* Spot the One */
.bz-so-wrap { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.bz-so-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.bz-so-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(60px, 1fr));
    gap: 8px;
    max-width: 520px;
    width: 100%;
}
.bz-so-card {
    aspect-ratio: 1/1;
    background: var(--bz-games-surface-2);
    border: 2px solid var(--bz-games-border);
    border-radius: 10px;
    padding: 4px;
    cursor: pointer;
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.15s ease, border-color 0.1s ease;
}
.bz-so-card:hover { border-color: var(--bz-games-accent); }
.bz-so-card.bz-so-faded { opacity: 0.25; }
.bz-so-card.bz-so-hue-red { background: linear-gradient(135deg, #7f1d1d, #450a0a); }
.bz-so-card.bz-so-hue-blue { background: linear-gradient(135deg, #1e3a8a, #0b1226); }
.bz-so-card.bz-so-hue-green { background: linear-gradient(135deg, #14532d, #052e16); }
.bz-so-card.bz-so-hue-yellow { background: linear-gradient(135deg, #78350f, #3f1d04); }
.bz-so-body { position: relative; width: 70%; height: 60%; display: flex; align-items: center; justify-content: center; }
.bz-so-body.bz-so-small .bz-so-shape { transform: scale(0.6); }
.bz-so-shape { width: 36px; height: 36px; background: rgba(255,255,255,0.8); }
.bz-so-shape-circle { border-radius: 50%; }
.bz-so-shape-square { border-radius: 4px; }
.bz-so-shape-triangle {
    background: transparent;
    width: 0; height: 0;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-bottom: 32px solid rgba(255,255,255,0.8);
}
.bz-so-shape-diamond { transform: rotate(45deg); border-radius: 2px; }
.bz-so-hat { position: absolute; top: -2px; left: 50%; transform: translateX(-50%); width: 40%; height: 8px; background: #0f172a; border-radius: 4px 4px 0 0; }
.bz-so-lbl { font-size: 0.7rem; color: rgba(255,255,255,0.7); }
.bz-so-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.bz-so-controls select, .bz-so-controls label {
    background: var(--bz-games-surface-2);
    color: var(--bz-games-text);
    border: 1px solid var(--bz-games-border);
    border-radius: 6px;
    padding: 6px 10px;
}
.bz-so-msg { min-height: 22px; margin: 0; color: var(--bz-games-text-dim); text-align: center; }

/* Paddle Duel */
.bz-pd-wrap { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.bz-pd-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.bz-pd-canvas {
    background: #0f172a;
    border-radius: var(--bz-games-radius-sm);
    max-width: 100%;
    height: auto;
    touch-action: none;
}
.bz-pd-score { font-weight: 700; font-size: 1rem; }
.bz-pd-msg { min-height: 22px; margin: 0; color: var(--bz-games-text-dim); text-align: center; }

/* Word Rescue */
.bz-wr-wrap { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.bz-wr-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.bz-wr-gallows { color: var(--bz-games-accent); }
.bz-wr-svg { width: 120px; height: 140px; }
.bz-wr-word { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.bz-wr-letter {
    min-width: 26px; height: 34px;
    border-bottom: 3px solid var(--bz-games-accent);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.2rem;
}
.bz-wr-letter-miss { color: var(--bz-games-bad, #f87171); }
.bz-wr-kb {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 4px;
    max-width: 480px;
    width: 100%;
}
.bz-wr-key {
    aspect-ratio: 1/1.1;
    background: var(--bz-games-surface-2);
    color: var(--bz-games-text);
    border: 1px solid var(--bz-games-border);
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    min-width: 0;
}
.bz-wr-key:hover:not(:disabled) { border-color: var(--bz-games-accent); }
.bz-wr-key:disabled { opacity: 0.6; cursor: not-allowed; }
.bz-wr-key-hit { background: #14532d; color: #bbf7d0; }
.bz-wr-key-miss { background: #4b1d1d; color: #fca5a5; }
.bz-wr-misses { color: var(--bz-games-text-dim); font-size: 0.9rem; }
.bz-wr-msg { min-height: 22px; margin: 0; color: var(--bz-games-text-dim); text-align: center; }

@media (max-width: 520px) {
    .bz-wr-kb { grid-template-columns: repeat(7, 1fr); }
    /* Word Rescue: keys should still be comfortably tappable. */
    .bz-wr-key { font-size: 0.85rem; }
    /* Fleet Hunter: stack the two boards so each one can use the full
       width. On phones we also want the friendly board (where the
       player is placing) to be as tall as possible, so we collapse the
       tray/hud to compact form and re-flow the boards column-wise. */
    .bz-fh-boards { gap: 14px; flex-direction: column; flex-wrap: nowrap; width: 100%; }
    .bz-fh-col { width: 100%; }
    .bz-fh-board { width: min(420px, 94vw); max-width: 94vw; }
    .bz-fh-col-friendly .bz-fh-board,
    .bz-fh-col-enemy .bz-fh-board {
        border-radius: var(--bz-games-radius-sm);
        border-width: 2px;
    }
    .bz-fh-cell { font-size: 0.6rem; }

    /* Keep the top control row compact — move the Rotate button into
       the HUD so it's always in thumb reach. */
    .bz-fh-top .bz-games-btn { padding: 8px 12px; }
    /* The small top-bar Rotate button is duplicated by the more prominent
       HUD rotate button on phones. Hide it to reduce clutter. */
    .bz-fh-top > .bz-games-btn:nth-of-type(1) { display: none; }

    /* Sticky HUD so it's always visible while placing, even as the
       board is scrolled into view. */
    .bz-fh-hud {
        position: sticky;
        top: 4px;
        z-index: 6;
        padding: 6px 8px;
        gap: 6px;
    }
    .bz-fh-hud-btn { min-width: 40px; min-height: 40px; padding: 4px 8px; font-size: 1rem; }
    .bz-fh-hud-btn-label { display: none; }
    .bz-fh-hud-rotate { padding: 4px 10px; }
    .bz-fh-hud-rotate span[aria-hidden] { font-size: 1.5rem; }
    .bz-fh-hud-name { font-size: 0.85rem; }
    .bz-fh-hud-orient { font-size: 0.65rem; }

    /* Tray: single-row scroll on very narrow screens keeps ships
       accessible without pushing the board off-screen. */
    .bz-fh-tray {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 6px;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
    .bz-fh-tray::-webkit-scrollbar { height: 4px; }
    .bz-fh-tray::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.5); border-radius: 2px; }
    .bz-fh-tray-item {
        flex: 0 0 auto;
        scroll-snap-align: start;
        padding: 6px 10px;
        min-height: 48px;
    }
    .bz-fh-tray-label { font-size: 0.65rem; }
    /* Four-in-a-Line: fill the width on phones. */
    .bz-c4-board { max-width: 100%; }
    /* Paddle Duel canvas is 640x360 native — ensure it scales down gracefully. */
    .bz-pd-canvas { width: 100%; }
    /* Block Fall canvas: keep proportion and keep some breathing room. */
    .bz-bf-canvas { width: 100%; max-width: 300px; }
}

/* ---------------------------------------------------------------------------
   Custom game logos (tile art + hero)
   --------------------------------------------------------------------------- */
.bz-games-tile-art-logo {
    padding: 0;
    overflow: hidden;
    background: #0c1530;
}
.bz-games-tile-art-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.bz-games-tile:hover .bz-games-tile-art-logo img {
    transform: scale(1.04);
}

.bz-games-hero-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}
.bz-games-hero-has-logo .bz-games-hero-copy {
    flex: 1 1 320px;
    min-width: 0;
}
.bz-games-hero-logo {
    flex: 0 0 auto;
    width: 96px;
    height: 96px;
    border-radius: 18px;
    overflow: hidden;
    background: #0c1530;
    box-shadow: var(--bz-games-shadow-sm);
    border: 1px solid var(--bz-games-border);
}
.bz-games-hero-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
@media (max-width: 520px) {
    .bz-games-hero-logo { width: 72px; height: 72px; border-radius: 14px; }
}

/* Doodle Pad styles moved to /free-tools.php (as .ft-doodle-*) when the
   sketch pad was relocated out of the /games/ section. */

/* ---------- Ladder Dash ---------- */
.bz-ld-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(200px, 260px);
    gap: 16px;
    width: 100%;
    max-width: 100%;
    align-items: start;
}
.bz-ld-controls {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
}
.bz-ld-controls label { color: var(--bz-games-muted, #94a3b8); font-size: 0.95rem; }
.bz-ld-select { margin-left: 6px; }
.bz-ld-check { display: inline-flex; align-items: center; gap: 6px; }
.bz-ld-check input { accent-color: #f59e0b; }

.bz-ld-board-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: 720px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.35);
    background: #0f172a;
    touch-action: manipulation;
}
.bz-ld-board {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}
.bz-ld-cell {
    position: relative;
    border: 1px solid rgba(15, 23, 42, 0.25);
    padding: 4px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: hidden;
    font-size: clamp(10px, 1.2vw, 13px);
}
.bz-ld-cell-a { background: #fde68a; }
.bz-ld-cell-b { background: #fef3c7; }
.bz-ld-num {
    font-weight: 700;
    color: #78350f;
    font-size: inherit;
    line-height: 1;
}
.bz-ld-mark {
    display: inline-block;
    margin-top: 2px;
    padding: 1px 4px;
    border-radius: 6px;
    font-size: 0.72em;
    font-weight: 700;
    line-height: 1.15;
    pointer-events: none;
}
.bz-ld-mark-ladder {
    background: rgba(34, 197, 94, 0.85);
    color: #052e16;
}
.bz-ld-mark-snake {
    background: rgba(220, 38, 38, 0.85);
    color: #fff5f5;
}
.bz-ld-finish {
    position: absolute;
    right: 4px;
    bottom: 2px;
    background: linear-gradient(135deg, #f97316, #dc2626);
    color: #fff;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.85em;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.5);
}
.bz-ld-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}
.bz-ld-ladder-rail {
    stroke: #b45309;
    stroke-width: 0.6;
    stroke-linecap: round;
    fill: none;
}
.bz-ld-ladder-rung {
    stroke: #b45309;
    stroke-width: 0.4;
    stroke-linecap: round;
    fill: none;
}
.bz-ld-snake-body {
    stroke: #16a34a;
    stroke-width: 1.6;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3));
}
.bz-ld-snake-head {
    fill: #dc2626;
    stroke: #7f1d1d;
    stroke-width: 0.3;
}
.bz-ld-tokens {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}
.bz-ld-token {
    position: absolute;
    width: 6.4%;
    height: 6.4%;
    min-width: 16px;
    min-height: 16px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(15, 23, 42, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
    font-size: clamp(10px, 1.3vw, 15px);
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: left 0.12s linear, top 0.12s linear;
}

.bz-ld-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 12px;
    color: #e2e8f0;
}
.bz-ld-die {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px;
    border-radius: 12px;
    border: 2px solid #f59e0b;
    background: linear-gradient(160deg, #fbbf24, #f59e0b);
    color: #451a03;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: transform 0.08s ease;
}
.bz-ld-die:active { transform: scale(0.97); }
.bz-ld-die.is-disabled,
.bz-ld-die[disabled] {
    background: #334155;
    border-color: #1e293b;
    color: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
}
.bz-ld-die-face {
    font-size: 2.4rem;
    line-height: 1;
}
.bz-ld-turn {
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
}
.bz-ld-status {
    min-height: 2.4em;
    font-size: 0.95rem;
    color: #cbd5e1;
    text-align: center;
}
.bz-ld-players {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.bz-ld-player {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.5);
    font-size: 0.92rem;
}
.bz-ld-player.is-turn {
    background: rgba(245, 158, 11, 0.18);
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.5);
}
.bz-ld-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
    font-weight: 700;
    border: 2px solid rgba(15, 23, 42, 0.8);
    flex-shrink: 0;
}
.bz-ld-pname { flex: 1; font-weight: 600; color: #e2e8f0; }
.bz-ld-psq { color: #cbd5e1; font-size: 0.85rem; }
.bz-ld-new { width: 100%; }

@media (max-width: 760px) {
    .bz-ld-wrap {
        grid-template-columns: 1fr;
    }
    .bz-ld-board-wrap { margin: 0 auto; }
    .bz-ld-panel { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .bz-ld-die { flex: 0 0 auto; }
    .bz-ld-turn { flex: 1 1 auto; text-align: left; }
    .bz-ld-status { flex: 1 1 100%; text-align: left; }
    .bz-ld-players { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; }
    .bz-ld-player { flex: 1 1 45%; min-width: 130px; }
    .bz-ld-new { width: auto; }
}
@media (max-width: 480px) {
    .bz-ld-cell { padding: 2px; }
    .bz-ld-mark { font-size: 0.62em; padding: 1px 3px; }
    .bz-ld-finish { font-size: 0.7em; padding: 1px 4px; }
}

/* ---------- Gem Cascade ---------- */
.bz-gc-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    align-items: stretch;
}
.bz-gc-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
}
.bz-gc-controls label { color: var(--bz-games-muted, #94a3b8); font-size: 0.95rem; }
.bz-gc-sel { margin-left: 6px; }
.bz-gc-hint-btn { background: #334155; color: #f1f5f9; }
.bz-gc-hint-btn:hover { background: #475569; }

.bz-gc-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: rgba(15, 23, 42, 0.55);
    border-radius: 10px;
    padding: 10px 12px;
}
.bz-gc-stat {
    flex: 1 1 90px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.bz-gc-lab {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}
.bz-gc-val {
    font-size: 1.2rem;
    font-weight: 800;
    color: #f8fafc;
    font-variant-numeric: tabular-nums;
}

.bz-gc-meter {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.bz-gc-meter-lab,
.bz-gc-meter-note {
    font-size: 0.85rem;
    color: #cbd5e1;
}
.bz-gc-meter-note { color: #94a3b8; font-size: 0.78rem; }
.bz-gc-meter-bar {
    flex: 1 1 140px;
    min-width: 140px;
    height: 10px;
    background: rgba(15, 23, 42, 0.65);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}
.bz-gc-meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ef4444, #f59e0b, #10b981, #3b82f6, #a855f7, #22d3ee);
    transition: width 0.25s ease;
    border-radius: inherit;
}

.bz-gc-board-wrap {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.45);
    background: #0f172a;
    touch-action: none;
}
.bz-gc-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.bz-gc-msg {
    min-height: 1.4em;
    font-size: 0.95rem;
    color: #e2e8f0;
    padding: 0 2px;
    text-align: center;
}
.bz-gc-help {
    margin: 2px 2px 0;
    font-size: 0.88rem;
    color: var(--bz-games-muted, #94a3b8);
    line-height: 1.5;
}

@media (max-width: 520px) {
    .bz-gc-stat { flex-basis: 70px; }
    .bz-gc-val { font-size: 1.05rem; }
    .bz-gc-help { font-size: 0.82rem; }
}

/* ============================================================
   Share bar — social media + copy link
   ============================================================ */
.bz-games-share-card { padding: 18px; }
.bz-games-share-card h2 {
    margin: 0 0 6px;
    font-size: 1.1rem;
}
.bz-games-share-intro {
    margin: 0 0 14px;
    color: var(--bz-games-text-dim);
    font-size: 0.95rem;
    line-height: 1.5;
}
.bz-games-share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}
.bz-games-share-btn {
    --bz-share-brand: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    min-height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--bz-games-radius-sm);
    background: var(--bz-share-brand);
    color: #ffffff;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.bz-games-share-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.bz-games-share-btn:active { transform: translateY(0); filter: brightness(0.95); }
.bz-games-share-btn:focus-visible {
    outline: 2px solid var(--bz-games-accent);
    outline-offset: 2px;
}
.bz-games-share-btn svg { flex: 0 0 auto; }
.bz-games-share-btn span { white-space: nowrap; }
.bz-games-share-btn--twitter { color: #ffffff; }
.bz-games-share-btn--native {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
}

.bz-games-share-status {
    margin-top: 10px;
    min-height: 1.2em;
    font-size: 0.88rem;
    color: var(--bz-games-good);
    opacity: 0;
    transition: opacity 160ms ease;
}
.bz-games-share-status.is-visible { opacity: 1; }

@media (max-width: 520px) {
    .bz-games-share-buttons {
        grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
        gap: 8px;
    }
    .bz-games-share-btn {
        padding: 10px 10px;
        font-size: 0.86rem;
    }
    .bz-games-share-btn span {
        font-size: 0.82rem;
    }
}

/* ============================================================
   Fullscreen — toggle button in stage head, floating exit button,
   plus CSS-overlay fallback for iOS Safari iPhone and legacy browsers.
   ============================================================ */
.bz-games-stage-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.bz-games-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    min-height: 40px;
    border-radius: 999px;
    border: 1px solid var(--bz-games-border);
    background: var(--bz-games-surface-2);
    color: var(--bz-games-text);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.bz-games-tool-btn:hover {
    background: var(--bz-games-surface);
    border-color: var(--bz-games-accent);
}
.bz-games-tool-btn:active { transform: scale(0.97); }
.bz-games-tool-btn:focus-visible {
    outline: 2px solid var(--bz-games-accent);
    outline-offset: 2px;
}
.bz-games-tool-btn[aria-pressed="true"] {
    background: var(--bz-games-accent);
    color: #0b1220;
    border-color: var(--bz-games-accent);
}

/* Floating exit button — hidden by default, visible when fullscreen is on */
.bz-games-fs-exit {
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    z-index: 2147483000;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    min-height: 48px;
    border-radius: 999px;
    border: 0;
    background: rgba(15, 23, 42, 0.94);
    color: #ffffff;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    backdrop-filter: blur(6px);
}
.bz-games-fs-exit:hover { background: #111c35; }
.bz-games-fs-exit:focus-visible {
    outline: 2px solid var(--bz-games-accent);
    outline-offset: 2px;
}

/* Reveal the exit button whenever the stage card is actively in fullscreen
   (either via the native API :fullscreen pseudo-class or our CSS fallback) */
.bz-games-stage-card:fullscreen .bz-games-fs-exit,
.bz-games-stage-card:-webkit-full-screen .bz-games-fs-exit,
.bz-games-stage-card.bz-games-fs-on .bz-games-fs-exit {
    display: inline-flex;
}

/* Native Fullscreen API styling: the browser already makes it fill the
   viewport, but we paint the background so letterboxing matches. */
.bz-games-stage-card:fullscreen,
.bz-games-stage-card:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    padding: 20px 16px 24px;
    border-radius: 0;
    background: var(--bz-games-bg);
    overflow: auto;
    display: flex;
    flex-direction: column;
}
.bz-games-stage-card:fullscreen .bz-games-stage,
.bz-games-stage-card:-webkit-full-screen .bz-games-stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* CSS-overlay fallback (iOS Safari iPhone) */
.bz-games-stage-card.bz-games-fs-on {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 20px 16px 24px !important;
    border-radius: 0 !important;
    background: var(--bz-games-bg) !important;
    z-index: 2147482000 !important;
    overflow: auto !important;
    display: flex !important;
    flex-direction: column !important;
}
.bz-games-stage-card.bz-games-fs-on .bz-games-stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
body.bz-games-fs-body-lock {
    overflow: hidden !important;
    position: fixed;
    inset: 0;
    width: 100%;
}

/* Let boards and canvases grow to fill the fullscreen viewport.
   Without this, per-game CSS caps like max-width: 520px would make
   the game render tiny in the middle of a huge fullscreen surface. */
.bz-games-stage-card:fullscreen .bz-games-stage > *,
.bz-games-stage-card.bz-games-fs-on .bz-games-stage > * {
    max-width: min(100%, 96vmin);
    width: 100%;
}
.bz-games-stage-card:fullscreen .bz-gc-board-wrap,
.bz-games-stage-card.bz-games-fs-on .bz-gc-board-wrap,
.bz-games-stage-card:fullscreen .bz-ld-board-wrap,
.bz-games-stage-card.bz-games-fs-on .bz-ld-board-wrap,
.bz-games-stage-card:fullscreen .bz-c4-board,
.bz-games-stage-card.bz-games-fs-on .bz-c4-board,
.bz-games-stage-card:fullscreen .bz-fs-grid,
.bz-games-stage-card.bz-games-fs-on .bz-fs-grid,
.bz-games-stage-card:fullscreen .bz-fh-boards,
.bz-games-stage-card.bz-games-fs-on .bz-fh-boards {
    max-width: min(96vmin, 900px) !important;
    width: 100% !important;
    margin-left: auto;
    margin-right: auto;
}
.bz-games-stage-card:fullscreen canvas,
.bz-games-stage-card.bz-games-fs-on canvas {
    max-width: 100%;
    max-height: calc(100vh - 180px);
    max-height: calc(100dvh - 180px);
    height: auto;
}

@media (max-width: 520px) {
    .bz-games-tool-btn {
        padding: 8px 10px;
        font-size: 0.82rem;
    }
    .bz-games-tool-btn span { display: none; }
    .bz-games-tool-btn { min-width: 40px; justify-content: center; }
    .bz-games-fs-exit {
        padding: 12px 14px;
        font-size: 0.88rem;
    }
}

/* ============================================================
   BizSuite Games Platform (games-platform.js companion styles)
   ============================================================ */

[data-bz-platform-login-cta] {
    display: block;
    padding: 10px 14px;
    margin: 12px 0;
    border-radius: var(--bz-games-radius-sm);
    background: linear-gradient(135deg, rgba(106, 166, 255, 0.12), rgba(255, 209, 102, 0.08));
    border: 1px solid var(--bz-games-border);
    color: var(--bz-games-text);
    font-size: 0.92rem;
}
[data-bz-platform-login-cta] .bz-platform-cta strong,
[data-bz-platform-login-cta] .bz-platform-hello strong { color: var(--bz-games-accent-2); }
[data-bz-platform-login-cta] a { color: var(--bz-games-accent); text-decoration: none; }
[data-bz-platform-login-cta] a:hover { text-decoration: underline; }

.bz-btn-inline {
    display: inline-block;
    padding: 4px 10px;
    margin: 0 2px;
    border-radius: 999px;
    background: rgba(106, 166, 255, 0.15);
    border: 1px solid rgba(106, 166, 255, 0.4);
    color: var(--bz-games-accent) !important;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
}
.bz-btn-inline:hover { background: rgba(106, 166, 255, 0.25); }

[data-bz-platform-tier-badge] {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--bz-games-surface-2);
    color: var(--bz-games-text-dim);
}

[data-bz-platform-credits] {
    font-size: 0.86rem;
    color: var(--bz-games-text-dim);
}
.bz-platform-credits-amount {
    color: var(--bz-games-accent-2);
    font-weight: 700;
}

[data-bz-platform-ad-slot] {
    min-height: 90px;
    margin: 16px 0;
    padding: 14px;
    border: 1px dashed var(--bz-games-border);
    border-radius: var(--bz-games-radius-sm);
    background: var(--bz-games-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.bz-platform-ad-placeholder { width: 100%; }
.bz-platform-ad-label {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bz-games-text-dim);
    margin-bottom: 6px;
}
.bz-platform-ad-blurb {
    font-size: 0.9rem;
    color: var(--bz-games-text);
}
.bz-platform-ad-blurb a {
    color: var(--bz-games-accent);
    text-decoration: none;
    font-weight: 600;
}
.bz-platform-ad-blurb a:hover { text-decoration: underline; }

[data-bz-platform-challenge-cta] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--bz-games-border);
    background: var(--bz-games-surface-2);
    color: var(--bz-games-text);
    border-radius: var(--bz-games-radius-sm);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
[data-bz-platform-challenge-cta]:hover {
    background: rgba(106, 166, 255, 0.2);
    border-color: var(--bz-games-accent);
}

[data-bz-platform-challenge-banner] {
    padding: 12px 16px;
    margin: 12px 0;
    border-radius: var(--bz-games-radius-sm);
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.15), rgba(106, 166, 255, 0.1));
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: var(--bz-games-text);
}
[data-bz-platform-challenge-banner] em {
    color: var(--bz-games-text-dim);
    font-style: italic;
}

.bz-platform-share-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bz-platform-share-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}
.bz-platform-share-box {
    position: relative;
    width: min(90vw, 460px);
    padding: 22px;
    background: var(--bz-games-surface);
    border: 1px solid var(--bz-games-border);
    border-radius: var(--bz-games-radius);
    box-shadow: var(--bz-games-shadow);
    color: var(--bz-games-text);
}
.bz-platform-share-box h3 {
    margin: 0 0 6px;
    font-size: 1.15rem;
    color: var(--bz-games-accent-2);
}
.bz-platform-share-box p {
    margin: 0 0 12px;
    color: var(--bz-games-text-dim);
    font-size: 0.9rem;
}
.bz-platform-share-box input {
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 12px;
    background: var(--bz-games-bg-soft);
    border: 1px solid var(--bz-games-border);
    border-radius: var(--bz-games-radius-sm);
    color: var(--bz-games-text);
    font-family: monospace;
    font-size: 0.85rem;
}
.bz-platform-share-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.bz-platform-share-buttons a,
.bz-platform-share-buttons button {
    display: block;
    padding: 10px 12px;
    text-align: center;
    text-decoration: none;
    background: var(--bz-games-surface-2);
    border: 1px solid var(--bz-games-border);
    border-radius: var(--bz-games-radius-sm);
    color: var(--bz-games-text);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}
.bz-platform-share-buttons a:hover,
.bz-platform-share-buttons button:hover {
    background: rgba(106, 166, 255, 0.2);
    border-color: var(--bz-games-accent);
}
.bz-platform-share-close {
    margin-top: 14px;
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px solid var(--bz-games-border);
    border-radius: var(--bz-games-radius-sm);
    color: var(--bz-games-text-dim);
    cursor: pointer;
    font-size: 0.85rem;
}
.bz-platform-share-close:hover {
    color: var(--bz-games-text);
    background: var(--bz-games-bg-soft);
}

