/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* CSS Variables for consistent theming */
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    /* Modern color palette */
    --background: #0f0f23;
    --surface: #1a1a2e;
    --surface-hover: #25253f;
    --card-background: rgba(26, 26, 46, 0.8);
    --glass-background: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(59, 130, 246, 0.5);
    
    /* Layout */
    --grid-size: 85px;
    --border-radius: 16px;
    --border-radius-sm: 12px;
    --border-radius-lg: 20px;
    
    /* Modern shadows and effects */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.3);
    --backdrop-blur: blur(12px);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    background-image: 
        radial-gradient(at 20% 50%, hsla(240, 100%, 70%, 0.1) 0px, transparent 50%),
        radial-gradient(at 80% 20%, hsla(280, 100%, 70%, 0.1) 0px, transparent 50%),
        radial-gradient(at 40% 90%, hsla(200, 100%, 70%, 0.1) 0px, transparent 50%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 24px;
}

/* Modern Logo Design */
.logo-container {
    position: relative;
    display: inline-block;
    margin-bottom: 24px;
}

.logo {
    font-size: 4.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 40%, #34d399 80%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 2;
    text-shadow: 0 0 60px rgba(96, 165, 250, 0.4);
    font-family: 'Inter', sans-serif;
}

.logo-accent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(96, 165, 250, 0.1) 2px,
            rgba(96, 165, 250, 0.1) 4px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 2px,
            rgba(167, 139, 250, 0.1) 2px,
            rgba(167, 139, 250, 0.1) 4px
        );
    border-radius: 24px;
    z-index: 1;
    opacity: 0.6;
    animation: loomWeave 8s ease-in-out infinite;
}

.logo-accent::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -20%;
    right: -20%;
    bottom: -20%;
    background: radial-gradient(ellipse at center, rgba(96, 165, 250, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    animation: logoGlow 3s ease-in-out infinite alternate;
}

@keyframes loomWeave {
    0%, 100% { 
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
        opacity: 0.6;
    }
    25% { 
        transform: translate(-50%, -50%) rotate(1deg) scale(1.02);
        opacity: 0.8;
    }
    50% { 
        transform: translate(-50%, -50%) rotate(0deg) scale(1.05);
        opacity: 0.4;
    }
    75% { 
        transform: translate(-50%, -50%) rotate(-1deg) scale(1.02);
        opacity: 0.8;
    }
}

@keyframes logoGlow {
    0% { 
        opacity: 0.3;
        transform: scale(0.95);
    }
    100% { 
        opacity: 0.6;
        transform: scale(1.1);
    }
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    font-weight: 500;
    max-width: 600px;
    margin: 0 auto;
}

/* Compact Stats Bar */
.stats-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 12px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 80px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 36px;
    text-align: right;
}

/* Special multiplier styling */
#multiplier {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    transition: all 0.3s ease;
    min-width: 40px;
}

/* Multiplier glow effects */
#multiplier.glow-1 {
    color: #6B7280;
    background: none;
    -webkit-text-fill-color: #6B7280;
}

#multiplier.glow-2 {
    text-shadow: 0 0 8px rgba(79, 70, 229, 0.4);
    filter: drop-shadow(0 0 4px rgba(79, 70, 229, 0.3));
}

#multiplier.glow-3 {
    text-shadow: 0 0 12px rgba(79, 70, 229, 0.6), 0 0 6px rgba(124, 58, 237, 0.4);
    filter: drop-shadow(0 0 6px rgba(79, 70, 229, 0.5));
}

#multiplier.glow-4 {
    text-shadow: 0 0 16px rgba(79, 70, 229, 0.8), 0 0 8px rgba(124, 58, 237, 0.6), 0 0 4px rgba(168, 85, 247, 0.4);
    filter: drop-shadow(0 0 8px rgba(79, 70, 229, 0.7));
}

#multiplier.glow-5 {
    text-shadow: 0 0 20px rgba(79, 70, 229, 1), 0 0 12px rgba(124, 58, 237, 0.8), 0 0 6px rgba(168, 85, 247, 0.6);
    filter: drop-shadow(0 0 12px rgba(79, 70, 229, 0.9));
    animation: pulse-glow 2s ease-in-out infinite alternate;
}

#multiplier.glow-6 {
    text-shadow: 0 0 24px rgba(79, 70, 229, 1), 0 0 16px rgba(124, 58, 237, 1), 0 0 8px rgba(168, 85, 247, 0.8), 0 0 4px rgba(236, 72, 153, 0.6);
    filter: drop-shadow(0 0 16px rgba(79, 70, 229, 1));
    animation: pulse-glow 1.5s ease-in-out infinite alternate;
}

