* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body.page-container {
    min-height: 100vh;
    background: radial-gradient(circle at top, rgba(56,189,248,0.18) 0, transparent 45%),
                radial-gradient(circle at bottom, rgba(56,189,248,0.12) 0, transparent 50%),
                #0B1120;
    color: #F9FAFB;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    padding-top: 72px;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.main-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 16px;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 900;
    width: 100%;
    background: rgba(15,23,42,0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(148,163,184,0.35);
    box-shadow: 0 10px 30px rgba(15,23,42,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
}

.nav-inner {
    max-width: 1200px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo-link {
    text-decoration: none;
}

.logo-lockup {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Noto Sans SC', system-ui, sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #F9FAFB;
    white-space: nowrap;
}

.logo-icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background-image: linear-gradient(135deg, #2563EB, #22C55E);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #F9FAFB;
    font-size: 18px;
    font-family: 'Noto Sans SC', system-ui, sans-serif;
}

.logo-text {
    letter-spacing: 0.02em;
}

.nav-links-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-links-desktop {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-links-mobile {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
}

.navbar-links-mobile.active {
    display: flex;
}

.nav-link {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    color: #E5E7EB;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: rgba(15,23,42,0.9);
    color: #F9FAFB;
    transform: translateY(-1px);
}

.nav-link.active {
    background: rgba(37,99,235,0.25);
    color: #EFF6FF;
    box-shadow: 0 0 0 1px rgba(129,140,248,0.8);
}

.menu-toggle {
    display: none;
}

.primary-button {
    padding: 10px 20px;
    min-height: 40px;
    min-width: 120px;
    background: #2563EB;
    color: #F9FAFB;
    border: 1px solid #1D4ED8;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(37,99,235,0.35);
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.primary-button:hover {
    background: #1D4ED8;
    border-color: #1D4ED8;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(37,99,235,0.45);
}

.primary-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #0B1120, 0 0 0 4px #38BDF8;
}

.primary-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(15,23,42,0.6);
    background: #1E40AF;
}

.primary-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.secondary-button {
    padding: 9px 18px;
    min-height: 40px;
    min-width: 110px;
    background: transparent;
    color: #E5E7EB;
    border: 1px solid #4B5563;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 0 0 rgba(0,0,0,0);
    transition: all 0.2s ease;
    text-decoration: none;
    background-image: linear-gradient(135deg, rgba(148,163,184,0.15), rgba(30,64,175,0.15));
}

.secondary-button:hover {
    background: rgba(15,23,42,0.9);
    border-color: #9CA3AF;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15,23,42,0.9);
}

.secondary-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #0B1120, 0 0 0 3px #38BDF8;
}

.secondary-button:active {
    transform: translateY(0);
    background: rgba(15,23,42,1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.7);
}

.secondary-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.ghost-icon-button {
    padding: 6px 8px;
    min-height: 32px;
    min-width: 32px;
    background: transparent;
    color: #9CA3AF;
    border: none;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.ghost-icon-button:hover {
    background: rgba(15,23,42,0.8);
    color: #E5E7EB;
    transform: translateY(-1px);
}

.ghost-icon-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #0B1120, 0 0 0 3px #38BDF8;
}

.ghost-icon-button:active {
    transform: translateY(0);
    background: rgba(15,23,42,1);
}

.ghost-icon-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.hero-section {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 32px;
    align-items: center;
    width: 100%;
    padding: 24px;
    border-radius: 20px;
    background: rgba(15,23,42,0.96);
    border: 1px solid rgba(148,163,184,0.4);
    box-shadow: 0 26px 80px rgba(15,23,42,0.98);
    position: relative;
    overflow: hidden;
    margin-bottom: 8px;
    background-image: radial-gradient(circle at 0% 0%, rgba(56,189,248,0.25), transparent 55%),
                      radial-gradient(circle at 100% 100%, rgba(129,140,248,0.3), transparent 55%);
}

.hero-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hero-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.pill-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.7);
    background: rgba(15,23,42,0.9);
    font-size: 11px;
    font-weight: 500;
    color: #E5E7EB;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

h1 {
    font-family: 'Noto Sans SC', system-ui, sans-serif;
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
    color: #F9FAFB;
    letter-spacing: 0.02em;
    margin: 0 0 8px;
    text-shadow: 0 0 24px rgba(15,23,42,0.9);
}

h2 {
    font-family: 'Noto Sans SC', system-ui, sans-serif;
    font-size: 24px;
    line-height: 1.3;
    font-weight: 600;
    color: #F9FAFB;
    letter-spacing: 0.01em;
    margin: 0 0 6px;
}

h3 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 600;
    color: #E5E7EB;
    letter-spacing: 0.01em;
    margin: 0 0 4px;
}

.body-text {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #E5E7EB;
    margin: 0 0 8px;
}

.small-caption-text {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 12px;
    line-height: 1.5;
    color: #9CA3AF;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-flashcard-preview {
    max-width: 320px;
    width: 100%;
}

