:root {
    --primary: #FF3B4E;
    --primary-dark: #D62F40;
    --accent: #FFB800;
    --success: #00B894;
    --bg-color: #F9FAFB;
    --text-main: #1A1A1A;
    --text-muted: #6B7280;
    --white: #FFFFFF;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius: 20px;
    --font-head: 'Sora', sans-serif;
    --font-body: 'Space Grotesk', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.app-container {
    width: 100%;
    max-width: 600px;
    position: relative;
    overflow-x: hidden;
}

/* Views Management */
.view {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.view.active-view {
    display: block;
    opacity: 1;
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-head);
    font-weight: 800;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Landing View & Subcategory View */
.main-header {
    text-align: center;
    margin-bottom: 2rem;
    margin-top: 2rem;
}

.main-header h1 {
    font-size: 2.5rem;
    line-height: 1.1;
}

.category-grid,
.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

/* Category Cards */
.category-card,
.quiz-card {
    background: var(--white);
    border: none;
    border-radius: var(--radius);
    padding: 2rem;
    text-align: left;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.category-card::before,
.quiz-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-card:hover,
.quiz-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.category-card:hover::before,
.quiz-card:hover::before {
    opacity: 1;
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.category-card h2,
.quiz-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.tag {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #F3F4F6;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-weight: 500;
}

/* Quiz View */
.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.header-text {
    flex-grow: 1;
    text-align: center;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.5rem;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: var(--primary);
}

.progress-container {
    flex-grow: 1;
    margin-left: 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#question-counter {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #E5E7EB;
    border-radius: 100px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.5s ease;
}

.question-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

#question-text {
    font-size: 1.4rem;
    margin-bottom: 2rem;
    line-height: 1.4;
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.answer-btn {
    background: #F3F4F6;
    border: 2px solid transparent;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.answer-btn:hover:not(:disabled) {
    background: #E5E7EB;
    border-color: #D1D5DB;
}

.answer-btn.correct {
    background: rgba(0, 184, 148, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.answer-btn.incorrect {
    background: rgba(255, 59, 78, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

/* Potjera Text Inputs */
.text-answer-container {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.text-input {
    flex: 1;
    min-width: 200px;
    padding: 1rem 1.5rem;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    font-size: 1rem;
    font-family: var(--font-body);
    transition: all 0.3s ease;
    -webkit-appearance: none;
}

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

.text-input.correct {
    border-color: var(--success);
    background: rgba(0, 184, 148, 0.1);
    color: var(--success);
}

.text-input.incorrect {
    border-color: var(--primary);
    background: rgba(255, 59, 78, 0.1);
    color: var(--primary);
}

.text-input:disabled {
    background: #F3F4F6;
    cursor: not-allowed;
    opacity: 0.7;
}

.confirm-btn {
    padding: 1rem 2rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.confirm-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.confirm-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.confirm-btn:disabled {
    background: #D1D5DB;
    cursor: not-allowed;
    opacity: 0.6;
}

.answer-feedback {
    width: 100%;
    margin-top: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.answer-feedback.correct {
    background: rgba(0, 184, 148, 0.1);
    color: var(--success);
    border: 2px solid var(--success);
}

.answer-feedback.incorrect {
    background: rgba(255, 59, 78, 0.1);
    color: var(--primary);
    border: 2px solid var(--primary);
}

/* Results View */
.results-card {
    background: var(--white);
    padding: 3rem 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
    margin-bottom: 2rem;
}

.score-display {
    font-family: var(--font-head);
    font-weight: 800;
    color: var(--primary);
    margin: 1.5rem 0;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
}

#final-score {
    font-size: 4rem;
    line-height: 1;
}

.score-display .total {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.result-message {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    font-weight: 600;
}

.action-buttons {
    display: grid;
    gap: 1rem;
}

.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-body);
    transition: transform 0.1s ease;
}

.btn:active {
    transform: scale(0.98);
}

.primary-btn {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(255, 59, 78, 0.3);
}

.secondary-btn {
    background: var(--white);
    color: var(--text-main);
    border: 2px solid #E5E7EB;
}

.text-btn {
    background: none;
    color: var(--text-muted);
    text-decoration: underline;
}

.hidden {
    display: none;
}

.review-item {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary);
}

.review-q {
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: block;
}

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

.review-correct {
    color: var(--success);
    font-weight: 600;
    display: block;
    margin-top: 0.25rem;
}

/* Responsive */
@media (max-width: 600px) {
    .text-answer-container {
        flex-direction: column;
    }

    .text-input {
        width: 100%;
    }

    .confirm-btn {
        width: 100%;
    }

    .main-header h1 {
        font-size: 2rem;
    }

    .category-card .card-icon {
        font-size: 2.5rem;
    }
}