@keyframes pulse-glow {
    from {
        text-shadow: 0 0 20px rgba(79, 70, 229, 1), 0 0 12px rgba(124, 58, 237, 0.8), 0 0 6px rgba(168, 85, 247, 0.6);
        filter: drop-shadow(0 0 12px rgba(79, 70, 229, 0.9));
    }
    to {
        text-shadow: 0 0 28px rgba(79, 70, 229, 1), 0 0 18px rgba(124, 58, 237, 1), 0 0 10px rgba(168, 85, 247, 0.8);
        filter: drop-shadow(0 0 18px rgba(79, 70, 229, 1));
    }
}

#timer, #score, #word-count {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Game Container */
.game-container {
    display: flex;
    justify-content: center;
    align-items: start;
    gap: 40px;
    margin-bottom: 48px;
    width: 100%;
}

.grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    flex-shrink: 0;
}

.grid-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Start Game Overlay */
.start-game-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: var(--border-radius-lg);
    padding: 24px 40px;
    box-shadow: 
        var(--shadow-lg),
        0 0 0 3px rgba(79, 70, 229, 0.2),
        0 0 30px rgba(79, 70, 229, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    backdrop-filter: blur(8px);
}

.start-game-overlay:hover {
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 
        var(--shadow-xl),
        0 0 0 4px rgba(79, 70, 229, 0.3),
        0 0 40px rgba(79, 70, 229, 0.4);
}

.start-game-overlay:active {
    transform: translate(-50%, -50%) scale(0.98);
}

.start-text {
    font-size: 1.25rem;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.start-hint {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* How To Play Button */
.how-to-play-button {
    position: absolute;
    top: calc(50% + 80px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px;
    color: #e2e8f0;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.how-to-play-button:hover {
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.2);
}

.help-icon {
    font-size: 1.1rem;
    animation: help-pulse 2s infinite;
}

.help-text {
    font-weight: 600;
    letter-spacing: 0.25px;
}

@keyframes help-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Letter Grid */
.letter-grid {
    display: grid;
    gap: 12px;
    padding: 32px;
    background: var(--glass-background);
    backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    justify-self: center;
    
    /* Touch optimizations for mobile */
    touch-action: none;
    -webkit-touch-callout: none;
}

.letter-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(59, 130, 246, 0.03), transparent);
    pointer-events: none;
}

.letter-grid.grid-3x3 {
    grid-template-columns: repeat(3, var(--grid-size));
    grid-template-rows: repeat(3, var(--grid-size));
}

.letter-grid.grid-4x4 {
    grid-template-columns: repeat(4, var(--grid-size));
    grid-template-rows: repeat(4, var(--grid-size));
}

.letter-grid.grid-5x5 {
    grid-template-columns: repeat(5, var(--grid-size));
    grid-template-rows: repeat(5, var(--grid-size));
}

.letter-cell {
    width: var(--grid-size);
    height: var(--grid-size);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-background);
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.letter-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.letter-hit-area {
    width: 70%;
    height: 70%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    color: var(--text-primary);
    z-index: 1;
    
    /* Touch optimizations for mobile */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    touch-action: none;
}

.letter-cell:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-glow);
}

.letter-cell:hover::before {
    opacity: 1;
}

.letter-cell:hover .letter-hit-area {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.letter-cell.selected {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: var(--primary-color);
    transform: translateY(-4px) scale(1.08);
    box-shadow: var(--shadow-glow);
}

.letter-cell.selected .letter-hit-area {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.letter-cell.highlighted {
    background: linear-gradient(135deg, var(--accent-color), #7c3aed);
    border-color: var(--accent-color);
    transform: translateY(-2px) scale(1.05);
}

.letter-cell.highlighted .letter-hit-area {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* Current Word Display */
.current-word {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-background);
    backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 24px 40px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    position: relative;
    overflow: hidden;
}

.current-word::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.05), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

#current-word-display {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
    text-transform: uppercase;
    z-index: 1;
    min-height: 32px;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 350px;
    flex-shrink: 0;
}

.found-words, .streak-info {
    background: var(--glass-background);
    backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.found-words::before, .streak-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
}

.found-words h3, .streak-info h4 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.words-list {
    max-height: 340px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 8px;
}

.words-list::-webkit-scrollbar {
    width: 6px;
}

.words-list::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 3px;
}

.words-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--card-background);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.word-item:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    transform: translateX(4px);
}

