/* ============================================================
   The Grammar Index — Corporate Theme
   ============================================================ */

:root {
    --primary: #1B5E9E;
    --primary-dark: #14486F;
    --primary-light: #2980C4;
    --bg: #F5F6FA;
    --bg-card: #FFFFFF;
    --text: #2C3E50;
    --text-muted: #6C7A89;
    --border: #E0E4EB;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --radius-pill: 50px;
    --success: #27AE60;
    --danger: #E74C3C;
    --warning: #F39C12;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji",
        "Segoe UI Emoji";
}

/* Reset & base */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Loading screen ---- */
.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg);
}

.loading-content {
    text-align: center;
}

.loading-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ---- Blazor error UI ---- */
#blazor-error-ui {
    background: var(--danger);
    color: #fff;
    padding: 0.75rem 1.25rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 9999;
    display: none;
    text-align: center;
}

#blazor-error-ui .reload,
#blazor-error-ui .dismiss {
    color: #fff;
    margin-left: 1rem;
    text-decoration: underline;
    cursor: pointer;
}

/* ---- Header ---- */
.app-header {
    background: var(--primary);
    color: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.app-header2 {
    background: var(--primary);
    color: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}



.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.header-subtitle {
    font-size: 0.82rem;
    opacity: 0.8;
    font-weight: 400;
    margin-left: 0.75rem;
}

/* ---- Footer ---- */
.app-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* ---- Main content ---- */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ---- Page title ---- */
.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.5rem 0;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0 0 0.4rem 0;
}

.page-hint {
    color: var(--primary, #1B5E9E);
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0 0 1.5rem 0;
}

/* ---- Search bar ---- */
.search-bar {
    margin-bottom: 1.25rem;
}

.search-bar .dxbl-text-edit {
    border-radius: var(--radius) !important;
}

/* ---- Section chips ---- */
.section-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.section-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    transition: all 0.2s ease;
    user-select: none;
}

.section-chip:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

.section-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ---- Custom filter modal ----
   Pupil/teacher picks a subset of topics to focus on. Modal is plain
   HTML/CSS (not a DevExpress popup) so it stays lightweight and matches
   the rest of the home-screen visual language. */
.custom-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.custom-modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    max-width: 760px;
    width: 100%;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
}

.custom-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.custom-modal-header h3 {
    margin: 0;
    color: var(--primary);
    font-size: 1.1rem;
}

.custom-modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: #888;
    line-height: 1;
    padding: 0 0.3rem;
}

.custom-modal-close:hover {
    color: var(--primary);
}

.custom-modal-body {
    overflow-y: auto;
    padding: 0.5rem 1.25rem 1rem;
    flex: 1;
}

.custom-modal-intro {
    font-size: 0.88rem;
    color: #555;
    margin: 0.5rem 0 1rem;
}

.custom-modal-section-group {
    margin-bottom: 0.75rem;
}

.custom-modal-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    color: var(--primary);
    margin: 0.75rem 0 0.25rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.custom-modal-section-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    padding: 0.15rem 0.7rem;
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
}

.custom-modal-section-toggle:hover {
    border-color: var(--primary);
}

.custom-modal-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.25rem;
    cursor: pointer;
    border-radius: 4px;
}

.custom-modal-row:hover {
    background: #f5f5fa;
}

.custom-modal-row input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    cursor: pointer;
    accent-color: var(--primary);
}

.custom-modal-row .title {
    flex: 1;
    font-size: 0.92rem;
}

.custom-modal-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.custom-modal-count {
    margin-right: auto;
    font-size: 0.88rem;
    color: #555;
    font-weight: 600;
}

.custom-modal-btn {
    border-radius: var(--radius-pill);
    padding: 0.45rem 1.1rem;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
}

.custom-modal-btn:hover {
    border-color: var(--primary);
}

.custom-modal-btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.custom-modal-btn.primary:hover {
    background: var(--primary);
    filter: brightness(1.1);
}

