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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: visible;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 50px;
    position: relative;
    overflow: visible;
}

/* Game Mode Selector */
.game-mode-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.mode-btn {
    background: linear-gradient(135deg, #ecf0f1 0%, #bdc3c7 100%);
    border: 2px solid #bdc3c7;
    border-radius: 25px;
    padding: 12px 24px;
    color: #2c3e50;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    justify-content: center;
}

.mode-btn:hover {
    background: linear-gradient(135deg, #d5dbdb 0%, #a6acaf 100%);
    border-color: #95a5a6;
    transform: translateY(-2px);
}

.mode-btn.active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-color: #2980b9;
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.mode-btn.active:hover {
    background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
    border-color: #21618c;
}

.mode-btn i {
    font-size: 1.1rem;
}

.practice-mode-banner {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    margin: 15px auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    max-width: 300px;
}

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

header h1 i {
    color: #3498db;
    margin-right: 10px;
}

.subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
    font-weight: 300;
}

.daily-challenge-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    margin: 10px 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    animation: shimmer 3s ease-in-out infinite;
}

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

.magic-wand-container {
    display: inline-block;
    position: relative;
    margin-right: 15px;
}

.magic-sparkles {
    position: absolute;
    top: 25px;
    left: 45px;
    width: 80px;
    height: 50px;
    pointer-events: none;
}

.sparkle {
    position: absolute;
    font-size: 1rem;
    font-weight: 700;
    animation: sparkleFloat 3s ease-in-out infinite;
}

.sparkle-1 {
    top: 25px;
    left: -10px;
    color: #f39c12;
    animation-delay: 0s;
}

.sparkle-2 {
    top: 10px;
    left: 5px;
    color: #9b59b6;
    animation-delay: 0.6s;
}

.sparkle-3 {
    top: 5px;
    left: 25px;
    color: #e74c3c;
    animation-delay: 1.2s;
}

.sparkle-4 {
    top: 10px;
    left: 45px;
    color: #3498db;
    animation-delay: 1.8s;
}

.sparkle-5 {
    top: 25px;
    left: 55px;
    color: #2ecc71;
    animation-delay: 2.4s;
}

@keyframes sparkleFloat {
    0%, 100% {
        transform: translateY(0px) scale(1);
        opacity: 0.7;
        text-shadow: 0 0 5px currentColor;
    }
    25% {
        transform: translateY(-8px) scale(1.2);
        opacity: 1;
        text-shadow: 0 0 15px currentColor;
    }
    50% {
        transform: translateY(-15px) scale(1.1);
        opacity: 0.9;
        text-shadow: 0 0 20px currentColor;
    }
    75% {
        transform: translateY(-8px) scale(1.2);
        opacity: 1;
        text-shadow: 0 0 15px currentColor;
    }
}

/* Game Info */
.game-info {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    color: #2c3e50;
}

.info-item i {
    color: #3498db;
    width: 20px;
}

/* Current Word Display */
.current-word-display {
    margin-bottom: 20px;
    text-align: center;
}

.word-info {
    background: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: inline-flex;
    align-items: center;
    gap: 15px;
    flex-wrap: nowrap;
}

/* Difficulty Selector */
.difficulty-selector {
    margin-bottom: 30px;
    text-align: center;
}

.difficulty-info {
    background: white;
    padding: 20px 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: inline-block;
}

.difficulty-info > span {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
}

.difficulty-options {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.difficulty-option {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.difficulty-option input[type="radio"] {
    display: none;
}

.difficulty-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 15px 20px;
    border: 2px solid #ecf0f1;
    border-radius: 10px;
    background: #fafafa;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
}

.difficulty-label i {
    font-size: 1.5rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.difficulty-label small {
    font-size: 0.8rem;
    color: #95a5a6;
    line-height: 1.2;
}

.difficulty-option input[type="radio"]:checked + .difficulty-label {
    border-color: #3498db;
    background: #e8f4f8;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.difficulty-option input[type="radio"]:checked + .difficulty-label i {
    color: #3498db;
}

.difficulty-option input[type="radio"]:checked + .difficulty-label small {
    color: #2980b9;
}

.difficulty-label:hover {
    border-color: #bdc3c7;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.current-letters {
    display: flex;
    gap: 10px;
    margin: 0;
    justify-content: center;
}

.difficulty-indicator {
    margin: 0;
    text-align: center;
}

.difficulty-indicator span {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.current-letter {
    background: #3498db;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    animation: letterPop 0.5s ease-out;
}

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

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.grid-block {
    width: 60px;
    height: 60px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
    background: #fafafa;
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
    overflow: hidden;
}

.grid-block:hover {
    border-color: #bdc3c7;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.grid-block.filled {
    background: #ffffff;
    border-color: #95a5a6;
}

.grid-block.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.4);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 15px rgba(52, 152, 219, 0.4); }
    to { box-shadow: 0 0 25px rgba(52, 152, 219, 0.8); }
}

.grid-block.correct {
    animation: correctPulse 0.6s ease-out;
}

