        /* Import Design Tokens */
        @import url('styles-tokens.css');

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

        body {
            font-family: var(--font-sans);
            background: var(--color-bg);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: var(--spacing-5);
            position: fixed;
            width: 100%;
            height: 100%;
            overflow: hidden;
            overscroll-behavior: contain;
            color: var(--color-text-primary);
            line-height: var(--line-height-normal);
            -webkit-font-smoothing: antialiased;
        }

        .container {
            background: var(--color-surface);
            border: var(--border-width-thin) solid var(--color-border);
            border-radius: var(--radius-md);
            padding: var(--spacing-10);
            max-width: 500px;
            width: 100%;
            max-height: 100vh;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            box-shadow: 0 0 0 var(--border-width-thin) var(--color-border);
        }

        @media (max-width: 600px) {
            .container {
                padding: var(--spacing-6);
                padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 120px); /* Extra space to prevent button cutoff */
                border-radius: 0;
                border: none;
                max-height: 100vh;
            }
        }

        h1 {
            text-align: center;
            font-family: var(--font-serif);
            color: var(--color-text-primary);
            margin-bottom: var(--spacing-7);
            font-size: var(--font-size-3xl);
            font-weight: var(--font-weight-bold);
            letter-spacing: var(--letter-spacing-tight);
        }

        @media (max-width: 600px) {
            h1 {
                font-size: var(--font-size-xl);
                margin-bottom: var(--spacing-5);
            }
        }

        /* Game Header - Thin nav bar */
        .game-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: var(--spacing-1) 0;
            border-bottom: var(--border-width-thin) solid var(--color-border);
            margin-bottom: var(--spacing-3);
        }

        .back-button-inline {
            background: none;
            border: none;
            padding: var(--spacing-1) 0;
            font-family: var(--font-sans);
            font-size: var(--font-size-sm);
            color: var(--color-text-secondary);
            cursor: pointer;
            font-weight: var(--font-weight-semibold);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
            display: flex;
            align-items: center;
            gap: var(--spacing-1);
            flex: 1;
            justify-content: flex-start;
            transition: color var(--transition-fast);
        }

        .back-button-inline:hover {
            color: var(--color-text-primary);
            background: none;
        }

        .streak-driver {
            font-family: var(--font-sans);
            font-size: var(--font-size-xs);
            color: var(--color-text-secondary);
            font-weight: var(--font-weight-medium);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
            flex: 1;
            text-align: center;
        }

        .streak-driver .emoji {
            font-size: var(--font-size-sm);
        }

        .streak-driver strong {
            color: var(--color-text-primary);
            font-weight: var(--font-weight-semibold);
        }

        .level-display {
            font-family: var(--font-sans);
            font-size: var(--font-size-sm);
            color: var(--color-text-secondary);
            font-weight: var(--font-weight-semibold);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
            flex: 1;
            text-align: right;
        }

        .level-display strong {
            color: var(--color-text-primary);
            font-weight: var(--font-weight-semibold);
        }

        /* Prominent Score Display */
        .score-section {
            text-align: center;
            margin-bottom: var(--spacing-3);
        }

        @media (max-width: 600px) {
            .score-section {
                margin-bottom: var(--spacing-2);
            }
        }

        .score-display {
            font-family: var(--font-serif);
            font-size: var(--font-size-4xl);
            font-weight: var(--font-weight-bold);
            color: var(--color-text-primary);
            line-height: var(--line-height-tight);
            margin-bottom: var(--spacing-2);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: var(--spacing-2);
            flex-wrap: nowrap; /* Prevent score from wrapping */
            white-space: nowrap;
        }

        @media (max-width: 600px) {
            .score-display {
                font-size: var(--font-size-3xl);
                gap: var(--spacing-1);
            }
        }

        .score-current {
            color: var(--color-text-primary);
        }

        .score-separator {
            color: var(--color-border);
            font-weight: var(--font-weight-normal);
        }

        .score-target {
            color: var(--color-text-secondary);
        }

        .score-feedback {
            font-size: var(--font-size-md);
            font-weight: var(--font-weight-semibold);
            color: var(--color-success);
            height: var(--spacing-5);
            min-height: var(--spacing-5);
            opacity: 0;
            transition: opacity var(--transition-slow);
            display: block;
        }

        .score-feedback.show {
            opacity: 1;
        }

        /* Visual Progress Bar */
        .progress-bar-container {
            width: 100%;
            height: 4px;
            background: var(--color-border);
            border-radius: 0;
            overflow: hidden;
            margin-bottom: var(--spacing-4);
            position: relative;
        }

        @media (max-width: 600px) {
            .progress-bar-container {
                margin-bottom: var(--spacing-3);
            }
        }

        .progress-bar-fill {
            height: 100%;
            background: var(--color-accent);
            transition: width var(--transition-progress), background-color var(--transition-progress);
            border-radius: 0;
        }

        .progress-bar-fill.progress-low {
            background: var(--color-accent);
        }

        .progress-bar-fill.progress-medium {
            background: var(--color-accent);
        }

        .progress-bar-fill.progress-high {
            background: var(--color-accent);
        }

        .progress-bar-fill.progress-complete {
            background: var(--color-success);
        }

        /* Hide old game-info */
        .game-info {
            display: none;
        }

        .grid {
            display: grid;
            gap: var(--tile-gap);
            margin-bottom: var(--spacing-5);
            justify-content: center;
            user-select: none;
            touch-action: none;
        }

        @media (max-width: 600px) {
            .grid {
                margin-bottom: var(--spacing-2);
            }
        }

        .tile {
            width: var(--tile-size);
            height: var(--tile-size);
            background: var(--color-surface);
            border: var(--border-width-base) solid var(--color-border);
            border-radius: 0;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            font-family: var(--font-serif);
            font-size: 26px;
            font-weight: var(--font-weight-bold);
            color: var(--color-text-primary);
            cursor: pointer;
            transition: all var(--transition-fast);
            position: relative;
        }

        /* Responsive tile sizing - set dynamically by JS based on grid size */
        @media (max-width: 600px) {
            .mobile-grid .tile {
                width: var(--mobile-tile-size, 64px);
                height: var(--mobile-tile-size, 64px);
                font-size: var(--mobile-font-size, 28px);
            }

            .mobile-grid .tile-points {
                font-size: var(--mobile-points-size, 10px);
            }

            .mobile-grid .tile-lock {
                font-size: var(--mobile-points-size, 10px);
            }

            .mobile-grid {
                gap: var(--mobile-gap, 6px);
            }
        }

        .tile-letter {
            line-height: 1;
        }

        .tile-points {
            position: absolute;
            bottom: 3px;
            right: 3px;
            font-size: 8px;
            font-weight: var(--font-weight-semibold);
            font-family: var(--font-sans);
            color: var(--color-text-secondary);
        }

        .tile-lock {
            position: absolute;
            bottom: 4px;
            left: 4px;
            font-size: var(--font-size-xs);
        }

        .tile:hover:not(.locked):not(.selected) {
            background: var(--color-bg);
            border-color: var(--color-primary);
        }

        .tile.selected {
            background: var(--color-accent) !important;
            color: var(--color-surface) !important;
            border-color: var(--color-accent) !important;
        }

        .tile.selected .tile-points {
            color: rgba(255, 255, 255, 0.8);
        }

        .tile.locked {
            background: #e8e8e8;
            color: #a8a29e;
            border-color: #d6d6d6;
            cursor: default;
        }

        .tile.hint {
            border-color: #2e7d32;
            border-width: 3px;
            animation: hint-pulse 2s infinite;
        }

        @keyframes hint-pulse {
            0%, 100% {
                border-color: #2e7d32;
                box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.4);
            }
            50% {
                border-color: #4caf50;
                box-shadow: 0 0 0 4px rgba(46, 125, 50, 0);
            }
        }

        /* Game over crumble animation */
        .tile.locked.crumble {
            animation: tile-crumble 0.6s ease-out forwards;
        }

        .tile.game-over {
            animation: tile-fall-fast 0.4s ease-in forwards;
        }

        @keyframes tile-crumble {
            0% {
                transform: translateY(0) rotate(0deg);
                opacity: 1;
            }
            100% {
                transform: translateY(100px) rotate(15deg);
                opacity: 0;
            }
        }

        @keyframes tile-fall-fast {
            0% {
                transform: translateY(0);
                opacity: 1;
            }
            100% {
                transform: translateY(120px);
                opacity: 0;
            }
        }

        .current-word {
            text-align: center;
            height: 36px;
            min-height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: var(--font-serif);
            font-size: var(--font-size-xl);
            font-weight: var(--font-weight-bold);
            color: var(--color-text-primary);
            margin-bottom: var(--spacing-4);
            padding: var(--spacing-2);
            letter-spacing: var(--letter-spacing-widest);
        }

        @media (max-width: 600px) {
            .current-word {
                height: var(--spacing-6);
                min-height: var(--spacing-6);
                font-size: var(--font-size-lg);
                margin-bottom: var(--spacing-2);
            }
        }

        .current-word.empty {
            font-size: var(--font-size-base);
            color: var(--color-text-secondary);
            font-weight: var(--font-weight-normal);
            font-family: var(--font-sans);
            letter-spacing: var(--letter-spacing-normal);
        }

        .message {
            text-align: center;
            height: var(--spacing-6);
            min-height: var(--spacing-6);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: var(--font-size-sm);
            margin-bottom: var(--spacing-4);
            padding: var(--spacing-2) var(--spacing-3);
            border-radius: 0;
            font-weight: var(--font-weight-semibold);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
            transition: opacity var(--transition-slow);
        }

        @media (max-width: 600px) {
            .message {
                margin-bottom: var(--spacing-2);
                font-size: var(--font-size-xs);
                height: var(--spacing-4);
                min-height: var(--spacing-4);
            }
        }

        .message.error {
            background: var(--color-error);
            color: var(--color-surface);
        }

        .message.win {
            background: var(--color-success);
            color: var(--color-surface);
            font-size: var(--font-size-md);
            font-weight: var(--font-weight-semibold);
        }

        .message.lose {
            background: var(--color-error);
            color: var(--color-surface);
            font-size: var(--font-size-md);
            font-weight: var(--font-weight-semibold);
        }

        .controls {
            display: flex;
            flex-direction: column;
            gap: var(--spacing-2);
            margin-top: auto;
            margin-bottom: var(--spacing-4);
            height: calc((var(--spacing-unit) * 3 + var(--font-size-base) * var(--line-height-normal) + var(--border-width-base) * 2) * 2 + var(--spacing-2));
        }

        @media (max-width: 600px) {
            .controls {
                margin-bottom: var(--spacing-6); /* Extra spacing on mobile to prevent cutoff */
            }
        }

        .button-row {
            display: flex;
            gap: var(--spacing-2);
        }

        button {
            flex: 1;
            padding: calc(var(--spacing-unit) * 1.5);
            font-family: var(--font-sans);
            font-size: var(--font-size-base);
            font-weight: var(--font-weight-bold);
            line-height: var(--line-height-normal);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
            border: var(--border-width-base) solid var(--color-primary);
            border-radius: 0;
            background: var(--color-surface);
            color: var(--color-primary);
            cursor: pointer;
            transition: all var(--transition-fast);
        }

        button:hover {
            background: var(--color-primary);
            color: var(--color-surface);
        }

        button:disabled {
            background: #f5f5f5;
            border-color: var(--color-border);
            color: var(--color-text-secondary);
            cursor: not-allowed;
            opacity: 0.6;
        }

        /* Game Over States */
        .grid.shake {
            animation: shake 0.5s;
        }

        .grid.lose-state .tile {
            border-color: var(--color-error);
            background: var(--color-bg);
        }

        .current-word.celebrate {
            animation: celebrate 0.6s;
            color: var(--color-success);
        }

        .controls button.hidden {
            display: none;
        }

        .controls button.highlight {
            background: var(--color-accent);
            border-color: var(--color-accent);
            color: var(--color-surface);
            animation: pulse 1s infinite;
        }

        /* Primary Button (Next Level) */
        #nextBtn {
            background: var(--color-primary);
            color: var(--color-surface);
        }

        #nextBtn:hover {
            background: #2a2a2a;
        }

        /* Ask a Friend Button */
        #askFriendBtn {
            background: var(--color-info) !important;
            border-color: var(--color-info) !important;
            color: var(--color-surface) !important;
        }

        #askFriendBtn:hover {
            background: #2563eb !important;
            border-color: #2563eb !important;
        }

        /* Mobile Button Adjustments */
        @media (max-width: 600px) {
            button {
                font-size: var(--font-size-sm);
                padding: calc(var(--spacing-unit) * 1.25);
            }
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
            20%, 40%, 60%, 80% { transform: translateX(10px); }
        }

        @keyframes celebrate {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.1); }
        }

        @keyframes pulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.05); }
        }

        @keyframes tilePop {
            0% { transform: scale(1); }
            50% { transform: scale(1.15); }
            100% { transform: scale(1); }
        }

        .tile.popping {
            animation: tilePop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        }

        @keyframes scoreFlash {
            0% { color: var(--color-text-primary); transform: scale(1); }
            50% { color: var(--color-success); transform: scale(1.15); }
            100% { color: var(--color-text-primary); transform: scale(1); }
        }

        .score-current.flash {
            animation: scoreFlash 0.5s ease;
        }

        /* Ad Placements */
        .ad-top {
            width: 100%;
            border-bottom: var(--border-width-thin) solid var(--color-border);
            text-align: center;
            background: #fafafa;
            margin-bottom: var(--spacing-4);
        }

        .ad-bottom {
            width: 100%;
            border-top: var(--border-width-thin) solid var(--color-border);
            text-align: center;
            background: #fafafa;
            margin-top: calc(var(--spacing-unit) * 1.5);
        }

        .ad-label {
            font-size: var(--font-size-xs);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wider);
            color: var(--color-text-secondary);
            padding: var(--spacing-1);
            font-weight: var(--font-weight-medium);
        }

        .ad-placeholder {
            min-height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--color-text-secondary);
            font-size: var(--font-size-xs);
            background: #f5f5f5;
            font-family: monospace;
        }

        @media (max-width: 600px) {
            .ad-placeholder {
                min-height: 40px;
            }

            .ad-top,
            .ad-bottom {
                margin-top: var(--spacing-1);
                margin-bottom: var(--spacing-2);
            }
        }

        /* Lobby Styles */
        .lobby {
            display: block;
        }

        .lobby.hidden {
            display: none;
        }

        /* Left Ad Positioning */
        .lobby-left-ad {
            position: absolute;
            width: 300px;
            height: 600px;
            z-index: 10;
            /* Position relative to lobby - calculated dynamically or via calc */
            left: calc(50% - 250px - 300px - 20px); /* 50% - (lobby half-width) - ad width - gap */
            top: 20px; /* Fixed top position */
        }

        /* Hide ad when on small screens */
        @media (max-width: 900px) {
            .lobby-left-ad {
                display: none;
            }
        }

        .lobby-tagline {
            text-align: center;
            font-family: var(--font-sans);
            font-size: var(--font-size-md);
            color: var(--color-text-secondary);
            line-height: var(--line-height-normal);
            margin: calc(var(--spacing-5) * -1) 0 var(--spacing-8) 0;
        }

        @media (max-width: 600px) {
            .lobby-tagline {
                font-size: var(--font-size-base);
                margin: calc(var(--spacing-3) * -1) 0 var(--spacing-5) 0;
            }
        }

        .daily-summary {
            text-align: center;
            padding: var(--spacing-3) var(--spacing-5);
            background: var(--color-accent);
            border: var(--border-width-thin) solid var(--color-primary);
            border-radius: 0;
            margin-bottom: var(--spacing-6);
            font-family: var(--font-sans);
            font-size: var(--font-size-sm);
            font-weight: var(--font-weight-semibold);
            color: var(--color-primary);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
        }

        @media (max-width: 600px) {
            .daily-summary {
                font-size: var(--font-size-xs);
                padding: var(--spacing-2) var(--spacing-4);
                margin-bottom: var(--spacing-4);
            }
        }

        .lobby-section-title {
            font-family: var(--font-sans);
            font-size: var(--font-size-sm);
            font-weight: var(--font-weight-semibold);
            color: var(--color-text-secondary);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
            margin-bottom: var(--spacing-4);
        }

        .lobby-cards {
            display: grid;
            gap: var(--spacing-5);
            margin-bottom: var(--spacing-5);
        }

        .size-card {
            background: var(--color-surface);
            border: var(--border-width-base) solid var(--color-border);
            border-radius: 0;
            padding: var(--spacing-6);
            cursor: pointer;
            transition: border-color var(--transition-fast);
        }

        @media (max-width: 600px) {
            .size-card {
                padding: var(--spacing-5);
            }
        }

        .size-card:hover {
            border-color: var(--color-primary);
        }

        .size-card-title {
            font-family: var(--font-serif);
            font-size: var(--font-size-xl);
            font-weight: var(--font-weight-bold);
            letter-spacing: var(--letter-spacing-tight);
            margin-bottom: var(--spacing-1);
            color: var(--color-text-primary);
        }

        .size-card-subtitle {
            font-family: var(--font-sans);
            font-size: var(--font-size-sm);
            color: var(--color-text-secondary);
            margin-bottom: var(--spacing-4);
            font-style: italic;
        }

        .size-card-info {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: var(--spacing-3);
        }

        .size-card-level {
            font-family: var(--font-sans);
            font-size: var(--font-size-sm);
            font-weight: var(--font-weight-medium);
            color: var(--color-text-secondary);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
        }

        .size-card-streak {
            font-family: var(--font-sans);
            font-size: var(--font-size-sm);
            font-weight: var(--font-weight-semibold);
            color: var(--color-text-primary);
            display: flex;
            align-items: center;
            gap: var(--spacing-1);
        }

        .size-card-progress-bar {
            width: 100%;
            height: 4px;
            background: var(--color-border);
            border-radius: 0;
            overflow: hidden;
            margin-bottom: var(--spacing-2);
        }

        .size-card-progress-fill {
            height: 100%;
            background: var(--color-accent);
            transition: width var(--transition-progress);
            border-radius: 0;
        }

        .size-card-progress {
            font-family: var(--font-sans);
            font-size: var(--font-size-xs);
            font-weight: var(--font-weight-medium);
            color: var(--color-text-secondary);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
        }

        .help-button {
            width: 100%;
            padding: var(--spacing-3);
            background: var(--color-surface);
            border: var(--border-width-base) solid var(--color-border);
            border-radius: 0;
            font-family: var(--font-sans);
            font-size: var(--font-size-sm);
            font-weight: var(--font-weight-semibold);
            color: var(--color-text-secondary);
            cursor: pointer;
            transition: all var(--transition-fast);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
        }

        .help-button:hover {
            border-color: var(--color-primary);
            color: var(--color-primary);
            background: var(--color-surface);
        }

        /* Game Container */
        .game-container {
            display: none;
        }

        .game-container.active {
            display: block;
        }

        /* Old streak indicator and back button - removed */

        /* Tier Milestone Celebration */
        .tier-celebration {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: var(--z-modal);
            animation: fadeIn var(--transition-base) ease;
        }

        .tier-celebration.active {
            display: flex;
        }

        .tier-celebration-content {
            background: var(--color-surface);
            border: var(--border-width-base) solid var(--color-primary);
            border-radius: 0;
            padding: var(--spacing-12) var(--spacing-16);
            text-align: center;
            animation: slideUp 0.3s ease;
        }

        .tier-celebration-emoji {
            font-size: var(--font-size-8xl);
            line-height: var(--line-height-tight);
            margin-bottom: var(--spacing-6);
        }

        .tier-celebration-title {
            font-family: var(--font-serif);
            font-size: var(--font-size-5xl);
            font-weight: var(--font-weight-bold);
            letter-spacing: var(--letter-spacing-tight);
            color: var(--color-text-primary);
            margin-bottom: var(--spacing-3);
        }

        .tier-celebration-message {
            font-family: var(--font-sans);
            font-size: var(--font-size-lg);
            color: var(--color-text-secondary);
            margin-bottom: var(--spacing-8);
        }

        .tier-celebration-button {
            padding: var(--spacing-4) var(--spacing-8);
            font-family: var(--font-sans);
            font-size: var(--font-size-base);
            font-weight: var(--font-weight-bold);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
            background: var(--color-primary);
            color: var(--color-surface);
            border: var(--border-width-base) solid var(--color-primary);
            border-radius: 0;
            cursor: pointer;
            transition: all var(--transition-fast);
        }

        .tier-celebration-button:hover {
            background: var(--color-text-primary);
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        @keyframes celebration-pop {
            0% {
                transform: scale(0.5);
                opacity: 0;
            }
            100% {
                transform: scale(1);
                opacity: 1;
            }
        }

        @keyframes celebration-spin {
            0% {
                transform: rotate(0deg) scale(0.5);
                opacity: 0;
            }
            50% {
                transform: rotate(180deg) scale(1.2);
            }
            100% {
                transform: rotate(360deg) scale(1);
                opacity: 1;
            }
        }

        /* Loading Screen */
        .loading-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--color-bg);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: var(--z-modal);
        }

        .loading-screen.active {
            display: flex;
        }

        .loading-content {
            text-align: center;
        }

        .loading-spinner {
            width: 48px;
            height: 48px;
            border: var(--border-width-thick) solid var(--color-border);
            border-top-color: var(--color-primary);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
            margin: 0 auto var(--spacing-6);
        }

        .loading-text {
            font-family: var(--font-sans);
            font-size: var(--font-size-md);
            color: var(--color-text-secondary);
            font-weight: var(--font-weight-medium);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        /* Error Screen */
        .error-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--color-bg);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: var(--z-modal);
        }

        .error-screen.active {
            display: flex;
        }

        .error-content {
            background: var(--color-surface);
            border: var(--border-width-base) solid var(--color-primary);
            border-radius: 0;
            padding: var(--spacing-8) var(--spacing-10);
            text-align: center;
            max-width: 480px;
            margin: var(--spacing-4);
        }

        .error-icon {
            font-size: var(--font-size-4xl);
            margin-bottom: var(--spacing-6);
        }

        .error-title {
            font-family: var(--font-serif);
            font-size: var(--font-size-2xl);
            font-weight: var(--font-weight-bold);
            letter-spacing: var(--letter-spacing-tight);
            color: var(--color-text-primary);
            margin-bottom: var(--spacing-3);
        }

        .error-message {
            font-family: var(--font-sans);
            font-size: var(--font-size-md);
            color: var(--color-text-secondary);
            margin-bottom: var(--spacing-8);
            line-height: var(--line-height-normal);
        }

        .error-button {
            padding: var(--spacing-4) var(--spacing-6);
            font-family: var(--font-sans);
            font-size: var(--font-size-base);
            font-weight: var(--font-weight-bold);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
            background: var(--color-primary);
            color: var(--color-surface);
            border: var(--border-width-base) solid var(--color-primary);
            border-radius: 0;
            cursor: pointer;
            transition: all var(--transition-fast);
        }

        .error-button:hover {
            background: #2a2a2a;
            border-color: #2a2a2a;
        }

        /* Confirmation Modal */
        .confirmation-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: var(--z-modal-high, 1500);
            animation: fadeIn var(--transition-base) ease;
        }

        .confirmation-modal.active {
            display: flex;
        }

        .confirmation-content {
            background: var(--color-surface);
            border: var(--border-width-base) solid var(--color-primary);
            border-radius: 0;
            padding: var(--spacing-8);
            max-width: 400px;
            text-align: center;
            animation: slideUp 0.3s ease;
        }

        .confirmation-title {
            font-family: var(--font-serif);
            font-size: var(--font-size-2xl);
            font-weight: var(--font-weight-bold);
            letter-spacing: var(--letter-spacing-tight);
            color: var(--color-text-primary);
            margin-bottom: var(--spacing-3);
        }

        .confirmation-message {
            font-family: var(--font-sans);
            font-size: var(--font-size-base);
            color: var(--color-text-secondary);
            margin-bottom: var(--spacing-6);
            line-height: var(--line-height-relaxed);
        }

        .confirmation-buttons {
            display: flex;
            gap: var(--spacing-3);
            justify-content: center;
        }

        .confirmation-button {
            padding: var(--spacing-3) var(--spacing-6);
            font-family: var(--font-sans);
            font-size: var(--font-size-sm);
            font-weight: var(--font-weight-bold);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
            border-radius: 0;
            cursor: pointer;
            transition: all var(--transition-fast);
            border: var(--border-width-base) solid var(--color-primary);
        }

        .confirmation-button.primary {
            background: var(--color-primary);
            color: var(--color-surface);
        }

        .confirmation-button.primary:hover {
            background: var(--color-text-primary);
        }

        .confirmation-button.secondary {
            background: var(--color-surface);
            color: var(--color-text-primary);
        }

        .confirmation-button.secondary:hover {
            border-color: var(--color-text-secondary);
        }

        @keyframes slideUp {
            from {
                transform: translateY(20px);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        /* Level Transition Toast */
        .level-toast {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
            color: white;
            padding: 14px 28px;
            border-radius: 12px;
            font-weight: 700;
            font-size: 18px;
            box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
            z-index: 3000;
            pointer-events: none;
            animation: toastSlide 2.5s ease forwards;
        }

        @media (max-width: 600px) {
            .level-toast {
                font-size: 16px;
                padding: 12px 24px;
                top: 10px;
            }
        }

        @keyframes toastSlide {
            0% {
                opacity: 0;
                transform: translateX(-50%) translateY(-20px) scale(0.95);
            }
            12% {
                opacity: 1;
                transform: translateX(-50%) translateY(0) scale(1);
            }
            88% {
                opacity: 1;
                transform: translateX(-50%) translateY(0) scale(1);
            }
            100% {
                opacity: 0;
                transform: translateX(-50%) translateY(-10px) scale(0.98);
            }
        }

        /* Level number pulse animation */
        @keyframes levelPulse {
            0%, 100% {
                transform: scale(1);
                color: #1a1a1a;
            }
            50% {
                transform: scale(1.15);
                color: #f59e0b;
            }
        }

        .level-display.pulse strong {
            animation: levelPulse 0.6s ease;
        }

        /* Welcome Modal */
        .welcome-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: var(--z-modal);
            animation: fadeIn 0.3s ease;
        }

        .welcome-modal.active {
            display: flex;
        }

        .welcome-content {
            background: var(--color-surface);
            border: var(--border-width-base) solid var(--color-primary);
            border-radius: 0;
            padding: var(--spacing-8) var(--spacing-10);
            max-width: 480px;
            width: 90%;
            text-align: center;
            animation: slideUp 0.3s ease;
        }

        @media (max-width: 600px) {
            .welcome-content {
                padding: var(--spacing-6) var(--spacing-5);
                width: 90%;
                max-height: 90vh;
                overflow-y: auto;
            }
        }

        .welcome-title {
            font-family: var(--font-serif);
            font-size: var(--font-size-3xl);
            font-weight: var(--font-weight-bold);
            letter-spacing: var(--letter-spacing-tight);
            color: var(--color-text-primary);
            margin-bottom: var(--spacing-8);
        }

        @media (max-width: 600px) {
            .welcome-title {
                font-size: var(--font-size-2xl);
                margin-bottom: var(--spacing-6);
            }
        }

        .welcome-instructions {
            text-align: left;
            margin-bottom: var(--spacing-8);
        }

        .welcome-bullet {
            display: flex;
            align-items: center;
            gap: var(--spacing-4);
            margin-bottom: var(--spacing-5);
        }

        .welcome-emoji {
            font-size: var(--font-size-3xl);
            min-width: 40px;
            text-align: center;
        }

        .welcome-text {
            font-family: var(--font-sans);
            font-size: var(--font-size-md);
            color: var(--color-text-primary);
            line-height: var(--line-height-normal);
        }

        .welcome-button {
            width: 100%;
            padding: var(--spacing-4) var(--spacing-6);
            font-family: var(--font-sans);
            font-size: var(--font-size-base);
            font-weight: var(--font-weight-bold);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
            background: var(--color-primary);
            color: var(--color-surface);
            border: var(--border-width-base) solid var(--color-primary);
            border-radius: 0;
            cursor: pointer;
            transition: all var(--transition-fast);
            margin-bottom: var(--spacing-3);
        }

        .welcome-button:hover {
            background: #2a2a2a;
            border-color: #2a2a2a;
        }

        .welcome-button-secondary {
            width: 100%;
            padding: var(--spacing-3) var(--spacing-6);
            font-family: var(--font-sans);
            font-size: var(--font-size-sm);
            font-weight: var(--font-weight-semibold);
            text-transform: uppercase;
            letter-spacing: var(--letter-spacing-wide);
            background: var(--color-surface);
            color: var(--color-text-secondary);
            border: var(--border-width-base) solid var(--color-border);
            border-radius: 0;
            cursor: pointer;
            transition: all var(--transition-fast);
        }

        .welcome-button-secondary:hover {
            border-color: var(--color-primary);
            color: var(--color-primary);
        }

        /* Help Modal */
        .help-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: var(--z-modal);
            animation: fadeIn 0.3s ease;
            overflow-y: auto;
            padding: var(--spacing-5);
        }

        .help-modal.active {
            display: flex;
        }

        .help-content {
            background: var(--color-surface);
            border: var(--border-width-base) solid var(--color-primary);
            border-radius: 0;
            padding: var(--spacing-8) var(--spacing-10);
            max-width: 560px;
            width: 90%;
            position: relative;
            animation: slideUp 0.3s ease;
            max-height: 90vh;
            overflow-y: auto;
        }

        @media (max-width: 600px) {
            .help-content {
                padding: var(--spacing-6) var(--spacing-5);
                width: 90%;
            }
        }

        .help-close {
            position: absolute;
            top: var(--spacing-4);
            right: var(--spacing-4);
            width: 32px;
            height: 32px;
            background: none;
            border: none;
            font-size: var(--font-size-3xl);
            color: var(--color-text-secondary);
            cursor: pointer;
            transition: color var(--transition-fast);
            line-height: var(--line-height-tight);
            padding: 0;
        }

        .help-close:hover {
            color: var(--color-text-primary);
        }

        .help-title {
            font-family: var(--font-serif);
            font-size: var(--font-size-2xl);
            font-weight: var(--font-weight-bold);
            letter-spacing: var(--letter-spacing-tight);
            color: var(--color-text-primary);
            margin-bottom: var(--spacing-6);
        }

        .help-section {
            margin-bottom: var(--spacing-6);
        }

        .help-section-title {
            font-family: var(--font-serif);
            font-size: var(--font-size-lg);
            font-weight: var(--font-weight-bold);
            letter-spacing: var(--letter-spacing-tight);
            color: var(--color-text-primary);
            margin-bottom: var(--spacing-2);
        }

        .help-section p {
            font-family: var(--font-sans);
            font-size: var(--font-size-base);
            color: var(--color-text-secondary);
            line-height: var(--line-height-relaxed);
        }

        /* Tutorial Styles */
        .tutorial-row-only .tile:not([data-row="2"]) {
            opacity: 0;
            pointer-events: none;
        }

        .grid.tutorial-row-only {
            transition: all 0.5s ease;
        }

        .grid .tile {
            transition: opacity 0.5s ease;
        }

        .message.tutorial-instruction {
            background: #e3f2fd;
            color: #1565c0;
            font-weight: 600;
        }

        /* Score Floater Animation */
        .score-floater {
            position: fixed;
            font-size: 20px;
            font-weight: 700;
            color: #2e7d32;
            pointer-events: none;
            z-index: 1000;
            animation: floatUp 0.4s ease-out forwards;
            transform-origin: center;
        }

        @keyframes floatUp {
            0% {
                opacity: 1;
                transform: translateY(0) translateX(-50%) scale(1);
            }
            100% {
                opacity: 0;
                transform: translateY(-60px) translateX(-50%) scale(1.3);
            }
        }


        /* Tutorial Hint Overlay */
        .tutorial-hint-overlay {
            position: fixed;
            left: 50%;
            transform: translateX(-50%);
            z-index: 9999;
            background: #e3f2fd;
            color: #1565c0;
            padding: 16px 24px;
            border-radius: 12px;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
            text-align: center;
            max-width: 85%;
            animation: hintFadeIn 0.3s ease;
            /* Top will be set dynamically via JS */
        }

        .tutorial-hint-overlay.hidden {
            display: none;
        }

        .tutorial-hint-overlay.hide-cta .tutorial-hint-cta {
            display: none;
        }

        .tutorial-hint-message {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 8px;
            line-height: 1.4;
        }

        .tutorial-hint-cta {
            font-size: 12px;
            color: #1565c0;
            opacity: 0.7;
            font-weight: 500;
        }

        @keyframes hintFadeIn {
            from {
                opacity: 0;
                transform: translateX(-50%) translateY(-10px);
            }
            to {
                opacity: 1;
                transform: translateX(-50%) translateY(0);
            }
        }

        /* Tutorial Highlight - for tiles referenced by hints */
        .tutorial-highlight {
            outline: 3px solid #f59e0b;
            outline-offset: 2px;
            animation: highlightPulse 1.5s ease infinite;
        }

        @keyframes highlightPulse {
            0%, 100% {
                outline-color: #f59e0b;
            }
            50% {
                outline-color: #fbbf24;
            }
        }

        /* First Level Hints - Subtle gold highlight for first daily level */
        .hint-tile {
            border-color: var(--color-accent);
            box-shadow: 0 0 0 1px var(--color-accent);
            animation: hint-pulse 1s ease-in-out infinite;
            z-index: 100;
            position: relative;
        }

        @keyframes hint-pulse {
            0%, 100% {
                opacity: 0.5;
            }
            50% {
                opacity: 0.9;
            }
        }


        /* Tutorial Modal */
        .tutorial-modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .tutorial-modal-overlay.active {
            opacity: 1;
        }

        .tutorial-modal {
            background: white;
            border-radius: 16px;
            padding: 32px;
            max-width: 400px;
            width: 90%;
            text-align: center;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
        }

        .tutorial-modal-title {
            font-size: 20px;
            font-weight: 700;
            color: #d32f2f;
            margin-bottom: 8px;
        }

        .tutorial-modal-subtitle {
            font-size: 14px;
            color: #666;
            margin-bottom: 24px;
        }

        .tutorial-modal-button {
            background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
            color: white;
            border: none;
            border-radius: 8px;
            padding: 14px 32px;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .tutorial-modal-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
        }

