:root {
    --bg: #f5f9ff;
    --bg-strong: #edf4ff;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-strong: #ffffff;
    --line: #dbe7f5;
    --line-strong: #c9d9ee;

    --text: #0f172a;
    --muted: #5f6f86;
    --muted-2: #7a8aa2;

    --blue-50: #eef4ff;
    --blue-100: #d9e8ff;
    --blue-200: #bfd8ff;
    --blue-300: #93c5fd;
    --blue-400: #5ba6ff;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;

    --green-50: #effcf3;
    --green-100: #d4f7de;
    --green-500: #16a34a;
    --green-700: #166534;

    --amber-50: #fff7ed;
    --amber-100: #fde7c7;
    --amber-600: #c97a12;

    --shadow-card: 0 12px 34px rgba(15, 23, 42, 0.06);
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.05);

    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 18px;

    --container: 1320px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Inter", sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, rgba(238, 244, 255, 0.88) 0%, rgba(245, 249, 255, 0.98) 100%);
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
}

.app-shell {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

.site-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(105, 144, 220, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(105, 144, 220, 0.12) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: linear-gradient(180deg, rgba(0,0,0,0.65), rgba(0,0,0,0.18));
    z-index: 0;
}

.site-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    z-index: 0;
}

.site-glow-1 {
    width: 340px;
    height: 340px;
    top: 70px;
    left: -80px;
    background: rgba(91, 166, 255, 0.18);
}

.site-glow-2 {
    width: 360px;
    height: 360px;
    right: -90px;
    top: 240px;
    background: rgba(147, 197, 253, 0.14);
}

.container {
    width: min(var(--container), calc(100% - 48px));
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, 0.84);
    border-bottom: 1px solid rgba(219, 231, 245, 0.95);
}

