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

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 50%, #ff9ff3 100%);
    min-height: 100vh;
    color: #333;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 0;
    background: rgba(255, 255, 255, 0.9);
    color: #ff6b6b;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

h1 {
    font-size: 2.8em;
    color: #fff;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
    margin-top: 50px;
}

.subtitle {
    font-size: 1.2em;
    color: rgba(255, 255, 255, 0.9);
}

main {
    flex: 1;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Category Selection */
h2 {
    text-align: center;
    color: #fff;
    font-size: 1.6em;
    margin-bottom: 25px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

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

.category-btn {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 16px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.category-btn:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

.category-btn:active {
    transform: translateY(-2px) scale(0.98);
}

.cat-icon {
    font-size: 2.5em;
}

.cat-name {
    font-size: 1.1em;
    font-weight: 700;
    color: #333;
}

.cat-desc {
    font-size: 0.75em;
    color: #666;
}

.random-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.random-btn .cat-name,
.random-btn .cat-desc {
    color: #fff;
}

.timer-setting {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.timer-setting label {
    font-weight: 600;
    color: #333;
}

.timer-setting select {
    padding: 10px 20px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
}

.timer-setting select:focus {
    outline: none;
    border-color: #ff6b6b;
}

/* Word Display Screen */
.word-card {
    background: #fff;
    border-radius: 24px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    margin-bottom: 25px;
}

.category-label {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
    color: #fff;
    padding: 8px 25px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 25px;
}

.word-display {
    font-size: 3em;
    font-weight: 800;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.2;
    word-wrap: break-word;
}

.timer-display {
    font-size: 3.5em;
    font-weight: 700;
    color: #667eea;
    font-variant-numeric: tabular-nums;
}

.timer-display.warning {
    color: #feca57;
    animation: pulse 0.5s ease infinite;
}

.timer-display.danger {
    color: #ff6b6b;
    animation: pulse 0.3s ease infinite;
}

.timer-display.finished {
    color: #ff4757;
    animation: shake 0.5s ease;
}

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

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

.word-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.control-btn {
    background: #fff;
    border: none;
    border-radius: 30px;
    padding: 15px 30px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    font-family: inherit;
}

.control-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

.control-btn:active {
    transform: translateY(-1px);
}

.control-btn.new-word {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: #fff;
}

.control-btn.start-timer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.control-btn.start-timer.running {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.control-btn.change-cat {
    background: linear-gradient(135deg, #feca57 0%, #ff9f43 100%);
    color: #333;
}

.difficulty-indicator {
    text-align: center;
    background: rgba(255, 255, 255, 0.8);
    padding: 12px 25px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    width: fit-content;
    margin: 0 auto;
}

.diff-label {
    font-weight: 600;
    color: #666;
}

.diff-stars {
    font-size: 1.2em;
}

footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
}

/* Responsive */
@media (max-width: 600px) {
    .back-btn {
        position: relative;
        display: inline-block;
        margin-bottom: 15px;
    }

    h1 {
        font-size: 2em;
        margin-top: 10px;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .category-btn {
        padding: 15px 10px;
    }

    .cat-icon {
        font-size: 2em;
    }

    .word-display {
        font-size: 2.2em;
    }

    .timer-display {
        font-size: 2.5em;
    }

    .control-btn {
        padding: 12px 20px;
        font-size: 0.9em;
    }

    .timer-setting {
        flex-direction: column;
        gap: 10px;
    }
}