.word-text {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.word-score {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 700;
    background: var(--glass-background);
    padding: 4px 8px;
    border-radius: 8px;
}

.streak-display {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.streak-item {
    padding: 10px 16px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 2px solid var(--border);
    background: var(--card-background);
    color: var(--text-secondary);
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.streak-item:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
}

.streak-item.completed {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    border-color: var(--success-color);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    transform: scale(1.05);
}





/* Modern Game Over Modal */
.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalIn 0.5s cubic-bezier(0.2, 0, 0.2, 1);
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(15, 15, 35, 0.9));
    backdrop-filter: blur(12px);
    animation: backdropIn 0.4s ease-out;
}

.modal-container {
    position: relative;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 24px;
    padding: 32px;
    max-width: 520px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: containerIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Modal Header */
.modal-header {
    text-align: center;
    margin-bottom: 32px;
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 8px rgba(59, 130, 246, 0.3));
}

.modal-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #60a5fa, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.modal-subtitle {
    color: #94a3b8;
    font-size: 1.1rem;
    margin: 0;
}

/* Game Stats */
.game-stats {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.stat-item {
    color: #e2e8f0;
    font-size: 1rem;
    font-weight: 500;
}

.stat-item strong {
    color: #94a3b8;
    font-weight: 600;
}

.stat-item span {
    color: #ffffff;
    font-weight: 700;
    margin-left: 8px;
}

/* Score Breakdown Card */
.score-breakdown-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
}

.score-breakdown-card h3 {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-item.highlight {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), transparent);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 8px 0;
}

.breakdown-item.total {
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.1), rgba(59, 130, 246, 0.1));
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
    font-weight: 700;
    font-size: 1.1rem;
}

.breakdown-label {
    color: #e2e8f0;
    font-weight: 600;
}

.breakdown-value {
    color: #ffffff;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.breakdown-item.highlight .breakdown-value {
    color: #60a5fa;
}

.breakdown-item.total .breakdown-value {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.2rem;
}

.breakdown-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.5), transparent);
    margin: 16px 0;
}

/* Missed Words Section */
.missed-words-section {
    margin-bottom: 32px;
}

.missed-words-section h3 {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
}

.missed-words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

/* Found Words Display Styling */
.word-length-group {
    margin-bottom: 20px;
    padding: 16px;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.6));
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.word-length-header {
    color: #10b981;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(16, 185, 129, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.word-list {
    color: #e2e8f0;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.6;
    letter-spacing: 0.25px;
    text-transform: uppercase;
}

.no-words {
    color: #64748b;
    font-style: italic;
    text-align: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 8px;
    border: 1px dashed rgba(100, 116, 139, 0.3);
}

.found-words-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* How To Play Modal */
.how-to-play-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalIn 0.5s cubic-bezier(0.2, 0, 0.2, 1);
}

.instructions-content {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 24px;
}

.instructions-content::-webkit-scrollbar {
    width: 6px;
}

.instructions-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.instructions-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 3px;
}

.instruction-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.8));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.instruction-card h3 {
    color: #60a5fa;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instruction-card p, .instruction-card li {
    color: #e2e8f0;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

.instruction-card ul {
    margin: 0;
    padding-left: 20px;
}

.instruction-card li {
    margin-bottom: 6px;
}

.instruction-card strong {
    color: #fbbf24;
    font-weight: 600;
}

.instruction-card em {
    color: #a78bfa;
    font-style: italic;
}

.pro-tips {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.1), rgba(6, 78, 59, 0.1));
    border: 2px solid rgba(16, 185, 129, 0.3);
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
}

.pro-tips h3 {
    color: #10b981;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
}

.tips-grid {
    display: grid;
    gap: 12px;
}

