/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #FF006E;
    --secondary-color: #FB5607;
    --accent-color: #FFBE0B;
    --purple-color: #8338EC;
    --blue-color: #3A86FF;
    --bg-dark: #0a0a0a;
    --bg-card: #1a1a1a;
    --text-light: #ffffff;
    --text-muted: #cccccc;
    --border-color: #333333;
    --success-color: #00ff88;
    --danger-color: #ff4757;
    --shadow-neon: 0 0 20px rgba(255, 0, 110, 0.3);
    --shadow-glow: 0 0 30px rgba(255, 190, 11, 0.2);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a0a1a 50%, var(--bg-dark) 100%);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: 80px;
}

/* Header */
.app-header {
    background: linear-gradient(90deg, var(--primary-color), var(--purple-color));
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow-neon);
    position: relative;
    overflow: hidden;
}

.app-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    margin: 0;
}

/* Main Content */
.main-content {
    padding: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Screen System */
.screen {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.screen.active {
    display: block;
}

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

/* Welcome Screen */
.welcome-container {
    text-align: center;
    padding: 2rem 0;
}

.logo-container {
    margin-bottom: 3rem;
}

.logo-container h2 {
    font-size: 2rem;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.logo-container p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Game Modes */
.game-modes {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 3rem;
}

.mode-btn {
    background: linear-gradient(135deg, var(--purple-color), var(--blue-color));
    border: none;
    padding: 1.5rem;
    border-radius: 15px;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-glow);
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(131, 56, 236, 0.4);
}

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

/* Quick Stats */
.quick-stats {
    display: flex;
    justify-content: space-around;
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stat-item span:last-child {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
}

/* Setup Screen */
.setup-container {
    padding: 1rem 0;
}

.setup-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--accent-color);
}

.setup-form {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    font-weight: 500;
}

.form-group select,
.form-group input[type="text"] {
    width: 100%;
    padding: 1rem;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-light);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group select:focus,
.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(255, 0, 110, 0.3);
}

/* Checkbox */
.checkbox-label {
    display: flex !important;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    margin-right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-weight: bold;
}

/* Buttons */
.primary-btn,
.secondary-btn,
.danger-btn {
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: var(--shadow-neon);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(255, 0, 110, 0.4);
}

.secondary-btn {
    background: var(--bg-card);
    color: var(--text-light);
    border: 2px solid var(--border-color);
}

.secondary-btn:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(255, 0, 110, 0.2);
}

.danger-btn {
    background: linear-gradient(135deg, var(--danger-color), #e74c3c);
    color: white;
}

.danger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(255, 71, 87, 0.4);
}