.section-card {
    display: flex;
    flex-direction: column;
    min-height: 220px;
    padding: 24px;
    background: rgba(15,23,42,0.95);
    border-radius: 16px;
    border: 1px solid rgba(148,163,184,0.35);
    box-shadow: 0 22px 60px rgba(15,23,42,0.95);
    position: relative;
    overflow: hidden;
    gap: 16px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
    cursor: default;
    background-image: radial-gradient(circle at top left, rgba(56,189,248,0.18), transparent 55%);
}

.section-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 28px 80px rgba(15,23,42,0.98);
    border-color: rgba(56,189,248,0.7);
}

.section-card-header {
    margin-bottom: 8px;
}

.section-card-body {
    flex: 1 1 auto;
}

.flashcard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 24px;
    align-items: stretch;
    width: 100%;
    margin: 0 auto;
}

.flashcard {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 260px;
    padding: 24px;
    background: rgba(15,23,42,0.96);
    border-radius: 20px;
    border: 1px solid rgba(148,163,184,0.4);
    box-shadow: 0 24px 70px rgba(15,23,42,0.98);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
    background-image: radial-gradient(circle at 20% 0%, rgba(59,130,246,0.28), transparent 55%),
                      radial-gradient(circle at 80% 100%, rgba(56,189,248,0.18), transparent 55%);
}

.flashcard:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 32px 90px rgba(15,23,42,0.99);
    border-color: rgba(96,165,250,0.9);
}

.flashcard:active {
    transform: translateY(-2px) scale(0.99);
    box-shadow: 0 18px 40px rgba(15,23,42,0.95);
}

.flashcard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9CA3AF;
}

.flashcard-character {
    font-family: 'Noto Sans SC', system-ui, sans-serif;
    font-size: 72px;
    line-height: 1;
    font-weight: 700;
    text-align: center;
    margin: 8px 0 4px;
    color: #F9FAFB;
    text-shadow: 0 0 24px rgba(15,23,42,0.9);
}

.flashcard-pinyin {
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    color: #38BDF8;
    margin-bottom: 4px;
}

.flashcard-translation {
    font-size: 15px;
    text-align: center;
    color: #E5E7EB;
    margin-bottom: 8px;
}

.flashcard-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 12px;
    font-size: 12px;
    color: #9CA3AF;
}

.flashcard-progress-pill {
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.6);
    background: rgba(15,23,42,0.9);
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.flashcard.mastered {
    border-color: rgba(34,197,94,0.9);
    background-image: radial-gradient(circle at 10% 0%, rgba(34,197,94,0.3), transparent 55%),
                      radial-gradient(circle at 90% 100%, rgba(56,189,248,0.18), transparent 55%);
}

.flashcard.mastered .flashcard-character {
    color: #BBF7D0;
}

.flashcard.mastered .flashcard-meta-row {
    color: #BBF7D0;
}

.flashcard-controls-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.tab-nav {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(15,23,42,0.95);
    border: 1px solid rgba(31,41,55,0.9);
    box-shadow: 0 18px 50px rgba(15,23,42,0.96);
    overflow: hidden;
}

.tab-item {
    padding: 6px 14px;
    min-height: 32px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: #9CA3AF;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-item:hover {
    color: #E5E7EB;
}

.tab-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #0B1120, 0 0 0 3px #38BDF8;
}

.tab-item.active {
    background: rgba(37,99,235,0.25);
    color: #EFF6FF;
    box-shadow: 0 0 0 1px rgba(129,140,248,0.8);
}

.quiz-question-card {
    display: flex;
    flex-direction: column;
    min-height: 260px;
    padding: 24px;
    background: rgba(15,23,42,0.96);
    border-radius: 20px;
    border: 1px solid rgba(148,163,184,0.4);
    box-shadow: 0 24px 70px rgba(15,23,42,0.98);
    position: relative;
    overflow: hidden;
    gap: 16px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    background-image: radial-gradient(circle at 0% 0%, rgba(56,189,248,0.18), transparent 55%),
                      radial-gradient(circle at 100% 100%, rgba(37,99,235,0.28), transparent 55%);
}

.quiz-question-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 30px 80px rgba(15,23,42,0.99);
    border-color: rgba(96,165,250,0.9);
}

.quiz-question-label {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9CA3AF;
}

.quiz-question-prompt {
    font-size: 20px;
    font-weight: 600;
    color: #F9FAFB;
    margin-bottom: 8px;
}

.quiz-character-large {
    font-family: 'Noto Sans SC', system-ui, sans-serif;
    font-size: 80px;
    line-height: 1;
    font-weight: 700;
    text-align: center;
    margin: 8px 0;
    color: #F9FAFB;
}

.quiz-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.quiz-option-button {
    padding: 10px 12px;
    min-height: 44px;
    width: 100%;
    background: rgba(15,23,42,0.95);
    color: #E5E7EB;
    border: 1px solid rgba(75,85,99,0.9);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 10px 30px rgba(15,23,42,0.9);
    text-align: left;
}