.custom-modal-btn.danger {
    color: #c0392b;
    border-color: #f4caca;
}

/* ---- Card grid ---- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

/* ---- Grammar card ---- */
.grammar-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.grammar-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.grammar-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.grammar-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.4;
}

.grammar-card-definition {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.55;
    margin-bottom: 0.75rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grammar-card-example {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    border-left: 3px solid var(--primary-light);
}

.grammar-card-example-label {
    font-weight: 600;
    color: var(--text);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.2rem;
}

.grammar-card-more {
    margin-top: 0.6rem;
    color: var(--primary, #1B5E9E);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: right;
}

/* ---- Tag badge ---- */
.tag-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    color: #fff;
    flex-shrink: 0;
}

/* ---- Entry detail page ---- */
.entry-detail {
    max-width: 800px;
    margin: 0 auto;
}

.entry-detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.entry-detail-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.entry-detail-definition {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    line-height: 1.7;
    font-size: 1rem;
    color: var(--text);
}

.entry-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    transition: color 0.15s;
}

.entry-back-link:hover {
    color: var(--primary-dark);
}

.entry-section-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* ---- Example blocks ---- */
.examples-section {
    margin-top: 1.5rem;
}

.examples-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 1rem 0;
}

.example-block {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary-light);
}

.example-block.correct {
    border-left-color: var(--success);
}

.example-block.incorrect {
    border-left-color: var(--danger);
}

.example-block-label {
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}

.example-block.correct .example-block-label {
    color: var(--success);
}

.example-block.incorrect .example-block-label {
    color: var(--danger);
}

.example-block-sentence {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text);
}

.example-block-sentence .hl {
    background: rgba(27, 94, 158, 0.12);
    padding: 0.1em 0.25em;
    border-radius: 3px;
    font-weight: 600;
    color: var(--primary);
}

.example-block.correct .example-block-sentence .hl {
    background: rgba(39, 174, 96, 0.12);
    color: var(--success);
}

.example-block.incorrect .example-block-sentence .hl {
    background: rgba(231, 76, 60, 0.12);
    color: var(--danger);
    text-decoration: line-through;
}

.example-block-note {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ---- No results ---- */
.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.no-results-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.no-results-hint {
    font-size: 0.9rem;
}

/* ---- Activation page ---- */
.activation-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    padding: 1.5rem;
}

.activation-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
    border: 1px solid var(--border);
}

.activation-logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.activation-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.activation-input {
    margin-bottom: 1rem;
}

.activation-message {
    margin-top: 1rem;
    font-size: 0.88rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
}

.activation-message.error {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
}

.activation-message.success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
}

/* ---- Back to top ---- */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 50;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }

    .header-subtitle {
        margin-left: 0;
    }

    .main-content {
        padding: 1rem;
    }

    .entry-detail-title {
        font-size: 1.4rem;
    }

    .activation-card {
        padding: 1.5rem;
    }

    .entry-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .section-chips {
        gap: 0.35rem;
    }

    .section-chip {
        padding: 0.25rem 0.65rem;
        font-size: 0.75rem;
    }
}

/* ===== Key Stage 2 & 3 edition ===== */

/* Right / wrong example groupings on the entry detail page */
.examples-section.examples-right {
    margin-top: 2rem;
    padding: 1rem 1.25rem 0.25rem;
    background: rgba(39, 174, 96, 0.05);
    border: 1px solid rgba(39, 174, 96, 0.2);
    border-radius: var(--radius);
}

.examples-section.examples-wrong {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem 0.25rem;
    background: rgba(231, 76, 60, 0.04);
    border: 1px solid rgba(231, 76, 60, 0.18);
    border-radius: var(--radius);
}

.examples-section.examples-right .examples-section-title {
    color: var(--success);
}

.examples-section.examples-wrong .examples-section-title {
    color: var(--danger);
}

.examples-section-icon {
    display: inline-block;
    margin-right: 0.3rem;
    font-size: 1.1em;
}

