* {
    box-sizing: border-box;
}

body {
    background: #f5f7fb;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1f2937;
}

.navbar-brand {
    letter-spacing: -0.5px;
}

.hero-section {
    padding: 80px 0 50px;
    background:
        radial-gradient(circle at top left, rgba(13, 110, 253, 0.16), transparent 35%),
        radial-gradient(circle at bottom right, rgba(102, 16, 242, 0.12), transparent 35%),
        #ffffff;
}

.hero-title {
    max-width: 760px;
    margin: 0 auto;
    font-size: 46px;
    font-weight: 800;
    line-height: 1.15;
    color: #111827;
}

.hero-desc {
    max-width: 620px;
    margin: 20px auto 0;
    font-size: 18px;
    color: #6b7280;
}

.level-section,
.lesson-section,
.flashcard-section {
    padding: 50px 0 80px;
}

.level-card,
.lesson-card {
    min-height: 260px;
    background: #ffffff;
    border-radius: 24px;
    padding: 32px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    transition: 0.25s ease;
    position: relative;
    overflow: hidden;
}

.level-card::before,
.lesson-card::before {
    content: "";
    position: absolute;
    width: 160px;
    height: 160px;
    background: rgba(13, 110, 253, 0.08);
    border-radius: 50%;
    right: -50px;
    top: -50px;
}

.level-card:hover,
.lesson-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
}

.level-icon {
    width: 86px;
    height: 86px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    color: #ffffff;
    font-size: 30px;
    font-weight: 800;
    margin-bottom: 24px;
}

.level-title,
.lesson-title {
    font-size: 24px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 12px;
}

.level-desc,
.lesson-desc {
    color: #6b7280;
    line-height: 1.7;
}

.level-action {
    margin-top: 24px;
    color: #0d6efd;
    font-weight: 700;
}

.level-action span {
    margin-left: 6px;
}

.page-header {
    padding: 50px 0 30px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.back-link {
    display: inline-block;
    color: #0d6efd;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 8px;
}

.back-link:hover {
    text-decoration: underline;
}

.page-title {
    font-size: 38px;
    font-weight: 800;
    color: #111827;
}

.page-desc {
    color: #6b7280;
    font-size: 17px;
    max-width: 650px;
}

.lesson-number {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    background: #e7f1ff;
    color: #0d6efd;
    font-weight: 700;
    margin-bottom: 18px;
}

.lesson-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 26px;
    color: #0d6efd;
    font-weight: 700;
}

.empty-box {
    background: #ffffff;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    color: #6b7280;
    border: 1px dashed #cbd5e1;
}

.flashcard-wrapper {
    max-width: 760px;
    margin: 0 auto;
}

.progress-area {
    margin-bottom: 24px;
}

.progress-area span {
    display: inline-block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #374151;
}

.progress {
    height: 10px;
    border-radius: 999px;
    background: #e5e7eb;
}

.progress-bar {
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    border-radius: 999px;
}

.flashcard-item {
    display: none;
}

.flashcard-item.active {
    display: block;
}

.flashcard {
    width: 100%;
    min-height: 540px;
    perspective: 1200px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    min-height: 540px;
    transition: transform 0.7s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    inset: 0;
    width: 100%;
    min-height: 540px;
    backface-visibility: hidden;
    border-radius: 30px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
    overflow: hidden;
}

.flashcard-front {
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.22), transparent 35%),
        linear-gradient(135deg, #0d6efd, #6610f2);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.kanji-big {
    font-size: 150px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 24px;
}

.flashcard-hint {
    font-size: 20px;
    opacity: 0.95;
    max-width: 480px;
}

.tap-hint {
    margin-top: 24px;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-weight: 600;
}

.flashcard-back {
    background: #ffffff;
    transform: rotateY(180deg);
    padding: 30px;
    overflow-y: auto;
}

.back-content {
    height: 100%;
}

.kanji-back {
    font-size: 70px;
    font-weight: 800;
    color: #111827;
    text-align: center;
    margin-bottom: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}

.info-grid div {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    padding: 14px;
    border-radius: 16px;
}

.info-grid span {
    display: block;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
}

.info-grid strong {
    color: #111827;
}

.example-box {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 18px;
}

.example-box h5 {
    font-weight: 800;
    margin-bottom: 12px;
}

.sentence-box {
    margin-top: 12px;
    padding: 14px;
    background: #ffffff;
    border-radius: 14px;
    border-left: 4px solid #0d6efd;
    color: #111827;
}

.sentence-box span {
    color: #6b7280;
}

.small-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.small-info span {
    padding: 8px 12px;
    background: #e7f1ff;
    color: #0d6efd;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
}

.mnemonic-box {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    padding: 16px;
    border-radius: 16px;
    line-height: 1.6;
}

.flashcard-actions {
    margin-top: 28px;
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.flashcard-actions .btn {
    min-width: 120px;
    border-radius: 999px;
    font-weight: 700;
    padding: 10px 20px;
}

.footer {
    padding: 24px 0;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
}

.footer p {
    margin: 0;
}

/* Responsive tablet */
@media (max-width: 992px) {
    .hero-title {
        font-size: 38px;
    }

    .page-title {
        font-size: 32px;
    }

    .kanji-big {
        font-size: 120px;
    }
}

/* Responsive mobile */
@media (max-width: 576px) {
    .hero-section {
        padding: 56px 0 36px;
    }

    .hero-title {
        font-size: 30px;
    }

    .hero-desc {
        font-size: 16px;
    }

    .page-header {
        padding: 36px 0 24px;
    }

    .page-title {
        font-size: 27px;
    }

    .level-card,
    .lesson-card {
        padding: 26px;
        min-height: auto;
        border-radius: 22px;
    }

    .level-icon {
        width: 74px;
        height: 74px;
        font-size: 26px;
    }

    .lesson-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .flashcard {
        min-height: 580px;
    }

    .flashcard-inner {
        min-height: 580px;
    }

    .flashcard-front,
    .flashcard-back {
        min-height: 580px;
        border-radius: 24px;
    }

    .flashcard-front {
        padding: 28px;
    }

    .kanji-big {
        font-size: 105px;
    }

    .flashcard-hint {
        font-size: 17px;
    }

    .flashcard-back {
        padding: 22px;
    }

    .kanji-back {
        font-size: 56px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .flashcard-actions {
        gap: 10px;
    }

    .flashcard-actions .btn {
        flex: 1;
        min-width: auto;
        font-size: 14px;
    }
}