 * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        :root {
            --primary: #ef233c;
            --primary-dark: #ef233c;
            --primary-light: #ef233c;
            --success: #ef233c;
            --danger: #d63031;
            --warning: #fdcb6e;
            --info: white;
            --dark: #fdfcdc;
            --dark-secondary: #16213e;
            --light: #f5f6fa;
            --card-bg: #cccccc;
            --text: black;
            --text-light: black;
            --border: blue;
            --shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
            --shadow-lg: 0 30px 60px rgba(0, 0, 0, 0.2);
            --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --gradient-horizontal: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
        }

        [data-theme="dark"] {
            --card-bg: #197278;
            --text: white;
            --text-light: #b2bec3;
            --border: black;
            --dark: #0f0f1a;
            --dark-secondary: #1a1a2e;
        }

        body {
            font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            background: #6a5837;
            min-height: 100vh;
            padding: 25px 20px;
            transition: background-color 0.3s ease;
            position: relative;
            overflow-x: hidden;
        }

        /* Animated Background */
        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: radial-gradient(circle at 20% 50%, rgba(108, 92, 231, 0.15) 0%, transparent 50%),
                        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.15) 0%, transparent 50%);
            pointer-events: none;
            z-index: 0;
        }

        @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap');

        .game-container {
            max-width: 1150px;
            width: 100%;
            margin: 0 auto;
            position: relative;
            z-index: 1;
        }

        /* ========== PREMIUM HEADER ========== */
        .premium-header {
            background: #5e7868;
            backdrop-filter: blur(20px);
            border-radius: 30px;
            padding: 18px 30px;
            margin-bottom: 30px;
            border: 1px solid rgba(255, 255, 255, 0.25);
            box-shadow: var(--shadow-lg);
            position: relative;
            overflow: hidden;
        }

        .premium-header::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -20%;
            width: 200px;
            height: 200px;
            background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
            border-radius: 50%;
            pointer-events: none;
        }

        .premium-header::after {
            content: '';
            position: absolute;
            bottom: -50%;
            left: -20%;
            width: 200px;
            height: 200px;
            background: #a2d2ff;
            border-radius: 50%;
            pointer-events: none;
        }

        .header-main {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 20px;
            position: relative;
            z-index: 2;
        }

        .logo-area {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .logo-icon {
            font-size: 2.5rem;
            filter: drop-shadow(0 5px 15px rgba(0,0,0,0.2));
            animation: floatIcon 3s ease-in-out infinite;
        }

        @keyframes floatIcon {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-5px); }
        }

        .logo-text {
            display: flex;
            flex-direction: column;
        }

        .logo-text h1 {
            font-size: 1.6rem;
            font-weight: 800;
            color: #29bf12;
            letter-spacing: -0.5px;
            text-shadow: 0 2px 10px rgba(0,0,0,0.2);
        }

        .logo-text span {
            font-size: 0.7rem;
            color: white;
            letter-spacing: 2px;
            opacity: 0.9;
        }

        .stats-container {
            display: flex;
            gap: 20px;
        }

        .stat-card {
            background: #386641;
            backdrop-filter: blur(10px);
            padding: 8px 22px;
            border-radius: 50px;
            text-align: center;
            border: 1px solid rgba(255,255,255,0.3);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            cursor: default;
        }

        .stat-card:hover {
            transform: translateY(-2px);
            background: #93a8ac;
        }

        .stat-label {
            font-size: 0.65rem;
            color: white;
            letter-spacing: 1px;
            text-transform: uppercase;
            font-weight: 500;
        }

        .stat-value {
            font-size: 1.3rem;
            font-weight: 800;
            color: white;
            line-height: 1.2;
        }

        .action-buttons {
            display: flex;
            gap: 12px;
        }

        .header-btn {
            background: #386641;
            border: 1px solid rgba(255,255,255,0.3);
            font-size: 1.2rem;
            cursor: pointer;
            padding: 10px;
            border-radius: 50%;
            width: 42px;
            height: 42px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            color: white;
        }

        .header-btn:hover {
            transform: scale(1.05);
            background: #02c39a;
            border-color: transparent;
        }

        .header-btn:focus-visible {
            outline: 2px solid #02c39a;
            outline-offset: 2px;
        }

        /* Main Game Card */
        .game-card {
            background: #bfd8bd;
            border-radius: 40px;
            padding: 25px;
            box-shadow: var(--shadow);
            margin-bottom: 25px;
            transition: all 0.3s ease;
        }

        .two-columns {
            display: grid;
            grid-template-columns: 1fr 0.9fr;
            gap: 30px;
        }

        /* Game Area */
        .game-area {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        /* Category Section */
        .category-section {
            background: #ccc5b9;
            border-radius: 25px;
            padding: 15px;
        }

        .category-title {
            font-size: 0.85rem;
            font-weight: 700;
            color: black;
            margin-bottom: 12px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .category-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
            gap: 10px;
        }

        .cat-btn {
            background: #386641;
            border: 2px solid var(--border);
            padding: 10px 8px;
            border-radius: 30px;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            color: white;
            font-family: inherit;
            position: relative;
            overflow: hidden;
        }

        .cat-btn::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: rgba(0, 0, 255, 0.1);
            transform: translate(-50%, -50%);
            transition: width 0.4s, height 0.4s;
        }

        .cat-btn:active::before {
            width: 100%;
            height: 100%;
        }

        .cat-btn.active {
            background: #988f2a;
            color: white;
            border-color: transparent;
            transform: scale(0.98);
        }

        .cat-btn:hover:not(.active) {
            transform: translateY(-2px);
            border-color: var(--primary);
            box-shadow: 0 4px 12px rgba(239, 35, 60, 0.2);
        }

        .cat-btn:focus-visible {
            outline: 2px solid var(--primary);
            outline-offset: 2px;
        }

        /* Word Display */
        .word-display {
            text-align: center;
            background: white;
            border-radius: 25px;
            padding: 25px 20px;
        }

        .word-letters {
            display: flex;
            justify-content: center;
            gap: 12px;
            flex-wrap: wrap;
            margin-bottom: 10px;
        }

        .letter-box {
            width: 60px;
            height: 70px;
            background: var(--card-bg);
            border: 2px solid var(--border);
            border-radius: 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.8rem;
            font-weight: 800;
            color: black;
            text-transform: uppercase;
            box-shadow: var(--shadow);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
        }

        .letter-box.filled {
            animation: letterPop 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
            border-color: #29bf12;
            background: #e8f5e9;
        }

        @keyframes letterPop {
            0% { transform: scale(0.8); opacity: 0; }
            50% { transform: scale(1.1); }
            100% { transform: scale(1); opacity: 1; }
        }

        /* Info Panel */
        .info-panel {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 12px;
            padding: 12px 15px;
            background: #b0c4b1;
            border-radius: 25px;
        }

        .category-badge {
            background: #988f2a;
            padding: 6px 18px;
            border-radius: 40px;
            color: white;
            font-weight: 600;
            font-size: 0.8rem;
            letter-spacing: 0.5px;
        }

        .hint-box {
            flex: 1;
            display: flex;
            align-items: center;
            gap: 8px;
            background: #386641;
            padding: 6px 15px;
            border-radius: 40px;
            min-width: 0;
        }

        .hint-text {
            color: white;
            font-size: 0.8rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .hint-btn {
            background: #ffcb77;
            border: none;
            padding: 8px 20px;
            border-radius: 40px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            font-family: inherit;
            font-size: 0.8rem;
            color: #333;
            position: relative;
            overflow: hidden;
        }

        .hint-btn::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.3);
            transform: translate(-50%, -50%);
            transition: width 0.4s, height 0.4s;
        }

        .hint-btn:active::before {
            width: 100%;
            height: 100%;
        }

        .hint-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

        .hint-btn:hover:not(:disabled) {
            transform: scale(1.02);
            filter: brightness(1.05);
            box-shadow: 0 4px 12px rgba(255, 203, 119, 0.3);
        }

        /* Wrong Guesses */
        .wrong-section {
            text-align: center;
            padding: 15px;
            background: white;
            border-radius: 20px;
        }

        .wrong-section > div:first-child {
            font-weight: 600;
            margin-bottom: 10px;
            color: #333;
        }

        .wrong-letters {
            display: flex;
            justify-content: center;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 8px;
            min-height: 45px;
        }

        .wrong-letter {
            background: #e63946;
            color: white;
            padding: 6px 16px;
            border-radius: 30px;
            font-weight: 700;
            font-size: 1rem;
            text-transform: uppercase;
            animation: wrongPop 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
            box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
        }

        @keyframes wrongPop {
            0% { transform: scale(0); opacity: 0; }
            70% { transform: scale(1.1); }
            100% { transform: scale(1); opacity: 1; }
        }

        /* Keyboard */
        .keyboard {
            display: grid;
            grid-template-columns: repeat(9, 1fr);
            gap: 8px;
        }

        .key {
            background: var(--card-bg);
            border: 2px solid var(--border);
            padding: 12px 5px;
            border-radius: 12px;
            font-size: 0.95rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            text-transform: uppercase;
            color: black;
            font-family: inherit;
            position: relative;
            overflow: hidden;
        }

        .key::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: rgba(239, 35, 60, 0.2);
            transform: translate(-50%, -50%);
            transition: width 0.4s, height 0.4s;
        }

        .key:active::before {
            width: 100%;
            height: 100%;
        }

        .key:hover:not(:disabled) {
            transform: translateY(-2px);
            border-color: #e63946;
            box-shadow: 0 4px 12px rgba(230, 57, 70, 0.2);
        }

        .key:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }

        .key.used-incorrect {
            background: #e63946;
            color: white;
            border-color: var(--danger);
            text-decoration: line-through;
        }

        .key.used-correct {
            background: #29bf12;
            color: white;
            border-color: #29bf12;
        }

        .key:focus-visible {
            outline: 2px solid var(--primary);
            outline-offset: 2px;
        }

        /* Hangman Area */
        .hangman-area {
            background: linear-gradient(135deg, rgba(108, 92, 231, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
            border-radius: 30px;
            padding: 20px;
            text-align: center;
            border: 2px solid var(--border);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .hangman-title {
            font-size: 0.9rem;
            font-weight: 700;
            color: black;
            margin-bottom: 15px;
        }

        canvas {
            background: white;
            border-radius: 20px;
            box-shadow: var(--shadow);
            width: 100%;
            max-width: 280px;
            height: auto;
            transition: all 0.3s ease;
        }

        /* Controls */
        .controls {
            display: flex;
            gap: 12px;
            margin-top: 10px;
        }

        .control-btn {
            flex: 1;
            padding: 12px;
            border: none;
            border-radius: 50px;
            font-weight: 700;
            font-size: 0.85rem;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            font-family: inherit;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            position: relative;
            overflow: hidden;
        }

        .control-btn::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.3);
            transform: translate(-50%, -50%);
            transition: width 0.4s, height 0.4s;
        }

        .control-btn:active::before {
            width: 100%;
            height: 100%;
        }

        .btn-primary { 
            background: #52b788; 
            color: white; 
        }
        
        .btn-danger { 
            background: #52b788; 
            color: white; 
        }
        
        .btn-success { 
            background: var(--success); 
            color: white; 
        }

        .control-btn:hover {
            transform: translateY(-2px);
            filter: brightness(1.05);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        }

        .control-btn:focus-visible {
            outline: 2px solid var(--primary);
            outline-offset: 2px;
        }

        /* History Section */
        .history-section {
            background: var(--card-bg);
            border-radius: 30px;
            padding: 20px;
            margin-top: 0;
        }

        .history-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 2px solid rgba(0, 0, 0, 0.1);
        }

        .history-title {
            font-weight: 800;
            color: black;
            font-size: 1rem;
        }

        .clear-history {
            background: none;
            border: none;
            color: #e63946;
            cursor: pointer;
            font-size: 0.85rem;
            padding: 6px 12px;
            border-radius: 8px;
            transition: all 0.2s ease;
            font-weight: 600;
        }

        .clear-history:hover {
            background: rgba(230, 57, 70, 0.1);
            transform: scale(1.02);
        }

        .history-list {
            max-height: 130px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .history-list::-webkit-scrollbar {
            width: 6px;
        }

        .history-list::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.1);
            border-radius: 10px;
        }

        .history-list::-webkit-scrollbar-thumb {
            background: #ef233c;
            border-radius: 10px;
        }

        .history-list::-webkit-scrollbar-thumb:hover {
            background: #c1121f;
        }

        .history-item {
            background: white;
            padding: 10px 15px;
            border-radius: 16px;
            font-size: 0.8rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            border: 1px solid transparent;
        }

        .history-item:hover {
            transform: translateX(5px);
            border-color: #ef233c;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        .history-word {
            font-weight: 700;
            text-transform: uppercase;
            font-size: 0.85rem;
        }

        .history-result.win { 
            color: #00b894; 
            font-weight: 700;
        }
        
        .history-result.loss { 
            color: #d63031; 
            font-weight: 700;
        }

        .history-time {
            font-size: 0.65rem;
            color: #666;
        }

        /* Modal */
        .modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(213, 189, 175, 0.95);
            backdrop-filter: blur(10px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            display: none;
            animation: fadeIn 0.3s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        .modal-content {
            background: var(--card-bg);
            padding: 40px;
            border-radius: 50px;
            text-align: center;
            max-width: 400px;
            width: 90%;
            animation: slideUp 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
            box-shadow: var(--shadow-lg);
        }

        @keyframes slideUp {
            from { transform: translateY(50px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }

        .modal-content h2 {
            font-size: 2rem;
            margin-bottom: 15px;
        }

        .word-reveal {
            font-size: 1.8rem;
            font-weight: 800;
            margin: 20px 0;
            text-transform: uppercase;
            color: #ef233c;
            letter-spacing: 4px;
            word-break: break-all;
        }

        /* Toast Notification */
        .toast {
            position: fixed;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(0, 0, 0, 0.9);
            backdrop-filter: blur(10px);
            color: white;
            padding: 12px 28px;
            border-radius: 50px;
            font-size: 0.9rem;
            z-index: 1100;
            animation: slideUpFade 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
            white-space: nowrap;
            max-width: 90%;
            white-space: normal;
            text-align: center;
            box-shadow: var(--shadow-lg);
            font-weight: 500;
        }

        @keyframes slideUpFade {
            from { 
                opacity: 0; 
                transform: translateX(-50%) translateY(20px); 
            }
            to { 
                opacity: 1; 
                transform: translateX(-50%) translateY(0); 
            }
        }

        /* Empty State */
        .empty-state {
            text-align: center;
            opacity: 0.6;
            padding: 20px;
            font-style: italic;
        }

        /* Responsive Design */
        @media (max-width: 900px) {
            .two-columns { 
                grid-template-columns: 1fr; 
                gap: 20px; 
            }
            
            .letter-box { 
                width: 50px; 
                height: 60px; 
                font-size: 1.5rem; 
            }
            
            .keyboard { 
                grid-template-columns: repeat(7, 1fr); 
            }
        }

        @media (max-width: 650px) {
            .letter-box { 
                width: 45px; 
                height: 55px; 
                font-size: 1.3rem; 
            }
            
            .keyboard { 
                grid-template-columns: repeat(6, 1fr); 
                gap: 6px; 
            }
            
            .key { 
                padding: 8px 3px; 
                font-size: 0.8rem; 
            }
        }

        @media (max-width: 550px) {
            body { 
                padding: 15px; 
            }
            
            .premium-header { 
                padding: 15px 20px; 
            }
            
            .logo-text h1 { 
                font-size: 1.3rem; 
            }
            
            .logo-icon { 
                font-size: 2rem; 
            }
            
            .stats-container { 
                gap: 10px; 
            }
            
            .stat-card { 
                padding: 5px 12px; 
            }
            
            .stat-value { 
                font-size: 1.1rem; 
            }
            
            .letter-box { 
                width: 38px; 
                height: 48px; 
                font-size: 1.1rem; 
            }
            
            .keyboard { 
                grid-template-columns: repeat(5, 1fr); 
            }
            
            .category-grid { 
                grid-template-columns: repeat(2, 1fr); 
            }
            
            .info-panel {
                flex-direction: column;
            }
            
            .hint-box {
                width: 100%;
            }
            
            .hint-text {
                white-space: normal;
                line-height: 1.3;
            }
            
            .controls {
                flex-direction: column;
            }
        }

        @media (max-width: 380px) {
            .letter-box { 
                width: 32px; 
                height: 42px; 
                font-size: 0.9rem; 
            }
            
            .keyboard { 
                grid-template-columns: repeat(4, 1fr); 
            }
        }