/* ========================
   Game Over Modal
   ======================== */

.game-over-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-over-modal-overlay.active {
    opacity: 1;
}

.game-over-modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--spacing-8);
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: modal-scale-in 0.3s ease-out;
}

@keyframes modal-scale-in {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.game-over-modal-header {
    text-align: center;
    margin-bottom: var(--spacing-4);
}

.game-over-modal-title {
    font-family: var(--font-serif);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin: 0;
}

.game-over-modal-body {
    text-align: center;
    margin-bottom: var(--spacing-6);
}

.game-over-modal-message {
    font-family: var(--font-sans);
    font-size: var(--font-size-md);
    color: var(--color-text-secondary);
    margin: 0 0 var(--spacing-5) 0;
    line-height: var(--line-height-relaxed);
}

.game-over-score-box {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: var(--spacing-4);
    margin: 0 auto;
    max-width: 280px;
}

.game-over-score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-2) 0;
}

.game-over-score-row:not(:last-child) {
    border-bottom: var(--border-width-thin) solid var(--color-border);
    margin-bottom: var(--spacing-2);
    padding-bottom: var(--spacing-3);
}

.game-over-score-row.secondary {
    opacity: 0.8;
}

.game-over-score-label {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
}

.game-over-score-value {
    font-family: var(--font-serif);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

.game-over-score-row:first-child .game-over-score-value {
    color: var(--color-accent);
}

.game-over-modal-footer {
    text-align: center;
}

.game-over-retry-button {
    background: var(--color-primary);
    color: var(--color-surface);
    border: none;
    border-radius: var(--radius-base);
    padding: var(--spacing-3) var(--spacing-8);
    font-family: var(--font-sans);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--letter-spacing-wide);
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
}

