
        /* ===== Site Header / Footer (new design) ===== */
        .site-header {
            /* No colour of its own: the bar is whatever the page behind it
               is, light or dark, on every game. Nothing draws a line under
               it either — no shadow, no border, no change of shade. */
            background: transparent;
            display: flex; justify-content: space-between; align-items: center;
            height: 64px; padding: 0 24px;
            width: 100%; flex-shrink: 0;
        }
        .site-logo { display: flex; align-items: center; gap: 10px; }
        .site-logo img.bigtoe { height: 60px; width: auto; display: block; }
        .site-logo img.logotext { height: 30px; width: auto; display: block; }
        .site-nav { display: flex; align-items: center; gap: 26px; }
        .site-nav a { text-decoration: none; color: #334155; font-weight: 500; font-size: 0.9rem; transition: color 0.2s; }
        .site-nav a:hover { color: #0d9488; }
        .site-nav a.site-play {
            background: #14b8a6; color: #fff; padding: 8px 18px; border-radius: 999px; font-weight: 600;
        }
        .site-nav a.site-play:hover { background: #0d9488; color: #fff; }
        /* Menu hidden for launch — flip this back to show it */
        .site-nav { display: none; }
        /* Language switch */
        .header-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
        .lang-switch { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
        .lang-switch button {
            border: 1px solid #d5d5d5; background: #fff; color: #555;
            border-radius: 999px; padding: 4px 12px; font-size: 0.8rem;
            font-weight: 600; cursor: pointer; transition: all 0.15s;
        }
        /* Language burger menu (mobile only) */
        .lang-menu { position: relative; }
        .lang-menu-btn {
            display: none;
            border: 1px solid #d5d5d5; background: #fff; color: #555;
            border-radius: 999px; padding: 4px 12px; font-size: 0.8rem;
            font-weight: 600; cursor: pointer; white-space: nowrap;
            transition: all 0.15s;
        }
        .lang-menu-btn:hover { border-color: #0d9488; color: #0d9488; }
        html.dark .lang-menu-btn { background: #1a1a2e; border-color: #3f3f5a; color: #e8e8f0; }
        html.dark .lang-menu-btn:hover { border-color: #14b8a6; color: #5eead4; }
        .lang-switch button:hover { border-color: #0d9488; color: #0d9488; }
        .lang-switch button.active { background: #14b8a6; border-color: #14b8a6; color: #fff; }
        /* Theme toggle (site-wide dark mode) */
        .theme-toggle {
            border: 1px solid #d5d5d5; background: #fff; color: #555;
            border-radius: 999px; padding: 4px 12px; font-size: 0.9rem; line-height: 1.5;
            font-weight: 600; cursor: pointer; transition: all 0.15s; flex-shrink: 0;
        }
        .theme-toggle:hover { border-color: #0d9488; color: #0d9488; }
        .theme-toggle .icon-dark { display: none; }
        /* Site-wide dark theme */
        html.dark .site-footer { color: #9ca3af; }
        html.dark .site-footer-links a { color: #9ca3af; }
        html.dark .site-footer-links a:hover { color: #5eead4; }
        html.dark .site-nav a { color: #cbd5e1; }
        html.dark .site-nav a:hover { color: #5eead4; }
        html.dark .lang-switch button { background: #1a1a2e; border-color: #3f3f5a; color: #cbd5e1; }
        html.dark .lang-switch button:hover { border-color: #14b8a6; color: #5eead4; }
        html.dark .lang-switch button.active { background: #14b8a6; border-color: #14b8a6; color: #fff; }
        html.dark .theme-toggle { background: #1a1a2e; border-color: #3f3f5a; color: #e8e8f0; }
        html.dark .theme-toggle:hover { border-color: #14b8a6; color: #5eead4; }
        html.dark .theme-toggle .icon-light { display: none; }
        html.dark .theme-toggle .icon-dark { display: inline; }
        /* The wordmark PNG has an opaque white background — invert it in dark mode */
        html.dark .site-logo img.logotext { filter: invert(1) hue-rotate(180deg); }
        .site-footer {
            /* Same as the header: the page's own background, and no rule
               above it. */
            background: transparent;
            padding: 18px 20px; display: flex; flex-direction: column; align-items: center; gap: 4px;
            font-size: 0.85rem; color: #555; width: 100%; flex-shrink: 0; text-align: center;
        }
        .site-footer-links { display: flex; gap: 20px; }
        .site-footer-links a { text-decoration: none; color: #555; }
        .site-footer-links a:hover { color: #5f9bb9; }
        @media (max-width: 720px) {
            .site-nav { display: none; }
            .site-logo img.bigtoe { height: 44px; }
            .site-logo img.logotext { height: 20px; }
            .lang-menu-btn { display: inline-block; }
            .lang-menu-dd {
                display: none;
                position: absolute; right: 0; top: calc(100% + 8px);
                background: #fff; border: 1px solid #d5d5d5; border-radius: 12px;
                box-shadow: 0 8px 24px rgba(0,0,0,0.15);
                padding: 6px; z-index: 500; min-width: 120px;
            }
            .lang-menu-dd.open { display: block; }
            .lang-menu-dd .lang-switch { flex-direction: column; align-items: stretch; gap: 4px; }
            .lang-menu-dd .lang-switch button { display: block; width: 100%; text-align: left; border: none; }
            html.dark .lang-menu-dd { background: #1a1a2e; border-color: #3f3f5a; }
        }

/* ===== Solitaire — BigToe Games ===== */

:root {
    --bg-color: #F5F5F5;
    --surface-color: #FFFFFF;
    --text-color: #212121;
    --text-secondary: #757575;
    --cell-bg: #FFFFFF;
    --cell-text: #212121;
    --cell-border: #E0E0E0;
    --primary: #009688;
    --primary-hover: #00796B;
    --accent: #FFB300;
    --button-bg: #E0E0E0;
    --button-hover: #BDBDBD;
    --button-active: #009688;
    --button-active-text: #FFFFFF;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
    --transition: 0.2s ease;
    --selected-border: #009688;
    /* Table felt and card colours */
    --felt: #E8EDE9;
    --card-face: #FFFFFF;
    --card-edge: #CFCFCF;
    --card-red: #D81B1B;
    --card-black: #101010;
    --slot-line: rgba(0,0,0,0.18);
    /* Geometry — the JS layout pass overwrites these on #board */
    --card-w: 64px;
    --card-h: 90px;
    --gap: 6px;
    --fan-up: 22px;
    --fan-down: 9px;
}

html.dark {
    --bg-color: #121212;
    --surface-color: #1E1E1E;
    --text-color: #E0E0E0;
    --text-secondary: #9E9E9E;
    --cell-bg: #1E1E1E;
    --cell-text: #E0E0E0;
    --cell-border: #424242;
    --button-bg: #333333;
    --button-hover: #424242;
    --button-active: #00BFA5;
    --button-active-text: #121212;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --selected-border: #00BFA5;
    --felt: #16201C;
    /* Cards stay white in the dark theme: the court portraits are painted
       on white, and anything softer shows as a block behind them. */
    --card-face: #FFFFFF;
    --card-edge: #8A8A8A;
    --card-red: #C62828;
    --card-black: #101010;
    --slot-line: rgba(255,255,255,0.22);
}

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

body {
    font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background var(--transition), color var(--transition);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.app-container {
    width: 100%;
    max-width: 900px;
    flex: 1;
    padding: 8px 8px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.header-brand { display: flex; align-items: center; gap: 8px; }
.header-emoji { font-size: 30px; line-height: 1; flex-shrink: 0; }
.header-text h1 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-color);
}
.header-text .publisher {
    font-size: 10px;
    color: var(--primary);
    font-weight: 500;
}
.header-right { display: flex; align-items: center; gap: 8px; }
.btn-icon {
    background: var(--button-bg);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}
.btn-icon:hover { background: var(--button-hover); }

/* Narrow phones: claw back the side padding so the seven columns can be wider. */
@media (max-width: 480px) {
    .app-container { padding: 6px 4px 8px; }
}

/* ---------- Status Row ---------- */
.status-row {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.status-item { font-weight: 600; color: var(--text-color); }
.status-item.hidden { display: none; }

/* ---------- Board ---------- */
.board {
    width: 100%;
    flex: 1;
    min-height: 0;
    background: var(--felt);
    border-radius: 12px;
    padding: var(--gap);
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}

.top-row,
.tableau {
    display: grid;
    grid-template-columns: repeat(7, var(--card-w));
    justify-content: space-between;
    gap: var(--gap);
}

.top-row { height: var(--card-h); }
/* Explicit columns run out of order in the left-handed layout, so pin every
   slot to the first row — grid would otherwise start a second one. */
.top-row .pile { grid-row: 1; }
.top-row [data-pile="f0"] { grid-column: 1; }
.top-row [data-pile="f1"] { grid-column: 2; }
.top-row [data-pile="f2"] { grid-column: 3; }
.top-row [data-pile="f3"] { grid-column: 4; }
.top-row [data-pile="waste"] { grid-column: 6; }
.top-row [data-pile="stock"] { grid-column: 7; }

/* Left-handed: stock and waste move to the left, foundations to the right. */
.top-row.lefty [data-pile="f0"] { grid-column: 4; }
.top-row.lefty [data-pile="f1"] { grid-column: 5; }
.top-row.lefty [data-pile="f2"] { grid-column: 6; }
.top-row.lefty [data-pile="f3"] { grid-column: 7; }
.top-row.lefty [data-pile="waste"] { grid-column: 2; }
.top-row.lefty [data-pile="stock"] { grid-column: 1; }

.tableau { flex: 1; min-height: 0; align-items: start; }

.pile {
    position: relative;
    width: var(--card-w);
    height: var(--card-h);
    border-radius: calc(var(--card-w) * 0.1);
    border: 2px dashed var(--slot-line);
}
.pile.column {
    height: 100%;
    border: none;
}
.pile.column::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: var(--card-h);
    border-radius: calc(var(--card-w) * 0.1);
    border: 2px dashed var(--slot-line);
}
.pile.waste { border: none; }

.pile .slot-mark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(var(--card-w) * 0.45);
    color: var(--slot-line);
    pointer-events: none;
}
.pile.drop-ok { border-color: var(--primary); }

/* ---------- Cards ---------- */
.card {
    position: absolute;
    left: 0;
    width: var(--card-w);
    height: var(--card-h);
    border-radius: calc(var(--card-w) * 0.1);
    background: var(--card-face);
    border: 1px solid var(--card-edge);
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    cursor: pointer;
    overflow: hidden;
    touch-action: none;
}
.card.red { color: var(--card-red); }
.card.black { color: var(--card-black); }

.card .corner {
    position: absolute;
    display: flex;
    align-items: baseline;
    gap: calc(var(--card-w) * 0.04);
    line-height: 1;
    font-weight: 700;
}
.card .corner.tl {
    top: calc(var(--card-h) * 0.035);
    left: calc(var(--card-w) * 0.06);
}
.card .corner .rank { font-size: calc(var(--card-w) * 0.32); }
.card .corner .suit { font-size: calc(var(--card-w) * 0.3); }

/* The printed area between the two corner indices. */
.card .face {
    position: absolute;
    top: 28%;
    bottom: 8%;
    left: 15%;
    right: 15%;
}
.card .face .pip {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: calc(var(--card-w) * 0.24);
    line-height: 1;
}
.card .face .pip.upside-down { transform: translate(-50%, -50%) rotate(180deg); }
.card .face.ace .pip { font-size: calc(var(--card-w) * 0.66); }

/* Large print: one rank over one suit, filling the card. Court cards get
   their letter here too, since a portrait is not what this mode is for. */
.card .face.large {
    top: 17%;
    bottom: 4%;
    left: 4%;
    right: 4%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.card .face.large .big-rank {
    font-size: calc(var(--card-w) * 0.56);
    font-weight: 800;
    line-height: 0.95;
}
.card .face.large .big-suit {
    font-size: calc(var(--card-w) * 0.46);
    line-height: 1;
}

/* A covered card: rank and suit side by side in the strip the fan leaves,
   which is the only part of it anyone will see. */
.card .face.large.covered {
    top: 4%;
    bottom: auto;
    height: 34%;
    flex-direction: row;
    justify-content: center;
    gap: calc(var(--card-w) * 0.06);
}
.card .face.large.covered .big-rank { font-size: calc(var(--card-w) * 0.44); }
.card .face.large.covered .big-suit { font-size: calc(var(--card-w) * 0.38); }

/* The court cards carry BigToe himself, cropped out of the painted
   cards so the game's own index supplies the rank and suit. */
.card .face.court {
    top: 26%;
    bottom: 6%;
    left: 10%;
    right: 10%;
}
.card .court-art {
    position: absolute;
    inset: 0;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}
.card .court-jack { background-image: url('jack_light.jpg'); }
.card .court-queen { background-image: url('queen_light.jpg'); }
.card .court-king { background-image: url('king_light.jpg'); }
html.dark .card .court-jack { background-image: url('jack_dark.jpg'); }
html.dark .card .court-queen { background-image: url('queen_dark.jpg'); }
html.dark .card .court-king { background-image: url('king_dark.jpg'); }

.card.down {
    background-image: url('cardback_light.jpg');
    background-size: cover;
    background-position: center;
    border-color: var(--card-edge);
}
html.dark .card.down { background-image: url('cardback_dark.jpg'); }

.card.selected {
    outline: 3px solid var(--selected-border);
    outline-offset: -1px;
}
.card.hint-ok { box-shadow: 0 0 0 3px var(--primary); }
.card.dragging { visibility: hidden; }

@keyframes cardShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
.card.shake { animation: cardShake 0.25s ease; }

/* A card flying from the stock to its place in the deal. */
@keyframes dealIn {
    from { transform: translate(var(--dx, 0), var(--dy, 0)) rotate(-5deg); }
    to { transform: none; }
}
.card.dealt-in { animation: dealIn 0.22s ease-out; }

/* The winning cards, on their way off the screen. */
.bounce-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 350;
}

@media (prefers-reduced-motion: reduce) {
    .card.dealt-in { animation: none; }
}

/* The floating copy that follows the pointer during a drag. */
.drag-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 400;
}
.drag-layer .card {
    box-shadow: 0 6px 14px rgba(0,0,0,0.35);
    cursor: grabbing;
}

/* ---------- Controls ---------- */
.controls-bar {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.ctrl-btn {
    background: var(--button-bg);
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.ctrl-btn:hover { background: var(--button-hover); }
.ctrl-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ctrl-btn.hidden { display: none; }
/* Offered off to the side, so finishing by hand stays the obvious thing. */
.ctrl-btn.finish {
    margin-right: auto;
    background: transparent;
    border: 2px solid var(--button-bg);
    color: var(--text-secondary);
    font-weight: 600;
}
.ctrl-btn.finish:hover { border-color: var(--primary); background: var(--button-bg); }
.ctrl-btn.primary { background: var(--primary); color: white; }
.ctrl-btn.primary:hover { background: var(--primary-hover); }

/* ---------- Overlays ---------- */
.celebration-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    transition: opacity 0.3s;
}
.celebration-overlay.hidden { display: none; }
.celebration-card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 32px 24px;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow);
}
.celebration-card .trophy { font-size: 48px; margin-bottom: 12px; }
.celebration-card .trophy img {
    width: 140px;
    height: 140px;
    border-radius: 18px;
    object-fit: cover;
    display: block;
    margin: 0 auto;
}
.celebration-card h2 {
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--text-color);
}
.celebration-card .stats-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin: 16px 0;
}
.celebration-card .stat .val {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}
.celebration-card .stat .lbl {
    font-size: 11px;
    color: var(--text-secondary);
}
.celebration-card button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 28px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background var(--transition);
}
.celebration-card button:hover { background: var(--primary-hover); }

.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 301;
    overflow: hidden;
}
.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confettiFall 3s ease-out forwards;
}
@keyframes confettiFall {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ---------- Settings ---------- */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    transition: opacity 0.3s;
}
.settings-overlay.hidden { display: none; }
.settings-modal {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 24px;
    max-width: 340px;
    width: 90%;
    box-shadow: var(--shadow);
    max-height: 90vh;
    overflow-y: auto;
}
.settings-modal h2 {
    font-size: 20px;
    margin-bottom: 16px;
    color: var(--text-color);
}
.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--cell-border);
}
.settings-row:last-of-type { border-bottom: none; }
.settings-label {
    font-size: 14px;
    color: var(--text-color);
    font-weight: 500;
}
.settings-note {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 12px;
}
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    display: inline-block;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--button-bg);
    border-radius: 26px;
    transition: var(--transition);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }
.settings-close-btn {
    display: block;
    margin: 16px auto 0;
    background: var(--button-bg);
    border: none;
    border-radius: 20px;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-color);
    transition: background var(--transition);
}
.settings-close-btn:hover { background: var(--button-hover); }

/* ---------- Splash Screen ---------- */
.splash-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 500;
    transition: opacity 0.5s, visibility 0.5s;
}
.splash-screen.fade-out { opacity: 0; visibility: hidden; }
.splash-screen.hidden { display: none; }
.splash-logo {
    width: 180px;
    height: auto;
    margin-bottom: 12px;
    animation: splashPulse 2s ease-in-out infinite;
}
@keyframes splashPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@media (max-width: 600px) { .splash-logo { width: 140px; } }
.splash-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 4px;
}
.splash-publisher {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
}
.splash-copyright {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 8px;
}
