
        /* ===== Site Header / Footer (new design) ===== */
        .site-header {
            background-color: #ffffff;
            display: flex; justify-content: space-between; align-items: center;
            height: 64px; padding: 0 24px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.05);
            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-header { background: #1a1a2e; box-shadow: 0 2px 5px rgba(0,0,0,0.4); }
        html.dark .site-footer { background: #1a1a2e; border-top-color: #2d2d44; 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 {
            background-color: #ffffff; border-top: 1px solid #e5e5e5;
            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; }
        }

        :root {
            --bg-color: #F5F5F5;
            --surface-color: #FFFFFF;
            --text-color: #212121;
            --text-secondary: #757575;
            --primary: #009688;
            --primary-hover: #00796B;
            --primary-light: #B2DFDB;
            --accent: #FFB300;
            --accent-light: #FFE082;
            --error: #E57373;
            --error-bg: #FFEBEE;
            --button-bg: #E0E0E0;
            --button-hover: #BDBDBD;
            --button-active: #009688;
            --button-active-text: #FFFFFF;
            --peg-color: #795548;
            --base-color: #5D4037;
            --disk-colors: #009688, #26A69A, #4DB6AC, #80CBC4, #B2DFDB, #E0F2F1;
            --disk-colors-dark: #00BFA5, #1DE9B6, #64FFDA, #A7FFEB, #B2DFDB, #E0F2F1;
            --shadow: 0 2px 8px rgba(0,0,0,0.1);
            --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
            --radius: 8px;
            --transition: 0.2s ease;
            --canvas-bg: #FAFAFA;
        }

        html.dark {
            --bg-color: #121212;
            --surface-color: #1E1E1E;
            --text-color: #E0E0E0;
            --text-secondary: #9E9E9E;
            --primary: #00BFA5;
            --primary-hover: #1DE9B6;
            --primary-light: #1A3A34;
            --accent: #FFCA28;
            --accent-light: #5D4037;
            --button-bg: #333333;
            --button-hover: #424242;
            --button-active: #00BFA5;
            --button-active-text: #121212;
            --peg-color: #8D6E63;
            --base-color: #6D4C41;
            --shadow: 0 2px 8px rgba(0,0,0,0.3);
            --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
            --canvas-bg: #1A1A1A;
        }

        *, *::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: 500px;
            flex: 1;
            padding: 8px 12px 12px;
            display: flex;
            flex-direction: column;
            align-items: center;
            overflow: hidden;
        }

        /* ---------- Header ---------- */
        header {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;
        }
        .header-brand {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .header-logo {
            height: 36px;
            width: auto;
            flex-shrink: 0;
        }
        .header-text h1 {
            font-size: 22px;
            font-weight: 700;
            line-height: 1.1;
            color: var(--text-color);
        }
        .header-text .publisher {
            font-size: 10px;
            color: var(--text-secondary);
            font-weight: 500;
            letter-spacing: 0.5px;
        }
        .header-right {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .btn-icon {
            width: 40px;
            height: 40px;
            border: none;
            border-radius: 50%;
            background: var(--button-bg);
            color: inherit;
            font-size: 20px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background var(--transition);
        }
        .btn-icon:hover { background: var(--button-hover); }
        .btn-icon:active { background: var(--button-active); color: var(--button-active-text); }

        /* ---------- Difficulty Bar ---------- */
        .difficulty-bar {
            display: flex;
            gap: 6px;
            width: 100%;
            margin-bottom: 10px;
        }
        .diff-btn {
            flex: 1;
            padding: 10px 4px;
            border: 2px solid var(--button-bg);
            border-radius: var(--radius);
            background: var(--surface-color);
            color: var(--text-color);
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            text-align: center;
            transition: all var(--transition);
        }
        .diff-btn.active {
            background: var(--primary);
            color: var(--button-active-text);
            border-color: var(--primary);
        }
        .diff-btn:hover:not(.active) {
            border-color: var(--primary);
            background: var(--primary-light);
        }

        /* ---------- Status Row ---------- */
        .status-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
            min-height: 22px;
            width: 100%;
        }
        .status-item {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        .status-value {
            font-size: 14px;
            font-weight: 700;
            color: var(--primary);
        }
        .status-label {
            font-size: 13px;
            color: var(--text-secondary);
        }

        /* ---------- Game Area ---------- */
        .game-area {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 6px 8px;
            position: relative;
        }
        #gameCanvas {
            display: block;
            border-radius: var(--radius);
            background: var(--canvas-bg);
            box-shadow: var(--shadow);
            touch-action: none;
            cursor: pointer;
            max-width: 100%;
            height: 38vh;
            max-height: 50vh;
        }

        /* ---------- Controls ---------- */
        .controls-bar {
            display: flex;
            justify-content: center;
            gap: 6px;
            margin-bottom: 8px;
        }
        .ctrl-btn {
            flex: 1;
            padding: 10px 4px;
            border: 2px solid var(--button-bg);
            border-radius: 8px;
            background: transparent;
            color: var(--text-color);
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            text-align: center;
            transition: all var(--transition);
        }
        .ctrl-btn:hover { border-color: var(--primary); background: var(--primary-light); }
        .ctrl-btn:active { background: var(--primary); color: #FFF; }
        .ctrl-btn:disabled { opacity: 0.4; cursor: not-allowed; }


        /* ---------- Overlays ----------
           RULE: All overlays/dialogs MUST use:
           - position: fixed; inset: 0;
           - display: flex; align-items: center; justify-content: center;
           - This ensures every dialog is dead-center on screen. */
        .overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 100;
        }
        .overlay.hidden { display: none; }

        .modal {
            background: var(--surface-color);
            border-radius: 12px;
            padding: 30px;
            text-align: center;
            max-width: 340px;
            width: 90%;
            box-shadow: var(--shadow);
        }
        .modal h2 {
            font-size: 24px;
            margin-bottom: 8px;
            color: var(--text-color);
        }
        .modal p {
            font-size: 15px;
            color: var(--text-secondary);
            margin-bottom: 20px;
        }
        .modal button {
            padding: 12px 32px;
            border: none;
            border-radius: 8px;
            background: var(--primary);
            color: var(--button-active-text);
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: background var(--transition);
        }
        .modal button:hover { background: var(--primary-hover); }

        /* ---------- Celebration ---------- */
        .celebration-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.7);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 300;
            overflow: hidden;
        }
        .celebration-overlay.hidden { display: none; }
        .celebration-card {
            background: var(--surface-color);
            border-radius: 20px;
            padding: 40px 32px;
            text-align: center;
            max-width: 400px;
            width: 90%;
            box-shadow: 0 16px 48px rgba(0,0,0,0.3);
            z-index: 1;
            animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }
        @keyframes popIn {
            0% { transform: scale(0.3); opacity: 0; }
            100% { transform: scale(1); opacity: 1; }
        }
        .celebration-card .trophy {
            font-size: 64px;
            animation: bounce 1s ease-in-out infinite;
        }
        .celebration-card .trophy img {
            width: 140px;
            height: 140px;
            border-radius: 18px;
            object-fit: cover;
            display: block;
            margin: 0 auto;
        }
        @keyframes bounce {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-12px); }
        }
        .celebration-card h2 {
            font-size: 32px;
            margin: 12px 0 8px;
            color: var(--primary);
        }
        .celebration-card .stats-row {
            display: flex;
            justify-content: space-around;
            margin: 16px 0;
        }
        .celebration-card .stat .val {
            font-size: 28px;
            font-weight: 700;
            color: var(--accent);
        }
        .celebration-card .stat .lbl {
            font-size: 12px;
            color: var(--text-secondary);
        }
        .celebration-card button {
            padding: 14px 40px;
            border: none;
            border-radius: 30px;
            background: var(--primary);
            color: var(--button-active-text);
            font-size: 18px;
            font-weight: 700;
            cursor: pointer;
            margin-top: 8px;
            transition: background var(--transition), transform 0.2s;
        }
        .celebration-card button:hover { background: var(--primary-hover); transform: scale(1.05); }

        /* ---------- Confetti ---------- */
        .confetti-container {
            position: fixed;
            inset: 0;
            pointer-events: none;
            z-index: 201;
            overflow: hidden;
        }
        .confetti-piece {
            position: absolute;
            width: 10px;
            height: 10px;
            border-radius: 2px;
            animation: confettiFall linear forwards;
        }
        @keyframes confettiFall {
            0% { transform: translateY(-10vh) 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;
        }
        .settings-overlay.hidden { display: none; }
        .settings-modal {
            background: var(--surface-color);
            border-radius: 12px;
            padding: 24px;
            max-width: 380px;
            width: 90%;
            max-height: 85vh;
            overflow-y: auto;
            box-shadow: var(--shadow);
        }
        .settings-modal h2 {
            font-size: 22px;
            margin-bottom: 16px;
            text-align: center;
            color: var(--text-color);
        }
        .settings-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 0;
            border-bottom: 1px solid var(--button-bg);
        }
        .settings-row:last-of-type { border-bottom: none; }
        .settings-label {
            font-size: 15px;
            color: var(--text-color);
            font-weight: 500;
        }
        .toggle-switch {
            position: relative;
            width: 48px;
            height: 26px;
            display: inline-block;
        }
        .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: background var(--transition);
        }
        .toggle-slider::before {
            content: '';
            position: absolute;
            height: 20px;
            width: 20px;
            left: 3px;
            bottom: 3px;
            background: white;
            border-radius: 50%;
            transition: transform 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;
            width: 100%;
            margin-top: 16px;
            padding: 12px;
            border: none;
            border-radius: 8px;
            background: var(--primary);
            color: var(--button-active-text);
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: background var(--transition);
        }
        .settings-close-btn:hover { background: var(--primary-hover); }
        .settings-branding {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding-top: 14px;
            margin-top: 8px;
            border-top: 1px solid var(--button-bg);
        }
        .settings-branding img { width: 22px; height: 22px; }
        .settings-branding span { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

        /* ---------- Splash Screen ---------- */
        .splash-screen {
            position: absolute;
            inset: 0;
            background: var(--bg-color);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 999;
            transition: opacity 0.5s ease;
        }
        .splash-screen.fade-out {
            opacity: 0;
            pointer-events: none;
        }
        .splash-screen.hidden { display: none; }
        .splash-logo {
            width: 180px;
            height: auto;
            margin-bottom: 12px;
            animation: splashPulse 2s ease-in-out infinite;
        }
        .splash-logo + .splash-logo {
            width: 140px;
        }
        @keyframes splashPulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.05); }
        }
        .splash-title {
            font-size: 24px;
            font-weight: 700;
            color: var(--text-color);
            letter-spacing: 1px;
            margin-bottom: 4px;
        }
        .splash-subtitle {
            font-size: 13px;
            color: var(--text-secondary);
            margin-bottom: 12px;
        }
        .splash-publisher {
            margin-top: 8px;
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 14px;
            color: var(--text-secondary);
        }
        .splash-publisher img { width: 32px; height: 32px; }
        .splash-copyright {
            position: absolute;
            bottom: 20px;
            font-size: 11px;
            color: var(--text-secondary);
        }

        /* ---------- Responsive ---------- */
        @media (max-width: 380px) {
            .difficulty-bar { gap: 3px; }
            .diff-btn { font-size: 11px; padding: 6px 2px; }
            .ctrl-btn { font-size: 11px; padding: 8px 2px; }
            .splash-logo { width: 140px; }
            .splash-title { font-size: 24px; }
        }