.game-over-retry-button:hover {
    background: var(--color-text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-base);
}

.game-over-retry-button:active {
    transform: translateY(0);
}

/* ========================
   Daily Challenge Lobby
   ======================== */

.daily-challenge-lobby {
    max-width: 500px;
    margin: 0 auto;
    padding: var(--spacing-6) var(--spacing-4);
    background: var(--color-surface);
}

.daily-lobby-header {
    text-align: center;
    margin-bottom: var(--spacing-8);
}

.daily-lobby-header h1 {
    font-family: var(--font-serif);
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-tight);
    margin: 0 0 var(--spacing-4) 0;
    color: var(--color-text-primary);
}

.daily-lobby-tagline {
    font-family: var(--font-sans);
    font-size: var(--font-size-md);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-relaxed);
    margin: 0 auto var(--spacing-4) auto;
    max-width: 360px;
}

.daily-lobby-social-proof {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-semibold);
    margin: 0 auto;
    padding: var(--spacing-2) var(--spacing-4);
    background: linear-gradient(135deg, rgba(255, 127, 0, 0.05) 0%, rgba(255, 87, 34, 0.05) 100%);
    border-radius: var(--border-radius-md);
    display: inline-block;
}

.daily-challenge-cards {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-6);
    margin-bottom: var(--spacing-8);
}