.examples-section-hint {
    margin: -0.25rem 0 0.75rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Joke box at the bottom of each entry */
.joke-box {
    margin-top: 2rem;
    padding: 1.1rem 1.35rem;
    background: linear-gradient(135deg, rgba(255, 213, 79, 0.18), rgba(255, 167, 38, 0.12));
    border: 1px dashed rgba(255, 152, 0, 0.55);
    border-radius: var(--radius);
}

.joke-box-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #b07000;
    margin-bottom: 0.4rem;
}

.joke-box-text {
    font-size: 1rem;
    line-height: 1.55;
    color: var(--text);
}

.joke-box-text + .joke-box-text {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px dashed rgba(255, 152, 0, 0.35);
}

/* Slightly friendlier page title for kids */
.page-title {
    font-size: 1.85rem;
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.45rem;
    }
}

/* ===== Header nav (Topics / Quiz) ===== */
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-title-link {
    text-decoration: none;
    color: inherit;
}
.header-title-link:hover { opacity: 0.85; }

.header-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}


.header-nav-link {
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border);
    transition: background 0.15s, transform 0.15s;
}
.header-nav-link:hover { background: rgba(255, 255, 255, 0.9); transform: translateY(-1px); }

.header-nav-link-accent {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.header-nav-link-accent:hover {
    background: var(--primary);
    color: #fff;
    opacity: 0.92;
}

/* ===== Quiz call-to-action card on Index =====
   The blue gradient now lives on the wrapper so the left half (Take the
   quiz link) and the right half (rotating tip) share one continuous card.
   The tip's own background is transparent — only its icon and text appear,
   against the card's blue. A vertical divider separates the two halves on
   wide viewports; on narrow viewports the tip stacks below. */
.quiz-cta {
    margin: 1.25rem 0 2rem;
    display: flex;
    align-items: stretch;
    background: linear-gradient(135deg, var(--primary), #2C7EBA);
    color: #fff;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(27, 94, 158, 0.25);
    overflow: hidden;
    transition: box-shadow 0.15s;
}

.quiz-cta:hover {
    box-shadow: 0 6px 18px rgba(27, 94, 158, 0.35);
}

.quiz-cta-button {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.4rem;
    color: #fff;
    text-decoration: none;
    flex: 1 1 0;
    min-width: 0;
    transition: background-color 0.15s;
}
.quiz-cta-button:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.quiz-cta-icon { font-size: 1.8rem; }

.quiz-cta-text {
    display: flex;
    flex-direction: column;
}
.quiz-cta-text strong {
    font-size: 1.1rem;
    margin-bottom: 0.15rem;
}
.quiz-cta-hint {
    font-size: 0.85rem;
    opacity: 0.92;
}

/* Right-half rotating tip. Background is transparent so the card's blue
   gradient shows through — only the icon + text are visible chrome.
   No divider between the two halves; the spacing speaks for itself. */
.quiz-cta-tip {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.1rem 1.4rem;
    flex: 1 1 0;
    min-width: 0;
    color: #fff;
}

.quiz-cta-tip-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.quiz-cta-tip-text {
    font-size: 0.95rem;
    line-height: 1.4;
    font-weight: 500;
}

/* On narrow viewports, stack the tip below the quiz button so both stay
   readable. */
@media (max-width: 760px) {
    .quiz-cta {
        flex-direction: column;
    }
}

/* ===== Quiz page ===== */
.quiz-pool-note {
    background: rgba(27, 94, 158, 0.08);
    border-left: 3px solid var(--primary);
    padding: 0.6rem 0.9rem;
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 1.5rem 0;
}

.quiz-question {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary-light);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.quiz-question.quiz-q-right { border-left-color: var(--success); }
.quiz-question.quiz-q-wrong { border-left-color: var(--danger); }

.quiz-question-num {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.quiz-question-sentence {
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}
.quiz-question-sentence .hl {
    background: rgba(27, 94, 158, 0.12);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.quiz-question-prompt {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0.7rem 0 0.6rem;
    color: var(--text);
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.5rem;
}

.quiz-option {
    padding: 0.65rem 0.9rem;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, transform 0.12s;
    text-align: left;
    color: var(--text);
}
.quiz-option:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(27, 94, 158, 0.05);
}
.quiz-option.selected {
    background: rgba(27, 94, 158, 0.12);
    border-color: var(--primary);
    color: var(--primary);
}
.quiz-option.correct {
    background: rgba(39, 174, 96, 0.15);
    border-color: var(--success);
    color: var(--success);
}
.quiz-option.wrong {
    background: rgba(231, 76, 60, 0.12);
    border-color: var(--danger);
    color: var(--danger);
    text-decoration: line-through;
}
.quiz-option:disabled { cursor: default; }

.quiz-answer-reveal {
    margin-top: 0.6rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

.quiz-submit {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.9rem 1.2rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}
.quiz-submit:hover:not(:disabled) { background: #1A507F; }
.quiz-submit:disabled {
    background: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
}

.quiz-result {
    margin-top: 1.25rem;
    padding: 1.25rem 1.4rem;
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.12), rgba(27, 94, 158, 0.08));
    border: 1px solid rgba(39, 174, 96, 0.25);
    border-radius: var(--radius);
    text-align: center;
}
.quiz-result-score {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--success);
    margin-bottom: 0.35rem;
}
.quiz-result-message {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 1rem;
}

/* ── Today screen (the new home page) ───────────────────────────── */

.today-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.25rem 0 0.75rem 0;
}

.today-title { margin: 0 0 0.25rem 0; font-size: 1.6rem; color: var(--text); }
.today-subtitle { margin: 0; color: var(--text-muted); font-size: 0.95rem; }

.today-streak {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    background: linear-gradient(135deg, #FFEDD5 0%, #FED7AA 100%);
    color: #9A3412;
    padding: 0.55rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(154, 52, 18, .15);
}
.today-streak-icon { font-size: 1.15rem; }
.today-streak-num { font-size: 1.45rem; line-height: 1; }
.today-streak-label { font-size: 0.78rem; font-weight: 600; }

.today-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.25rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}

.today-card-primary {
    background: linear-gradient(135deg, #1B5E9E 0%, #2980C4 100%);
    color: #fff;
    border: 0;
    box-shadow: 0 4px 16px rgba(27, 94, 158, .25);
}

.today-card-eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.8;
    margin-bottom: 0.35rem;
}
.today-card-title { margin: 0; font-size: 1.4rem; color: #fff; }
.today-card-blurb { margin: 0.6rem 0 1.2rem 0; font-size: 0.95rem; line-height: 1.6; opacity: 0.92; }

.today-progress { margin-bottom: 1.2rem; }
.today-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    overflow: hidden;
}
.today-progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 999px;
    transition: width 0.4s ease;
}
.today-progress-label {
    margin-top: 0.45rem;
    font-size: 0.85rem;
    opacity: 0.85;
}