.tip {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    color: #d1fae5;
    font-size: 0.9rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Share Section */
.share-section {
    margin-bottom: 32px;
}

.share-section h3 {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.share-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(145deg, #374151, #1f2937);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.share-btn.twitter:hover {
    background: linear-gradient(145deg, #1da1f2, #0d8bd9);
    border-color: #1da1f2;
    box-shadow: 0 8px 25px rgba(29, 161, 242, 0.4);
}

.share-btn.facebook:hover {
    background: linear-gradient(145deg, #1877f2, #166fe5);
    border-color: #1877f2;
    box-shadow: 0 8px 25px rgba(24, 119, 242, 0.4);
}

.share-btn.linkedin:hover {
    background: linear-gradient(145deg, #0077b5, #005885);
    border-color: #0077b5;
    box-shadow: 0 8px 25px rgba(0, 119, 181, 0.4);
}

.share-btn.whatsapp:hover {
    background: linear-gradient(145deg, #25d366, #1da851);
    border-color: #25d366;
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4);
}

.share-btn.reddit:hover {
    background: linear-gradient(145deg, #ff4500, #e03d00);
    border-color: #ff4500;
    box-shadow: 0 8px 25px rgba(255, 69, 0, 0.4);
}

.share-btn.copy:hover {
    background: linear-gradient(145deg, #6b7280, #4b5563);
    border-color: #6b7280;
    box-shadow: 0 8px 25px rgba(107, 114, 128, 0.4);
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    min-width: 140px;
}

.action-btn.primary {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.6);
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.action-btn.secondary {
    background: linear-gradient(145deg, #374151, #1f2937);
    color: #e5e7eb;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.action-btn.secondary:hover {
    transform: translateY(-2px);
    background: linear-gradient(145deg, #4b5563, #374151);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Animations */
@keyframes modalIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes backdropIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(12px);
    }
}

@keyframes containerIn {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Connection Line */
.connection-line {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

/* Animations */
@keyframes wordFound {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.word-found-animation {
    animation: wordFound 0.3s ease;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.timer-warning {
    animation: pulse 1s infinite;
    color: var(--warning-color) !important;
}

.timer-danger {
    animation: pulse 0.5s infinite;
    color: var(--error-color) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Mobile Logo Adjustments */
    .logo {
        font-size: 3rem;
        letter-spacing: -0.01em;
    }
    
    .logo-accent {
        width: 110%;
        height: 110%;
    }
    .container {
        padding: 20px 16px;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    .stats-bar {
        gap: 18px;
        padding: 10px 16px;
        max-width: 100%;
    }
    
    .stat-item {
        min-width: 70px;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
    
    #multiplier {
        font-size: 1.2rem;
    }
    
    .game-container {
        flex-direction: column;
        align-items: center;
        gap: 32px;
    }
    
    :root {
        --grid-size: 70px;
    }
    
    .letter-grid {
        padding: 24px;
    }
    
    /* Mobile Modal Optimizations */
    .modal-container {
        margin: 16px;
        padding: 24px;
        max-height: calc(100vh - 32px);
        border-radius: 20px;
    }
    
    .modal-title {
        font-size: 2rem;
    }
    
    .modal-subtitle {
        font-size: 1rem;
    }
    
    .score-breakdown-card {
        padding: 20px;
    }
    
    .stats-text {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .breakdown-item {
        padding: 10px 0;
        font-size: 0.9rem;
    }
    
    .share-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .share-btn {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    .share-btn span {
        display: none;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .action-btn {
        padding: 12px 20px;
        min-width: auto;
        width: 100%;
    }
    
    .how-to-play-button {
        top: calc(50% + 70px);
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .instruction-card {
        padding: 16px;
    }
    
    .instructions-content {
        max-height: 50vh;
    }
}

@media (max-width: 480px) {
    .modal-container {
        margin: 8px;
        padding: 20px;
        max-height: calc(100vh - 16px);
    }
    
    .modal-icon {
        font-size: 2.5rem;
    }
    
    .modal-title {
        font-size: 1.75rem;
    }
    
    .stat-item {
        font-size: 0.9rem;
    }
    
    .share-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .share-btn {
        padding: 8px;
        border-radius: 10px;
    }
    
    .letter-hit-area {
        font-size: 1.3rem;
    }
    
    .current-word {
        max-width: 100%;
        padding: 20px 24px;
    }
    

    
    .sidebar {
        gap: 20px;
        width: 100%;
        max-width: 500px;
    }
    
    .found-words, .streak-info {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    /* Small Mobile Logo */
    .logo {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .container {
        padding: 16px 12px;
    }
    
    .stats-bar {
        gap: 14px;
        padding: 8px 12px;
        flex-wrap: wrap;
    }
    
    .stat-item {
        min-width: 62px;
        justify-content: space-between;
    }
    
    #multiplier {
        font-size: 1.1rem;
    }
    
    .start-game-overlay {
        padding: 20px 32px;
        min-width: 180px;
    }
    
    .start-text {
        font-size: 1.1rem;
    }
    
    .start-hint {
        font-size: 0.85rem;
    }
    
    :root {
        --grid-size: 60px;
    }
    
    .letter-grid {
        padding: 20px;
        gap: 8px;
    }
    
    .letter-hit-area {
        font-size: 1.1rem;
    }
    
    .current-word {
        padding: 16px 20px;
        min-height: 60px;
    }
    
    #current-word-display {
        font-size: 1.3rem;
        letter-spacing: 2px;
    }
    
    .found-words, .streak-info {
        padding: 16px;
    }
    
    .btn {
        min-width: 100px;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

/* Missed Words Section Styles */
.missed-words-section {
    margin: 20px 0;
    text-align: center;
}

.missed-words-section h3 {
    color: var(--text-color);
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: 600;
}

.missed-words-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.missed-word {
    background: linear-gradient(135deg, #FF6B6B, #FF8E8E);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
    transition: transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.missed-word:hover {
    transform: translateY(-1px);
}

.word-length-badge {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.missed-word .word-text {
    flex: 1;
}

/* Share Section Styles */
.share-section {
    margin: 32px 0;
    text-align: center;
}

.share-section h3 {
    color: var(--text-primary);
    margin-bottom: 24px;
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    max-width: 480px;
    margin: 0 auto;
}

.share-btn {
    padding: 14px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    background: var(--glass-background);
    backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    min-height: 48px;
}

.share-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.share-btn:hover::before {
    transform: translateX(100%);
}

.share-btn:hover {
    transform: translateY(-3px) scale(1.02);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.share-btn:active {
    transform: translateY(0) scale(0.98);
}

.share-btn svg {
    width: 18px;
    height: 18px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.share-btn:hover svg {
    transform: scale(1.1);
}

/* Platform-specific accent colors for borders and glows */
.share-btn.twitter:hover {
    border-color: rgba(29, 161, 242, 0.6);
    box-shadow: 0 8px 32px rgba(29, 161, 242, 0.3);
}

.share-btn.facebook:hover {
    border-color: rgba(24, 119, 242, 0.6);
    box-shadow: 0 8px 32px rgba(24, 119, 242, 0.3);
}

.share-btn.linkedin:hover {
    border-color: rgba(10, 102, 194, 0.6);
    box-shadow: 0 8px 32px rgba(10, 102, 194, 0.3);
}

.share-btn.whatsapp:hover {
    border-color: rgba(37, 211, 102, 0.6);
    box-shadow: 0 8px 32px rgba(37, 211, 102, 0.3);
}

.share-btn.reddit:hover {
    border-color: rgba(255, 69, 0, 0.6);
    box-shadow: 0 8px 32px rgba(255, 69, 0, 0.3);
}

.share-btn.copy:hover {
    border-color: rgba(168, 85, 247, 0.6);
    box-shadow: 0 8px 32px rgba(168, 85, 247, 0.3);
}

.share-btn.copied {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: rgba(16, 185, 129, 0.6) !important;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.4) !important;
    animation: shareSuccess 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes shareSuccess {
    0% { 
        transform: scale(1); 
        background: rgba(16, 185, 129, 0.1);
    }
    50% { 
        transform: scale(1.05); 
        background: rgba(16, 185, 129, 0.3);
    }
    100% { 
        transform: scale(1); 
        background: rgba(16, 185, 129, 0.2);
    }
}

/* Play Again Button in Modal */
.game-over-content .btn.primary {
    margin-top: 32px;
    padding: 16px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    position: relative;
    z-index: 1;
}

.game-over-content .btn.primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-glow);
}

/* Hide text on very small screens, show only icons */
@media (max-width: 480px) {
    .share-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .share-btn {
        padding: 12px;
        min-width: 48px;
        font-size: 0;
    }
    
    .share-btn svg {
        width: 20px;
        height: 20px;
    }
}
@media (max-width: 600px) {
    .share-buttons {
        gap: 8px;
    }
    
    .share-btn {
        width: 45px;
        height: 45px;
    }
    
    .share-btn svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .share-section {
        margin: 15px 0;
    }
    
    .share-buttons {
        gap: 6px;
    }
    
    .share-btn {
        width: 40px;
        height: 40px;
    }
    
    .share-btn svg {
        width: 16px;
        height: 16px;
    }
    

}

/* Responsive Grid Sizing for 5x5 Grid */
@media (max-width: 768px) {
    :root {
        --grid-size: 70px; /* Smaller grid cells on tablets */
    }
    
    .modal-container {
        margin: 16px;
        padding: 24px;
        max-height: calc(100vh - 32px);
        border-radius: 20px;
    }
    
    .stats-text {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    :root {
        --grid-size: 60px; /* Even smaller on phones to fit 5x5 grid */
    }
    
    .letter-hit-area {
        font-size: 1.3rem;
    }
    
    .stat-item {
        font-size: 0.9rem;
    }
    
    .modal-container {
        margin: 8px;
        padding: 20px;
        max-height: calc(100vh - 16px);
    }
    
    .modal-title {
        font-size: 1.75rem;
    }
    
    .breakdown-item {
        font-size: 0.9rem;
    }
}