.daily-challenge-card {
    background: var(--color-surface);
    border: var(--border-width-base) solid var(--color-border);
    border-radius: 0;
    padding: var(--spacing-6);
    transition: border-color var(--transition-fast);
    position: relative;
}

.daily-card-date-badge {
    position: absolute;
    top: var(--spacing-3);
    right: var(--spacing-3);
    font-family: var(--font-sans);
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    opacity: 0.6;
}

.daily-challenge-card:hover {
    border-color: var(--color-primary);
}

.daily-card-header {
    margin-bottom: var(--spacing-5);
    padding-bottom: var(--spacing-4);
    border-bottom: var(--border-width-thin) solid var(--color-border);
}

.daily-card-title {
    font-family: var(--font-serif);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-1);
}

.daily-card-subtitle {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
}

.daily-card-progress {
    margin-bottom: var(--spacing-5);
}

.daily-card-indicators {
    display: flex;
    justify-content: center;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-3);
}

.level-indicator {
    font-size: var(--font-size-3xl);
    line-height: var(--line-height-tight);
}

.daily-card-status {
    text-align: center;
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
}

.daily-card-button {
    width: 100%;
    background: var(--color-primary);
    color: var(--color-surface);
    border: var(--border-width-base) solid var(--color-primary);
    border-radius: 0;
    padding: var(--spacing-4) var(--spacing-6);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.daily-card-button:hover {
    background: #2a2a2a;
    border-color: #2a2a2a;
}

.daily-card-button.complete {
    background: var(--color-success);
    border-color: var(--color-success);
    color: var(--color-surface);
}

.daily-card-button.complete:hover {
    background: #4a6a4c;
    border-color: #4a6a4c;
}

.daily-lobby-complete-message {
    text-align: center;
    padding: var(--spacing-8) var(--spacing-5);
    background: var(--color-accent);
    border: var(--border-width-base) solid var(--color-primary);
    border-radius: 0;
    margin-bottom: var(--spacing-8);
}

.complete-message-icon {
    font-size: var(--font-size-4xl);
    margin-bottom: var(--spacing-4);
}

.complete-message-text {
    font-family: var(--font-serif);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    letter-spacing: var(--letter-spacing-tight);
    margin-bottom: var(--spacing-2);
}

.complete-message-subtitle {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    color: var(--color-primary);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
}

.daily-lobby-actions {
    text-align: center;
}

.practice-mode-button {
    background: var(--color-surface);
    color: var(--color-primary);
    border: var(--border-width-base) solid var(--color-primary);
    border-radius: 0;
    padding: var(--spacing-4) var(--spacing-8);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.practice-mode-button:hover {
    background: var(--color-primary);
    color: var(--color-surface);
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .daily-challenge-lobby {
        padding: var(--spacing-5) var(--spacing-3);
    }

    .daily-lobby-header {
        margin-bottom: var(--spacing-6);
    }

    .daily-lobby-header h1 {
        font-size: var(--font-size-3xl);
        margin-bottom: var(--spacing-3);
    }

    .daily-lobby-tagline {
        font-size: var(--font-size-sm);
        margin-bottom: var(--spacing-3);
    }

    .daily-lobby-social-proof {
        font-size: var(--font-size-xs);
        padding: var(--spacing-2) var(--spacing-3);
    }

    .daily-challenge-cards {
        gap: var(--spacing-5);
    }

    .daily-challenge-card {
        padding: var(--spacing-5);
    }

    .daily-card-title {
        font-size: var(--font-size-lg);
    }

    .level-indicator {
        font-size: var(--font-size-2xl);
    }

    .daily-card-button {
        padding: var(--spacing-3) var(--spacing-5);
        font-size: var(--font-size-sm);
    }

    .practice-mode-button {
        padding: var(--spacing-3) var(--spacing-6);
        font-size: var(--font-size-sm);
    }
}

/* Share Modal */
.share-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--transition-base) ease;
}