.setup-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Game Screen */
.game-container {
    padding: 1rem 0;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-display,
.difficulty-display {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.attempts-display {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--danger-color);
}

/* Progress Container */
.progress-container {
    text-align: center;
    margin-bottom: 2rem;
}

.hearts-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.heart {
    font-size: 2rem;
    transition: all 0.3s ease;
    animation: heartbeat 2s infinite;
}

.heart.lost {
    opacity: 0.3;
    filter: grayscale(100%);
    animation: none;
}

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

/* Word Display */
.word-container {
    text-align: center;
    margin-bottom: 2rem;
}

.word-display {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.letter-slot {
    width: 3rem;
    height: 3rem;
    border-bottom: 3px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.letter-slot.revealed {
    animation: letterReveal 0.5s ease-out;
    border-bottom-color: var(--success-color);
    color: var(--success-color);
}

@keyframes letterReveal {
    from {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Hint */
.hint-container {
    text-align: center;
    margin-bottom: 2rem;
}

.hint-btn {
    background: linear-gradient(135deg, var(--accent-color), #f39c12);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    color: var(--bg-dark);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hint-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 190, 11, 0.4);
}

.hint-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.hint-text {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--accent-color);
    margin-top: 1rem;
    color: var(--accent-color);
    font-style: italic;
}

/* Virtual Keyboard */
.virtual-keyboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(35px, 1fr));
    gap: 0.5rem;
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.key {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.8rem;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    user-select: none;
}

.key:hover {
    border-color: var(--primary-color);
    background: rgba(255, 0, 110, 0.1);
}

.key.correct {
    background: var(--success-color);
    color: var(--bg-dark);
    border-color: var(--success-color);
    cursor: not-allowed;
}

.key.incorrect {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
    cursor: not-allowed;
    opacity: 0.7;
}

.key:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Game Buttons */
.game-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

/* Multiplayer Info */
.multiplayer-info {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.current-player {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.players-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.player-card {
    background: var(--bg-dark);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.player-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(255, 0, 110, 0.3);
}

.player-name {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.player-score {
    color: var(--accent-color);
    font-size: 1.2rem;
    font-weight: bold;
}

/* Statistics Screen */
.stats-container {
    padding: 1rem 0;
}

.stats-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--accent-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Category Stats */
.stats-by-category {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.stats-by-category h3 {
    margin-bottom: 1.5rem;
    color: var(--accent-color);
    text-align: center;
}

.category-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.category-stat:last-child {
    border-bottom: none;
}

.category-name {
    font-weight: bold;
}

.category-performance {
    display: flex;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stats-buttons {
    text-align: center;
}

/* Settings Screen */
.settings-container {
    padding: 1rem 0;
}

.settings-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--accent-color);
}

.settings-groups {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-group {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.settings-group h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.setting-item {
    margin-bottom: 1.5rem;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    line-height: 1.4;
}

/* FAQ Screen */
.faq-container {
    padding: 1rem 0;
}

.faq-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--accent-color);
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    background: var(--bg-card);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1.5rem;
    text-align: left;
    color: var(--text-light);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}

.faq-question:hover {
    background: rgba(255, 0, 110, 0.1);
}

.faq-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-answer.show {
    max-height: 200px;
    padding: 1.5rem;
}

.faq-answer p {
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

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

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 20px;
    border: 2px solid var(--primary-color);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 50px rgba(255, 0, 110, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: scale(0.8) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.modal-body {
    padding: 1.5rem;
}

.result-message {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-light);
}

.result-word {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
}

.result-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.result-stat {
    text-align: center;
}

.modal-actions {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-actions button {
    flex: 1;
    max-width: 150px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.5rem;
    transition: all 0.3s ease;
    border-radius: 10px;
    min-width: 60px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-color);
    background: rgba(255, 0, 110, 0.1);
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 480px) {
    .main-content {
        padding: 0.5rem;
    }
    
    .app-header h1 {
        font-size: 1.5rem;
    }
    
    .setup-form {
        padding: 1.5rem;
    }
    
    .setup-buttons {
        flex-direction: column;
    }
    
    .game-buttons {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .virtual-keyboard {
        grid-template-columns: repeat(7, 1fr);
    }
    
    .key {
        padding: 0.6rem 0.4rem;
        font-size: 0.9rem;
    }
    
    .letter-slot {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.2rem;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions button {
        max-width: none;
    }
}

@media (min-width: 768px) {
    .main-content {
        padding: 2rem;
    }
    
    .game-modes {
        flex-direction: row;
    }
    
    .setup-buttons {
        justify-content: space-between;
    }
    
    .game-buttons {
        justify-content: space-between;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .settings-groups {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 2rem;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 0, 110, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* Pulse Animation for Important Elements */
.pulse {
    animation: pulse 2s infinite;
}

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

/* Success/Error Messages */
.message {
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: bold;
}

.message.success {
    background: rgba(0, 255, 136, 0.2);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.message.error {
    background: rgba(255, 71, 87, 0.2);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

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

/* Focus styles for keyboard navigation */
button:focus,
select:focus,
input:focus,
.nav-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg-dark: #000000;
        --bg-card: #1a1a1a;
        --text-light: #ffffff;
        --border-color: #666666;
    }
}