.quiz-option-button:hover {
    background: rgba(15,23,42,1);
    border-color: rgba(148,163,184,0.9);
    transform: translateY(-1px);
    box-shadow: 0 16px 40px rgba(15,23,42,0.98);
}

.quiz-option-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #0B1120, 0 0 0 3px #38BDF8;
}

.quiz-option-button:active {
    transform: translateY(0);
    box-shadow: 0 8px 24px rgba(15,23,42,0.9);
}

.quiz-option-button:disabled {
    opacity: 0.7;
    cursor: default;
}

.quiz-option-button.correct {
    background: rgba(22,163,74,0.18);
    border-color: rgba(34,197,94,0.9);
    color: #BBF7D0;
    box-shadow: 0 18px 40px rgba(22,163,74,0.6);
}

.quiz-option-button.incorrect {
    background: rgba(127,29,29,0.4);
    border-color: rgba(248,113,113,0.9);
    color: #FECACA;
    box-shadow: 0 18px 40px rgba(127,29,29,0.7);
}

.quiz-footer {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.input-label {
    font-size: 13px;
    font-weight: 500;
    color: #E5E7EB;
    margin-bottom: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.text-input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    background: rgba(15,23,42,0.95);
    color: #F9FAFB;
    border: 1px solid rgba(75,85,99,0.9);
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 10px 30px rgba(15,23,42,0.9);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.2s ease;
    outline: none;
}

.text-input::placeholder {
    color: #6B7280;
}

.text-input:hover {
    border-color: rgba(148,163,184,0.9);
    background: rgba(15,23,42,1);
}

.text-input:focus-visible {
    border-color: #38BDF8;
    box-shadow: 0 0 0 1px #38BDF8, 0 0 0 4px rgba(56,189,248,0.35);
}

.text-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.helper-text {
    font-size: 12px;
    color: #9CA3AF;
    margin-top: 4px;
}

.error-text {
    font-size: 12px;
    color: #FCA5A5;
    margin-top: 4px;
}

.progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    align-items: stretch;
    width: 100%;
}

.progress-stat-card {
    display: flex;
    flex-direction: column;
    min-height: 160px;
    padding: 20px;
    background: rgba(15,23,42,0.96);
    border-radius: 16px;
    border: 1px solid rgba(55,65,81,0.9);
    box-shadow: 0 18px 50px rgba(15,23,42,0.96);
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.progress-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 70px rgba(15,23,42,0.98);
    border-color: rgba(56,189,248,0.8);
}

.progress-stat-label {
    font-size: 13px;
    color: #9CA3AF;
}

.progress-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #F9FAFB;
}

.progress-stat-meta {
    font-size: 12px;
    color: #9CA3AF;
}

.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(15,23,42,0.9);
    border: 1px solid rgba(55,65,81,0.9);
    overflow: hidden;
    position: relative;
}

.progress-bar-inner {
    height: 100%;
    border-radius: 999px;
    background-image: linear-gradient(90deg, #22C55E, #38BDF8);
    transition: width 0.3s ease-out;
}

.progress-actions {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid rgba(55,65,81,0.9);
    background: rgba(15,23,42,0.96);
    box-shadow: 0 18px 50px rgba(15,23,42,0.96);
}

.vocab-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 480px;
}

.vocab-table thead {
    background: rgba(15,23,42,1);
}

.vocab-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #E5E7EB;
    border-bottom: 1px solid rgba(55,65,81,0.9);
    white-space: nowrap;
}

.vocab-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(31,41,55,0.9);
    color: #E5E7EB;
}

.vocab-table tbody tr:hover {
    background: rgba(15,23,42,0.9);
}

.vocab-table tbody tr:last-child td {
    border-bottom: none;
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,0.85);
    backdrop-filter: blur(10px);
}

.modal-dialog {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    background: rgba(15,23,42,0.98);
    border-radius: 20px;
    border: 1px solid rgba(148,163,184,0.4);
    box-shadow: 0 30px 90px rgba(0,0,0,0.9);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.modal-body {
    overflow: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.footer {
    margin-top: auto;
    width: 100%;
    border-top: 1px solid rgba(31,41,55,0.9);
    background: rgba(15,23,42,0.98);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    z-index: 10;
}

.footer-inner {
    max-width: 1200px;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: #9CA3AF;
}

.footer-brand-text {
    font-weight: 500;
    color: #E5E7EB;
}

.quiz-top-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.quiz-mode-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hero-meta {
    margin-top: 4px;
}

@media (max-width: 900px) {
    .hero-section {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-right {
        order: -1;
    }
}

@media (max-width: 768px) {
    .navbar-links-desktop {
        display: none;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .main-wrapper {
        padding: 12px 8px 16px;
    }

    .section-card,
    .hero-section {
        padding: 20px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