.today-card-actions { display: flex; gap: 0.65rem; flex-wrap: wrap; }
.today-continue {
    background: #fff;
    color: var(--primary);
    border: 0;
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
    transition: transform 0.1s ease;
}
.today-continue:hover { transform: translateY(-1px); }

.today-card-done {
    margin: 0;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.7rem 1rem;
    border-radius: 6px;
}

.today-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    margin: 1.25rem 0;
}

.today-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    color: var(--text);
    text-decoration: none;
    transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.today-tile:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .07);
    text-decoration: none;
}
.today-tile-icon { font-size: 1.6rem; margin-bottom: 0.4rem; }
.today-tile-title { font-weight: 700; font-size: 1rem; margin-bottom: 0.2rem; }
.today-tile-blurb { font-size: 0.82rem; color: var(--text-muted); }

.today-section { margin: 1.5rem 0; }
.today-section-title { font-size: 1.1rem; margin: 0 0 0.75rem 0; color: var(--text); }

.today-recent {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.6rem;
}

.today-recent-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    color: var(--text);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    transition: border-color 0.15s ease;
}
.today-recent-item:hover { border-color: var(--primary); text-decoration: none; }
.today-recent-title { font-weight: 600; font-size: 0.92rem; }
.today-recent-section { font-size: 0.75rem; color: var(--text-muted); }

