:root {
    --primary-blue: #2196F3;
    --success-green: #4CAF50;
    --warning-yellow: #FFC107;
    --danger-red: #F44336;
    --accent-purple: #9C27B0;
    --bg-light: #f8f9fa;
    --bg-dark: #343a40;
    --text-dark: #212529;
    --text-light: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --paper-texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-opacity='0.03'%3E%3Cpolygon fill='%23000' points='50 0 60 40 100 50 60 60 50 100 40 60 0 50 40 40'/%3E%3C/g%3E%3C/svg%3E");
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-purple) 100%);
    background-attachment: fixed;
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 80px;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--paper-texture);
    pointer-events: none;
    z-index: 1;
}

.app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 10;
}

.app-header h1 {
    color: var(--primary-blue);
    margin-bottom: 5px;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

.app-header p {
    color: var(--text-light);
    font-size: 1.1rem;
}

.app-main {
    padding: 20px;
    position: relative;
    z-index: 5;
}

.page-section {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.page-section.active {
    display: block;
}

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

.game-generator {
    max-width: 600px;
    margin: 0 auto;
}

.config-form {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.config-form h2 {
    color: var(--primary-blue);
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.8rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.generate-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--success-green), var(--primary-blue));
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

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

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

.game-result {
    max-width: 600px;
    margin: 0 auto;
}

.game-result.hidden {
    display: none;
}

.game-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.game-card h3 {
    color: var(--primary-blue);
    font-size: 2rem;
    margin-bottom: 15px;
}

.game-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.info-badge {
    background: var(--bg-light);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.game-instructions {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    text-align: left;
    border-left: 4px solid var(--primary-blue);
}

.game-instructions h4 {
    color: var(--primary-blue);
    margin-bottom: 10px;
}

.game-instructions ol,
.game-instructions ul {
    margin-left: 20px;
}

.game-instructions li {
    margin-bottom: 5px;
}

.game-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

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

.timer-btn {
    background: var(--warning-yellow);
    color: var(--text-dark);
}

.score-btn {
    background: var(--accent-purple);
    color: white;
}

.new-game-btn {
    background: var(--success-green);
    color: white;
}

.stop-btn {
    background: var(--danger-red);
    color: white;
}

.danger-btn {
    background: var(--danger-red);
    color: white;
}

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

.timer-display {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 15px;
}

.timer-display.hidden {
    display: none;
}

.timer-circle {
    width: 120px;
    height: 120px;
    border: 6px solid var(--primary-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    background: white;
    box-shadow: var(--shadow);
}

.timer-circle.warning {
    border-color: var(--warning-yellow);
    animation: pulse 1s infinite;
}

.timer-circle.danger {
    border-color: var(--danger-red);
    animation: pulse 0.5s infinite;
}

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

#timeLeft {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-dark);
}

.score-container,
.history-container,
.faq-container {
    max-width: 600px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.score-container h2,
.history-container h2,
.faq-container h2 {
    color: var(--primary-blue);
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.add-player {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.add-player input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
}

.add-player input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.score-board {
    margin-bottom: 20px;
}

.player-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-blue);
}

.player-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.score-controls-player {
    display: flex;
    gap: 5px;
}

.score-btn-small {
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    min-width: 35px;
    transition: all 0.2s ease;
}

.score-btn-plus {
    background: var(--success-green);
    color: white;
}

.score-btn-minus {
    background: var(--danger-red);
    color: white;
}

.score-btn-small:hover {
    transform: scale(1.1);
}

.player-score-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-blue);
    min-width: 40px;
    text-align: center;
}

.no-players,
.no-history {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 1.1rem;
}

.score-actions,
.history-actions {
    text-align: center;
}

.game-history-item {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-blue);
}

.game-history-item h4 {
    color: var(--primary-blue);
    margin-bottom: 5px;
}

.game-history-meta {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.game-history-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.history-badge {
    background: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.faq-item {
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

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

.faq-question:hover {
    background: #e9ecef;
}

.faq-question[aria-expanded="true"] {
    background: var(--primary-blue);
    color: white;
}

.faq-icon {
    font-size: 1.2rem;
    font-weight: bold;
    transition: transform 0.3s ease;
}

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

.faq-answer {
    padding: 20px;
    background: white;
    border-top: 1px solid var(--border-color);
    animation: slideDown 0.3s ease;
}

.faq-answer[hidden] {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
        padding-top: 20px;
        padding-bottom: 20px;
    }
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

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

.nav-item.active {
    color: var(--primary-blue);
    background: rgba(33, 150, 243, 0.1);
}

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

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

.nav-item:hover {
    color: var(--primary-blue);
    transform: translateY(-2px);
}

footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    background: rgba(0, 0, 0, 0.1);
    margin-top: 40px;
    position: relative;
    z-index: 5;
}

@media (max-width: 768px) {
    .app-main {
        padding: 15px;
    }
    
    .config-form,
    .game-card,
    .score-container,
    .history-container,
    .faq-container {
        padding: 20px;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-btn {
        width: 100%;
        justify-content: center;
    }
    
    .add-player {
        flex-direction: column;
    }
    
    .add-player input {
        margin-bottom: 10px;
    }
    
    .game-info {
        flex-direction: column;
        align-items: center;
    }
    
    .info-badge {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 15px;
    }
    
    .app-header h1 {
        font-size: 1.5rem;
    }
    
    .config-form,
    .game-card,
    .score-container,
    .history-container,
    .faq-container {
        padding: 15px;
        margin: 10px;
        border-radius: 15px;
    }
    
    .timer-circle {
        width: 100px;
        height: 100px;
    }
    
    #timeLeft {
        font-size: 1.2rem;
    }
    
    .nav-item span {
        font-size: 0.7rem;
    }
    
    .nav-item i {
        font-size: 1.1rem;
    }
}

.pulse-animation {
    animation: pulse 0.6s ease-in-out;
}

.shake-animation {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.success-message {
    background: var(--success-green);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin: 10px 0;
    animation: slideDown 0.3s ease;
}

.error-message {
    background: var(--danger-red);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin: 10px 0;
    animation: slideDown 0.3s ease;
}