.topbar-inner {
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.brand-mark {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    position: relative;
    background: linear-gradient(135deg, var(--blue-600), var(--blue-400));
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.brand-mark-core {
    position: absolute;
    inset: 3px;
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.24);
}

.brand-mark-a {
    position: relative;
    z-index: 1;
    color: #ffffff;
    font-family: "Sora", sans-serif;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.brand-text {
    display: grid;
    gap: 2px;
}

.brand-title {
    font-family: "Sora", sans-serif;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topnav a {
    text-decoration: none;
    min-height: 44px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    transition: 0.16s ease;
}

.topnav a:hover {
    background: var(--blue-50);
    color: var(--blue-700);
}

.topnav-accent {
    background: linear-gradient(135deg, var(--blue-600), var(--blue-400));
    color: #fff !important;
    box-shadow: 0 14px 28px rgba(22, 93, 255, 0.18);
}

.topnav-accent:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
}

.page-wrap {
    padding: 24px 0 44px;
}

.breadcrumbs {
    margin-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.breadcrumbs a {
    color: var(--blue-700);
    text-decoration: none;
}

.hero,
.topic-hero {
    background: linear-gradient(135deg, rgba(239, 245, 255, 0.96), rgba(228, 239, 255, 0.92));
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: 34px;
    margin-bottom: 24px;
}

.block-label,
.hero-label {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--blue-50);
    color: var(--blue-700);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.hero h1,
.hero h2,
.topic-title {
    margin: 16px 0 12px;
    font-family: "Sora", sans-serif;
    font-size: clamp(34px, 4vw, 52px);
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1.05;
}

.hero p,
.topic-subtitle {
    margin: 0;
    font-size: 17px;
    line-height: 1.8;
    color: var(--muted);
}

.hero-badges,
.topic-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.soft-pill {
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    font-weight: 800;
    color: var(--muted);
}

.page-grid,
.topic-page-grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.sidebar-column,
.topic-sidebar {
    display: grid;
    gap: 18px;
}

.content-column,
.topic-main {
    display: grid;
    gap: 22px;
}

.sidebar-card,
.topic-sidebar-card,
.main-card,
.content-card,
.progress-card,
.paper-progress-card,
.lo-card,
.empty-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.sidebar-card,
.topic-sidebar-card,
.main-card,
.content-card,
.progress-card,
.paper-progress-card,
.empty-card {
    padding: 22px;
}

.section-title {
    margin: 0 0 18px;
    font-family: "Sora", sans-serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

/* topic sidebar */

.topic-sidebar-section-label {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--blue-50);
    color: var(--blue-700);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.topic-sidebar-unit + .topic-sidebar-unit {
    margin-top: 16px;
}

.topic-sidebar-unit-kicker {
    font-size: 12px;
    font-weight: 800;
    color: var(--muted-2);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.topic-sidebar-unit-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 12px;
    line-height: 1.4;
}

.topic-sidebar-topic-list {
    display: grid;
    gap: 10px;
}

.topic-sidebar-topic-wrap + .topic-sidebar-topic-wrap {
    margin-top: 2px;
}

.topic-sidebar-topic-link {
    display: block;
    text-decoration: none;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    border-radius: 16px;
    padding: 14px 16px;
    transition: 0.16s ease;
}

.topic-sidebar-topic-link:hover {
    border-color: var(--blue-300);
    background: #f8fbff;
    transform: translateY(-1px);
}

.topic-sidebar-topic-link.active {
    border-color: var(--blue-300);
    background: linear-gradient(180deg, #eef5ff 0%, #e9f2ff 100%);
}

.topic-sidebar-topic-name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.5;
}

.topic-sidebar-lo-list {
    margin-top: 10px;
    margin-left: 14px;
    padding-left: 12px;
    border-left: 2px solid var(--line);
    display: grid;
    gap: 8px;
}

.topic-sidebar-lo-link {
    display: block;
    text-decoration: none;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 14px;
    padding: 10px 12px;
    transition: 0.16s ease;
}

.topic-sidebar-lo-link:hover {
    border-color: var(--blue-300);
    background: #f8fbff;
    transform: translateY(-1px);
}

.topic-sidebar-lo-code {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: var(--blue-700);
    margin-bottom: 4px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.topic-sidebar-lo-title {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
}

.topic-sidebar-empty {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.topic-sidebar-sections {
    display: grid;
    gap: 10px;
}

.topic-sidebar-section-link {
    display: block;
    text-decoration: none;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    border-radius: 16px;
    padding: 14px 16px;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    transition: 0.16s ease;
}

.topic-sidebar-section-link:hover {
    border-color: var(--blue-300);
    background: #f8fbff;
    transform: translateY(-1px);
}

/* progress */

.progress-card {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 22px;
    align-items: center;
}

.progress-ring {
    --progress: 0;
    width: 118px;
    height: 118px;
    border-radius: 50%;
    background: conic-gradient(var(--blue-500) calc(var(--progress) * 1%), #dce8f8 0);
    display: grid;
    place-items: center;
    position: relative;
}

.progress-ring::before {
    content: "";
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px var(--line);
    position: absolute;
}

.progress-ring-inner {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    text-align: center;
}

.progress-ring-value {
    font-family: "Sora", sans-serif;
    font-size: 22px;
    font-weight: 800;
}

.progress-ring-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.progress-bars {
    display: grid;
    gap: 14px;
}

.progress-row {
    display: grid;
    gap: 8px;
}

.progress-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.progress-row-label {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.03em;
}

.progress-row-value {
    font-size: 14px;
    font-weight: 800;
    color: var(--blue-700);
}

.progress-track {
    height: 10px;
    border-radius: 999px;
    background: #e3edf9;
    overflow: hidden;
}

.progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--blue-600), var(--blue-400));
    transition: width 0.5s ease;
}

.paper-progress-card h3,
.topic-main-card h3,
.content-card h3 {
    margin: 0 0 14px;
    font-family: "Sora", sans-serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.paper-progress-list {
    display: grid;
    gap: 14px;
}

.paper-row {
    display: grid;
    gap: 8px;
}

.paper-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.paper-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    border: 1px solid transparent;
}

.paper-chip.paper-1 {
    background: var(--amber-50);
    color: var(--amber-600);
    border-color: var(--amber-100);
}

.paper-chip.paper-2 {
    background: var(--green-50);
    color: var(--green-700);
    border-color: var(--green-100);
}

.paper-chip.paper-3 {
    background: var(--blue-50);
    color: var(--blue-700);
    border-color: var(--blue-100);
}

/* content */

.main-section {
    display: grid;
    gap: 14px;
}

.main-section h2 {
    margin: 0;
    font-family: "Sora", sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.learning-objectives-list {
    display: grid;
    gap: 14px;
}

.lo-card {
    padding: 18px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
}

.lo-card-code {
    font-size: 13px;
    font-weight: 800;
    color: var(--blue-700);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.lo-card-text {
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    font-weight: 600;
}

.content-card {
    margin-bottom: 14px;
}

.content-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.content-card p {
    margin: 0;
    color: var(--text);
    line-height: 1.8;
}

.empty-note,
.empty-state-box {
    border: 1px dashed var(--line-strong);
    background: rgba(255, 255, 255, 0.72);
    border-radius: 18px;
    padding: 16px 18px;
    color: var(--muted);
    line-height: 1.7;
}

/* cards */

.unit-grid,
.topic-grid,
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 18px;
    align-items: stretch;
}

.topic-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    align-items: stretch;
}

.unit-card,
.topic-card,
.info-card {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 22px;
    transition: 0.18s ease;
    overflow: hidden;
}

.unit-card:hover,
.topic-card:hover,
.info-card:hover {
    transform: translateY(-2px);
    border-color: var(--blue-300);
}

.grade-card-link,
.topic-card-strong {
    display: block;
    width: 100%;
    height: 100%;
}

.unit-kicker,
.topic-kicker-small {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--blue-50);
    color: var(--blue-700);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 12px;
}

.unit-title,
.topic-card-title {
    font-family: "Sora", sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 12px;
}

.unit-text,
.topic-card-text {
    color: var(--muted);
    line-height: 1.75;
    margin: 0;
}

.topic-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.topic-mini-pill {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: #f8fbff;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.topic-paper-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.topic-card-footer {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.topic-open-link {
    color: var(--blue-700);
    font-weight: 800;
    font-size: 15px;
}

.topic-progress-inline {
    color: var(--muted);
    font-weight: 800;
    font-size: 14px;
}

.topic-card-progress {
    margin-top: 10px;
}

.unit-progress-card {
    margin-bottom: 24px;
}

/* auth */

.auth-shell {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 0 30px;
}

.auth-card {
    width: min(100%, 640px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow-card);
    padding: 32px;
}

.auth-title {
    margin: 0 0 10px 0;
    font-family: "Sora", sans-serif;
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.auth-subtitle {
    margin: 0 0 20px 0;
    color: var(--muted);
    line-height: 1.8;
    font-size: 16px;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-field {
    display: grid;
    gap: 8px;
}

.auth-field label {
    font-weight: 700;
    color: var(--text);
}

.auth-field input,
.auth-field select,
.auth-field textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #ffffff;
    border-radius: 16px;
    padding: 14px 16px;
    font-size: 15px;
    color: var(--text);
    outline: none;
    transition: 0.16s ease;
    font-family: inherit;
}

.auth-field input:focus,
.auth-field select:focus,
.auth-field textarea:focus {
    border-color: var(--blue-300);
    box-shadow: 0 0 0 4px rgba(45, 127, 255, 0.10);
}

.auth-check label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--muted);
}

.auth-submit-btn,
.auth-google-btn,
.auth-secondary-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 52px;
    border-radius: 16px;
    border: 0;
    text-decoration: none;
    font-weight: 800;
    font-size: 15px;
    transition: 0.18s ease;
    cursor: pointer;
    padding: 0 18px;
}

.auth-submit-btn {
    background: linear-gradient(135deg, var(--blue-600), var(--blue-400));
    color: white;
    box-shadow: 0 14px 28px rgba(22, 93, 255, 0.22);
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
}

.auth-google-btn,
.auth-secondary-btn {
    width: 100%;
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--line);
}