/* ── Path screen ─────────────────────────────────────────────────── */

.path-list { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 1rem; }

.path-level {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    transition: border-color 0.15s ease;
}
.path-level.started { border-left: 4px solid var(--primary); }
.path-level.complete {
    border-left: 4px solid #16A34A;
    background: linear-gradient(to right, #F0FDF4 0%, var(--bg-card) 30%);
}
.path-level.locked { opacity: 0.65; }

.path-level-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.5rem;
}

.path-level-num {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}
.path-level.started .path-level-num { background: var(--primary); color: #fff; }
.path-level.complete .path-level-num { background: #16A34A; color: #fff; }

.path-level-titles { flex: 1 1 auto; }
.path-level-title-ja { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.path-level-title-en { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }

.path-level-progress-num {
    flex: 0 0 auto;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.path-level-blurb {
    margin: 0.25rem 0 0.75rem 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

.path-level-progress-bar {
    height: 6px;
    background: var(--bg);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.9rem;
}
.path-level-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width 0.4s ease;
}
.path-level.complete .path-level-progress-fill { background: #16A34A; }

.path-level-slugs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.path-slug {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.3rem 0.7rem;
    border-radius: 16px;
    font-size: 0.82rem;
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.path-slug:hover { border-color: var(--primary); text-decoration: none; }
.path-slug.completed {
    background: #DCFCE7;
    border-color: #BBF7D0;
    color: #15803D;
}
.path-slug-check { font-size: 0.78rem; line-height: 1; }
.path-slug.completed .path-slug-check { color: #16A34A; }
.path-slug-title { font-weight: 500; }
.path-slug-missing { opacity: 0.45; cursor: help; }

/* ---- Japanese definition overlay (EntryDetail) ---- */
.entry-detail-title-en {
    margin: -0.5rem 0 1rem;
    font-size: 0.95rem;
    color: #6B7280;
    font-style: italic;
}
.ja-draft-badge {
    display: inline-block;
    padding: 1px 7px;
    margin-right: 8px;
    background: #F59E0B;
    color: #fff;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    vertical-align: 2px;
}
.entry-detail-en-original {
    margin-top: 1rem;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: #6B7280;
    border-top: 1px dashed #E5E7EB;
}
.entry-detail-en-original summary {
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
}
.entry-detail-en-original summary:hover { color: var(--primary); }
.entry-detail-en-original-body {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: #F9FAFB;
    border-left: 3px solid #E5E7EB;
    border-radius: 0 4px 4px 0;
    color: #4B5563;
    line-height: 1.55;
}

/* ---- Today tile primary (drill CTA) + 4-col layout ---- */
.today-grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.today-tile-primary {
    background: linear-gradient(135deg, #1B5E9E 0%, #4FC3F7 100%);
    color: #fff;
    border-color: #1B5E9E;
}
.today-tile-primary .today-tile-blurb { color: rgba(255,255,255,0.9); }
.today-tile-primary:hover { border-color: #0D47A1; color: #fff; }

/* ---- Drill page ---- */
.drill-shell {
    max-width: 760px;
    margin: 0 auto;
    padding: 1rem 0;
}
.drill-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.drill-progress {
    flex: 1;
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.drill-mode-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    background: var(--bg-card);
}
.drill-mode-btn {
    padding: 6px 14px;
    background: transparent;
    border: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.drill-mode-btn.active {
    background: var(--primary);
    color: #fff;
}
.drill-mode-btn:hover:not(.active) { color: var(--text); background: rgba(0,0,0,0.03); }

.drill-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2.25rem 1.75rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}
.drill-prompt-label,
.drill-answer-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.6rem;
}
.drill-prompt-term {
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}
.drill-prompt-term-en {
    margin-top: 0.4rem;
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
}
.drill-prompt-definition {
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--text);
    text-align: left;
}
.drill-answer-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border), transparent);
    margin: 1.5rem 0 1.25rem;
}
.drill-answer-body {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text);
    text-align: left;
}
.drill-answer-term {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text);
}
.drill-answer-term-en {
    margin-top: 0.3rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-style: italic;
}
.drill-meta {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}
.drill-meta-pill {
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 999px;
    background: #F3F4F6;
    color: #4B5563;
}
.drill-meta-new {
    background: #DBEAFE;
    color: #1E40AF;
}

.drill-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.drill-reveal {
    min-width: 200px;
    padding: 0.85rem 2rem;
    font-size: 1rem;
}
.drill-detail-link {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
}
.drill-detail-link:hover { color: var(--primary); }

.drill-rating {
    margin-top: 1.5rem;
    text-align: center;
}
.drill-rating-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.drill-rating-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
}
.drill-rate {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.85rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    cursor: pointer;
    transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.drill-rate:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.drill-rate-label {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}
.drill-rate-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.drill-rate-again { border-color: #FCA5A5; }
.drill-rate-again .drill-rate-label { color: #B91C1C; }
.drill-rate-hard { border-color: #FCD34D; }
.drill-rate-hard .drill-rate-label { color: #B45309; }
.drill-rate-good { border-color: #86EFAC; }
.drill-rate-good .drill-rate-label { color: #15803D; }
.drill-rate-easy { border-color: #93C5FD; }
.drill-rate-easy .drill-rate-label { color: #1E40AF; }

@media (max-width: 540px) {
    .drill-prompt-term { font-size: 1.6rem; }
    .drill-card { padding: 1.5rem 1rem; min-height: 220px; }
    .drill-rating-buttons { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Today screen: rotating tip card ---- */
.today-tip {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    padding: 0.85rem 1.1rem;
    margin-bottom: 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.today-tip-icon {
    flex-shrink: 0;
    font-size: 1.4rem;
    line-height: 1.3;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #F1F5F9;
}
.today-tip-body { flex: 1; min-width: 0; }
.today-tip-category {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.today-tip-text {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
}
/* Soft category tints — keep the surface calm, not a banner. */
.today-tip-dictionary .today-tip-icon { background: #DBEAFE; }
.today-tip-funfact    .today-tip-icon { background: #FEF3C7; }
.today-tip-studytip   .today-tip-icon { background: #DCFCE7; }

/* ============================================================
   Public landing page (shown before activation)
   ============================================================ */
.landing { min-height: 100vh; background: #fff; color: #1F2937; }

.landing-header {
    position: sticky; top: 0; z-index: 20;
    background: rgba(255,255,255,0.92);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid #E5E7EB;
}
.landing-header-inner {
    max-width: 1080px; margin: 0 auto; padding: 0.75rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.landing-brand { font-weight: 800; font-size: 1.15rem; color: #1B5E9E; }
.landing-nav { display: flex; align-items: center; gap: 1rem; }
.landing-nav-link { color: #4B5563; text-decoration: none; font-size: 0.9rem; }
.landing-nav-link:hover { color: #1B5E9E; }
.landing-nav-cta {
    background: #1B5E9E; color: #fff; border: 0; border-radius: 8px;
    padding: 0.5rem 1rem; font-weight: 600; font-size: 0.9rem; cursor: pointer;
}
.landing-nav-cta:hover { background: #0D47A1; }
@media (max-width: 640px) { .landing-nav-link { display: none; } }

.landing-hero {
    background: linear-gradient(135deg, #1B5E9E 0%, #4FC3F7 100%);
    color: #fff; padding: 4rem 1.25rem 4.5rem; text-align: center;
}
.landing-hero-inner { max-width: 760px; margin: 0 auto; }
.landing-hero-title { font-size: 2.6rem; font-weight: 800; line-height: 1.15; margin: 0 0 1rem; }
.landing-hero-subtitle { font-size: 1.15rem; line-height: 1.6; color: rgba(255,255,255,0.92); margin: 0 0 1.75rem; }
.landing-hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.landing-btn {
    border: 0; border-radius: 10px; padding: 0.85rem 1.75rem;
    font-weight: 700; font-size: 1rem; cursor: pointer; transition: transform .1s ease, box-shadow .15s ease;
}
.landing-btn:hover { transform: translateY(-2px); }
.landing-btn-primary { background: #fff; color: #1B5E9E; box-shadow: 0 4px 14px rgba(0,0,0,0.15); }
.landing-btn-ghost { background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.5); }
.landing-btn-lg { padding: 1rem 2.5rem; font-size: 1.1rem; }
.landing-hero-badges { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.landing-badge {
    background: rgba(255,255,255,0.18); color: #fff; border: 1px solid rgba(255,255,255,0.4);
    border-radius: 999px; padding: 4px 14px; font-size: 0.8rem; font-weight: 600;
}
.landing-badge-light { background: #EFF6FF; color: #1B5E9E; border-color: #BFDBFE; }
@media (max-width: 640px) { .landing-hero-title { font-size: 1.9rem; } }

.landing-section { max-width: 1080px; margin: 0 auto; padding: 3.5rem 1.25rem; }
.landing-section-title { font-size: 1.8rem; font-weight: 800; text-align: center; margin: 0 0 2rem; color: #1F2937; }
.landing-feature-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.25rem;
}
.landing-feature {
    background: #F9FAFB; border: 1px solid #E5E7EB; border-radius: 14px; padding: 1.5rem;
}
.landing-feature-icon { font-size: 2rem; margin-bottom: 0.6rem; }
.landing-feature h3 { font-size: 1.1rem; margin: 0 0 0.5rem; color: #1B5E9E; }
.landing-feature p { font-size: 0.92rem; line-height: 1.6; color: #4B5563; margin: 0; }

.landing-exam { background: #F1F5F9; padding: 3.5rem 1.25rem; }
.landing-exam-inner { max-width: 720px; margin: 0 auto; text-align: center; }
.landing-exam-body { font-size: 1.05rem; line-height: 1.7; color: #334155; margin: 0 0 1.5rem; }

.landing-languages-body { max-width: 680px; margin: 0 auto 1.5rem; text-align: center; font-size: 1.02rem; line-height: 1.7; color: #4B5563; }
.landing-languages-list { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.landing-language-chip {
    background: #EFF6FF; color: #1B5E9E; border: 1px solid #BFDBFE; border-radius: 999px;
    padding: 6px 16px; font-size: 0.95rem; font-weight: 600;
}

.landing-final { background: linear-gradient(135deg, #1B5E9E 0%, #4FC3F7 100%); color: #fff; padding: 4rem 1.25rem; }
.landing-final-inner { max-width: 640px; margin: 0 auto; text-align: center; }
.landing-final-title { font-size: 2rem; font-weight: 800; margin: 0 0 0.75rem; }
.landing-final-body { font-size: 1.05rem; line-height: 1.65; color: rgba(255,255,255,0.92); margin: 0 0 1.75rem; }

.landing-footer { text-align: center; padding: 1.5rem; color: #9CA3AF; font-size: 0.85rem; border-top: 1px solid #E5E7EB; }

/* Back link on the activation card (returns to the landing) */
.activation-back {
    background: none; border: 0; color: #6B7280; cursor: pointer;
    font-size: 0.85rem; padding: 0; margin-bottom: 0.75rem;
}
.activation-back:hover { color: #1B5E9E; }

/* Landing product screenshot showcase */
.landing-showcase {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.25rem;
    margin-top: -2.5rem;   /* lift the frame so it overlaps the hero gradient */
    position: relative;
    z-index: 5;
}
.landing-showcase-frame {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}
.landing-showcase-frame img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Reassurance note on the activation card (web-seat behaviour) */
.activation-note {
    margin-top: 1rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #6B7280;
    text-align: center;
}
