
        :root {
            --felt-green: #2d5e2e;
            --card-width: 60px;
            --card-height: 84px;
            --card-radius: 6px;
            --highlight: #ffd700;
            --safe-top: env(safe-area-inset-top, 20px);
            --safe-bottom: env(safe-area-inset-bottom, 20px);
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            background-color: var(--felt-green);
            color: white;
            margin: 0;
            display: flex;
            flex-direction: column;
            height: 100vh;
            overflow: hidden;
            user-select: none;
            -webkit-user-select: none;
            padding-top: calc(var(--safe-top) + 10px);
            touch-action: none;
        }

        #game-board {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            gap: 60px;
            padding: 10px;
            position: relative;
        }

        /* --- Player Rows --- */
        .player-row {
            position: relative;
            width: 100%;
            height: 160px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        /* --- Side Elements --- */
        .left-panel {
            position: absolute;
            left: 5px;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            z-index: 10;
            width: 50px;
        }

        .turn-indicator {
            width: 40px;
            height: 40px;
            display: flex;
            justify-content: center;
            align-items: center;
            opacity: 0.3;
            transition: opacity 0.3s;
        }

        .turn-indicator.active {
            opacity: 1;
        }

        .turn-dot {
            width: 15px;
            height: 15px;
            background-color: var(--highlight);
            border-radius: 50%;
            box-shadow: 0 0 10px var(--highlight);
            animation: pulse 1.5s infinite;
        }

        /* SCORE PILL */
        .score-tally {
            background: rgba(0, 0, 0, 0.4);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: #ddd;
            padding: 5px 4px;
            border-radius: 10px;
            font-size: 9px;
            font-weight: bold;
            text-align: center;
            min-width: 45px;
            line-height: 1.2;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        /* Capture Showcase Anchor */
        .stack-anchor {
            position: absolute;
            right: 10px;
            width: var(--card-width);
            height: var(--card-height);
            z-index: 999;
            pointer-events: none;
            overflow: visible;
            top: 50%;
            transform: translateY(-50%);
        }

        /* --- Center Column --- */
        .hand-column {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 6px;
            position: relative;
            z-index: 5;
        }

        /* --- Hand Areas --- */
        .hand-area {
            display: flex;
            justify-content: center;
            align-items: center;
            height: var(--card-height);
            position: relative;
        }

        /* --- Counters --- */
        .info-pill {
            background: rgba(0, 0, 0, 0.4);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: #ddd;
            padding: 2px 10px;
            border-radius: 10px;
            font-size: 10px;
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            white-space: nowrap;
            position: relative;
            transition: opacity 0.3s;
        }

        .hidden-pill {
            opacity: 0;
            pointer-events: none;
        }

        #cpu-club-counter { transform: translateY(25px); }
        #player-club-counter { transform: translateY(-25px); }

        .deck-counter {
            position: absolute;
            top: -25px;
            background: rgba(0, 0, 0, 0.6);
            border-color: rgba(255, 215, 0, 0.4);
            color: #ffd700;
        }

        /* --- Sur Areas --- */
        .sur-container {
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: center;
            gap: 4px;
            height: 20px;
            transition: opacity 0.2s;
        }

        .sur-container.hidden { opacity: 0; }

        .sur-pill {
            background: var(--highlight);
            color: #333;
            padding: 2px 8px;
            border-radius: 10px;
            font-weight: bold;
            font-size: 10px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.3);
            white-space: nowrap;
        }

        /* --- Stacked Card Styles --- */
        .stacked-card {
            position: absolute !important;
            left: 0 !important;
            width: 100% !important;
            height: 100% !important;
            margin: 0 !important;
            background-color: white;
            border-radius: var(--card-radius);
            border: 1px solid #999;
            box-shadow: 0 -1px 4px rgba(0,0,0,0.5);
            transform-origin: top center;
        }

        /* --- Table Area --- */
        #table-area {
            flex: none;
            height: 25vh;
            min-height: 180px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 12px;
            display: flex;
            flex-wrap: wrap;
            align-content: center;
            justify-content: center;
            padding: 10px;
            gap: 8px;
            position: relative;
            z-index: 1;
        }

        /* --- Cards --- */
        #opponent-hand .card {
            background: linear-gradient(135deg, #a83232 0%, #7d1e1e 100%);
            border: 2px solid #fff;
        }

        .card {
            width: var(--card-width);
            height: var(--card-height);
            background-color: white;
            border-radius: var(--card-radius);
            box-shadow: 0 2px 5px rgba(0,0,0,0.3);
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding: 4px;
            box-sizing: border-box;
            font-weight: bold;
            font-size: 14px;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
            position: relative;
            -webkit-tap-highlight-color: transparent;
        }

        .card.red { color: #d40000; }
        .card.black { color: #000; }

        .card-center {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 24px;
        }

        .card.selected {
            transform: translateY(-15px);
            box-shadow: 0 0 0 3px var(--highlight), 0 5px 15px rgba(0,0,0,0.5);
            z-index: 10;
        }

        .card.target-selected {
            box-shadow: 0 0 0 3px #00e5ff;
        }

        /* --- Controls --- */
        #controls {
            height: 120px;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            gap: 15px;
            padding-bottom: calc(50px + var(--safe-bottom));
            flex-shrink: 0;
        }

        .btn-wrapper {
            display: inline-block;
            position: relative;
            margin-top: 10px;
        }

        button {
            background: var(--highlight);
            border: none;
            padding: 14px 40px;
            border-radius: 30px;
            font-weight: bold;
            color: #333;
            font-size: 1.2rem;
            box-shadow: 0 5px 0 #bfa200;
            cursor: pointer;
            transition: all 0.1s;
            min-width: 140px;
        }
        button:active {
            transform: translateY(3px);
            box-shadow: none;
        }
        button:disabled {
            background: #999;
            box-shadow: none;
            color: #555;
            cursor: default;
            opacity: 0.5;
        }

        /* --- Round Over Modal --- */
        #message-overlay {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0,0,0,0.95);
            padding: 20px;
            border-radius: 16px;
            text-align: center;
            display: none;
            z-index: 2000;
            width: 85%;
            max-width: 320px;
            border: 1px solid #555;
            box-shadow: 0 10px 30px rgba(0,0,0,0.8);
        }

        .breakdown-row {
            display: flex;
            flex-direction: column;
            margin-bottom: 12px;
            border-bottom: 1px solid rgba(255,255,255,0.1);
            padding-bottom: 10px;
        }

        .breakdown-title {
            font-size: 0.85rem;
            color: #aaa;
            text-transform: uppercase;
            margin-bottom: 5px;
            text-align: left;
        }

        .mini-cards-container {
            display: flex;
            flex-wrap: nowrap;
            overflow-x: auto;
            gap: 2px;
            padding: 4px 0;
            min-height: 40px;
            align-items: center;
        }

        .mini-cards-container::-webkit-scrollbar { height: 4px; }
        .mini-cards-container::-webkit-scrollbar-thumb { background: #555; border-radius: 2px; }

        .mini-card {
            width: 24px;
            height: 34px;
            background: white;
            border-radius: 3px;
            color: black;
            font-size: 10px;
            font-weight: bold;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-shrink: 0;
            line-height: 1;
            border: 1px solid #ccc;
        }
        .mini-card.red { color: #d40000; }

        .sur-display-row {
            display: flex;
            gap: 4px;
            margin-top: 4px;
            flex-wrap: wrap;
        }

        .score-line {
            display: flex;
            justify-content: space-between;
            font-size: 0.9rem;
            margin-top: 2px;
        }
        .score-val { color: var(--highlight); font-weight: bold; }

        @keyframes pulse {
            0% { transform: scale(0.95); opacity: 0.7; }
            50% { transform: scale(1.1); opacity: 1; }
            100% { transform: scale(0.95); opacity: 0.7; }
        }

        @media (min-width: 600px) {
            :root {
                --card-width: 80px;
                --card-height: 112px;
            }
        }

*{box-sizing:border-box}body{height:auto;min-height:100svh;overflow:visible;overflow-x:hidden;touch-action:pan-y;padding-top:max(8px,env(safe-area-inset-top));padding-inline:8px}button{touch-action:manipulation}button:focus-visible{outline:3px solid #00e5ff;outline-offset:4px}.game-shell{display:flex;flex:1;flex-direction:column;width:100%;max-width:900px;margin:auto}.utility{display:flex;justify-content:flex-end;gap:4px;height:44px;flex-shrink:0}.utility button,.hint-button{padding:0;min-width:44px;width:44px;height:44px;background:transparent;color:#fff;border-radius:50%;box-shadow:none;font-size:24px}.utility button:hover,.hint-button:hover{background:#ffffff12}#game-board{gap:clamp(16px,3vh,32px);padding:10px 0;justify-content:center}.player-row{height:145px;min-height:145px}.left-panel{left:0;width:44px}.score-tally{min-width:36px;padding:4px;font-size:14px;color:white}.stack-anchor{right:0}.hand-column{gap:6px}#table-area{height:auto;min-height:170px;padding:14px 10px;gap:8px}#cpu-club-counter,#player-club-counter{transform:none}.deck-counter{top:-20px}#controls{height:auto;min-height:95px;padding:4px 0 max(20px,env(safe-area-inset-bottom));align-items:center;position:relative}.btn-wrapper{margin:0}.card{border:0;padding:4px;min-width:var(--card-width);border-radius:6px;box-shadow:0 2px 5px #0005;color:#000;font-size:14px;flex-shrink:0;line-height:1;min-height:var(--card-height);text-align:left}.card:disabled{background:white;color:#000;opacity:1;box-shadow:0 2px 5px #0005}.card.red:disabled{color:#d40000}.card:active{transform:none}.card.selected:active{transform:translateY(-15px)}.card-bottom{align-self:flex-end;transform:rotate(180deg)}#opponent-hand .card{background:linear-gradient(135deg,#a83232,#7d1e1e);border:2px solid #fff}.info-pill{font-size:11px;padding:2px 8px}.hand-area{gap:2px}.sur-pill{padding:2px 6px}.stacked-card{background:white;border:1px solid #999;padding:4px;display:flex;align-items:center;justify-content:center;font-weight:700;color:#000;font-size:22px;opacity:.85}.stacked-card.red{color:#d40000}.guidance{min-height:20px;text-align:center;font-size:12px;margin:0;color:#f7d981}.sr-only{position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden}dialog{background:#111;color:white;border:1px solid #555;border-radius:16px;padding:22px;width:min(340px,calc(100% - 32px));max-height:calc(100svh - 40px);overflow:auto;box-shadow:0 10px 30px #0008}dialog::backdrop{background:#0008}dialog h2{font-size:20px;margin:0 0 16px}dialog p{font-size:14px;line-height:1.6}dialog .close{float:right;min-width:44px;width:44px;height:44px;padding:0;background:transparent;color:white;box-shadow:none;font-size:24px}.score-row{display:grid;grid-template-columns:1fr 42px 42px;font-size:13px;gap:8px;padding:8px 0;border-bottom:1px solid #ffffff1a}.score-row span:not(:first-child){text-align:right}.score-row.total{color:#ffd700;font-weight:bold}#next-round{width:100%;margin-top:20px;font-size:16px}.capture-ghost{position:fixed;z-index:4000;pointer-events:none;width:var(--card-width);height:var(--card-height);border-radius:6px;background:#fff;box-shadow:0 2px 5px #0005;display:grid;place-items:center;font-size:24px;color:#000}.capture-ghost.red{color:#d40000}@media(max-width:350px){:root{--card-width:48px;--card-height:67px}.player-row{height:130px;min-height:130px}.left-panel{width:36px}.score-tally{min-width:30px}.hand-column{margin-right:10px}.stack-anchor{width:42px;height:59px}.turn-indicator{width:32px;height:32px}#table-area{min-height:155px}.card{font-size:13px}.card-center{font-size:22px}}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}

.utility button:disabled,.hint-button:disabled{background:transparent;color:#fff;opacity:.35}
#controls{position:sticky;bottom:0;background:var(--felt-green);z-index:100}

/* Compact visual guide; game and score panels keep their original appearance. */
#rules{padding:0;width:min(380px,calc(100% - 24px));max-height:calc(100dvh - 24px);border:1px solid var(--help-line);border-radius:22px;background:var(--help-bg);color:var(--help-ink);font:14px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;box-shadow:0 20px 70px #0006;overflow:hidden}
#rules[open]{display:flex;flex-direction:column}#rules::backdrop{background:#0008;backdrop-filter:blur(6px)}
#rules .help-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 18px 14px;margin:0;border-bottom:1px solid var(--help-line);background:var(--help-bg);flex:none}
#rules h2{font-size:22px;font-weight:650;letter-spacing:-.6px;margin:0}#rules h3{font-size:13px;font-weight:650;margin:0 0 8px}#rules p{font-size:13px;line-height:1.45;margin:0}#rules .help-header p{color:var(--help-muted);font-size:12px;margin-top:3px}
#rules .help-close{float:none;min-width:44px;width:44px;height:44px;padding:12px;border:0;border-radius:50%;background:var(--help-panel);color:var(--help-ink);box-shadow:none;display:grid;place-items:center;flex:none}#rules .help-close svg{width:20px;height:20px}#rules .help-close:focus-visible{outline:2px solid var(--help-ink);outline-offset:2px}#rules .help-close:active{transform:none}
#rules .help-content{overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;padding:18px;display:flex;flex-direction:column;gap:18px;min-height:0;text-align:left}
#rules .help-note{color:var(--help-muted);font-size:11px;line-height:1.5;margin-top:10px}#rules .help-example{background:var(--help-panel);border-radius:16px;padding:16px}#rules .help-example p{color:var(--help-muted);font-size:12px}
#rules{--help-bg:#153c25;--help-panel:#ffffff0c;--help-ink:#f8f7ed;--help-muted:#c5d5c9;--help-line:#ffffff20}
#rules .help-steps{display:flex;align-items:center;justify-content:space-between;gap:4px;font-size:12px;font-weight:550}#rules .help-steps b{color:#ffd700;font-weight:400}
#rules .help-equation{display:flex;align-items:center;justify-content:center;gap:14px;margin-bottom:12px}#rules .help-equation>b{font-size:18px;color:var(--help-muted);font-weight:400}#rules .help-equation>strong{font-size:32px;color:#ffd700;font-weight:650}
#rules .help-card{background:#fffdf7;color:#171717;border-radius:6px;width:42px;height:58px;padding:5px;display:flex;flex-direction:column;align-items:flex-start;justify-content:space-between;font-size:17px;font-weight:650;box-shadow:0 2px 3px #0003}#rules .help-card>span{align-self:center;font-size:22px}#rules .red{color:#df283b}#rules .help-example>p{text-align:center}
#rules .help-ranks{display:flex;flex-direction:column;gap:12px}#rules .help-ranks>div{display:flex;align-items:center;gap:12px}#rules .help-rank{width:50px;font-size:13px;font-weight:650;color:#ffd700;flex:none}
#rules .help-points{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}#rules .help-points>div{display:flex;align-items:center;justify-content:space-between;gap:4px;padding:10px 9px;border-radius:10px;background:var(--help-panel);font-size:11px}#rules .help-points strong{font-size:17px;color:#ffd700;font-weight:650}

/* Keep actions visible; long tables scroll within the board rather than out of the frame. */
.game-shell{height:calc(100svh - max(8px,env(safe-area-inset-top)));min-height:0;flex:0 0 auto}
#game-board{flex:1 1 0;min-height:0;overflow-y:auto;justify-content:safe center;overscroll-behavior:contain}
.player-row{flex-shrink:0}#controls{flex-shrink:0;min-height:76px;padding-bottom:max(12px,env(safe-area-inset-bottom))}
#guidance{flex:none;min-height:20px}#save-notice:empty{display:none}
@media(max-height:660px){#game-board{gap:10px;padding-block:6px}.player-row{height:120px;min-height:120px}#table-area{min-height:120px;padding:12px 8px}#controls{min-height:66px}}