.share-modal.active {
    display: flex;
}

.share-content {
    background: var(--color-surface);
    border: var(--border-width-base) solid var(--color-primary);
    border-radius: 0;
    padding: var(--spacing-8) var(--spacing-10);
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.share-title {
    font-family: var(--font-serif);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-2);
}

.share-grid-size {
    font-family: var(--font-sans);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-5);
}

.share-emoji-line {
    font-size: var(--font-size-6xl);
    letter-spacing: var(--spacing-2);
    margin: var(--spacing-6) 0;
    line-height: var(--line-height-tight);
}

.share-stats {
    display: flex;
    justify-content: space-around;
    gap: var(--spacing-4);
    margin: var(--spacing-6) 0;
    padding: var(--spacing-5) 0;
    border-top: var(--border-width-thin) solid var(--color-border);
    border-bottom: var(--border-width-thin) solid var(--color-border);
}

.share-stat {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-1);
}

.share-stat-value {
    font-family: var(--font-sans);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

.share-stat-label {
    font-family: var(--font-sans);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
}

.share-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
    margin-top: var(--spacing-6);
}

.share-button {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    border: none;
    border-radius: 0;
    padding: var(--spacing-4) var(--spacing-6);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.share-button.primary {
    background: var(--color-primary);
    color: var(--color-surface);
    border: var(--border-width-base) solid var(--color-primary);
}

.share-button.primary:hover {
    background: var(--color-text-primary);
}

.share-button.secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: var(--border-width-base) solid var(--color-border);
}

.share-button.secondary:hover {
    border-color: var(--color-primary);
}

.share-button.tertiary {
    background: transparent;
    color: var(--color-text-secondary);
    border: var(--border-width-base) solid var(--color-border);
}

.share-button.tertiary:hover {
    color: var(--color-text-primary);
    border-color: var(--color-text-primary);
}

.share-button.success {
    background: var(--color-success);
    color: var(--color-surface);
    border: var(--border-width-base) solid var(--color-success);
}

.share-button.success:hover {
    background: #4a6a4c;
    border-color: #4a6a4c;
}

.share-button.text-link {
    background: transparent;
    color: var(--color-text-secondary);
    border: none;
    text-transform: none;
    letter-spacing: normal;
    font-weight: var(--font-weight-normal);
    padding: var(--spacing-3) var(--spacing-4);
    text-decoration: underline;
}