.auth-google-btn:hover,
.auth-secondary-btn:hover {
    background: var(--blue-50);
    border-color: var(--blue-200);
}

.auth-divider {
    position: relative;
    text-align: center;
    margin: 12px 0 18px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.auth-divider::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 1px solid #e5eefc;
    z-index: 0;
}

.auth-divider span {
    position: relative;
    z-index: 1;
    background: rgba(255,255,255,0.95);
    padding: 0 10px;
}

.auth-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
    color: var(--muted);
    font-size: 14px;
}

.auth-links a {
    color: var(--blue-700);
    text-decoration: none;
    font-weight: 700;
}

.auth-alert,
.auth-error,
.auth-note-box,
.auth-success {
    border-radius: 16px;
    padding: 14px 16px;
    line-height: 1.7;
    font-size: 14px;
}

.auth-alert,
.auth-error {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
}

.auth-note-box {
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    color: var(--muted);
}

.auth-success {
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    color: #166534;
    margin-bottom: 18px;
    font-weight: 600;
}

.profile-topline {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--blue-600), var(--blue-400));
    color: white;
    font-family: "Sora", sans-serif;
    font-size: 24px;
    font-weight: 800;
    box-shadow: 0 14px 28px rgba(22, 93, 255, 0.20);
}

.profile-title {
    margin: 0 0 4px 0;
    font-family: "Sora", sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.profile-email {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

/* responsive */

@media (max-width: 1100px) {
    .page-grid,
    .topic-page-grid {
        grid-template-columns: 1fr;
    }

    .progress-card {
        grid-template-columns: 1fr;
        justify-items: start;
    }
}

@media (max-width: 760px) {
    .container {
        width: min(var(--container), calc(100% - 28px));
    }

    .topbar-inner {
        min-height: 86px;
        align-items: flex-start;
        padding: 14px 0;
        flex-direction: column;
    }

    .topnav {
        width: 100%;
    }

    .topnav a {
        min-height: 40px;
        padding: 0 14px;
    }

    .hero,
    .topic-hero,
    .sidebar-card,
    .topic-sidebar-card,
    .main-card,
    .content-card,
    .progress-card,
    .paper-progress-card,
    .auth-card {
        padding: 18px;
        border-radius: 22px;
    }

    .hero h1,
    .hero h2,
    .topic-title,
    .auth-title {
        font-size: 30px;
    }
}
.paper-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.paper-filter-chip {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: 0.16s ease;
}

.paper-filter-chip:hover {
    background: var(--blue-50);
    border-color: var(--blue-200);
    color: var(--blue-700);
}

.paper-filter-chip.active {
    background: linear-gradient(135deg, var(--blue-600), var(--blue-400));
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.16);
}

.lo-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}