:root {
    --bg: #ffffff;
    --surface: #f5f5f5;
    --text: #1a1a1a;
    --muted: #666666;
    --accent: #e07c3c;
    --accent-hover: #f09250;
    --card-front-bg: #d4edda;
    --card-back-bg: #f8d7da;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.page {
    flex: 1;
    max-width: 560px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.hero-title {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--muted);
    margin: 0;
}

.main-content {
    text-align: center;
    color: var(--muted);
}

.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: 0.875rem;
}

/* Auth forms */
.hero-offer {
    font-size: 1rem;
    color: var(--accent);
    margin-top: 0.5rem;
    font-weight: 500;
}

.auth-section {
    margin-top: 2rem;
}

.auth-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 1rem;
    border: 1px solid #e0e0e0;
}

.auth-card h2 {
    margin: 0 0 1.5rem;
    font-size: 1.25rem;
}

.auth-form .form-group {
    margin-bottom: 1rem;
}

.auth-form label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.auth-form input {
    width: 100%;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    box-sizing: border-box;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.auth-form .btn {
    width: 100%;
    padding: 12px 20px;
    margin-top: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.auth-divider {
    text-align: center;
    margin: 1.5rem 0 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.auth-link {
    text-align: center;
}

.auth-link a {
    color: var(--accent);
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

.accent-link {
    color: var(--accent);
    text-decoration: none;
}

.accent-link:hover {
    text-decoration: underline;
}

.auth-help {
    margin-top: 1rem;
    font-size: 0.85rem;
}

.auth-help a {
    color: var(--muted);
    text-decoration: none;
}

.auth-help a:hover {
    color: var(--accent);
}

/* Flash messages */
.flash-messages {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.flash {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.flash-success {
    background: rgba(61, 153, 112, 0.2);
    color: #5dd39e;
}

.flash-error {
    background: rgba(192, 57, 43, 0.2);
    color: #e74c3c;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid #ddd;
}

.dashboard-header .hero-title {
    margin: 0;
}

.dashboard-header .hero-subtitle {
    margin: 0.25rem 0 0;
}

.access-badge {
    font-size: 0.85rem;
    color: var(--muted);
    background: var(--surface);
    padding: 4px 10px;
    border-radius: 6px;
}

.btn-logout {
    padding: 8px 16px;
    background: transparent;
    color: var(--muted);
    border: 1px solid #ccc;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-logout:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.dashboard-content {
    padding: 2rem 0;
}

.dashboard-content h2 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
}

.dashboard-content .muted {
    color: var(--muted);
}

/* Lessons page */
.lessons-page {
    max-width: 960px;
}

.lessons-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid #ddd;
}

.lessons-header .hero-title {
    margin: 0;
}

.lessons-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
}

.nav-link:hover {
    color: var(--accent);
}

.lessons-selector-section {
    padding: 1.5rem 0;
}

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

.lesson-select {
    width: 100%;
    max-width: 320px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
}

.lesson-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Card carousel */
.cards-carousel-section {
    padding: 1rem 0 2rem;
}

.carousel-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.carousel-btn {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border: 1px solid #ccc;
    background: #fff;
    color: var(--text);
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.carousel-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.carousel-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.carousel-track {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.card-slot {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 373px;
    gap: 1rem;
    background: transparent;
    border-radius: 12px;
    padding: 0;
    border: none;
}

.card-type-label {
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0.5rem 0 0;
    flex-shrink: 0;
}

.card-half.card-front {
    background: var(--card-front-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #c3e6cb;
    height: 373px;
    box-sizing: border-box;
}

.card-half.card-back {
    background: var(--card-back-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #f5c6cb;
    height: 373px;
    box-sizing: border-box;
}

.card-half.card-media {
    background: #4a90d9;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #2d6db5;
    height: 373px;
    box-sizing: border-box;
    color: #fff;
}

.card-media .media-btn {
    background: rgba(255,255,255,0.95);
    color: #2d6db5;
    border-color: #fff;
}

.card-media .media-btn:hover:not(:disabled) {
    background: #fff;
    color: #1a5a9e;
}

.card-media-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    width: 100%;
    height: 100%;
}

.card-media-image {
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
    border-radius: 8px;
}

.card-media-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.media-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border: 1px solid #3498db;
    border-radius: 6px;
    background: #fff;
    color: #2980b9;
    cursor: pointer;
}

.media-btn:hover:not(:disabled) {
    background: #3498db;
    color: #fff;
}

.media-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


@media (max-width: 600px) {
    .card-slot {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 1rem;
    }

    .card-half.card-back {
        border-top: none;
        padding-top: 1.5rem;
    }

    .card-half.card-media {
        min-height: 200px;
    }
}

.card-half {
    display: flex;
    flex-direction: column;
    min-height: 0;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.card-half .card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

.card-text {
    margin: 0;
    font-weight: 600;
}

.card-front .card-text-large {
    color: #155724;
    font-size: clamp(2.5rem, 10vw, 6rem);
}

.card-front .card-text-fit {
    color: #155724;
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
    line-height: 1.3;
    word-wrap: break-word;
    max-width: 100%;
}

.card-question-line {
    color: #155724;
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
    margin: 0;
}

.card-back .card-text {
    color: #721c24;
    font-size: 1.25rem;
}

.card-back .card-consonant-name {
    color: #721c24;
    font-size: 1.4rem;
    font-weight: 600;
}

.card-front .card-subtitle {
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    color: #155724;
    margin: 0;
}

.card-back .card-subtitle {
    font-size: 0.95rem;
    color: #721c24;
    margin: 0;
}

.card-image {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
    margin-top: 0.5rem;
}

.card-audio-btn {
    display: block;
    margin: 0.75rem auto 0;
    padding: 0.5rem;
    background: rgba(0,0,0,0.08);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #721c24;
}

.card-audio-btn:hover {
    background: rgba(0,0,0,0.15);
}

.card-audio-icon {
    width: 2rem;
    height: 2rem;
    display: block;
}

.card-rating-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: nowrap;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
}

.rating-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    white-space: nowrap;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.rating-btn:hover {
    background: var(--surface);
}

.rating-again { border-color: #e74c3c; color: #e74c3c; }
.rating-hard { border-color: #e67e22; color: #e67e22; }
.rating-good { border-color: #27ae60; color: #27ae60; }
.rating-easy { border-color: #3498db; color: #3498db; }

.empty-state {
    color: var(--muted);
    font-style: italic;
    margin: 0;
}

.carousel-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.carousel-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: #ccc;
    cursor: pointer;
    padding: 0;
}

.carousel-dots .dot:hover {
    background: var(--muted);
}

.carousel-dots .dot.active {
    background: var(--accent);
    transform: scale(1.2);
}

.carousel-position {
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted);
    margin: 0;
}