.share-button.text-link:hover {
    color: var(--color-text-primary);
}

.share-button.large {
    padding: var(--spacing-5) var(--spacing-6);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
}

.share-feedback {
    margin-top: var(--spacing-4);
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-accent);
    min-height: var(--spacing-5);
}

@media (max-width: 600px) {
    .share-content {
        padding: var(--spacing-6);
    }

    .share-title {
        font-size: var(--font-size-2xl);
    }

    .share-emoji-line {
        font-size: var(--font-size-5xl);
        letter-spacing: var(--spacing-1-5);
    }

    .share-stat-value {
        font-size: var(--font-size-2xl);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ask a Friend Modal */
.ask-friend-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--transition-base) ease;
}

.ask-friend-modal.active {
    display: flex;
}

.ask-friend-content {
    background: var(--color-surface);
    border: var(--border-width-base) solid var(--color-primary);
    border-radius: 0;
    padding: var(--spacing-8) var(--spacing-10);
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.ask-friend-title {
    font-family: var(--font-serif);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-3);
}

.ask-friend-message {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--spacing-6);
}

.ask-friend-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.ask-friend-button {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    border: none;
    border-radius: 0;
    padding: var(--spacing-4) var(--spacing-6);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ask-friend-button.primary {
    background: var(--color-primary);
    color: var(--color-surface);
    border: var(--border-width-base) solid var(--color-primary);
}

.ask-friend-button.primary:hover {
    background: var(--color-text-primary);
}

.ask-friend-button.secondary {
    background: var(--color-surface);
    color: var(--color-error, #ef4444);
    border: var(--border-width-base) solid var(--color-border);
    font-size: var(--font-size-sm);
}

.ask-friend-button.secondary:hover {
    border-color: var(--color-error, #ef4444);
}

.ask-friend-button.tertiary {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: var(--border-width-base) solid var(--color-border);
}

.ask-friend-button.tertiary:hover {
    border-color: var(--color-primary);
}

.ask-friend-feedback {
    margin-top: var(--spacing-4);
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-accent);
    min-height: var(--spacing-5);
}

@media (max-width: 600px) {
    .ask-friend-content {
        padding: var(--spacing-6);
    }

    .ask-friend-title {
        font-size: var(--font-size-2xl);
    }

    .ask-friend-message {
        font-size: var(--font-size-sm);
    }
}

/* ============================================
   Share Link Modal
   ============================================ */

.share-link-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--transition-base) ease;
}

.share-link-modal.active {
    display: flex;
}

.share-link-content {
    background: var(--color-surface);
    border: var(--border-width-base) solid var(--color-primary);
    border-radius: 0;
    padding: var(--spacing-8) var(--spacing-10);
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.share-link-title {
    font-family: var(--font-serif);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-4);
}

.share-link-preview {
    background: var(--color-bg);
    border: var(--border-width-thin) solid var(--color-border);
    border-radius: 0;
    padding: var(--spacing-4);
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: var(--line-height-relaxed);
    white-space: pre-line;
    margin-bottom: var(--spacing-5);
    text-align: left;
}

.share-link-url-container {
    display: flex;
    gap: var(--spacing-2);
    margin-bottom: var(--spacing-2);
}

.share-link-url {
    flex: 1;
    padding: var(--spacing-3);
    border: var(--border-width-base) solid var(--color-border);
    border-radius: 0;
    font-family: 'Courier New', monospace;
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    background: var(--color-bg);
}

.share-link-copy {
    padding: var(--spacing-3) var(--spacing-5);
    background: var(--color-primary);
    color: var(--color-surface);
    border: var(--border-width-base) solid var(--color-primary);
    border-radius: 0;
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.share-link-copy:hover {
    background: var(--color-text-primary);
}

.share-link-feedback {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-accent);
    min-height: var(--spacing-5);
    margin-bottom: var(--spacing-4);
}

.share-link-social-title {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    margin-bottom: var(--spacing-3);
}

.share-link-social {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-2);
    margin-bottom: var(--spacing-5);
}

.social-button {
    padding: var(--spacing-3) var(--spacing-4);
    border: var(--border-width-base) solid var(--color-border);
    border-radius: 0;
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
}

.social-button:hover {
    border-color: var(--color-primary);
}

.social-button.twitter {
    border-color: #1DA1F2;
    color: #1DA1F2;
}

.social-button.twitter:hover {
    background: #1DA1F2;
    color: white;
}

.social-button.whatsapp {
    border-color: #25D366;
    color: #25D366;
}

.social-button.whatsapp:hover {
    background: #25D366;
    color: white;
}

.social-button.facebook {
    border-color: #1877F2;
    color: #1877F2;
}

.social-button.facebook:hover {
    background: #1877F2;
    color: white;
}

.social-button.messenger {
    border-color: #0084FF;
    color: #0084FF;
}

.social-button.messenger:hover {
    background: #0084FF;
    color: white;
}

.social-icon {
    font-size: var(--font-size-lg);
}

.share-link-close {
    width: 100%;
    padding: var(--spacing-4);
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: var(--border-width-base) solid var(--color-border);
    border-radius: 0;
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.share-link-close:hover {
    border-color: var(--color-primary);
}

@media (max-width: 600px) {
    .share-link-content {
        padding: var(--spacing-6);
    }

    .share-link-title {
        font-size: var(--font-size-2xl);
    }

    .share-link-social {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Tutorial Experience (New Standalone Tutorial)
   ============================================ */

/* Full-screen tutorial container */
.tutorial-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg);
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Tutorial step content */
.tutorial-step-content {
    opacity: 1;
    transform: translateY(0);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

/* Individual step container */
.tutorial-step {
    max-width: 500px;
    width: 90%;
    padding: var(--spacing-8);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-6);
}

/* Progress dots */
.tutorial-progress {
    position: absolute;
    top: var(--spacing-4);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--spacing-2);
}

.tutorial-progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-border);
    transition: background var(--transition-base);
}

.tutorial-progress-dot.active {
    background: var(--color-accent);
}

/* Title text (intro step) */
.tutorial-title {
    font-family: var(--font-serif);
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--color-text-primary);
    text-align: center;
    margin-bottom: var(--spacing-2);
}

/* Message text */
.tutorial-message {
    font-family: var(--font-serif);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--color-text-primary);
    line-height: var(--line-height-normal);
    white-space: pre-line; /* Respect line breaks */
}

/* Call-to-action */
.tutorial-cta {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    color: var(--color-text-secondary);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.tutorial-cta:hover {
    opacity: 1;
}

/* Skip button */
.tutorial-skip {
    position: absolute;
    bottom: var(--spacing-4);
    right: var(--spacing-4);
    font-family: var(--font-sans);
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.tutorial-skip:hover {
    opacity: 1;
}

/* Visual demonstration container */
.tutorial-visual {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Step-specific visuals */

/* Single tile (step 1) */
.tutorial-tile {
    width: var(--tile-size);
    height: var(--tile-size);
    background: var(--color-surface);
    border: var(--border-width-base) solid var(--color-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    font-family: var(--font-serif);
}

.tutorial-tile .letter {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

.tutorial-tile .points {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
}

.tutorial-tile .points.pulsing {
    color: var(--color-accent);
    animation: pulse 1s infinite;
}

/* Grid of tiles (steps 2-3) */
.tutorial-grid {
    display: flex;
    gap: var(--tile-gap);
}

.tutorial-grid.mini .tutorial-tile {
    width: calc(var(--tile-size) * 0.9);
    height: calc(var(--tile-size) * 0.9);
}

.tutorial-tile.lit {
    background: var(--color-accent);
    animation: lightUp 0.3s ease forwards;
}

.tutorial-tile.locked {
    background: var(--color-border);
    opacity: 0.6;
    animation: lockAnimation 0.5s ease forwards;
}

.butter-emoji {
    position: absolute;
    font-size: var(--font-size-xl);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: butterPop 0.4s ease forwards;
}

/* Point highlight circle (step 1) */
.point-highlight-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-accent);
    border-radius: 50%;
    animation: pulseCircle 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulseCircle {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.5;
    }
}

/* Score display (step 2) */
.tutorial-score {
    margin-top: var(--spacing-6);
    font-family: var(--font-sans);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    text-align: center;
}

.tutorial-score .score-total {
    color: var(--color-accent);
    font-size: var(--font-size-2xl);
}

/* Floating point animation (step 2) */
.floating-point {
    position: fixed;
    font-family: var(--font-sans);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-accent);
    pointer-events: none;
    z-index: 10000;
    animation: floatUp 1s ease-out forwards;
    transform: translateX(-50%);
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-60px);
    }
}

/* Direction arrows (step 5) */
.tutorial-arrows {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-4);
}

.tutorial-arrow {
    font-size: var(--font-size-4xl);
    color: var(--color-accent);
}