@keyframes correctPulse {
    0% { background: #27ae60; transform: scale(1); }
    50% { background: #2ecc71; transform: scale(1.1); }
    100% { background: #ffffff; transform: scale(1); }
}

.grid-block.incorrect {
    animation: incorrectShake 0.6s ease-out;
}

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

/* Game Controls */
.game-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    width: 100%;
    max-width: 500px;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.input-section label {
    font-size: 1.1rem;
    color: #2c3e50;
    font-weight: 500;
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

#guess-input {
    width: 60px;
    height: 50px;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
    background: white;
    transition: all 0.3s ease;
}

#guess-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
}

/* Mobile keyboard handling */
@media screen and (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .game-grid {
        margin-bottom: 20px;
    }
    
    /* Prevent layout shift when keyboard appears */
    .input-section {
        position: relative;
        margin-bottom: 20px;
    }
    
    /* Keep the game grid visible when keyboard is shown */
    body {
        overflow-x: hidden;
    }
    
    /* Adjust spacing for mobile */
    header {
        padding-top: 30px;
        margin-bottom: 20px;
    }
    
    /* Stack word info vertically on smaller screens */
    .word-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

@media screen and (max-width: 480px) {
    .word-info {
        padding: 12px 15px;
    }
    
    .difficulty-indicator span {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

#guess-input:disabled {
    background: #ecf0f1;
    color: #95a5a6;
    cursor: not-allowed;
}

/* Countdown animations */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.game-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

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

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-info {
    background: #f39c12;
    color: white;
}

.btn-info:hover {
    background: #d68910;
}

.btn-warning {
    background: #f39c12;
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-warning:disabled {
    background: #bdc3c7;
    color: #7f8c8d;
    cursor: not-allowed;
    transform: none;
}

.btn-warning:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Power-up sparkle effect */
.btn-warning::before {
    content: '✨';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.8rem;
    animation: sparkle 2s ease-in-out infinite;
}

.btn-warning:disabled::before {
    display: none;
}

@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0.8) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.2) rotate(180deg); }
}

.btn:disabled {
    background: #bdc3c7;
    color: #7f8c8d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: #ecf0f1;
    border-radius: 4px;
    margin-top: 20px;
    position: relative;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: -25px;
    right: 0;
    font-size: 0.9rem;
    color: #7f8c8d;
    font-weight: 500;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 25px 30px 20px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #95a5a6;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 30px 30px;
    text-align: center;
    flex-shrink: 0;
}

/* Share Buttons */
.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.share-buttons .btn {
    min-width: 90px;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.share-buttons .btn i {
    margin-right: 5px;
}

#share-facebook {
    background: #1877f2;
    color: white;
}

#share-facebook:hover {
    background: #166fe5;
}

#share-twitter {
    background: #1da1f2;
    color: white;
}

#share-twitter:hover {
    background: #0d8bd9;
}

#share-text {
    background: #28a745;
    color: white;
}

#share-text:hover {
    background: #218838;
}

#share-copy {
    background: #6c757d;
    color: white;
}

#share-copy:hover {
    background: #5a6268;
}

/* Rules Modal */
.rules-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rule-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.rule-item i {
    color: #3498db;
    font-size: 1.2rem;
    margin-top: 2px;
    min-width: 20px;
}

.rule-item strong {
    color: #2c3e50;
    font-size: 1.1rem;
}

.rule-item p {
    color: #7f8c8d;
    margin-top: 5px;
}

/* Brain Activity Modal */
.brain-benefits-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.benefit-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #3498db;
}

.benefit-section h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.benefit-section h3 i {
    color: #3498db;
    font-size: 1.2rem;
}

.benefit-section p {
    color: #5a6c7d;
    margin-bottom: 12px;
    line-height: 1.5;
}

.benefit-section ul {
    margin: 0;
    padding-left: 20px;
}

.benefit-section li {
    color: #5a6c7d;
    margin-bottom: 8px;
    line-height: 1.4;
}

.benefit-section strong {
    color: #2c3e50;
    font-weight: 600;
}

.neuroplasticity {
    background: linear-gradient(135deg, #e8f4f8 0%, #f0f8ff 100%);
    border-left-color: #e74c3c;
}

.neuroplasticity h3 i {
    color: #e74c3c;
}

.research-note {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    border-left: 3px solid #f39c12;
}

.research-note p {
    margin: 0;
    font-style: italic;
    color: #6c757d;
    font-size: 0.95rem;
}

/* Celebration Animation */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1001;
    opacity: 0;
}

.celebration.active {
    opacity: 1;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f39c12;
    animation: confetti-fall 3s linear infinite;
}

.confetti:nth-child(1) {
    left: 10%;
    background: #e74c3c;
    animation-delay: 0s;
}

.confetti:nth-child(2) {
    left: 30%;
    background: #3498db;
    animation-delay: 0.5s;
}

.confetti:nth-child(3) {
    left: 50%;
    background: #2ecc71;
    animation-delay: 1s;
}

.confetti:nth-child(4) {
    left: 70%;
    background: #f39c12;
    animation-delay: 1.5s;
}

.confetti:nth-child(5) {
    left: 90%;
    background: #9b59b6;
    animation-delay: 2s;
}

@keyframes confetti-fall {
    0% {
        top: -10px;
        transform: rotate(0deg);
    }
    100% {
        top: 100vh;
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .game-info {
        gap: 15px;
        font-size: 1rem;
    }
    
    .share-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .share-buttons .btn {
        width: 100%;
        min-width: auto;
    }
    
    .grid-block {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .game-grid {
        gap: 6px;
        padding: 15px;
    }
    
    .current-letter {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-header, .modal-body, .modal-footer {
        padding: 20px;
    }
    
    .game-buttons {
        gap: 10px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        min-width: 100px;
    }
}

/* Footer */
.game-footer {
    margin-top: 40px;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid #ecf0f1;
}

.game-footer p {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin: 0;
    font-style: italic;
}

@media (max-width: 480px) {
    .grid-block {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .game-grid {
        gap: 4px;
        padding: 10px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .input-group {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .grid-block {
        border-width: 3px;
    }
    
    .grid-block.active {
        border-width: 4px;
    }
}
