/* ============================================
       Guess the Price — Quiz
       ============================================ */

        :root {
            --background: #f8fafc;
            --foreground: #0f172a;
            --text-secondary: #475569;
            --card: #ffffff;
            --card-foreground: #0f172a;
            --popover: #ffffff;
            --popover-foreground: #0f172a;
            --primary: #2563eb;
            --primary-dark: #1d4ed8;
            --primary-light: #3b82f6;
            --primary-glow: rgba(37, 99, 235, 0.2);
            --secondary: #64748b;
            --secondary-foreground: #ffffff;
            --muted: #f1f5f9;
            --muted-foreground: #64748b;
            --accent: #dc2626;
            --accent-foreground: #ffffff;
            --destructive: #dc2626;
            --destructive-foreground: #ffffff;
            --border: #e2e8f0;
            --input: #ffffff;
            --ring: #2563eb;
            --radius: 0.75rem;
            --radius-lg: 1rem;
            --radius-pill: 9999px;
            --correct: #059669;
            --correct-dark: #047857;
            --present: #eab308;
            --absent: #94a3b8;
            --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
            --shadow-md:
                0 4px 6px -1px rgb(0 0 0 / 0.07),
                0 2px 4px -2px rgb(0 0 0 / 0.06);
            --shadow-lg:
                0 10px 25px -3px rgb(0 0 0 / 0.08),
                0 4px 6px -4px rgb(0 0 0 / 0.05);
            --shadow-xl: 0 20px 40px -8px rgb(0 0 0 / 0.12);
            --shadow-glow: 0 0 20px var(--primary-glow);
            --waffle-bg: #f8fafc;
            --waffle-bg-solid: #f8fafc;
            --waffle-bg-pattern: #f1f5f9;
            --waffle-board-bg: #ffffff;
            --waffle-btn-bg: #ffffff;
            --waffle-btn-border: #e2e8f0;
            --waffle-btn-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
            --card-accent: #2563eb;
            --title-gradient: linear-gradient(
                135deg,
                #0f172a 0%,
                #2563eb 50%,
                #1d4ed8 100%
            );
            --game-card-bg: linear-gradient(
                165deg,
                #ffffff 0%,
                #f8fafc 35%,
                #f1f5f9 70%,
                #e2e8f0 100%
            );
            --game-card-edge: linear-gradient(
                135deg,
                rgba(37, 99, 235, 0.06) 0%,
                transparent 50%,
                rgba(29, 78, 216, 0.04) 100%
            );
            --game-card-pattern: radial-gradient(
                circle at 20% 30%,
                rgba(37, 99, 235, 0.04) 0%,
                transparent 50%
            );
        }

        [data-theme="dark"] {
            --background: #0c0f1a;
            --foreground: #f1f5f9;
            --text-secondary: #94a3b8;
            --card: #1e293b;
            --card-foreground: #f1f5f9;
            --popover: #1e293b;
            --popover-foreground: #f1f5f9;
            --primary: #3b82f6;
            --primary-dark: #2563eb;
            --primary-light: #60a5fa;
            --primary-glow: rgba(59, 130, 246, 0.25);
            --secondary: #94a3b8;
            --muted: #334155;
            --muted-foreground: #94a3b8;
            --accent: #ef4444;
            --border: #334155;
            --input: #1e293b;
            --correct: #10b981;
            --correct-dark: #059669;
            --absent: #64748b;
            --waffle-bg: #0c0f1a;
            --waffle-bg-solid: #0c0f1a;
            --waffle-bg-pattern: #1e293b;
            --card-accent: #3b82f6;
            --waffle-board-bg: #1e293b;
            --waffle-btn-bg: #334155;
            --waffle-btn-border: #475569;
            --waffle-btn-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
            --title-gradient: linear-gradient(
                135deg,
                #f1f5f9 0%,
                #60a5fa 50%,
                #3b82f6 100%
            );
            --game-card-bg: linear-gradient(
                165deg,
                #1e293b 0%,
                #172033 40%,
                #0f172a 75%,
                #0c0f1a 100%
            );
            --game-card-edge: linear-gradient(
                135deg,
                rgba(59, 130, 246, 0.08) 0%,
                transparent 50%,
                rgba(37, 99, 235, 0.05) 100%
            );
            --game-card-pattern: radial-gradient(
                ellipse 80% 50% at 70% 20%,
                rgba(59, 130, 246, 0.06) 0%,
                transparent 50%
            );
        }

        *,
        *::before,
        *::after {
            box-sizing: border-box;
            margin: 0;
        }

        .quiz-wrapper {
            font-family:
                "Inter",
                system-ui,
                -apple-system,
                sans-serif;
            margin: 0;
            padding: 0;
            background: var(--waffle-bg-solid);
            color: var(--foreground);
            transition:
                background 0.35s ease,
                color 0.35s ease;
            min-height: 100vh;
            line-height: 1.6;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        /* Subtle dot pattern background */
        .quiz-wrapper::after {
            content: "";
            position: fixed;
            inset: 0;
            background-image: radial-gradient(
                circle,
                var(--border) 1px,
                transparent 1px
            );
            background-size: 24px 24px;
            opacity: 0.4;
            pointer-events: none;
            z-index: 0;
        }

        /* Layout: grid; sidebar on right from 768px up */
        .quiz-main {
            position: relative;
            z-index: 1;
            max-width: 1200px;
            margin: 0 auto;
            padding: 2rem 1.5rem;
            display: grid;
            gap: 2rem;
            grid-template-columns: minmax(0, 1fr);
            align-items: start;
        }

        .quiz-game-area {
            display: flex;
            flex-direction: column;
            align-items: stretch;
            gap: 0;
            width: 100%;
            max-width: 100%;
            min-width: 0;
            margin: 0 auto;
            overflow: visible;
        }

        .quiz-game-area .quiz-game-card {
            width: 100%;
            max-width: 100%;
            min-width: 0;
            background: var(--game-card-bg);
            border-radius: calc(var(--radius) * 2);
            padding: 2rem;
            box-shadow: var(--shadow-lg);
            border: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1.75rem;
            overflow: visible;
            position: relative;
        }
        .quiz-game-area .quiz-game-card::before {
            content: "";
            position: absolute;
            inset: 0;
            border-radius: inherit;
            background: var(--game-card-edge);
            pointer-events: none;
        }
        .quiz-game-area .quiz-game-card::after {
            content: "";
            position: absolute;
            inset: 0;
            border-radius: inherit;
            background: var(--game-card-pattern);
            pointer-events: none;
        }
        .quiz-game-area .quiz-game-card > * {
            position: relative;
            z-index: 1;
        }

        .quiz-game-header {
            text-align: center;
            margin: 0;
            width: 100%;
            padding-bottom: 1.25rem;
            border-bottom: 1px solid var(--border);
            margin-bottom: 0;
        }

        .quiz-game-area .quiz-game-header .quiz-game-title {
            font-family: "DM Serif Display", serif;
            font-size: 2.5rem;
            font-weight: 400;
            margin: 0 0 0.5rem 0;
            letter-spacing: -0.02em;
            background: var(--title-gradient);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            line-height: 1.15;
        }

        .quiz-game-area .quiz-game-header .quiz-game-description {
            font-size: 0.9375rem;
            line-height: 1.6;
            margin: 0 auto 0.75rem;
            max-width: 420px;
            color: var(--text-secondary);
            font-weight: 500;
            letter-spacing: -0.01em;
        }

        .quiz-header-bar {
            display: flex;
            flex-direction: column;
            gap: 0.85rem;
            margin: 0;
            padding: 1.3rem 1.4rem;
            background: var(--muted);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            width: 100%;
            overflow: visible;
        }

        .quiz-header-row {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.9rem;
            flex-wrap: wrap;
        }

        .quiz-game-number-row {
            margin-bottom: 0.5rem;
        }
        .quiz-game-number-btn {
            background: none;
            border: none;
            padding: 0.5rem 0.75rem;
            cursor: pointer;
            font-size: 1rem;
            font-weight: 700;
            color: var(--foreground);
            letter-spacing: 0.02em;
            text-transform: uppercase;
            transition: all 0.2s ease;
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
            border-radius: var(--radius);
        }
        .quiz-game-number-btn:hover {
            color: var(--primary);
            background: color-mix(in srgb, var(--primary) 8%, transparent);
        }
        .quiz-game-number-btn .num {
            color: var(--primary);
            font-weight: 900;
            font-size: 1.3em;
        }
        .quiz-game-number-btn .dropdown-icon {
            font-size: 0.7em;
            color: var(--muted-foreground);
            transition:
                color 0.2s ease,
                transform 0.2s ease;
            margin-left: 0.1rem;
        }
        .quiz-game-number-btn:hover .dropdown-icon {
            color: var(--primary);
            transform: translateY(1px);
        }
        .quiz-guess-info {
            font-size: 1rem;
            font-weight: 700;
            color: var(--foreground);
            letter-spacing: 0.03em;
            text-transform: uppercase;
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
        }
        .quiz-guess-info .num.highlight {
            color: #ffffff;
            font-weight: 800;
            font-size: 1.2em;
            padding: 0.2em 0.45em;
            background: var(--correct);
            background: linear-gradient(
                135deg,
                var(--correct),
                var(--correct-dark)
            );
            border-radius: calc(var(--radius) * 0.6);
            box-shadow: 0 2px 6px
                color-mix(in srgb, var(--correct) 35%, transparent);
            display: inline-block;
            min-width: 1.3em;
            text-align: center;
        }

        .quiz-datalist-wrap {
            flex: 1;
            min-width: 0;
            position: relative;
            z-index: 50;
        }

        .quiz-guess-input {
            width: 100%;
            min-height: 2.75rem;
            padding: 0.625rem 1rem;
            font-size: 0.9375rem;
            font-weight: 500;
            border: 1.5px solid var(--border);
            border-radius: var(--radius);
            background: var(--input);
            color: var(--foreground);
            box-shadow: var(--shadow-sm);
            transition:
                border-color 0.2s ease,
                box-shadow 0.2s ease;
            letter-spacing: -0.01em;
        }

        .quiz-guess-input:hover {
            border-color: var(--primary-light);
        }

        .quiz-guess-input:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px var(--primary-glow);
        }

        .quiz-guess-input::placeholder {
            color: var(--muted-foreground);
            font-weight: 400;
        }

        .quiz-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            padding: 0.625rem 1.25rem;
            border-radius: var(--radius-lg);
            border: 1.5px solid var(--waffle-btn-border);
            background: var(--waffle-btn-bg);
            color: var(--foreground);
            font-weight: 600;
            font-size: 0.875rem;
            letter-spacing: -0.01em;
            cursor: pointer;
            transition:
                transform 0.2s ease,
                box-shadow 0.2s ease,
                border-color 0.2s ease,
                background 0.2s ease;
            font-family: inherit;
            min-height: 2.75rem;
            box-shadow: var(--shadow-sm);
        }

        .quiz-btn:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-md);
            border-color: var(--primary-light);
            color: var(--primary);
            background: var(--muted);
        }

        .quiz-btn.primary {
            background: linear-gradient(
                135deg,
                var(--primary) 0%,
                var(--primary-dark) 100%
            );
            color: #ffffff;
            border-color: var(--primary-dark);
            box-shadow: 0 4px 14px var(--primary-glow);
        }

        .quiz-btn.primary:hover {
            background: linear-gradient(
                135deg,
                var(--primary-light) 0%,
                var(--primary) 100%
            );
            border-color: var(--primary);
            box-shadow: 0 6px 20px var(--primary-glow);
            transform: translateY(-2px);
            color: #ffffff;
        }

        .quiz-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

        .quiz-grid-wrap {
            width: 100%;
            min-width: 0;
            overflow-x: auto;
            position: relative;
            z-index: 0;
        }

        .quiz-grid-header {
            display: grid;
            grid-template-columns: 1.2fr 0.8fr 1fr 1fr 0.7fr 0.9fr;
            gap: 6px;
            margin-bottom: 8px;
            padding: 0 2px 8px;
            font-size: 0.6875rem;
            font-weight: 700;
            color: var(--muted-foreground);
            text-transform: uppercase;
            letter-spacing: 0.06em;
            border-bottom: 1px solid var(--border);
        }

        .quiz-guess-row {
            display: grid;
            grid-template-columns: 1.2fr 0.8fr 1fr 1fr 0.7fr 0.9fr;
            gap: 6px;
            margin-bottom: 6px;
        }

        .quiz-tile {
            padding: 0.6rem 0.4rem;
            font-size: 0.75rem;
            font-weight: 600;
            border-radius: calc(var(--radius) * 0.75);
            background: var(--muted);
            border: 1.5px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            word-break: break-word;
            transition: all 0.25s ease;
            letter-spacing: -0.01em;
            color: var(--foreground);
        }

        .quiz-tile.correct {
            background: var(--correct);
            color: #ffffff;
            border-color: var(--correct-dark);
            box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
        }

        .quiz-tile.absent {
            background: var(--absent);
            color: #ffffff;
            border-color: transparent;
        }

        .quiz-tile.experience-up::after {
            content: " \2191";
            opacity: 0.85;
        }
        .quiz-tile.experience-down::after {
            content: " \2193";
            opacity: 0.85;
        }

        #quizPlayerList {
            position: absolute;
            left: 0;
            right: 0;
            top: 100%;
            margin-top: 4px;
            max-height: min(420px, 65vh);
            overflow-y: auto;
            overflow-x: hidden;
            background: var(--popover);
            border: 1.5px solid var(--border);
            border-radius: var(--radius);
            z-index: 100;
            list-style: none;
            padding: 0.25rem;
            margin: 0;
            box-shadow: var(--shadow-xl);
            min-width: 100%;
            box-sizing: border-box;
        }

        #quizPlayerList li {
            padding: 0.6rem 0.875rem;
            cursor: pointer;
            font-size: 0.875rem;
            font-weight: 500;
            color: var(--foreground);
            border-radius: calc(var(--radius) * 0.6);
            border-left: none;
            transition: background 0.12s ease;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
        }

        #quizPlayerList li .player-name {
            flex: 1;
        }

        #quizPlayerList li .player-meta {
            font-size: 0.6875rem;
            font-weight: 600;
            color: var(--muted-foreground);
            background: var(--muted);
            padding: 0.15rem 0.5rem;
            border-radius: calc(var(--radius) * 0.5);
            letter-spacing: 0.02em;
            flex-shrink: 0;
            max-width: 45%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        #quizPlayerList li:hover,
        #quizPlayerList li.selected {
            background: var(--muted);
            border-left-color: transparent;
        }

        .quiz-sidebar {
            background: var(--waffle-board-bg);
            border-radius: calc(var(--radius) * 2);
            padding: 1.5rem;
            box-shadow: var(--shadow-md);
            border: 1px solid var(--border);
            width: 100%;
            max-width: 100%;
            min-width: min(100%, 380px);
            display: flex;
            flex-direction: column;
            gap: 1.25rem;
        }

        .quiz-sidebar-section {
            background: var(--muted);
            border-radius: var(--radius);
            padding: 1.15rem 1.2rem;
            border: 1px solid var(--border);
        }

        .quiz-sidebar-section h3 {
            font-family: "DM Serif Display", serif;
            font-size: 1rem;
            font-weight: 400;
            margin: 0 0 0.625rem 0;
            color: var(--foreground);
            padding-bottom: 0;
            border-bottom: none;
            display: block;
        }

        .quiz-sidebar-how-text {
            font-size: 0.8125rem;
            color: var(--muted-foreground);
            line-height: 1.55;
            margin: 0 0 0.5rem 0;
            font-weight: 400;
        }

        .quiz-color-legend {
            display: flex;
            flex-direction: column;
            gap: 0.625rem;
        }
        .quiz-legend-item {
            display: flex;
            align-items: flex-start;
            gap: 0.625rem;
        }
        .quiz-legend-color {
            width: 20px;
            height: 20px;
            border-radius: calc(var(--radius) * 0.5);
            flex-shrink: 0;
        }
        .quiz-legend-color.correct {
            background: var(--correct);
            border: none;
        }
        .quiz-legend-color.absent {
            background: var(--absent);
            border: none;
        }
        .quiz-legend-text {
            font-size: 0.8125rem;
            font-weight: 600;
            color: var(--foreground);
        }
        .quiz-legend-description {
            font-size: 0.75rem;
            color: var(--muted-foreground);
            margin: 0.15rem 0 0 0;
            line-height: 1.4;
        }

        .quiz-sidebar-actions {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            flex-wrap: wrap;
        }

        .quiz-sidebar-actions .quiz-btn {
            background: var(--waffle-btn-bg);
            border: 1.5px solid var(--border);
            color: var(--foreground);
            font-weight: 600;
            font-size: 0.8125rem;
            padding: 0.5rem 0.875rem;
            border-radius: var(--radius);
            box-shadow: var(--shadow-sm);
        }

        .quiz-sidebar-actions .quiz-btn:hover {
            border-color: var(--primary);
            color: var(--primary);
            background: var(--muted);
        }

        .quiz-theme-toggle {
            font-size: 1.1rem;
            cursor: pointer;
            min-width: 2.5rem;
            min-height: 2.5rem;
            padding: 0.4rem;
            border: 1.5px solid var(--border);
            border-radius: var(--radius);
            background: var(--waffle-btn-bg);
            transition: all 0.15s ease;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .quiz-theme-toggle:hover {
            border-color: var(--primary);
            background: var(--muted);
        }

        .quiz-btn-link {
            background: transparent;
            border: none;
            color: var(--primary);
            text-decoration: none;
            padding: 0.2rem 0;
            font-size: 0.8125rem;
            font-weight: 600;
            cursor: pointer;
            font-family: inherit;
            transition: opacity 0.15s ease;
        }

        .quiz-btn-link:hover {
            opacity: 0.7;
            text-decoration: underline;
        }
        .quiz-btn-past {
            font-size: 0.8125rem;
            padding: 0.4rem 0.75rem;
        }
        .quiz-btn-wide {
            min-width: 120px;
        }

        #todayPuzzleBtn.quiz-btn-today {
            padding: 0.4rem 0.9rem;
            border-radius: 999px;
            background: linear-gradient(135deg, #3b82f6, #8b5cf6);
            color: #ffffff;
            font-weight: 600;
            box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
        }

        #todayPuzzleBtn.quiz-btn-today:hover {
            background: linear-gradient(135deg, #2563eb, #7c3aed);
            transform: translateY(-1px);
        }
        .quiz-past-puzzle-desc {
            color: var(--muted-foreground);
            font-size: 0.875rem;
            margin: 0 0 0.5rem 0;
        }
        .quiz-past-puzzle-your-date {
            font-size: 0.8125rem;
            color: var(--muted-foreground);
            margin: 0 0 1rem 0;
        }
        .quiz-past-puzzle-your-date strong {
            color: var(--foreground);
        }
        .quiz-past-puzzle-row {
            margin-bottom: 1rem;
        }
        .quiz-past-puzzle-row label {
            display: block;
            font-weight: 600;
            margin-bottom: 0.35rem;
        }
        .quiz-past-puzzle-calendar {
            background: var(--muted);
            border-radius: var(--radius);
            padding: 0.75rem;
            border: 1px solid var(--border);
        }
        .quiz-cal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 0.5rem;
            font-weight: 700;
            font-size: 0.9375rem;
            flex-wrap: wrap;
            gap: 0.35rem;
        }
        .quiz-cal-month-year-row {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            flex-wrap: wrap;
        }
        .quiz-cal-month-btn {
            padding: 0.35rem 0.6rem;
            border: 1px solid var(--border);
            border-radius: 4px;
            background: var(--card);
            cursor: pointer;
            font-size: 0.9375rem;
            font-weight: 700;
        }
        .quiz-cal-month-btn:hover {
            background: var(--border);
        }
        .quiz-cal-year-select {
            padding: 0.35rem 0.5rem;
            border: 1px solid var(--border);
            border-radius: 4px;
            background: var(--card);
            font-size: 0.9375rem;
            font-weight: 600;
            cursor: pointer;
            color: var(--foreground);
        }
        .quiz-cal-month-list {
            display: none;
            position: absolute;
            top: 100%;
            left: 0;
            margin-top: 2px;
            background: var(--popover);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            box-shadow: var(--shadow-lg);
            z-index: 10;
            padding: 0.35rem;
            grid-template-columns: repeat(3, 1fr);
            gap: 2px;
        }
        .quiz-cal-month-list.open {
            display: grid;
        }
        .quiz-cal-month-list button {
            padding: 0.4rem 0.5rem;
            border: none;
            border-radius: 4px;
            background: transparent;
            cursor: pointer;
            font-size: 0.8125rem;
            font-weight: 500;
            text-align: left;
        }
        .quiz-cal-month-list button:hover {
            background: var(--muted);
        }
        .quiz-cal-month-wrap {
            position: relative;
        }
        .quiz-cal-nav {
            display: flex;
            gap: 0.25rem;
        }
        .quiz-cal-nav button {
            padding: 0.25rem 0.5rem;
            border: 1px solid var(--border);
            border-radius: 4px;
            background: var(--card);
            cursor: pointer;
            font-size: 0.875rem;
        }
        .quiz-cal-nav button:hover {
            background: var(--border);
        }
        .quiz-cal-weekdays {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            gap: 2px;
            margin-bottom: 4px;
            font-size: 0.6875rem;
            font-weight: 600;
            color: var(--muted-foreground);
            text-align: center;
        }
        .quiz-cal-grid {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            gap: 2px;
        }
        .quiz-cal-day {
            aspect-ratio: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.8125rem;
            font-weight: 500;
            border-radius: 4px;
            cursor: pointer;
        }
        .quiz-cal-day:hover {
            background: var(--border);
        }
        .quiz-cal-day.selected {
            background: var(--primary);
            color: var(--primary-foreground);
        }
        .quiz-cal-day.other-month {
            color: var(--muted-foreground);
            opacity: 0.6;
        }
        .quiz-cal-day.future {
            opacity: 0.35;
            cursor: not-allowed;
            pointer-events: none;
        }
        .quiz-cal-day.future:hover {
            background: none;
        }
        .quiz-cal-selected-label {
            font-size: 0.8125rem;
            color: var(--muted-foreground);
            margin-top: 0.5rem;
        }
        .quiz-past-puzzle-actions {
            display: flex;
            gap: 0.75rem;
            flex-wrap: wrap;
            margin-top: 1rem;
        }
        .quiz-dialog-close-btn {
            position: absolute;
            top: 1rem;
            right: 1rem;
            width: 2rem;
            height: 2rem;
            border: none;
            background: transparent;
            color: var(--muted-foreground);
            font-size: 1.5rem;
            font-weight: 300;
            line-height: 1;
            cursor: pointer;
            border-radius: var(--radius);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            z-index: 10;
            padding: 0;
        }
        .quiz-dialog-close-btn:hover {
            background: var(--muted);
            color: var(--foreground);
        }
        .quiz-dialog-close-btn:active {
            transform: scale(0.95);
        }
        .quiz-btn-hint {
            background: linear-gradient(135deg, #fbbf24, #f59e0b);
            color: #ffffff;
            font-weight: 600;
        }
        .quiz-btn-hint:hover {
            background: linear-gradient(135deg, #f59e0b, #d97706);
            transform: translateY(-1px);
        }
        .quiz-hint-content {
            margin: 1.5rem 0;
        }
        .quiz-hint-text {
            font-size: 1.125rem;
            line-height: 1.6;
            color: var(--foreground);
            padding: 1.25rem;
            background: var(--muted);
            border-radius: var(--radius);
            border-left: 4px solid #fbbf24;
            margin: 0 0 1rem 0;
            font-weight: 500;
        }
        .quiz-hint-list {
            margin: 1rem 0;
        }
        .quiz-hint-item {
            font-size: 1rem;
            line-height: 1.7;
            color: var(--foreground);
            padding: 1rem 1.25rem;
            background: var(--muted);
            border-radius: var(--radius);
            margin-bottom: 0.75rem;
            border-left: 4px solid #fbbf24;
            display: flex;
            align-items: flex-start;
            gap: 0.75rem;
        }
        .quiz-hint-item::before {
            content: "•";
            font-size: 1.5rem;
            color: #fbbf24;
            font-weight: bold;
            line-height: 1;
            margin-top: 0.1rem;
        }
        .quiz-hint-item.hidden {
            display: none;
        }
        .quiz-hint-levels {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            flex-wrap: wrap;
        }
        .quiz-hint-info {
            font-size: 0.875rem;
            color: var(--muted-foreground);
            margin: 0;
        }
        .quiz-hint-info span {
            font-weight: 700;
            color: var(--primary);
        }
        .quiz-game-numbers-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
            gap: 0.5rem;
            max-height: 300px;
            overflow-y: auto;
            padding: 0.5rem;
            border: 1.5px solid var(--border);
            border-radius: var(--radius);
            background: var(--input);
        }
        .quiz-game-number-item {
            padding: 0.5rem;
            text-align: center;
            border: 1.5px solid var(--border);
            border-radius: var(--radius);
            background: var(--card);
            cursor: pointer;
            transition: all 0.2s ease;
            font-weight: 600;
            color: var(--foreground);
        }
        .quiz-game-number-item:hover {
            background: var(--primary);
            color: var(--primary-foreground);
            border-color: var(--primary);
            transform: translateY(-1px);
        }
        .quiz-game-number-item.selected {
            background: var(--primary);
            color: var(--primary-foreground);
            border-color: var(--primary);
            box-shadow: 0 0 0 2px var(--primary);
        }
        .quiz-game-number-item.disabled {
            opacity: 0.4;
            cursor: not-allowed;
            background: var(--muted);
        }

        .quiz-color-legend {
            display: flex;
            flex-direction: column;
            gap: 0.625rem;
        }

        .quiz-legend-item {
            display: flex;
            align-items: flex-start;
            gap: 0.625rem;
        }

        .quiz-legend-color {
            width: 20px;
            height: 20px;
            border-radius: calc(var(--radius) * 0.5);
            flex-shrink: 0;
        }

        .quiz-legend-color.correct {
            background: var(--correct);
            border: none;
        }
        .quiz-legend-color.absent {
            background: var(--absent);
            border: none;
        }

        .quiz-legend-text {
            font-size: 0.8125rem;
            font-weight: 600;
            color: var(--foreground);
        }

        .quiz-legend-description {
            font-size: 0.75rem;
            color: var(--muted-foreground);
            margin: 0.15rem 0 0 0;
            line-height: 1.4;
        }

        /* Toast notifications */
        .quiz-toast {
            position: fixed;
            top: 1.25rem;
            left: 50%;
            transform: translateX(-50%) translateY(-12px);
            min-height: 2.5rem;
            background: var(--popover);
            color: var(--popover-foreground);
            padding: 0.75rem 1.25rem;
            border-radius: var(--radius);
            border: 1px solid var(--border);
            font-weight: 600;
            text-align: center;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            opacity: 0;
            box-shadow: var(--shadow-xl);
            z-index: 1000;
            max-width: 90vw;
            font-size: 0.875rem;
            letter-spacing: -0.01em;
        }

        .quiz-toast.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
        .quiz-toast.success {
            background: var(--correct);
            color: #ffffff;
            border-color: var(--correct-dark);
        }
        .quiz-toast.error {
            background: var(--destructive);
            color: #ffffff;
            border-color: var(--destructive);
        }
        .quiz-toast.info {
            background: var(--primary);
            color: #ffffff;
            border-color: var(--primary-dark);
        }

        .quiz-stats-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 0.7rem 0.75rem;
        }

        .quiz-stat-card {
            text-align: center;
            padding: 1rem 0.75rem;
            background: var(--card);
            border-radius: var(--radius-lg);
            border: 1px solid var(--border);
            box-shadow: var(--shadow-sm);
            transition:
                box-shadow 0.2s ease,
                border-color 0.2s ease;
        }

        .quiz-stat-card:hover {
            box-shadow: var(--shadow-md);
            border-color: var(--primary-light);
        }

        .quiz-stat-number {
            font-size: 1.35rem;
            font-weight: 800;
            color: var(--primary);
            margin: 0;
            line-height: 1.2;
        }

        .quiz-stat-label {
            font-size: 0.6875rem;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.06em;
            margin: 0.35rem 0 0 0;
            font-weight: 600;
        }

        .quiz-next-game-timer {
            margin-top: 1.1rem;
            padding: 0.8rem 0.9rem;
            border-radius: var(--radius);
            background: linear-gradient(
                135deg,
                rgba(59, 130, 246, 0.06),
                rgba(56, 189, 248, 0.08)
            );
            border: 1px solid rgba(59, 130, 246, 0.25);
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.8rem;
            color: var(--muted-foreground);
        }

        .quiz-next-game-label {
            font-weight: 600;
        }

        .quiz-next-game-value {
            font-family:
                ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
                "Liberation Mono", "Courier New", monospace;
            font-weight: 700;
            color: var(--primary);
        }

        .quiz-next-game-banner {
            margin-top: 0.75rem;
            padding: 0.6rem 0.75rem;
            border-radius: var(--radius);
            background: linear-gradient(
                135deg,
                rgba(59, 130, 246, 0.06),
                rgba(56, 189, 248, 0.08)
            );
            border: 1px solid rgba(59, 130, 246, 0.25);
            display: flex;
            flex-wrap: wrap;
            gap: 0.4rem 0.75rem;
            align-items: center;
            font-size: 0.8rem;
            color: var(--muted-foreground);
        }

        .quiz-next-game-banner .quiz-next-game-extra {
            flex-basis: 100%;
        }

        @keyframes confettiFall {
            0% {
                transform: translate3d(0, 0, 0) rotate(0deg);
                opacity: 1;
            }
            100% {
                transform: translate3d(var(--dx, 0), 120vh, 0)
                    rotate(720deg);
                opacity: 0.6;
            }
        }
        @keyframes resultCelebrate {
            0% {
                box-shadow:
                    0 0 0 0 rgba(37, 99, 235, 0.45),
                    var(--shadow-xl);
            }
            50% {
                box-shadow:
                    0 0 0 14px rgba(37, 99, 235, 0),
                    var(--shadow-xl);
            }
            100% {
                box-shadow:
                    0 0 0 0 rgba(37, 99, 235, 0),
                    var(--shadow-xl);
            }
        }

        #quizConfetti {
            position: fixed;
            inset: 0;
            pointer-events: none;
            overflow: hidden;
            z-index: 45;
        }

        .quiz-confetti-piece {
            position: absolute;
            top: -15vh;
            width: 8px;
            height: 12px;
            opacity: 0.95;
            will-change: transform;
            animation: confettiFall 3.2s ease-out forwards;
        }
        @media (min-width: 600px) {
            .quiz-confetti-piece {
                width: 10px;
                height: 16px;
            }
        }
        @media (prefers-reduced-motion: reduce) {
            .quiz-confetti-piece {
                animation: none;
                opacity: 0;
            }
            .quiz-modal-overlay.show .quiz-modal {
                animation: none;
            }
        }

        /* Modal overlay – hidden until .show */
        .quiz-modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 50;
            padding: 1rem;
        }

        .quiz-modal {
            background: var(--popover);
            color: var(--popover-foreground);
            border-radius: calc(var(--radius) * 2);
            padding: 2rem;
            max-width: min(400px, 92vw);
            width: 100%;
            text-align: center;
            border: 1px solid var(--border);
            box-shadow: var(--shadow-xl);
        }

        .quiz-modal h2 {
            font-family: "DM Serif Display", serif;
            font-weight: 400;
            font-size: 1.5rem;
            margin: 0 0 0.75rem 0;
            color: var(--foreground);
            letter-spacing: -0.02em;
        }

        .quiz-modal p {
            color: var(--text-secondary);
            margin: 0 0 1.25rem 0;
            font-size: 0.9375rem;
            line-height: 1.5;
        }
        .quiz-modal button {
            font-family: inherit;
        }

        /* Dialog – centered in viewport */
        .quiz-dialog {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            margin: 0;
            border: 1px solid var(--border);
            border-radius: calc(var(--radius) * 2);
            padding: 2rem;
            max-width: 90vw;
            width: min(480px, 92vw);
            max-height: 90vh;
            overflow-y: auto;
            background: var(--popover);
            color: var(--popover-foreground);
            box-shadow: var(--shadow-xl);
        }

        .quiz-dialog::backdrop {
            background: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
        }

        .quiz-dialog h2 {
            font-family: "DM Serif Display", serif;
            font-weight: 400;
            color: var(--foreground);
            margin-top: 0;
            font-size: 1.375rem;
            letter-spacing: -0.02em;
        }

        .quiz-help-content {
            text-align: left;
            font-size: 0.875rem;
            color: var(--muted-foreground);
            line-height: 1.65;
        }
        .quiz-help-content .quiz-help-intro {
            color: var(--foreground);
            font-weight: 500;
            margin: 0 0 1rem 0;
            padding-bottom: 1rem;
            border-bottom: 1px solid var(--border);
        }
        .quiz-help-content h3 {
            color: var(--foreground);
            font-size: 0.9375rem;
            font-weight: 600;
            margin: 1.25rem 0 0.5rem;
        }
        .quiz-help-content h3:first-of-type {
            margin-top: 0;
        }
        .quiz-help-content ul {
            margin: 0.25rem 0 0.5rem 1.25rem;
        }
        .quiz-help-content p {
            margin: 0 0 0.5rem 0;
        }

        /* Sidebar on the right from 768px */
        @media (min-width: 768px) {
            .quiz-main {
                grid-template-columns: minmax(0, 1fr) 320px;
                gap: 1.5rem;
                padding: 2rem 1.5rem;
            }
            .quiz-sidebar {
                padding: 1.5rem;
            }
        }

        @media (min-width: 992px) {
            .quiz-main {
                grid-template-columns: minmax(0, 1fr) 380px;
                gap: 2rem;
                padding: 2.5rem 2rem;
            }
            .quiz-sidebar {
                position: sticky;
                top: 2rem;
                padding: 1.5rem;
                min-width: 340px;
            }
        }

        @media (max-width: 767px) {
            .quiz-main {
                padding: 1rem;
                gap: 1rem;
            }
            .quiz-game-area .quiz-game-card {
                padding: 1.25rem;
            }
            .quiz-game-area .quiz-game-header .quiz-game-title {
                font-size: 1.75rem;
            }
            .quiz-game-area .quiz-game-header .quiz-game-description {
                font-size: 0.8125rem;
            }
            .quiz-header-bar {
                padding: 0.75rem;
            }
            .quiz-header-row {
                gap: 0.5rem;
            }
            .quiz-grid-header,
            .quiz-guess-row {
                gap: 4px;
                font-size: 0.625rem;
            }
            .quiz-tile {
                padding: 0.45rem 0.3rem;
                font-size: 0.6875rem;
            }
            .quiz-sidebar {
                order: -1;
                padding: 1rem;
            }
        }

        @media (max-width: 480px) {
            .quiz-main {
                padding: 0.75rem;
            }
            .quiz-game-area .quiz-game-card {
                padding: 1rem;
                gap: 1.25rem;
            }
            .quiz-game-area .quiz-game-header .quiz-game-title {
                font-size: 1.375rem;
            }
            .quiz-game-area .quiz-game-header .quiz-game-description {
                font-size: 0.75rem;
            }
            .quiz-btn {
                padding: 0.5rem 0.75rem;
                font-size: 0.8125rem;
            }
            .quiz-guess-input {
                font-size: 0.875rem;
            }
            .quiz-grid-header,
            .quiz-guess-row {
                grid-template-columns: 1.1fr 0.7fr 0.9fr 0.9fr 0.6fr 0.7fr;
                gap: 3px;
            }
            .quiz-tile {
                padding: 0.35rem 0.25rem;
                font-size: 0.625rem;
            }
            .quiz-sidebar {
                padding: 0.875rem;
            }
            .quiz-toast {
                font-size: 0.75rem;
                padding: 0.6rem 0.875rem;
                max-width: 95vw;
            }
            .quiz-modal {
                padding: 1.25rem;
            }
        }

        @media (max-width: 400px) {
            .quiz-header-row {
                flex-direction: column;
                align-items: stretch;
            }
            .quiz-datalist-wrap {
                min-width: 0;
            }
        }

        @media (max-width: 375px) {
            .quiz-game-area .quiz-game-header .quiz-game-title {
                font-size: 1.25rem;
            }
            .quiz-game-area .quiz-game-card {
                padding: 0.875rem;
            }
            .quiz-btn {
                padding: 0.45rem 0.65rem;
                font-size: 0.75rem;
            }
            .quiz-sidebar {
                padding: 0.75rem;
            }
        }

        @media (prefers-reduced-motion: reduce) {
            *,
            *::before,
            *::after {
                transition-duration: 0.01ms !important;
            }
            .quiz-play-area.visible,
            .quiz-play-area.visible .quiz-timer-bar,
            .quiz-play-area.visible .quiz-question-num,
            .quiz-play-area.visible .quiz-question-prompt,
            .quiz-play-area.visible .quiz-choices,
            .quiz-play-area.visible .quiz-score-bar,
            .quiz-choice-btn,
            .quiz-play-area-bg,
            .quiz-play-area-bg.quiz-bg-zoom,
            .quiz-modal-overlay.show,
            .quiz-modal-overlay .quiz-modal,
            .quiz-timer-bar .timer-value.low {
                animation: none !important;
            }
            .quiz-question-prompt .price-product-img {
                animation: none !important;
                transform: rotate(-25deg);
            }
            .quiz-choice-btn::before {
                animation: none !important;
            }
        }

        .quiz-sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }
        .quiz-btn:focus-visible,
        .quiz-guess-input:focus-visible,
        .quiz-theme-toggle:focus-visible {
            outline: 2px solid var(--ring);
            outline-offset: 2px;
        }

        /* Quiz header bar (dark) */
        .quiz-top-bar {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            padding: 0.75rem 1rem;
            background: #3f3f46;
            color: #fff;
            border-radius: var(--radius) var(--radius) 0 0;
            font-weight: 600;
            font-size: 1.125rem;
        }
        .quiz-top-bar .quiz-icons {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-left: auto;
            padding-right: 0.5rem;
        }
        .quiz-top-bar .quiz-icons button {
            background: none;
            border: none;
            color: inherit;
            cursor: pointer;
            padding: 0.25rem;
            font-size: 1.1rem;
            opacity: 0.9;
        }
        .quiz-top-bar .quiz-icons button:hover {
            opacity: 1;
        }

        .quiz-inputs-heading {
            font-size: 1.25rem;
            font-weight: 700;
            margin: 0 0 1rem 0;
            color: var(--foreground);
        }
        .quiz-region-label,
        .quiz-guess-label,
        .quiz-choices-label {
            font-weight: 700;
            font-size: 0.875rem;
            margin-bottom: 0.5rem;
            display: block;
            color: var(--foreground);
            letter-spacing: 0.02em;
        }
        /* ----- Quiz start hero (setup section) ----- */
        #quizSetupSection {
            width: 100%;
            max-width: 100%;
            position: relative;
            margin: 0 -2rem 0;
            padding: 3rem 2rem;
            border-radius: calc(var(--radius) * 2);
            overflow: hidden;
            min-height: 280px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        /* Background: images/guess_price.png – cover full width so no gaps on left/right */
        #quizSetupSection::before {
            content: "";
            position: absolute;
            inset: -4%;
            background-image: url("https://tools.xrespond.com/kh/guess_price/guess_price.png");
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            z-index: 0;
            opacity: 0.55;
            animation: heroBgZoomInOut 12s ease-in-out infinite;
        }
        #quizSetupSection::after {
            content: "";
            position: absolute;
            inset: 0;
            background: linear-gradient(
                135deg,
                rgba(15, 23, 42, 0.82) 0%,
                rgba(30, 58, 95, 0.75) 50%,
                rgba(79, 70, 229, 0.7) 100%
            );
            z-index: 1;
            pointer-events: none;
        }
        [data-theme="dark"] #quizSetupSection::after {
            background: linear-gradient(
                135deg,
                rgba(0, 0, 0, 0.78) 0%,
                rgba(30, 41, 59, 0.72) 100%
            );
        }
        @keyframes heroBgZoomInOut {
            0%,
            100% {
                transform: scale(1);
            }
            50% {
                transform: scale(1.12);
            }
        }
        .quiz-start-hero {
            position: relative;
            z-index: 2;
            text-align: center;
            width: 100%;
            max-width: 420px;
            margin: 0 auto;
        }
        .quiz-start-hero .hero-badge {
            display: inline-block;
            font-size: 0.75rem;
            font-weight: 700;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: rgba(255, 255, 255, 0.9);
            background: rgba(255, 255, 255, 0.15);
            padding: 0.4rem 0.9rem;
            border-radius: var(--radius-pill);
            margin-bottom: 1.25rem;
            animation: heroFadeIn 0.8s ease-out;
        }
        .quiz-start-hero .hero-cta-text {
            font-size: 1.125rem;
            font-weight: 500;
            color: rgba(255, 255, 255, 0.95);
            line-height: 1.5;
            margin: 0 0 1.75rem 0;
            animation: heroFadeIn 0.8s ease-out 0.15s both;
        }
        .quiz-start-hero .start-game-wrap {
            margin: 0;
            animation: heroFadeIn 0.8s ease-out 0.3s both;
        }
        .quiz-start-hero .quiz-btn-start-cta {
            position: relative;
            z-index: 1;
            min-width: 200px;
            padding: 0.875rem 1.75rem;
            font-size: 1rem;
            font-weight: 600;
            letter-spacing: 0.04em;
            border-radius: var(--radius);
            border: none;
            background: rgba(255, 255, 255, 0.95);
            color: #0f172a !important;
            cursor: pointer;
            transition:
                transform 0.2s ease,
                box-shadow 0.2s ease;
            animation: btnRgbGlow 3s linear infinite;
        }
        .quiz-start-hero .quiz-btn-start-cta:hover,
        .quiz-start-hero .quiz-btn-start-cta:focus {
            color: #0f172a !important;
        }
        .quiz-start-hero .quiz-btn-start-cta::before {
            content: "";
            position: absolute;
            inset: -3px;
            border-radius: inherit;
            background: linear-gradient(
                90deg,
                #ff0080,
                #ff8c00,
                #40e0d0,
                #6366f1,
                #ff0080
            );
            background-size: 300% 100%;
            z-index: -2;
            animation: rgbBorder 2.5s linear infinite;
        }
        .quiz-start-hero .quiz-btn-start-cta::after {
            content: "";
            position: absolute;
            inset: 3px;
            border-radius: calc(var(--radius) - 2px);
            background: rgba(255, 255, 255, 0.96);
            z-index: -1;
        }
        .quiz-start-hero .quiz-btn-start-cta {
            position: relative;
            z-index: 2;
        }
        .quiz-start-hero .quiz-btn-start-cta:hover {
            transform: scale(1.04);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
            color: #0f172a !important;
        }
        .quiz-start-hero .quiz-btn-start-cta:active {
            transform: scale(0.98);
        }
        @keyframes rgbBorder {
            0% {
                background-position: 0% 50%;
            }
            100% {
                background-position: 300% 50%;
            }
        }
        @keyframes btnRgbGlow {
            0%,
            100% {
                box-shadow: 0 0 12px rgba(255, 0, 128, 0.25);
            }
            25% {
                box-shadow: 0 0 14px rgba(255, 140, 0, 0.3);
            }
            50% {
                box-shadow: 0 0 14px rgba(64, 224, 208, 0.3);
            }
            75% {
                box-shadow: 0 0 14px rgba(99, 102, 241, 0.3);
            }
        }
        @keyframes heroFadeIn {
            from {
                opacity: 0;
                transform: translateY(14px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        @media (max-width: 767px) {
            #quizSetupSection {
                margin: 0 -1.25rem 0;
                padding: 2rem 1.25rem;
                min-height: 240px;
            }
            .quiz-start-hero .hero-cta-text {
                font-size: 1rem;
            }
            .quiz-start-hero .quiz-btn-start-cta {
                min-width: 180px;
                padding: 0.875rem 1.5rem;
            }
        }
        @media (max-width: 480px) {
            #quizSetupSection {
                margin: 0 -1rem 0;
                padding: 1.5rem 1rem;
                min-height: 200px;
            }
            .quiz-start-hero .hero-cta-text {
                font-size: 0.9rem;
            }
            .quiz-start-hero .quiz-btn-start-cta {
                min-width: 160px;
                padding: 0.75rem 1.25rem;
            }
        }
        @media (max-width: 375px) {
            #quizSetupSection {
                margin: 0 -0.75rem 0;
                padding: 1.25rem 0.75rem;
                min-height: 180px;
            }
            .quiz-start-hero .hero-cta-text {
                font-size: 0.85rem;
            }
            .quiz-start-hero .quiz-btn-start-cta {
                min-width: 140px;
                padding: 0.65rem 1.1rem;
            }
        }
        @media (prefers-reduced-motion: reduce) {
            #quizSetupSection::before {
                animation: none;
            }
            .quiz-start-hero .hero-badge,
            .quiz-start-hero .hero-cta-text,
            .quiz-start-hero .start-game-wrap {
                animation: none;
            }
            .quiz-start-hero .quiz-btn-start-cta,
            .quiz-start-hero .quiz-btn-start-cta::before {
                animation: none;
            }
        }
        .quiz-inputs-row {
            display: flex;
            flex-direction: column;
            gap: 1.25rem;
            margin-bottom: 0;
            width: 100%;
            max-width: 100%;
        }
        .quiz-inputs-left {
            width: 100%;
            max-width: 100%;
        }
        .quiz-inputs-right {
            width: 100%;
            max-width: 100%;
        }
        .quiz-region-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 0.5rem;
            margin-bottom: 0.75rem;
        }
        @media (min-width: 520px) {
            .quiz-region-grid {
                grid-template-columns: repeat(4, 1fr);
            }
        }
        .quiz-region-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.4rem;
            padding: 0.65rem 0.5rem;
            border: 1.5px solid var(--border);
            border-radius: var(--radius-lg);
            background: var(--card);
            color: var(--foreground);
            font-weight: 600;
            font-size: 0.75rem;
            cursor: pointer;
            transition:
                transform 0.2s ease,
                box-shadow 0.2s ease,
                border-color 0.2s ease,
                background 0.2s ease;
            text-align: center;
            box-shadow: var(--shadow-sm);
        }
        .quiz-region-btn:hover {
            border-color: var(--primary-light);
            background: var(--muted);
            box-shadow: var(--shadow-md);
        }
        .quiz-region-btn.selected {
            background: linear-gradient(
                135deg,
                var(--primary) 0%,
                var(--primary-dark) 100%
            );
            color: #fff;
            border-color: var(--primary-dark);
            box-shadow: 0 2px 10px var(--primary-glow);
        }
        .quiz-region-btn .quiz-region-icon {
            width: 36px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 4px;
            overflow: hidden;
        }
        .quiz-region-btn .quiz-region-icon svg {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }
        .quiz-region-btn .quiz-region-icon img {
            width: 32px;
            height: 24px;
            object-fit: contain;
        }
        .quiz-selected-count-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.6rem 0.875rem;
            background: var(--muted);
            border-radius: var(--radius-lg);
            font-size: 0.875rem;
            font-weight: 600;
            color: var(--text-secondary);
            margin-bottom: 0.5rem;
            cursor: pointer;
            user-select: none;
            border: 1px solid var(--border);
            transition:
                background 0.2s ease,
                color 0.2s ease,
                border-color 0.2s ease;
        }
        .quiz-selected-count-bar:hover {
            background: var(--card);
            color: var(--foreground);
            border-color: var(--primary-light);
        }
        .quiz-selected-count-chevron {
            transition: transform 0.2s ease;
        }
        .quiz-selected-count-bar[aria-expanded="true"] .quiz-selected-count-chevron {
            transform: rotate(180deg);
        }
        .quiz-country-picker-panel {
            display: none;
            margin-bottom: 1rem;
            padding: 1rem;
            background: var(--muted);
            border: 1px solid var(--border);
            border-radius: var(--radius);
        }
        .quiz-country-picker-panel.open {
            display: block;
        }
        .quiz-country-picker-actions {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 0.75rem;
        }
        .quiz-btn-small {
            padding: 0.4rem 0.75rem;
            font-size: 0.8125rem;
            border-radius: var(--radius);
            font-weight: 600;
            border: 1.5px solid var(--border);
            background: var(--card);
            color: var(--foreground);
            box-shadow: var(--shadow-sm);
        }
        .quiz-btn-small:hover {
            border-color: var(--primary-light);
            background: var(--muted);
        }
        .quiz-country-picker-list {
            max-height: 280px;
            overflow-y: auto;
            display: grid;
            grid-template-columns: 1fr;
            gap: 0.25rem;
        }
        @media (min-width: 400px) {
            .quiz-country-picker-list {
                grid-template-columns: repeat(2, 1fr);
            }
        }
        @media (min-width: 600px) {
            .quiz-country-picker-list {
                grid-template-columns: repeat(3, 1fr);
            }
        }
        .quiz-country-picker-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.35rem 0.5rem;
            border-radius: calc(var(--radius) * 0.6);
            cursor: pointer;
            font-size: 0.8125rem;
        }
        .quiz-country-picker-item:hover {
            background: var(--card);
        }
        .quiz-country-picker-item input {
            accent-color: var(--primary);
            flex-shrink: 0;
        }
        .quiz-country-picker-item .quiz-country-picker-flag {
            width: 24px;
            height: 16px;
            object-fit: contain;
            flex-shrink: 0;
        }
        .quiz-radio-group {
            display: flex;
            align-items: center;
            gap: 1rem;
            flex-wrap: wrap;
            margin-bottom: 1rem;
        }
        .quiz-radio-group label {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
            cursor: pointer;
            font-weight: 500;
            font-size: 0.9375rem;
        }
        .quiz-radio-group input {
            accent-color: var(--primary);
        }

        .quiz-start-game-wrap {
            margin-top: 1.25rem;
        }
        .quiz-start-game-wrap .quiz-btn.primary {
            min-width: 160px;
        }

        /* Quiz play area */
        .quiz-play-area {
            display: none;
            width: 100%;
            position: relative;
            overflow: hidden;
            border-radius: inherit;
        }
        .quiz-play-area.visible {
            display: block;
        }
        /* Play area background: same image, cover so it shows properly like the start screen */
        .quiz-play-area-bg {
            position: absolute;
            inset: 0;
            background-image: url("https://tools.xrespond.com/kh/guess_price/guess_price.png");
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            z-index: 0;
            opacity: 0.42;
            animation: quizBgFloat 10s ease-in-out infinite;
        }
        .quiz-play-area-bg::after {
            content: "";
            position: absolute;
            inset: 0;
            background: linear-gradient(
                135deg,
                rgba(37, 99, 235, 0.52) 0%,
                rgba(15, 23, 42, 0.48) 45%,
                rgba(99, 102, 241, 0.5) 75%,
                rgba(37, 99, 235, 0.45) 100%
            );
            z-index: 1;
            pointer-events: none;
        }
        [data-theme="dark"] .quiz-play-area-bg {
            opacity: 0.35;
        }
        [data-theme="dark"] .quiz-play-area-bg::after {
            background: linear-gradient(
                135deg,
                rgba(37, 99, 235, 0.4) 0%,
                rgba(15, 23, 42, 0.6) 50%,
                rgba(99, 102, 241, 0.35) 100%
            );
        }
        @keyframes quizBgFloat {
            0%,
            100% {
                transform: scale(1);
            }
            50% {
                transform: scale(1.06);
            }
        }
        .quiz-play-area-bg.quiz-bg-zoom {
            animation: quizBgZoom 0.9s ease-out;
        }
        @keyframes quizBgZoom {
            0% {
                transform: scale(1);
            }
            45% {
                transform: scale(1.15);
            }
            100% {
                transform: scale(1);
            }
        }
        .quiz-play-area-content {
            position: relative;
            z-index: 1;
        }
        .quiz-question-num {
            font-weight: 700;
            color: var(--text-secondary);
            margin-bottom: 0.75rem;
            font-size: 0.875rem;
        }
        .quiz-question-prompt {
            margin-bottom: 1.25rem;
            min-height: 140px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
        }
        .quiz-question-prompt .flag-img,
        .quiz-question-prompt .logo-img,
        .quiz-question-prompt .price-product-img {
            max-width: 200px;
            max-height: 120px;
            object-fit: contain;
            animation: productImgRotate 4s ease-in-out infinite;
        }
        @keyframes productImgRotate {
            0%,
            100% {
                transform: rotate(-25deg);
            }
            50% {
                transform: rotate(25deg);
            }
        }
        .quiz-question-prompt .price-product-name-wrap {
            text-align: center;
            margin: 0;
        }
        .quiz-question-prompt .price-product-name {
            font-size: 1.0625rem;
            font-weight: 700;
            color: var(--foreground);
            margin: 0;
            line-height: 1.35;
            padding: 0 0.5rem;
        }
        .quiz-question-prompt .price-product-hint {
            font-size: 0.875rem;
            font-weight: 500;
            color: var(--text-secondary);
            margin: 0.35rem 0 0 0;
        }
        .quiz-question-prompt .country-name-prompt {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--foreground);
        }
        .quiz-choices {
            display: grid;
            gap: 0.75rem;
        }
        .quiz-choices.cols-2 {
            grid-template-columns: 1fr 1fr;
        }
        .quiz-choices.cols-4 {
            grid-template-columns: repeat(2, 1fr);
        }
        .quiz-choices.cols-8 {
            grid-template-columns: repeat(2, 1fr);
        }
        @media (min-width: 480px) {
            .quiz-choices.cols-4 {
                grid-template-columns: repeat(2, 1fr);
            }
            .quiz-choices.cols-8 {
                grid-template-columns: repeat(4, 1fr);
            }
        }
        .quiz-choice-btn {
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            padding: 0.875rem 1rem;
            border: none;
            border-radius: var(--radius-lg);
            background: var(--waffle-btn-bg);
            color: var(--foreground);
            font-weight: 600;
            font-size: 0.9375rem;
            cursor: pointer;
            transition:
                transform 0.2s ease,
                box-shadow 0.2s ease;
            box-shadow: var(--shadow-sm);
            overflow: hidden;
        }
        .quiz-choice-btn::before {
            content: "";
            position: absolute;
            inset: -2px;
            border-radius: calc(var(--radius-lg) + 2px);
            background: linear-gradient(
                90deg,
                #ff0080,
                #ff8c00,
                #40e0d0,
                #6366f1,
                #ff0080
            );
            background-size: 300% 100%;
            animation: quizChoiceRgb 3s linear infinite;
            z-index: -2;
        }
        .quiz-choice-btn::after {
            content: "";
            position: absolute;
            inset: 2px;
            border-radius: calc(var(--radius-lg) - 2px);
            background: var(--waffle-btn-bg);
            z-index: -1;
        }
        @keyframes quizChoiceRgb {
            0% {
                background-position: 0% 50%;
            }
            100% {
                background-position: 300% 50%;
            }
        }
        .quiz-choice-btn:hover:not(:disabled) {
            transform: translateY(-2px) scale(1.02);
            box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
        }
        .quiz-choice-btn .choice-flag {
            width: 32px;
            height: 22px;
            object-fit: contain;
        }
        .quiz-choice-btn .choice-flag-only {
            width: 80px;
            height: 56px;
        }
        .quiz-choice-btn.correct {
            background: linear-gradient(
                135deg,
                var(--correct) 0%,
                var(--correct-dark) 100%
            );
            color: #fff;
            box-shadow: 0 2px 12px rgba(5, 150, 105, 0.35);
        }
        .quiz-choice-btn.correct::before {
            display: none;
        }
        .quiz-choice-btn.correct::after {
            background: linear-gradient(
                135deg,
                var(--correct) 0%,
                var(--correct-dark) 100%
            );
        }
        .quiz-choice-btn.wrong {
            background: var(--absent);
            color: #fff;
            opacity: 0.85;
        }
        .quiz-choice-btn.wrong::before {
            display: none;
        }
        .quiz-choice-btn.wrong::after {
            background: var(--absent);
        }
        .quiz-choice-btn:disabled {
            cursor: default;
        }
        .quiz-score-bar {
            margin-top: 1rem;
            font-weight: 800;
            color: var(--primary);
            font-size: 1rem;
        }
        .quiz-timer-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.5rem 0.75rem;
            background: var(--muted);
            border-radius: var(--radius);
            margin-bottom: 1rem;
            font-weight: 700;
            font-size: 0.9375rem;
        }
        .quiz-timer-bar .timer-value {
            font-variant-numeric: tabular-nums;
            color: var(--primary);
        }
        .quiz-timer-bar .timer-value.low {
            color: var(--accent);
        }

        /* ============ CrowdParty-style joyful animations (respects prefers-reduced-motion) ============ */
        @keyframes fadeIn {
            from {
                opacity: 0;
            }
            to {
                opacity: 1;
            }
        }
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(12px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        /* Bouncy spring-like entrances (CrowdParty-style) */
        @keyframes bounceIn {
            0% {
                opacity: 0;
                transform: scale(0.85);
            }
            55% {
                transform: scale(1.04);
            }
            75% {
                transform: scale(0.97);
            }
            100% {
                opacity: 1;
                transform: scale(1);
            }
        }
        @keyframes bounceInUp {
            0% {
                opacity: 0;
                transform: translateY(24px);
            }
            55% {
                transform: translateY(-4px);
            }
            75% {
                transform: translateY(2px);
            }
            100% {
                opacity: 1;
                transform: translateY(0);
            }
        }
        @keyframes scaleIn {
            from {
                opacity: 0;
                transform: scale(0.95);
            }
            to {
                opacity: 1;
                transform: scale(1);
            }
        }
        /* Correct: satisfying pop */
        @keyframes correctBounce {
            0% {
                transform: scale(1);
            }
            40% {
                transform: scale(1.08);
            }
            70% {
                transform: scale(0.98);
            }
            100% {
                transform: scale(1);
            }
        }
        /* Wrong: gentle shake */
        @keyframes wrongShake {
            0%,
            100% {
                transform: translateX(0);
            }
            20% {
                transform: translateX(-6px);
            }
            40% {
                transform: translateX(5px);
            }
            60% {
                transform: translateX(-3px);
            }
            80% {
                transform: translateX(2px);
            }
        }
        @keyframes pulseLow {
            0%,
            100% {
                opacity: 1;
            }
            50% {
                opacity: 0.85;
            }
        }

        .quiz-play-area.visible {
            animation: fadeIn 0.35s ease-out forwards;
        }
        .quiz-play-area.visible .quiz-timer-bar {
            animation: bounceInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1)
                0.08s both;
        }
        .quiz-play-area.visible .quiz-question-num {
            animation: bounceInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1)
                0.12s both;
        }
        .quiz-play-area.visible .quiz-question-prompt {
            animation: bounceInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1)
                0.18s both;
        }
        .quiz-play-area.visible .quiz-choices {
            animation: fadeIn 0.3s ease-out 0.22s both;
        }
        .quiz-choice-btn {
            animation: bounceInUp 0.45s cubic-bezier(0.34, 1.56, 0.64, 1)
                both;
        }
        .quiz-choices.cols-2 .quiz-choice-btn:nth-child(1) {
            animation-delay: 0.28s;
        }
        .quiz-choices.cols-2 .quiz-choice-btn:nth-child(2) {
            animation-delay: 0.34s;
        }
        .quiz-choices.cols-4 .quiz-choice-btn:nth-child(1) {
            animation-delay: 0.28s;
        }
        .quiz-choices.cols-4 .quiz-choice-btn:nth-child(2) {
            animation-delay: 0.34s;
        }
        .quiz-choices.cols-4 .quiz-choice-btn:nth-child(3) {
            animation-delay: 0.4s;
        }
        .quiz-choices.cols-4 .quiz-choice-btn:nth-child(4) {
            animation-delay: 0.46s;
        }
        .quiz-choice-btn.correct {
            animation: correctBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
        }
        .quiz-choice-btn.wrong {
            animation: wrongShake 0.45s ease-in-out;
        }
        .quiz-timer-bar .timer-value.low {
            animation: pulseLow 1.5s ease-in-out infinite;
        }
        .quiz-play-area.visible .quiz-score-bar {
            animation: bounceInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1)
                0.28s both;
        }

        .quiz-modal-overlay.show {
            display: flex;
            animation: fadeIn 0.25s ease-out;
        }
        .quiz-modal-overlay.show .quiz-modal {
            animation:
                bounceIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
                resultCelebrate 1.2s ease-out 0.3s;
        }

        .quiz-game-area .quiz-game-card {
            transition:
                box-shadow 0.3s ease,
                transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
        }
        .quiz-game-area .quiz-game-card:hover {
            box-shadow: var(--shadow-xl);
            transform: translateY(-2px);
        }
        .quiz-sidebar-section {
            transition:
                transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease;
        }
        .quiz-region-btn {
            transition:
                transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease;
        }
        .quiz-region-btn:hover {
            transform: translateY(-2px) scale(1.02);
        }
        .quiz-region-btn:active {
            transform: translateY(0) scale(0.98);
        }
        .quiz-btn.primary {
            transition:
                transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease;
        }
        .quiz-btn.primary:hover {
            transform: scale(1.03);
        }
        .quiz-btn.primary:active {
            transform: scale(0.98);
        }
        .quiz-choice-btn {
            transition:
                transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.2s ease,
                background 0.2s ease;
        }
        .quiz-choice-btn:hover:not(:disabled) {
            transform: translateY(-1px);
        }
        .quiz-choice-btn:active:not(:disabled) {
            transform: translateY(0) scale(0.99);
        }

/* tc-scoped:tc-wp-tool-root */

.tc-wp-tool-root {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: flow-root;
  isolation: isolate;
  position: relative;
}
.tc-wp-tool-root img,
.tc-wp-tool-root video,
.tc-wp-tool-root svg,
.tc-wp-tool-root iframe {
  max-width: 100%;
  height: auto;
}


.quiz-game-area .quiz-game-header .quiz-game-title {
	color:black !important;
}

.quiz-sidebar-section h3 {
color:black !important;
}