.tutorial-arrow.pulsing {
    animation: pulse 1s infinite;
}

/* Word length comparison (step 6) */
.tutorial-comparison {
    display: flex;
    gap: var(--spacing-8);
    align-items: center;
}

.example {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    align-items: center;
}

.example-word {
    font-family: var(--font-serif);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-wide);
}

.example.invalid .example-word {
    color: var(--color-error);
}

.example.valid .example-word {
    color: var(--color-success);
}

.example-icon {
    font-size: var(--font-size-4xl);
}

.example-label {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
}

/* Target score UI (step 7) */
.tutorial-game-ui {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
    align-items: center;
}

/* Tutorial-specific styles (namespaced to prevent conflicts with game) */
.tutorial-visual .target-display {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-2);
    justify-content: center;
}

.tutorial-visual .target-label {
    font-family: var(--font-sans);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-widest);
}

.tutorial-visual .target-value {
    font-family: var(--font-serif);
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-accent);
}

.tutorial-visual .target-value.pulsing,
.tutorial-visual .target-display.pulsing .target-value {
    animation: pulse 1s infinite;
}

.tutorial-visual .progress-bar-container {
    width: 200px;
    height: 8px;
    background: var(--color-border);
    border: var(--border-width-thin) solid var(--color-primary);
    overflow: hidden;
}

.tutorial-visual .progress-bar {
    height: 100%;
    background: var(--color-accent);
    transition: width var(--transition-progress);
}

.tutorial-gap-indicator {
    font-family: var(--font-sans);
    font-size: 9px;
    color: var(--color-text-secondary);
    margin-top: -8px;
    text-align: center;
    letter-spacing: var(--letter-spacing-normal);
}

.tutorial-visual .score-display {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-2);
    justify-content: center;
}

.tutorial-visual .score-label {
    font-family: var(--font-sans);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-widest);
}

.tutorial-visual .score-value {
    font-family: var(--font-serif);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

/* Ready to play screen (step 7) */
.tutorial-ready {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-6);
    padding: var(--spacing-8) 0;
}

.tutorial-ready-icon {
    font-size: 80px;
    color: var(--color-accent);
    animation: checkmarkPop 0.5s ease-out;
}

@keyframes checkmarkPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.tutorial-replay-btn {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    background: none;
    border: none;
    text-decoration: underline;
    cursor: pointer;
    padding: var(--spacing-2);
    transition: color var(--transition-fast);
}

.tutorial-replay-btn:hover {
    color: var(--color-text-primary);
}

/* Animations */

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

@keyframes lightUp {
    0% {
        background: var(--color-surface);
    }
    100% {
        background: var(--color-accent);
    }
}

@keyframes lockAnimation {
    0% {
        background: var(--color-accent);
        opacity: 1;
    }
    100% {
        background: var(--color-border);
        opacity: 0.6;
    }
}

@keyframes butterPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Mobile responsive */

@media (max-width: 600px) {
    .tutorial-step {
        padding: var(--spacing-5);
    }

    .tutorial-message {
        font-size: var(--font-size-2xl);
    }

    .tutorial-comparison {
        flex-direction: column;
        gap: var(--spacing-4);
    }

    .tutorial-arrows {
        gap: var(--spacing-3);
    }

    .tutorial-arrow {
        font-size: var(--font-size-3xl);
    }
}

/* Challenge Accept Screen */
.challenge-accept-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--transition-base) ease;
}

.challenge-accept-screen.active {
    display: flex;
}

.challenge-accept-content {
    background: var(--color-surface);
    border: var(--border-width-base) solid var(--color-primary);
    border-radius: 0;
    padding: var(--spacing-8) var(--spacing-10);
    max-width: 480px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.challenge-accept-header {
    margin-bottom: var(--spacing-6);
}

.challenge-title {
    font-family: var(--font-serif);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-2);
}

.challenge-subtitle {
    font-family: var(--font-sans);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-1);
}

.challenge-date {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

.challenge-description {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-6);
}

.challenge-intro {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-6);
    padding: var(--spacing-4);
    background: var(--color-background);
    border: var(--border-width-thin) solid var(--color-border);
    line-height: var(--line-height-relaxed);
}

.challenge-intro p {
    margin: 0;
}

.challenge-emoji-legend {
    display: flex;
    justify-content: center;
    gap: var(--spacing-4);
    margin-top: var(--spacing-2);
    margin-bottom: var(--spacing-4);
}

.emoji-hint {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: var(--spacing-1);
}

.challenge-stats-box {
    background: var(--color-background);
    border: var(--border-width-thin) solid var(--color-border);
    border-radius: 0;
    padding: var(--spacing-6);
    margin: var(--spacing-6) 0;
}

.challenge-emoji-line {
    font-size: var(--font-size-4xl);
    letter-spacing: var(--spacing-2);
    margin: var(--spacing-4) 0;
    line-height: var(--line-height-tight);
}

.challenge-stat-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
    margin-top: var(--spacing-4);
}

.challenge-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-3);
}

.challenge-stat-label {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.challenge-stat-value {
    font-family: var(--font-sans);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

.challenge-accept-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
    margin-top: var(--spacing-6);
}

.challenge-accept-button {
    width: 100%;
    padding: var(--spacing-4) var(--spacing-6);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    border: var(--border-width-base) solid var(--color-primary);
    border-radius: 0;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.challenge-accept-button.primary {
    background: var(--color-primary);
    color: var(--color-surface);
}

.challenge-accept-button.primary:hover {
    background: #2a2a2a;
    border-color: #2a2a2a;
}

.challenge-accept-button.secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.challenge-accept-button.secondary:hover {
    background: var(--color-background);
}

.challenge-spinner {
    font-size: var(--font-size-6xl);
    margin: var(--spacing-10) 0;
    animation: spin 1s linear infinite;
}

.challenge-error {
    text-align: center;
    padding: var(--spacing-8);
}

.challenge-error-icon {
    font-size: var(--font-size-6xl);
    margin-bottom: var(--spacing-4);
}

.challenge-error-title {
    font-family: var(--font-serif);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-3);
}

.challenge-error-message {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--spacing-6);
}

.challenge-error-button {
    width: 100%;
    padding: var(--spacing-4) var(--spacing-6);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    background: var(--color-primary);
    color: var(--color-surface);
    border: var(--border-width-base) solid var(--color-primary);
    border-radius: 0;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.challenge-error-button:hover {
    background: #2a2a2a;
    border-color: #2a2a2a;
}

.challenge-loading {
    text-align: center;
    padding: var(--spacing-10) var(--spacing-8);
}

.challenge-loading-text {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    margin-top: var(--spacing-4);
}

.challenge-stats-title {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    margin-bottom: var(--spacing-3);
}

.challenge-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
    margin-top: var(--spacing-6);
}

.challenge-decline-button {
    width: 100%;
    padding: var(--spacing-4) var(--spacing-6);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: var(--border-width-base) solid var(--color-border);
    border-radius: 0;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.challenge-decline-button:hover {
    background: var(--color-background);
    border-color: var(--color-primary);
}

.challenge-info {
    margin-top: var(--spacing-5);
    padding-top: var(--spacing-5);
    border-top: var(--border-width-thin) solid var(--color-border);
}

.challenge-info p {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: var(--line-height-relaxed);
    margin: 0;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
    .challenge-accept-content {
        padding: var(--spacing-4) var(--spacing-5);
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .challenge-title {
        font-size: var(--font-size-xl);
    }

    .challenge-subtitle {
        font-size: var(--font-size-base);
    }

    .challenge-emoji-line {
        font-size: var(--font-size-3xl);
        letter-spacing: var(--spacing-1);
        margin: var(--spacing-3) 0;
    }

    .challenge-stats-box {
        padding: var(--spacing-4);
        margin: var(--spacing-4) 0;
    }

    .challenge-stat-grid {
        gap: var(--spacing-3);
    }

    .challenge-stat-value {
        font-size: var(--font-size-lg);
    }

    .challenge-accept-buttons {
        margin-top: var(--spacing-4);
        gap: var(--spacing-2);
    }

    .challenge-accept-button {
        padding: var(--spacing-3) var(--spacing-4);
        font-size: var(--font-size-sm);
    }
}

/* Challenge Comparison Modal */
.challenge-comparison-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--transition-base) ease;
}

.challenge-comparison-modal.active {
    display: flex;
}

.challenge-comparison-content {
    background: var(--color-surface);
    border: var(--border-width-base) solid var(--color-primary);
    border-radius: 0;
    padding: var(--spacing-8) var(--spacing-10);
    max-width: 600px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.challenge-comparison-header {
    margin-bottom: var(--spacing-6);
}

.challenge-comparison-title {
    font-family: var(--font-serif);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-2);
}

.challenge-comparison-subtitle {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
}

.challenge-comparison-table {
    background: var(--color-background);
    border: var(--border-width-thin) solid var(--color-border);
    border-radius: 0;
    padding: var(--spacing-6);
    margin: var(--spacing-6) 0;
}

.challenge-comparison-grid-size {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    margin-top: var(--spacing-2);
}

.challenge-comparison-names {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--spacing-4);
    align-items: center;
    margin-bottom: var(--spacing-6);
    padding-bottom: var(--spacing-5);
    border-bottom: var(--border-width-base) solid var(--color-border);
}

.challenge-comparison-name {
    font-family: var(--font-sans);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

.challenge-comparison-name.challenger {
    text-align: right;
}

.challenge-comparison-name.player {
    text-align: left;
}

.challenge-comparison-vs {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
}

.challenge-comparison-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--spacing-4);
    align-items: center;
    padding: var(--spacing-4) 0;
    border-bottom: var(--border-width-thin) solid var(--color-border);
}

.challenge-comparison-row:last-child {
    border-bottom: none;
}

.challenge-comparison-label {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
}

.challenge-comparison-icon {
    font-size: var(--font-size-base);
}

.challenge-comparison-stat {
    font-family: var(--font-sans);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    text-align: center;
}

.challenge-comparison-stat.winner {
    color: var(--color-accent);
}

.challenge-comparison-stat .crown {
    margin-left: var(--spacing-1);
}

.challenge-comparison-result {
    margin: var(--spacing-6) 0;
    padding: var(--spacing-5);
    background: var(--color-background);
    border: var(--border-width-thin) solid var(--color-border);
    border-radius: 0;
    font-family: var(--font-serif);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    text-align: center;
}

.challenge-comparison-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
    margin-top: var(--spacing-6);
}

.challenge-comparison-stats {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-5);
}

.challenge-comparison-stat {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--spacing-4);
    align-items: center;
}

.challenge-stat-label-row {
    grid-column: 1 / -1;
    font-family: var(--font-sans);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    margin-bottom: var(--spacing-2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
}

.challenge-stat-challenger,
.challenge-stat-player {
    font-family: var(--font-sans);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

.challenge-stat-challenger {
    text-align: right;
}

.challenge-stat-player {
    text-align: left;
}

.challenge-stat-challenger.winner,
.challenge-stat-player.winner {
    color: var(--color-accent);
}

.challenge-stat-divider {
    width: 2px;
    height: 30px;
    background: var(--color-border);
}

.challenge-result {
    margin: var(--spacing-6) 0;
    padding: var(--spacing-5);
    background: var(--color-background);
    border: var(--border-width-thin) solid var(--color-border);
    border-radius: 0;
}

.challenge-result-text {
    font-family: var(--font-serif);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

.challenge-result-score {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    margin-top: var(--spacing-2);
}

.challenge-comparison-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
    margin-top: var(--spacing-6);
}

.challenge-comparison-button {
    width: 100%;
    padding: var(--spacing-4) var(--spacing-6);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    border: var(--border-width-base) solid var(--color-primary);
    border-radius: 0;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.challenge-comparison-button.primary {
    background: var(--color-primary);
    color: var(--color-surface);
}

.challenge-comparison-button.primary:hover {
    background: #2a2a2a;
    border-color: #2a2a2a;
}

.challenge-comparison-button.secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.challenge-comparison-button.secondary:hover {
    background: var(--color-background);
}

.challenge-comparison-button.tertiary {
    background: transparent;
    color: var(--color-text-secondary);
    border: var(--border-width-base) solid var(--color-border);
}

.challenge-comparison-button.tertiary:hover {
    color: var(--color-text-primary);
    border-color: var(--color-text-primary);
}

.challenge-comparison-button.large {
    padding: var(--spacing-5) var(--spacing-8);
    font-size: var(--font-size-lg);
}

.challenge-comparison-button.text-link {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    text-transform: none;
    letter-spacing: normal;
    font-weight: var(--font-weight-normal);
    padding: var(--spacing-2);
}

.challenge-comparison-button.text-link:hover {
    color: var(--color-text-primary);
    text-decoration: underline;
}

/* New card-based layout */
.challenge-comparison-result-hero {
    margin-bottom: var(--spacing-8);
    padding: var(--spacing-6);
    background: var(--color-background);
    border: var(--border-width-base) solid var(--color-primary);
    font-family: var(--font-serif);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    text-align: center;
}

.challenge-comparison-cards {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--spacing-6);
    align-items: center;
    margin: var(--spacing-8) 0;
}

.challenge-comparison-card {
    background: var(--color-background);
    border: var(--border-width-base) solid var(--color-border);
    padding: var(--spacing-6);
    text-align: center;
    transition: all 0.2s ease;
}

.challenge-comparison-card.winner {
    border-color: var(--color-primary);
    border-width: 3px;
    background: linear-gradient(to bottom, rgba(255, 215, 0, 0.03), var(--color-surface));
    box-shadow: 0 0 0 2px var(--color-primary);
}

.challenge-card-name {
    font-family: var(--font-sans);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-4);
}

.challenge-card-emoji {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-5);
    letter-spacing: var(--spacing-1);
}

.challenge-card-stats {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.challenge-card-stat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    font-family: var(--font-sans);
}

.challenge-card-stat .stat-icon {
    font-size: var(--font-size-base);
}

.challenge-card-stat .stat-value {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.win-indicator {
    display: inline-block;
    margin-left: var(--spacing-1);
    color: #10b981;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-sm);
}

.challenge-comparison-vs {
    font-family: var(--font-sans);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

@media (max-width: 600px) {
    .challenge-comparison-content {
        padding: var(--spacing-4) var(--spacing-5);
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .challenge-comparison-header {
        margin-bottom: var(--spacing-4);
    }

    .challenge-comparison-title {
        font-size: var(--font-size-xl);
        margin-bottom: var(--spacing-1);
    }

    .challenge-comparison-grid-size {
        font-size: var(--font-size-sm);
    }

    .challenge-comparison-table {
        padding: var(--spacing-4);
        margin: var(--spacing-4) 0;
    }

    .challenge-comparison-names {
        margin-bottom: var(--spacing-4);
        padding-bottom: var(--spacing-3);
        gap: var(--spacing-2);
    }

    .challenge-comparison-name {
        font-size: var(--font-size-base);
    }

    .challenge-comparison-row {
        padding: var(--spacing-3) 0;
        gap: var(--spacing-2);
    }

    .challenge-comparison-label {
        font-size: var(--font-size-xs);
    }

    .challenge-comparison-stat {
        font-size: var(--font-size-lg);
    }

    .challenge-comparison-result {
        margin: var(--spacing-4) 0;
        padding: var(--spacing-3);
        font-size: var(--font-size-lg);
    }

    .challenge-comparison-actions {
        margin-top: var(--spacing-4);
        gap: var(--spacing-2);
    }

    .challenge-comparison-button {
        padding: var(--spacing-3) var(--spacing-4);
        font-size: var(--font-size-sm);
    }

    /* Mobile styles for new card layout */
    .challenge-comparison-result-hero {
        margin-bottom: var(--spacing-5);
        padding: var(--spacing-4);
        font-size: var(--font-size-xl);
    }

    .challenge-comparison-cards {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: var(--spacing-3);
        margin: var(--spacing-5) 0;
    }

    .challenge-comparison-card {
        padding: var(--spacing-4);
    }

    .challenge-card-name {
        font-size: var(--font-size-base);
        margin-bottom: var(--spacing-3);
    }

    .challenge-card-emoji {
        font-size: var(--font-size-lg);
        margin-bottom: var(--spacing-3);
    }

    .challenge-card-stat .stat-value {
        font-size: var(--font-size-base);
    }

    .challenge-comparison-vs {
        font-size: var(--font-size-base);
        order: 1; /* Place VS between cards on mobile */
    }

    .challenge-comparison-card:first-child {
        order: 0;
    }

    .challenge-comparison-card:last-child {
        order: 2;
    }
}

/* Challenge Banner */
.challenge-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: var(--border-width-base) solid var(--color-primary);
    padding: var(--spacing-3) var(--spacing-4);
    z-index: var(--z-header);
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.challenge-banner.hidden {
    display: none;
}

.challenge-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
}

.challenge-banner-icon {
    font-size: var(--font-size-lg);
}

.challenge-banner-text {
    font-family: var(--font-sans);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
}

@media (max-width: 600px) {
    .challenge-banner {
        padding: var(--spacing-2) var(--spacing-3);
    }

    .challenge-banner-text {
        font-size: var(--font-size-xs);
    }

    .challenge-banner-icon {
        font-size: var(--font-size-base);
    }
}

/* Accessibility: Respect prefers-reduced-motion */

@media (prefers-reduced-motion: reduce) {
    .tutorial-container *,
    .tutorial-step-content,
    .tutorial-arrow,
    .target-value,
    .floating-point,
    .point-highlight-circle,
    .tutorial-ready-icon {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
