/* ========================================
   GLOBAL APP THEME
   Lexion
======================================== */

/* ========================================
   DESIGN LANGUAGE SWITCHER
   - default: Soft Modern
   - optional: Editorial Clean via body.editorial-clean
======================================== */
:root {
    --app-base: #F8FAFC;
    --app-surface: #FFFFFF;
    --app-section: #F1F5F9;
    --app-text: #1E293B;
    --app-muted: #475569;
    --app-primary: #7C3AED;
    --app-sub-accent: #8B5CF6;
    --app-border: #D9E2EC;
    --app-radius-card: 16px;
    --app-radius-control: 12px;
    --app-content-max: 1080px;
    --app-line-height: 1.65;
}

body {
    background: var(--app-base);
    color: var(--app-text);
    line-height: var(--app-line-height);
}

/* Soft Modern (default) */
body.soft-modern,
body:not(.editorial-clean) {
    --app-base: #F8FAFC;
    --app-surface: #FFFFFF;
    --app-section: #F1F5F9;
    --app-text: #1E293B;
    --app-muted: #475569;
    --app-primary: #7C3AED;
    --app-sub-accent: #8B5CF6;
    --app-radius-card: 16px;
    --app-radius-control: 12px;
    --app-content-max: 1080px;
    --app-line-height: 1.65;
}

/* Editorial Clean (content-first) */
body.editorial-clean {
    --app-base: #FAFAF9;
    --app-surface: #FFFFFF;
    --app-section: #F5F5F4;
    --app-text: #111827;
    --app-muted: #4B5563;
    --app-primary: #0EA5E9;
    --app-sub-accent: #8B5CF6;
    --app-radius-card: 12px;
    --app-radius-control: 12px;
    --app-content-max: 760px;
    --app-line-height: 1.78;
}

body.dark-mode {
    --app-base: #0F172A;
    --app-surface: #111827;
    --app-section: #1F2937;
    --app-text: #F3F4F6;
    --app-muted: #CBD5E1;
    --app-primary: #A78BFA;
    --app-sub-accent: #A78BFA;
    --app-border: #334155;
}

.container,
.container-fluid {
    max-width: var(--app-content-max);
}

h1, h2, h3, h4, h5,
p, li, label, .form-text,
.form-label {
    color: var(--app-text);
}

.text-muted {
    color: var(--app-muted) !important;
}

.card,
.alert,
.form-control,
.form-select,
textarea.form-control {
    border-radius: var(--app-radius-control);
    border-color: var(--app-border);
}

.card {
    border-radius: var(--app-radius-card);
    background: var(--app-surface);
}

.section-soft {
    background: var(--app-section);
    border-radius: var(--app-radius-card);
    padding: 1rem 1.1rem;
}

.btn-primary {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-success,
.badge.bg-success {
    background: var(--app-sub-accent) !important;
    border-color: var(--app-sub-accent) !important;
}

.btn-outline-success {
    color: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
}

.btn-outline-success:hover,
.btn-outline-success:focus {
    background: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
    color: #fff !important;
}

.alert-success {
    background: #eef2ff !important;
    border-color: #c7d2fe !important;
    color: #3730a3 !important;
}

.text-success,
.text-success-emphasis {
    color: #4f46e5 !important;
}

.bg-success {
    background-color: var(--app-sub-accent) !important;
}

body.dark-mode a,
body.dark-mode .btn-link,
body.dark-mode .nav-link {
    color: #BFDBFE;
}
body {
    background: #EDE8E0;
    font-family: "Inter", "Noto Sans JP", "Segoe UI", sans-serif;
    color: #1C1B18;
    min-height: 100vh;
}

.lexion-word {
    font-family: "Georgia", "Hiragino Mincho ProN", "Yu Mincho", serif;
    font-weight: 700;
    letter-spacing: -0.01em;
}


/* ========================================
   HEADINGS
======================================== */

h1, h2, h3, h4, h5 {
    font-weight: 700;
    color: #111827;
}

p, li, label, .form-text {
    color: #1f2937;
}

.text-muted {
    color: #475569 !important;
}

/* ========================================
   CARD
======================================== */

.card {
    border: none;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 35px rgba(37, 99, 235, 0.08);
    transition: 0.25s ease;
}

    .card:hover {
        transform: translateY(-2px);
        box-shadow: 0 18px 40px rgba(124, 58, 237, 0.12);
    }

/* ========================================
   TEXTAREA
======================================== */

textarea.form-control {
    border-radius: 20px;
    border: 1px solid #dbeafe;
    background: white;
    padding: 18px;
    font-size: 1rem;
    resize: none;
    transition: 0.25s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.03);
}

    textarea.form-control:focus {
        border-color: #7c3aed;
        box-shadow: 0 0 0 0.25rem rgba(124, 58, 237, 0.18);
        background: white;
    }

/* ========================================
   PRIMARY BUTTON
======================================== */

.btn-primary {
    background: linear-gradient( 135deg, #7c3aed, #2563eb );
    border: none;
    color: white;
    border-radius: 16px;
    padding: 12px 22px;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: all 0.25s ease;
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.25);
}

    .btn-primary:hover {
        transform: translateY(-2px);
        opacity: 0.96;
        box-shadow: 0 14px 30px rgba(37, 99, 235, 0.35);
    }

/* ========================================
   SUCCESS BUTTON
======================================== */

.btn-success {
    background: linear-gradient( 135deg, #8b5cf6, #3b82f6 );
    border: none;
    color: white;
    border-radius: 16px;
    padding: 12px 22px;
    font-weight: 600;
    transition: all 0.25s ease;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.22);
}

    .btn-success:hover {
        transform: translateY(-2px);
        opacity: 0.96;
    }

/* ========================================
   WARNING BUTTON
======================================== */

.btn-warning {
    background: linear-gradient( 135deg, #6366f1, #60a5fa );
    border: none;
    color: white;
    border-radius: 16px;
    padding: 12px 22px;
    font-weight: 600;
    transition: all 0.25s ease;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.22);
}

    .btn-warning:hover {
        transform: translateY(-2px);
        opacity: 0.96;
    }

/* ========================================
   SECONDARY BUTTON
======================================== */

.btn-secondary {
    background: linear-gradient( 135deg, #334155, #1e293b );
    border: none;
    color: white;
    border-radius: 16px;
    padding: 12px 22px;
    font-weight: 600;
    transition: all 0.25s ease;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

    .btn-secondary:hover {
        transform: translateY(-2px);
        opacity: 0.96;
    }

/* ========================================
   DISABLED BUTTON
======================================== */

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ========================================
   ALERT
======================================== */

.alert {
    border: none;
    border-radius: 18px;
    padding: 16px 18px;
    font-weight: 500;
    box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}

/* ========================================
   VOCAB ROW
======================================== */

.border-bottom {
    border-color: rgba(99, 102, 241, 0.12) !important;
}

/* ========================================
   CHECKBOX
======================================== */

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #4B5C3B;
}

/* ========================================
   SCROLLBAR
======================================== */

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #7A8B6B, #4B5C3B);
    border: 2px solid #EDE8E0;
    border-radius: 999px;
}

::-webkit-scrollbar-track {
    background: #E5DFD5;
}

/* ========================================
   DARK MODE
======================================== */

body.dark-mode {
    background: linear-gradient(135deg, #0f172a 0%, #111827 45%, #1e1b4b 100%);
    color: #e2e8f0;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode .form-label {
    color: #e2e8f0;
}

body.dark-mode .card {
    background: rgba(30, 41, 59, 0.88);
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.5);
}

body.dark-mode .text-muted {
    color: #cbd5e1 !important;
}

body.dark-mode .form-control {
    color: #e2e8f0;
    background-color: #1f2937;
    border-color: #334155;
}

body.dark-mode .form-control:focus {
    background-color: #111827;
    color: #e2e8f0;
    border-color: #7c3aed;
}

body.dark-mode .sidebar {
    background: #161b26;
}

/* ========================================
   AUTH PAGES
======================================== */

.auth-shell {
    max-width: 1120px;
}

.auth-card {
    border-radius: 28px;
}

.auth-visual {
    position: relative;
    padding: 2.2rem;
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.22), transparent 40%),
                radial-gradient(circle at 80% 10%, rgba(196,181,253,0.45), transparent 36%),
                linear-gradient(140deg, #312e81 0%, #4f46e5 45%, #0ea5e9 100%);
    color: #eef2ff;
    min-height: 100%;
    overflow: hidden;
}

.auth-visual::before,
.auth-visual::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    background: rgba(255,255,255,0.14);
}

.auth-visual::before {
    width: 180px;
    height: 180px;
    bottom: -65px;
    right: -40px;
}

.auth-visual::after {
    width: 120px;
    height: 120px;
    top: -35px;
    left: -35px;
}

.register-visual {
    background: radial-gradient(circle at 18% 25%, rgba(255,255,255,0.25), transparent 40%),
                radial-gradient(circle at 78% 5%, rgba(125,211,252,0.3), transparent 36%),
                linear-gradient(140deg, #4c1d95 0%, #0891b2 45%, #6366f1 100%);
}

.auth-visual-content {
    position: relative;
    z-index: 1;
}

.auth-badge {
    display: inline-block;
    font-size: 0.78rem;
    letter-spacing: .02em;
    text-transform: none;
    font-weight: 600;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.25);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    margin-bottom: 1rem;
}

.auth-visual h2 {
    color: #fff;
    line-height: 1.35;
    font-size: 1.7rem;
    margin-bottom: .8rem;
}

.auth-feature-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.auth-feature-list li {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: .55rem .75rem;
    margin-bottom: .6rem;
    font-size: .94rem;
}

.auth-input {
    border-radius: 14px;
    border: 1px solid #dbeafe;
}

.auth-submit {
    border-radius: 14px;
    letter-spacing: .01em;
}

.auth-error-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: .6rem;
}

.auth-error-actions .btn {
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.password-input-group {
    position: relative;
}

.password-input-group .auth-input {
    padding-right: 2.75rem;
    border-radius: 14px !important;
}

.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: .55rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #64748b;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color .2s ease, color .2s ease;
    z-index: 5;
}

.password-toggle-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

.password-toggle-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.28);
}

.password-toggle-btn i {
    font-size: 1rem;
    line-height: 1;
}

@media (max-width: 767.98px) {
    .auth-card {
        border-radius: 22px;
    }
}

body.dark-mode .auth-visual {
    color: #e2e8f0;
}

body.dark-mode .auth-feature-list li {
    background: rgba(15,23,42,0.35);
}

/* ========================================
   LANDING PAGE
======================================== */

.landing-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(130deg, #1e1b4b 0%, #312e81 45%, #4c1d95 100%);
    color: #e2e8f0;
}

.landing-pill {
    display: inline-block;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 999px;
    padding: .35rem .75rem;
}

.landing-title {
    color: #fff;
    font-size: clamp(2rem, 4vw, 3rem);
}

.landing-lead { max-width: 42ch; }

.landing-mock {
    border-radius: 20px;
    background: rgba(255,255,255,.95);
    animation: floatUp 5s ease-in-out infinite;
}

.landing-stat {
    border-radius: 14px;
    background: #f8fafc;
    padding: .85rem;
}

.landing-stat span {
    display: block;
    color: #64748b;
    font-size: .82rem;
}

.hero-glow {
    position: absolute;
    border-radius: 999px;
    filter: blur(24px);
    opacity: .45;
    pointer-events: none;
}

.hero-glow-one {
    width: 260px;
    height: 260px;
    background: #38bdf8;
    top: -80px;
    left: -70px;
    animation: drift 12s ease-in-out infinite;
}

.hero-glow-two {
    width: 280px;
    height: 280px;
    background: #a78bfa;
    bottom: -90px;
    right: -80px;
    animation: drift 10s ease-in-out infinite reverse;
}

@keyframes drift {
    0%,100% { transform: translateY(0px); }
    50% { transform: translateY(20px); }
}

@keyframes floatUp {
    0%,100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

/* ========================================
   HOME HERO IMAGE
======================================== */
.hero-image-grid {
    display: grid;
    gap: 14px;
}

.hero-image-sub-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.hero-image-wrap {
    margin: 0;
    border-radius: 24px;
    overflow: hidden;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.hero-image {
    display: block;
    width: 100%;
    height: auto;
}

@media (max-width: 767.98px) {
    .hero-image-sub-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   MOBILE BUTTON OPTIMIZATION
======================================== */
@media (max-width: 768px) {
    .btn {
        min-height: 48px;
        width: 100%;
        justify-content: center;
        text-align: center;
        padding: 0.75rem 1rem;
        white-space: normal;
    }

    .btn.btn-sm {
        min-height: 44px;
    }

    .btn-group {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.5rem;
    }

    .btn-group > .btn,
    .btn-group > .btn-check + .btn {
        width: 100%;
        margin-left: 0 !important;
        border-radius: 12px !important;
    }

    .d-flex.gap-2:has(> .btn),
    .d-flex.gap-3:has(> .btn),
    .d-flex.flex-wrap.gap-2:has(> .btn),
    .d-flex.flex-wrap.gap-3:has(> .btn),
    .vocab-actions {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        width: 100%;
    }

    .d-flex.gap-2:has(> .btn) > .btn,
    .d-flex.gap-3:has(> .btn) > .btn,
    .d-flex.flex-wrap.gap-2:has(> .btn) > .btn,
    .d-flex.flex-wrap.gap-3:has(> .btn) > .btn,
    .vocab-actions > .btn {
        width: 100%;
    }
}


.auth-social-group {
    margin-top: 1rem;
}

.auth-social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    width: 100%;
    min-height: 3.1rem;
    border-radius: 14px;
    font-weight: 600;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #0f172a;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.auth-social-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, .08);
}

.auth-social-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 .2rem rgba(59, 130, 246, 0.28);
}

.auth-social-btn-google:hover {
    border-color: #93c5fd;
}

.auth-social-btn-apple {
    background: #0f172a;
    border-color: #0f172a;
    color: #f8fafc;
}

.auth-social-btn-apple:hover {
    border-color: #0f172a;
    box-shadow: 0 12px 24px rgba(15, 23, 42, .25);
}

.auth-social-icon {
    width: 1.15rem;
    height: 1.15rem;
    object-fit: contain;
    flex-shrink: 0;
}

/* Diary formality segmented buttons */
.formality-selector {
    width: 100%;
}

.formality-selector > .btn,
.formality-selector > .btn-check + .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-inline: 0.9rem;
}

body.dark-mode .auth-social-btn-google {
    background: #111827;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode .auth-social-btn-google:hover {
    border-color: #60a5fa;
}

body.dark-mode .auth-social-btn-apple {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}

/* ========================================
   THEME HARMONIZATION (final override)
======================================== */
body {
    background: var(--app-base) !important;
    color: var(--app-text) !important;
    line-height: var(--app-line-height);
}

h1, h2, h3, h4, h5,
p, li, label, .form-text, .form-label,
.table, .list-group-item {
    color: var(--app-text) !important;
}

.text-muted { color: var(--app-muted) !important; }

.card {
    border-radius: var(--app-radius-card) !important;
    background: var(--app-surface) !important;
}

.form-control,
.form-select,
textarea.form-control {
    border-radius: var(--app-radius-control) !important;
    border: 1px solid var(--app-border) !important;
    background-color: var(--app-surface) !important;
    color: var(--app-text) !important;
}


body.dark-mode .list-group-item,
body.dark-mode .table,
body.dark-mode .table th,
body.dark-mode .table td,
body.dark-mode .dropdown-menu,
body.dark-mode .modal-content {
    background-color: var(--app-surface) !important;
    color: var(--app-text) !important;
    border-color: var(--app-border) !important;
}

body.dark-mode .table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: rgba(148, 163, 184, 0.08);
    color: var(--app-text) !important;
}

body.dark-mode .form-control::placeholder,
body.dark-mode textarea.form-control::placeholder {
    color: #94A3B8 !important;
}

body.dark-mode .alert-secondary,
body.dark-mode .alert-info,
body.dark-mode .alert-light,
body.dark-mode .alert-warning {
    background: rgba(15, 23, 42, 0.88);
    color: #e5eefb;
    border-color: #334155;
}

body.dark-mode .alert-danger {
    background: rgba(69, 10, 10, 0.72);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.42);
}

body.dark-mode .btn-outline-secondary,
body.dark-mode .btn-outline-primary {
    color: #dbeafe;
    border-color: #64748b;
    background: transparent;
}

body.dark-mode .btn-outline-secondary:hover,
body.dark-mode .btn-outline-secondary:focus,
body.dark-mode .btn-outline-primary:hover,
body.dark-mode .btn-outline-primary:focus {
    color: #0f172a;
    border-color: #dbeafe;
    background: #dbeafe;
}

.btn-primary {
    background: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
}

.btn-success,
.badge.bg-success {
    background: var(--app-sub-accent) !important;
    border-color: var(--app-sub-accent) !important;
}

/* App-wide contrast guardrails */
body:not(.dark-mode) .card,
body:not(.dark-mode) .modal-content,
body:not(.dark-mode) .dropdown-menu,
body:not(.dark-mode) .list-group-item,
body:not(.dark-mode) .table,
body:not(.dark-mode) .section-soft,
body:not(.dark-mode) .bg-white,
body:not(.dark-mode) .bg-light,
body:not(.dark-mode) [style*="background: white"],
body:not(.dark-mode) [style*="background:white"],
body:not(.dark-mode) [style*="background: #fff"],
body:not(.dark-mode) [style*="background:#fff"],
body:not(.dark-mode) [style*="background: #ffffff"],
body:not(.dark-mode) [style*="background:#ffffff"],
body:not(.dark-mode) [style*="background-color: white"],
body:not(.dark-mode) [style*="background-color:white"],
body:not(.dark-mode) [style*="background-color: #fff"],
body:not(.dark-mode) [style*="background-color:#fff"],
body:not(.dark-mode) [style*="background-color: #ffffff"],
body:not(.dark-mode) [style*="background-color:#ffffff"] {
    color: #111827 !important;
}

body:not(.dark-mode) .bg-white .text-white,
body:not(.dark-mode) .bg-light .text-white,
body:not(.dark-mode) .section-soft .text-white,
body:not(.dark-mode) .modal-content .text-white,
body:not(.dark-mode) .dropdown-menu .text-white,
body:not(.dark-mode) .list-group-item .text-white,
body:not(.dark-mode) [style*="background: white"] .text-white,
body:not(.dark-mode) [style*="background:white"] .text-white,
body:not(.dark-mode) [style*="background: #fff"] .text-white,
body:not(.dark-mode) [style*="background:#fff"] .text-white,
body:not(.dark-mode) [style*="background: #ffffff"] .text-white,
body:not(.dark-mode) [style*="background:#ffffff"] .text-white,
body:not(.dark-mode) [style*="background-color: white"] .text-white,
body:not(.dark-mode) [style*="background-color:white"] .text-white,
body:not(.dark-mode) [style*="background-color: #fff"] .text-white,
body:not(.dark-mode) [style*="background-color:#fff"] .text-white,
body:not(.dark-mode) [style*="background-color: #ffffff"] .text-white,
body:not(.dark-mode) [style*="background-color:#ffffff"] .text-white {
    color: #111827 !important;
}

body.dark-mode .card,
body.dark-mode .modal-content,
body.dark-mode .dropdown-menu,
body.dark-mode .list-group-item,
body.dark-mode .table,
body.dark-mode .section-soft,
body.dark-mode .bg-dark,
body.dark-mode .bg-black,
body.dark-mode [style*="background: black"],
body.dark-mode [style*="background:black"],
body.dark-mode [style*="background: #000"],
body.dark-mode [style*="background:#000"],
body.dark-mode [style*="background: #000000"],
body.dark-mode [style*="background:#000000"],
body.dark-mode [style*="background-color: black"],
body.dark-mode [style*="background-color:black"],
body.dark-mode [style*="background-color: #000"],
body.dark-mode [style*="background-color:#000"],
body.dark-mode [style*="background-color: #000000"],
body.dark-mode [style*="background-color:#000000"] {
    color: #f8fafc !important;
}

body.dark-mode .bg-dark .text-dark,
body.dark-mode .bg-black .text-dark,
body.dark-mode .card .text-dark,
body.dark-mode .modal-content .text-dark,
body.dark-mode .dropdown-menu .text-dark,
body.dark-mode .list-group-item .text-dark,
body.dark-mode [style*="background: black"] .text-dark,
body.dark-mode [style*="background:black"] .text-dark,
body.dark-mode [style*="background: #000"] .text-dark,
body.dark-mode [style*="background:#000"] .text-dark,
body.dark-mode [style*="background: #000000"] .text-dark,
body.dark-mode [style*="background:#000000"] .text-dark,
body.dark-mode [style*="background-color: black"] .text-dark,
body.dark-mode [style*="background-color:black"] .text-dark,
body.dark-mode [style*="background-color: #000"] .text-dark,
body.dark-mode [style*="background-color:#000"] .text-dark,
body.dark-mode [style*="background-color: #000000"] .text-dark,
body.dark-mode [style*="background-color:#000000"] .text-dark {
    color: #f8fafc !important;
}

body.dark-mode .result-heading {
    color: #e5e7eb !important;
}

body.dark-mode .result-heading-primary {
    background: rgba(67, 56, 202, 0.28) !important;
    color: #dbeafe !important;
    border-left-color: #818cf8 !important;
}

body.dark-mode .result-heading-cefr {
    background: rgba(109, 40, 217, 0.22) !important;
    color: #ede9fe !important;
    border-left-color: #a78bfa !important;
}

body.dark-mode .result-heading-feedback {
    background: rgba(194, 65, 12, 0.24) !important;
    color: #fed7aa !important;
    border-left-color: #fb923c !important;
}

body.dark-mode .result-heading-explanation {
    background: rgba(109, 40, 217, 0.26) !important;
    color: #ede9fe !important;
    border-left-color: #a78bfa !important;
}

body.dark-mode .result-heading-reply {
    background: rgba(29, 78, 216, 0.26) !important;
    color: #dbeafe !important;
    border-left-color: #60a5fa !important;
}

body:not(.dark-mode) .table th,
body:not(.dark-mode) .table td,
body.dark-mode .table th,
body.dark-mode .table td,
body.dark-mode .dropdown-item,
body.dark-mode .modal-title {
    color: inherit !important;
}
/* Dashboard light-mode contrast */
body:not(.dark-mode) .dashboard-shell {
    color: #17264a;
}

body:not(.dark-mode) .dashboard-shell .metric-card,
body:not(.dark-mode) .dashboard-shell .chart-card,
body:not(.dark-mode) .dashboard-shell .latest-section {
    background: #f7f9ff;
    border-color: #e9edff;
    color: #1f2f57;
}

body:not(.dark-mode) .dashboard-shell .latest-card {
    background: #eef2ff;
    color: #17264a;
}

body:not(.dark-mode) .dashboard-shell .metric-label,
body:not(.dark-mode) .dashboard-shell .donut-hole small,
body:not(.dark-mode) .dashboard-shell .bar-day,
body:not(.dark-mode) .dashboard-shell .legend-percent,
body:not(.dark-mode) .dashboard-shell .empty-state {
    color: #4d5a80 !important;
}

body:not(.dark-mode) .dashboard-shell .metric-value,
body:not(.dark-mode) .dashboard-shell .metric-value span,
body:not(.dark-mode) .dashboard-shell .metric-card small,
body:not(.dark-mode) .dashboard-shell .chart-card,
body:not(.dark-mode) .dashboard-shell .chart-card h5,
body:not(.dark-mode) .dashboard-shell .chart-card h5 i,
body:not(.dark-mode) .dashboard-shell .legend-label,
body:not(.dark-mode) .dashboard-shell .legend-value,
body:not(.dark-mode) .dashboard-shell .latest-section h5,
body:not(.dark-mode) .dashboard-shell .latest-section h5 i,
body:not(.dark-mode) .dashboard-shell .latest-body,
body:not(.dark-mode) .dashboard-shell .donut-hole strong {
    color: #142245 !important;
}

body:not(.dark-mode) .dashboard-shell .chart-card .text-muted,
body:not(.dark-mode) .dashboard-shell .latest-section .text-muted,
body:not(.dark-mode) .dashboard-shell .latest-card .text-muted,
body:not(.dark-mode) .dashboard-shell .latest-created {
    color: #3f4f77 !important;
}

body:not(.dark-mode) .dashboard-shell .bar-count {
    background: #eef2ff;
    color: #1f2f57 !important;
    font-weight: 700;
}

body:not(.dark-mode) .dashboard-shell .donut-hole {
    background: #ffffff;
}

body.dark-mode .dashboard-shell .chart-card,
body.dark-mode .dashboard-shell .metric-card,
body.dark-mode .dashboard-shell .streak-highlight,
body.dark-mode .dashboard-shell .loading-card {
    background: #0f172a;
    border-color: #334155;
    color: #e5eefc;
}

body.dark-mode .dashboard-shell .streak-highlight {
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    box-shadow: 0 18px 36px rgba(2, 6, 23, 0.5);
}

body.dark-mode .dashboard-shell .latest-section {
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    border-color: #334155;
    color: #e5eefc;
    box-shadow: 0 18px 36px rgba(2, 6, 23, 0.5);
}

body.dark-mode .dashboard-shell .latest-card {
    background: rgba(15, 23, 42, 0.88);
    border-color: #334155;
    color: #f8fafc;
    box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.12);
}

body.dark-mode .dashboard-shell .chart-card *,
body.dark-mode .dashboard-shell .metric-card *,
body.dark-mode .dashboard-shell .streak-highlight__title,
body.dark-mode .dashboard-shell .streak-highlight__cta,
body.dark-mode .dashboard-shell .streak-share-toggle,
body.dark-mode .dashboard-shell .streak-share-copy,
body.dark-mode .dashboard-shell .legend-label,
body.dark-mode .dashboard-shell .legend-value,
body.dark-mode .dashboard-shell .latest-section h5,
body.dark-mode .dashboard-shell .latest-section h5 i,
body.dark-mode .dashboard-shell .latest-body {
    color: #ffffff !important;
}

body.dark-mode .dashboard-shell .streak-highlight__eyebrow,
body.dark-mode .dashboard-shell .streak-highlight__meta,
body.dark-mode .dashboard-shell .streak-share-toggle__meta,
body.dark-mode .dashboard-shell .streak-share-guide,
body.dark-mode .dashboard-shell .metric-label,
body.dark-mode .dashboard-shell .latest-created,
body.dark-mode .dashboard-shell .latest-section .text-muted,
body.dark-mode .dashboard-shell .latest-card .text-muted,
body.dark-mode .dashboard-shell .legend-percent {
    color: #c7d2e5 !important;
}

body.dark-mode .dashboard-shell .bar-day {
    color: #e2e8f0 !important;
    font-weight: 700;
    text-shadow: 0 1px 10px rgba(15, 23, 42, 0.45);
}

body.dark-mode .dashboard-shell .latest-card .btn-primary {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    border-color: transparent;
    color: #f8fafc !important;
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.32);
}

body.dark-mode .dashboard-shell .latest-card .btn-primary:hover,
body.dark-mode .dashboard-shell .latest-card .btn-primary:focus {
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
    color: #ffffff !important;
}

body.dark-mode .dashboard-shell .status-pill--success {
    background: rgba(109, 40, 217, 0.18);
    color: #ede9fe;
}

body.dark-mode .dashboard-shell .status-pill--warning {
    background: rgba(245, 158, 11, 0.18);
    color: #fde68a;
}

body.dark-mode .dashboard-shell .bar-track {
    background: #1e293b;
    border: 1px solid #334155;
}

body.dark-mode .dashboard-shell .bar-count {
    background: #172033;
    border: 1px solid #475569;
    color: #ffffff !important;
    box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.14);
}

body.dark-mode .dashboard-shell .streak-share-panel {
    border-top-color: #334155;
}

body.dark-mode .dashboard-shell .streak-share-textarea {
    background: #020617;
    border-color: #334155;
    color: #f8fafc;
}

body.dark-mode .dashboard-shell .streak-share-status {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode .dashboard-shell .donut-hole {
    background: #0f172a;
}

/* Growth insights dashboard */
.growth-page {
    max-width: 1120px;
}

.growth-page .growth-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.growth-page .growth-kicker {
    margin: 0 0 .25rem;
    color: #52616f;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.growth-page .growth-header h1,
.growth-page .growth-panel h2 {
    margin: 0;
    color: #1d2733;
}

.growth-page .growth-header h1 {
    font-size: clamp(1.75rem, 3vw, 2.45rem);
    font-weight: 800;
}

.growth-page .growth-muted {
    color: #687687;
}

.growth-page .growth-window {
    min-width: 172px;
    padding: .8rem 1rem;
    border: 1px solid #d8dee7;
    border-radius: 8px;
    background: #f8fafc;
    text-align: right;
}

.growth-page .growth-window span,
.growth-page .growth-window strong,
.growth-page .growth-card span,
.growth-page .growth-card small {
    display: block;
}

.growth-page .growth-window span {
    color: #687687;
    font-size: .82rem;
}

.growth-page .growth-window strong {
    color: #1d2733;
}

.growth-page .growth-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.growth-page .growth-card,
.growth-page .growth-panel {
    border: 1px solid #d8dee7;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(20, 33, 48, .06);
}

.growth-page .growth-card {
    padding: 1rem;
}

.growth-page .growth-card span,
.growth-page .growth-card small,
.growth-page .growth-panel-heading span,
.growth-page .trend-summary span,
.growth-page .trend-bar-label,
.growth-page .funnel-row small,
.growth-page .signal-list span {
    color: #687687;
}

.growth-page .growth-card strong,
.growth-page .trend-summary strong {
    display: block;
    color: #111827;
}

.growth-page .growth-card strong {
    margin: .35rem 0;
    font-size: 2rem;
    line-height: 1;
}

.growth-page .growth-panel {
    padding: 1rem;
}

.growth-page .growth-two-column {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
    gap: 1rem;
}

.growth-page .growth-panel-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.growth-page .growth-panel-heading h2 {
    font-size: 1.1rem;
    font-weight: 800;
}

.growth-page .growth-panel-heading span,
.growth-page .trend-summary span {
    font-size: .84rem;
}

.growth-page .growth-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    margin-bottom: .85rem;
}

.growth-page .growth-filter-row-metrics {
    margin-bottom: 1rem;
}

.growth-page .growth-chip {
    border: 1px solid #d8dee7;
    border-radius: 999px;
    background: #f8fafc;
    color: #405060;
    padding: .55rem .95rem;
    font-size: .9rem;
    font-weight: 700;
    line-height: 1;
    transition: all .16s ease;
}

.growth-page .growth-chip.is-active {
    border-color: #7C3AED;
    background: #7C3AED;
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(124, 58, 237, .18);
}

.growth-page .metric-chip.is-active {
    border-color: #2563eb;
    background: #2563eb;
    box-shadow: 0 8px 16px rgba(37, 99, 235, .18);
}

.growth-page .trend-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .85rem;
    margin-bottom: 1rem;
}

.growth-page .trend-summary div {
    padding: .85rem 1rem;
    border-radius: 10px;
    background: linear-gradient(180deg, #f8fbff 0%, #f3f7fb 100%);
    border: 1px solid #e2e8f0;
}

.growth-page .trend-summary strong {
    margin-top: .25rem;
    font-size: 1.55rem;
    line-height: 1.1;
}

.growth-page .trend-chart {
    overflow-x: auto;
    padding-bottom: .25rem;
}

.growth-page .trend-bars {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(36px, 1fr);
    align-items: end;
    gap: .65rem;
    min-height: 260px;
}

.growth-page .trend-bar-column {
    display: grid;
    gap: .45rem;
    justify-items: center;
}

.growth-page .trend-bar-value {
    color: #405060;
    font-size: .78rem;
    font-weight: 700;
}

.growth-page .trend-bar-track {
    display: flex;
    align-items: end;
    justify-content: center;
    width: 100%;
    min-height: 180px;
    padding: 0 .2rem;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef3f9 100%);
}

.growth-page .trend-bar-fill {
    width: 100%;
    min-height: 8%;
    border-radius: 10px 10px 6px 6px;
    background: linear-gradient(180deg, #a78bfa 0%, #6d28d9 100%);
}

.growth-page .trend-bar-label {
    font-size: .75rem;
    white-space: nowrap;
}

.growth-page .funnel-list,
.growth-page .signal-list,
.growth-page .event-table {
    display: grid;
    gap: .6rem;
}

.growth-page .funnel-row,
.growth-page .signal-list div,
.growth-page .event-row {
    display: grid;
    align-items: center;
    gap: .75rem;
    padding: .75rem;
    border-radius: 8px;
    background: #f8fafc;
}

.growth-page .funnel-row,
.growth-page .signal-list div {
    grid-template-columns: minmax(0, 1fr) auto;
}

.growth-page .funnel-row strong,
.growth-page .funnel-row small {
    display: block;
}

.growth-page .funnel-row > span,
.growth-page .signal-list strong {
    color: #7C3AED;
    font-size: 1.25rem;
    font-weight: 800;
}

.growth-page .event-row {
    grid-template-columns: 1.2fr 1fr .8fr .8fr;
    font-size: .92rem;
}

.growth-page .event-row-head {
    color: #52616f;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
}

body.dark-mode .growth-page .growth-card,
body.dark-mode .growth-page .growth-panel,
body.dark-mode .growth-page .growth-window,
body.dark-mode .growth-page .trend-summary div,
body.dark-mode .growth-page .trend-bar-track,
body.dark-mode .growth-page .funnel-row,
body.dark-mode .growth-page .signal-list div,
body.dark-mode .growth-page .event-row {
    background: #111827;
    border-color: #334155;
    color: #f8fafc;
}

body.dark-mode .growth-page .growth-header h1,
body.dark-mode .growth-page .growth-panel h2,
body.dark-mode .growth-page .growth-window strong,
body.dark-mode .growth-page .growth-card strong,
body.dark-mode .growth-page .trend-summary strong,
body.dark-mode .growth-page .trend-bar-value,
body.dark-mode .growth-page .event-row,
body.dark-mode .growth-page .funnel-row strong,
body.dark-mode .growth-page .signal-list strong {
    color: #f8fafc;
}

body.dark-mode .growth-page .growth-kicker,
body.dark-mode .growth-page .growth-muted,
body.dark-mode .growth-page .growth-window span,
body.dark-mode .growth-page .growth-card span,
body.dark-mode .growth-page .growth-card small,
body.dark-mode .growth-page .growth-panel-heading span,
body.dark-mode .growth-page .trend-summary span,
body.dark-mode .growth-page .trend-bar-label,
body.dark-mode .growth-page .signal-list span,
body.dark-mode .growth-page .funnel-row small,
body.dark-mode .growth-page .event-row-head {
    color: #cbd5e1;
}

@media (max-width: 900px) {
    .growth-page .growth-header,
    .growth-page .growth-panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .growth-page .growth-window {
        width: 100%;
        text-align: left;
    }

    .growth-page .growth-grid,
    .growth-page .growth-two-column,
    .growth-page .trend-summary {
        grid-template-columns: 1fr;
    }

    .growth-page .trend-bars {
        min-width: max-content;
    }

    .growth-page .event-row {
        grid-template-columns: 1fr;
    }
}

body.dark-mode .bottom-nav {
    background: linear-gradient(180deg, rgba(7, 10, 16, 0.98) 0%, rgba(0, 0, 0, 0.98) 100%);
    background-color: #05070b;
    border-top-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.42);
}

body.dark-mode .bottom-nav-icon-shell {
    color: #b2b7c2;
}

body.dark-mode .bottom-nav-label,
body.dark-mode .bottom-nav-item:not(.active) .bottom-nav-label {
    color: #b2b7c2;
}

body.dark-mode .bottom-nav-item.active .bottom-nav-label,
body.dark-mode .bottom-nav-item.active .bottom-nav-icon-shell,
body.dark-mode .bottom-nav-hit.active .bottom-nav-icon-shell,
body.dark-mode .bottom-nav-hit:hover .bottom-nav-icon-shell,
body.dark-mode .bottom-nav-hit:focus-visible .bottom-nav-icon-shell {
    color: #ffffff;
}

body.dark-mode .bottom-nav-icon-shell--primary {
    background: linear-gradient(180deg, #f8fafc 0%, #dbe4f0 100%);
    color: #111827;
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.3);
}

body.dark-mode .bottom-nav-icon-svg--plus {
    stroke: #111827;
}

body.dark-mode .bottom-nav-item--primary.active .bottom-nav-icon-shell--primary,
body.dark-mode .bottom-nav-item--primary .bottom-nav-hit:hover .bottom-nav-icon-shell--primary,
body.dark-mode .bottom-nav-item--primary .bottom-nav-hit:focus-visible .bottom-nav-icon-shell--primary,
body.dark-mode .bottom-nav-item--primary .bottom-nav-hit:active .bottom-nav-icon-shell--primary {
    color: #111827;
}

body.dark-mode .bottom-nav-item--primary .bottom-nav-hit:active .bottom-nav-icon-shell--primary {
    background: linear-gradient(180deg, #ffffff 0%, #dbe4f0 100%);
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.38);
}

body.dark-mode .bottom-nav-item--primary .bottom-nav-hit:active .bottom-nav-icon-svg--plus {
    stroke: #111827;
}

/* ========================================
   FAQ (Landing & Pricing) — JS不要
======================================== */
.landing-faq-section {
    max-width: 720px;
    margin: 0 auto;
}

/* Blazor 版 (.faq-item button) と details 版 (details.faq-item) 共通 */
.faq-item {
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: 16px;
    margin-bottom: 0.6rem;
    overflow: hidden;
    background: rgba(255,255,255,0.92);
    list-style: none;
}

/* details 要素のデフォルトマーカーを消す */
.faq-item summary { list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }

.faq-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 1.2rem;
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: color 0.15s ease;
}

.faq-question:hover,
.faq-item.is-open .faq-question,
.faq-item[open] > .faq-question {
    color: #7c3aed;
}

.faq-chevron {
    font-size: 0.7rem;
    color: #94a3b8;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.faq-item.is-open .faq-chevron { transform: rotate(0deg); }

.faq-answer {
    padding: 0 1.2rem 1.1rem;
    color: #475569;
    line-height: 1.7;
    font-size: 0.95rem;
}

/* ========================================
   COMPARISON TABLE (Pricing)
======================================== */
.plan-compare-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
}

.plan-compare-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(37,99,235,0.08);
    background: rgba(255,255,255,0.92);
    min-width: 480px;
}

.plan-compare-table th {
    padding: 1rem 1.2rem;
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    background: rgba(124,58,237,0.06);
    color: #1e293b;
    border-bottom: 1px solid rgba(99,102,241,0.15);
}

.plan-compare-table th.col-feature { text-align: left; }

.plan-compare-table th.col-pro {
    background: linear-gradient(135deg, rgba(124,58,237,0.14), rgba(37,99,235,0.08));
    color: #7c3aed;
}

.plan-compare-table td {
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid rgba(99,102,241,0.08);
    color: #374151;
    font-size: 0.94rem;
    text-align: center;
    vertical-align: middle;
}

.plan-compare-table td:first-child {
    text-align: left;
    font-weight: 500;
    color: #1e293b;
}

.plan-compare-table tr:last-child td { border-bottom: none; }
.plan-compare-table .check-icon { color: #7c3aed; font-size: 1.1rem; }
.plan-compare-table .cross-icon { color: #9ca3af; }

/* ========================================
   MILESTONE BANNER (Authenticated Home)
======================================== */
.milestone-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, rgba(124,58,237,0.09), rgba(37,99,235,0.06));
    border: 1px solid rgba(124,58,237,0.22);
    border-radius: 16px;
    padding: 0.85rem 1.1rem;
    margin-bottom: 1rem;
    animation: milestone-pop 0.45s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes milestone-pop {
    from { opacity: 0; transform: scale(0.93) translateY(6px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.milestone-badge-icon {
    font-size: 1.6rem;
    line-height: 1;
    flex-shrink: 0;
}

.milestone-badge-text strong {
    display: block;
    color: #7c3aed;
    font-weight: 700;
    font-size: 0.95rem;
}

.milestone-badge-text span {
    color: #475569;
    font-size: 0.84rem;
}

/* ========================================
   X SHARE BUTTON (DiaryPromptTool)
======================================== */
.x-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.x-share-btn:hover {
    background: #1a1a1a;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* ========================================
   SOCIAL PROOF NUMBERS (Landing)
======================================== */
.social-proof-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0 0;
}

.social-proof-item {
    text-align: center;
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: 14px;
    padding: 0.7rem 1.2rem;
    min-width: 110px;
}

.social-proof-number {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    color: #7c3aed;
    line-height: 1.2;
}

.social-proof-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.15rem;
}

/* ========================================
   DIARY SAMPLE BANNER (first-time user)
======================================== */
.diary-sample-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    align-items: baseline;
    background: linear-gradient(135deg, rgba(251,191,36,0.12), rgba(245,158,11,0.07));
    border: 1px solid rgba(251,191,36,0.4);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.diary-sample-banner strong {
    color: #92400e;
    font-weight: 700;
}

.diary-sample-banner span {
    color: #78350f;
}

/* ========================================
   FIRST DIARY CELEBRATION BANNER
======================================== */
.diary-first-celebration {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, rgba(79,70,229,0.12), rgba(99,102,241,0.08));
    border: 1px solid rgba(79,70,229,0.28);
    border-radius: 16px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 1rem;
    animation: milestone-pop 0.45s cubic-bezier(.34,1.56,.64,1) both;
}

.celebration-icon {
    font-size: 1.6rem;
    line-height: 1;
    flex-shrink: 0;
}

.diary-first-celebration strong {
    display: block;
    color: #3730a3;
    font-weight: 700;
    font-size: 0.95rem;
}

.diary-first-celebration span {
    color: #4338ca;
    font-size: 0.84rem;
}

/* ========================================
   AUTO VOCAB CARD (AiSupport tab)
======================================== */
.diary-auto-vocab-card {
    border-left: 3px solid rgba(124,58,237,0.4);
}

.auto-vocab-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auto-vocab-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(99,102,241,0.08);
    cursor: pointer;
    transition: opacity 0.15s;
}

.auto-vocab-item:last-child {
    border-bottom: none;
}

.auto-vocab-item:not(.is-selected) {
    opacity: 0.45;
}

.auto-vocab-checkbox {
    margin-top: 0.15rem;
    flex-shrink: 0;
    accent-color: #4B5C3B;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.auto-vocab-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.auto-vocab-expression {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.95rem;
}

.auto-vocab-meaning {
    color: #64748b;
    font-size: 0.88rem;
}

/* ========================================
   VS CHATGPT COMPARISON SECTION (Landing)
======================================== */
.vs-chatgpt-section {
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(99,102,241,0.12);
    border-radius: 24px;
    padding: 2rem 1.5rem;
}

/* ========================================
   AI SCORE CARD (Diary page)
======================================== */
.score-card {
    background: linear-gradient(135deg, #f0ebff 0%, #faf5ff 100%);
    border: 1px solid #e2d4ff;
    border-radius: var(--app-radius-card);
    padding: 1.25rem 1.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.score-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.score-card__title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--app-primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.score-card__cefr {
    font-size: 0.78rem;
    font-weight: 700;
    background: var(--app-primary);
    color: #fff;
    padding: 0.2rem 0.65rem;
    border-radius: 99px;
}

.score-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}

.score-row__label {
    font-size: 0.78rem;
    color: var(--app-muted);
    width: 5.5rem;
    flex-shrink: 0;
}

.score-row__track {
    flex: 1;
    height: 7px;
    background: #e2d4ff;
    border-radius: 99px;
    overflow: hidden;
}

.score-row__fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #7C3AED, #a78bfa);
}

.score-row__value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--app-text);
    width: 2.2rem;
    text-align: right;
    flex-shrink: 0;
}

/* ========================================
   SCORE CARD – dark mode
======================================== */
body.dark-mode .score-card {
    background: linear-gradient(135deg, rgba(76, 29, 149, 0.28) 0%, rgba(49, 46, 129, 0.22) 100%);
    border-color: rgba(139, 92, 246, 0.28);
}

body.dark-mode .score-card__title {
    color: #c4b5fd;
}

body.dark-mode .score-row__label {
    color: #94a3b8;
}

body.dark-mode .score-row__track {
    background: rgba(139, 92, 246, 0.22);
}

body.dark-mode .score-row__value {
    color: #e2e8f0;
}

/* ========================================
   SCORE TREND (Dashboard)
======================================== */
.score-trend-empty {
    font-size: 0.85rem;
    color: var(--app-muted);
    text-align: center;
    padding: 1.5rem 0;
}

.score-trend-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.35rem;
    height: 72px;
}

.score-trend-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    gap: 0.25rem;
}

.score-trend-bar-track {
    flex: 1;
    width: 100%;
    background: #f1f5f9;
    border-radius: 5px 5px 0 0;
    position: relative;
    overflow: hidden;
}

.score-trend-bar-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(0deg, #7C3AED, #a78bfa);
    border-radius: 5px 5px 0 0;
}

.score-trend-label {
    font-size: 0.62rem;
    color: var(--app-muted);
    white-space: nowrap;
}

/* ========================================
   PROFILE PAGE  (pf-* classes)
======================================== */

.profile-shell {
    display: flex;
    justify-content: center;
    padding-bottom: 80px;
}

.loading-card {
    display: flex;
    align-items: center;
    padding: 2rem;
    color: var(--app-muted);
    font-size: 0.9rem;
}

/* ── Card ─────────────────────────────── */
.pf-card {
    width: 100%;
    max-width: 520px;
    background: var(--app-surface);
    border-radius: var(--app-radius-card);
    border: 1px solid var(--app-border);
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
    overflow: hidden;
}

/* ── Hero ─────────────────────────────── */
.pf-hero {
    position: relative;
}

.pf-hero-banner {
    height: 80px;
    background: linear-gradient(135deg, #2E3B22 0%, #4B5C3B 45%, #7A6030 100%);
    opacity: 0.92;
}

body.dark-mode .pf-hero-banner {
    opacity: 0.75;
}

.pf-hero-body {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 12px 20px 16px 96px; /* left space for the absolute-positioned avatar */
}

.pf-hero-info {
    min-width: 0;
}

.pf-avatar {
    position: absolute;
    left: 20px;
    top: -32px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4B5C3B 0%, #896D2C 100%);
    border: 3px solid var(--app-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    box-shadow: 0 2px 12px rgba(75,92,59,0.35);
    cursor: pointer;
    overflow: hidden;
}

.pf-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.pf-avatar-edit {
    position: absolute;
    bottom: 0;
    right: -2px;
    width: 22px;
    height: 22px;
    background: var(--app-primary);
    border-radius: 50%;
    border: 2px solid var(--app-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #fff;
    pointer-events: none;
}

.pf-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--app-text);
    line-height: 1.2;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pf-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.5;
}

.pf-badge--level {
    background: var(--lx-green-soft);
    border: 1px solid rgba(75,92,59,0.3);
    color: var(--lx-green-mid);
}

.pf-badge--xp {
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.3);
    color: #b45309;
}

body.dark-mode .pf-badge--xp {
    color: #fbbf24;
}

/* ── Sections ─────────────────────────── */
.pf-section {
    padding: 18px 20px;
}

.pf-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--app-muted);
    margin-bottom: 14px;
}

.pf-divider {
    height: 1px;
    background: var(--app-border);
    margin: 0 20px;
}

/* ── Level row ────────────────────────── */
.pf-level-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pf-level-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--app-text);
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.pf-level-sub {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--app-muted);
    letter-spacing: 0.04em;
    margin-top: 4px;
}

/* ── Progress ring ────────────────────── */
.pf-ring-wrap {
    flex-shrink: 0;
}

.pf-ring {
    width: 86px;
    height: 86px;
    display: block;
    overflow: visible;
}

.pf-ring-bg {
    fill: none;
    stroke: var(--app-border);
    stroke-width: 7;
}

.pf-ring-fill {
    fill: none;
    stroke: var(--app-primary);
    stroke-width: 7;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 0.9s cubic-bezier(.4,0,.2,1);
}

.pf-ring-text {
    fill: var(--app-text);
    font-size: 16px;
    font-weight: 800;
    text-anchor: middle;
    dominant-baseline: middle;
    letter-spacing: -0.02em;
}

/* ── Radar chart ──────────────────────── */
.pf-radar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.pf-radar {
    width: 240px;
    height: 240px;
    display: block;
    overflow: visible;
}

.pf-radar-grid {
    fill: none;
    stroke: var(--app-border);
    stroke-width: 1;
}

.pf-radar-axis {
    stroke: var(--app-border);
    stroke-width: 1;
}

.pf-radar-poly {
    fill: rgba(75,92,59,0.13);
    stroke: var(--lx-green);
    stroke-width: 2;
    stroke-linejoin: round;
}

body.dark-mode .pf-radar-poly {
    fill: rgba(75,92,59,0.22);
}

.pf-radar-label {
    fill: var(--app-muted);
    font-size: 11px;
    font-weight: 600;
}

/* ── Score bars ───────────────────────── */
.pf-scores {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pf-score-row {}

.pf-score-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}

.pf-score-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--app-text);
}

.pf-score-val {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--app-primary);
    font-variant-numeric: tabular-nums;
}

.pf-score-track {
    height: 5px;
    background: var(--app-section);
    border-radius: 100px;
    overflow: hidden;
}

.pf-score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--lx-green) 0%, var(--lx-gold) 100%);
    border-radius: 100px;
    min-width: 3px;
    transition: width 0.7s cubic-bezier(.4,0,.2,1);
}

/* ── Empty state ──────────────────────── */
.pf-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 0 16px;
    text-align: center;
}

.pf-empty-icon {
    font-size: 2rem;
    color: var(--app-border);
}

.pf-empty-text {
    font-size: 0.85rem;
    color: var(--app-muted);
    line-height: 1.5;
    max-width: 220px;
}

/* ── Footer ───────────────────────────── */
.pf-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--app-section);
    border-top: 1px solid var(--app-border);
}

.pf-footer-icon {
    font-size: 1.4rem;
    color: var(--app-primary);
    flex-shrink: 0;
}

.pf-footer-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--app-text);
    line-height: 1.3;
}

.pf-footer-sub {
    font-size: 0.75rem;
    color: var(--app-muted);
    margin-top: 2px;
}

/* ── Plan badges (in hero) ────────────── */
.pf-badge--pro {
    background: var(--lx-gold-soft);
    border: 1px solid rgba(137,109,44,0.35);
    color: var(--lx-gold);
}

.pf-badge--free {
    background: var(--app-section);
    border: 1px solid var(--app-border);
    color: var(--app-muted);
}

/* ── Account section ──────────────────── */
.pf-account-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pf-account-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    gap: 12px;
}

.pf-account-key {
    color: var(--app-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.pf-account-val {
    color: var(--app-text);
    font-weight: 600;
    text-align: right;
}

.pf-text-link {
    color: var(--app-primary);
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
}

.pf-text-link:hover {
    text-decoration: underline;
    color: var(--app-primary);
}

/* ── Password form ────────────────────── */
.pf-form .form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--app-text);
    margin-bottom: 5px;
}

.pf-form .form-control {
    font-size: 0.875rem;
    background: var(--app-base);
    border-color: var(--app-border);
    color: var(--app-text);
}

.pf-form .btn-outline-secondary {
    border-color: var(--app-border);
    color: var(--app-muted);
}

.pf-form .btn-outline-secondary:hover {
    background: var(--app-section);
    color: var(--app-text);
}

/* ========================================
   UPGRADE CTA BANNER (profile)
======================================== */
.pf-upgrade-banner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    margin: 0 16px;
    padding: 12px 14px;
    background: linear-gradient(120deg, rgba(137,109,44,0.07) 0%, rgba(242,232,204,0.5) 100%);
    border: 1px solid rgba(137,109,44,0.25);
    border-radius: 12px;
}

.pf-upgrade-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.pf-upgrade-body {
    min-width: 0;
}

.pf-upgrade-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--lx-gold);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-upgrade-sub {
    font-size: 0.72rem;
    color: var(--app-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* override global btn-primary padding inside the banner */
.pf-upgrade-btn.btn {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
    border-radius: 8px !important;
    min-height: unset !important;
    background: var(--lx-gold) !important;
    border-color: var(--lx-gold) !important;
    box-shadow: none !important;
    white-space: nowrap;
    font-weight: 700;
    line-height: 1.4;
}

/* ========================================
   NAV GROUP LABELS + UPGRADE CTA (sidebar)
======================================== */
.nav-group-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    padding: 18px 20px 4px;
}

.nav-group-label:first-child {
    padding-top: 8px;
}

.nav-upgrade-cta {
    margin: 16px 12px 8px;
}

.nav-upgrade-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(120deg, rgba(124,58,237,0.25) 0%, rgba(167,139,250,0.18) 100%);
    border: 1px solid rgba(167,139,250,0.35);
    border-radius: 12px;
    text-decoration: none;
    transition: background 0.15s;
}

.nav-upgrade-btn:hover {
    background: linear-gradient(120deg, rgba(124,58,237,0.35) 0%, rgba(167,139,250,0.28) 100%);
    text-decoration: none;
}

.nav-upgrade-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.nav-upgrade-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.nav-upgrade-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #c4b5fd;
    line-height: 1.2;
}

.nav-upgrade-sub {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    margin-top: 1px;
}

.nav-upgrade-arrow {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    flex-shrink: 0;
}

/* ========================================
   MOBILE-FIRST GLOBAL IMPROVEMENTS
======================================== */

/* Mobile-first: touch target improvements */
@media (max-width: 768px) {
    /* フォームは大きめにして入力しやすく */
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 1rem;
    }

    /* ナビリンクは指で押しやすいサイズに */
    .nav-link {
        padding-top: 10px;
        padding-bottom: 10px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* プロフィールフォーム内のボタンは通常サイズで十分 */
    .pf-form .btn {
        min-height: 44px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .pf-card {
        border-radius: 12px;
    }

    .pf-section {
        padding: 16px 16px;
    }

    .pf-hero-body {
        padding: 8px 16px 12px 92px;
    }

    .pf-upgrade-banner {
        margin: 0 12px;
        padding: 10px 12px;
    }
}

/* Profile card full-width on small screens */
@media (max-width: 540px) {
    .profile-shell {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .pf-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* ========================================
   RANKING
======================================== */
.ranking-period-tabs {
    display: flex;
    gap: 8px;
}

.ranking-period-btn {
    padding: 6px 20px;
    border: 1.5px solid var(--app-border);
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--app-muted);
    background: transparent;
    transition: all 0.15s;
}

.ranking-period-btn.active,
.ranking-period-btn:hover {
    border-color: var(--app-primary);
    color: var(--app-primary);
    background: #f5f0ff;
}

body.dark-mode .ranking-period-btn.active,
body.dark-mode .ranking-period-btn:hover {
    background: #2d1f4e;
}

.ranking-table-card {
    border-radius: var(--app-radius-card);
    overflow: hidden;
}

.ranking-table {
    font-size: 0.9rem;
}

.ranking-table thead th {
    background: var(--app-section);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--app-border);
}

.ranking-table tbody tr {
    transition: background 0.12s;
}

.ranking-table tbody tr:hover {
    background: var(--app-section);
}

.ranking-row--me {
    background: #f5f0ff !important;
    border-left: 3px solid var(--app-primary);
}

body.dark-mode .ranking-row--me {
    background: #2d1f4e !important;
}

.ranking-col-rank {
    width: 64px;
    padding: 12px 16px !important;
    text-align: center;
}

.ranking-col-name {
    padding: 12px 16px !important;
}

.ranking-col-stat {
    width: 80px;
    padding: 12px 16px !important;
}

.ranking-medal {
    font-size: 1.4rem;
    line-height: 1;
}

.ranking-rank-num {
    font-weight: 700;
    color: var(--app-muted);
    font-size: 0.95rem;
}

.ranking-username {
    font-weight: 500;
    color: var(--app-text);
}

.ranking-me-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--app-primary);
    background: #ede9fe;
    border-radius: 10px;
    padding: 1px 8px;
    vertical-align: middle;
}

body.dark-mode .ranking-me-badge {
    background: #2d1f4e;
}

.ranking-stat {
    font-weight: 700;
    font-size: 0.95rem;
}

.ranking-stat-unit {
    font-size: 0.75rem;
    color: var(--app-muted);
    font-weight: 400;
}

.ranking-my-row-card {
    border: 2px solid var(--app-primary);
    border-radius: var(--app-radius-card);
}

/* ========================================
   SNAP & WRITE
======================================== */
.snap-write-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 0 6px;
    border-bottom: 1px solid var(--app-border);
    margin-bottom: 8px;
}

.snap-camera-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1.5px solid var(--app-border);
    border-radius: var(--app-radius-control);
    background: var(--app-section);
    color: var(--app-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.snap-camera-label:hover {
    border-color: var(--app-primary);
    background: #f5f0ff;
    color: var(--app-primary);
}

.snap-camera-icon {
    font-size: 1rem;
}

.snap-file-input {
    display: none;
}

.snap-preview-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 8px;
    border: 1.5px solid var(--app-border);
    flex-shrink: 0;
}

.snap-loading {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--app-muted);
    font-size: 0.82rem;
}

.snap-result-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0 8px;
}

.snap-result-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    padding: 10px 14px;
    background: var(--app-section);
    border: 1.5px solid var(--app-border);
    border-radius: var(--app-radius-control);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}

.snap-result-card:hover {
    border-color: var(--app-primary);
    background: #f5f0ff;
}

.snap-result-theme {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--app-primary);
    letter-spacing: 0.02em;
}

.snap-result-example {
    font-size: 0.88rem;
    color: var(--app-text);
    line-height: 1.5;
}

body.dark-mode .snap-result-card {
    background: var(--app-section);
    border-color: var(--app-border);
}

body.dark-mode .snap-result-card:hover {
    border-color: var(--app-primary);
    background: #2d1f4e;
}

body.dark-mode .snap-camera-label {
    background: var(--app-section);
    border-color: var(--app-border);
    color: var(--app-muted);
}

body.dark-mode .snap-camera-label:hover {
    border-color: var(--app-primary);
    background: #2d1f4e;
    color: var(--app-primary);
}

/* ========================================
   REGISTER PAGE: auth-divider / Google-first
======================================== */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--app-muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--app-border);
}

.auth-social-btn--primary {
    min-height: 3.5rem;
    font-size: 1.05rem;
    border-color: #4285f4;
    background: #f0f6ff;
    color: #1a56db;
}

.auth-social-btn--primary:hover {
    background: #e0edff;
    border-color: #1a56db;
}

body.dark-mode .auth-social-btn--primary {
    background: #1e2a3a;
    border-color: #60a5fa;
    color: #93c5fd;
}

/* ========================================
   LP HERO: "登録不要" バッジ
======================================== */
.hero-cta-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15em 0.55em;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(255,255,255,0.3);
    vertical-align: middle;
    letter-spacing: 0.02em;
}

/* ========================================
   DIARY PROMPT TOOL: 添削結果リッチ化
======================================== */
.correction-result-praise {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: #eef2ff;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.correction-result-praise span {
    font-weight: 700;
    color: #4f46e5;
    white-space: nowrap;
}

.correction-result-praise p {
    font-size: 0.88rem;
    color: #4338ca;
}

body.dark-mode .correction-result-praise {
    background: #1e1b4b;
}

body.dark-mode .correction-result-praise span,
body.dark-mode .correction-result-praise p {
    color: #c4b5fd;
}

.correction-result-after {
    font-weight: 600;
    color: var(--app-primary);
}

.correction-result-save-cta {
    margin-top: 1.25rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #eef2ff 0%, #eff6ff 100%);
    border-radius: 14px;
    text-align: center;
    border: 1px solid #c7d2fe;
}

body.dark-mode .correction-result-save-cta {
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
    border-color: #3730a3;
}

.correction-result-save-label {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.correction-result-save-btn {
    font-size: 1rem;
    padding: 0.7rem 1.75rem;
    border-radius: 12px;
}

.correction-result-save-sub {
    margin-top: 0.65rem;
    font-size: 0.82rem;
    color: var(--app-muted);
    margin-bottom: 0;
}

.prompt-card--large .prompt-card-text {
    font-size: 1rem;
    font-style: italic;
    color: var(--app-muted);
    margin-bottom: 1rem;
}

/* ========================================
   INTERACTION ANIMATIONS
   統一感のある洗練されたUXモーション
======================================== */

/* ── 1. Button: Ripple + Press ────────── */
.btn {
    position: relative;
    overflow: hidden;
}

/* 押し込み感 */
.btn:active:not(:disabled) {
    transform: translateY(1px) scale(0.97) !important;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.12) !important;
    transition: transform 0.08s ease, box-shadow 0.08s ease !important;
}

/* Ripple の波紋 */
.btn .ripple-wave {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.38);
    transform: scale(0);
    pointer-events: none;
    animation: ripple-expand 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes ripple-expand {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ── 2. AI Loading: Shimmer Skeleton ──── */
.ai-skeleton-line {
    height: 1em;
    border-radius: 6px;
    background: linear-gradient(
        90deg,
        var(--app-section) 25%,
        rgba(124, 58, 237, 0.09) 50%,
        var(--app-section) 75%
    );
    background-size: 200% 100%;
    animation: shimmer-sweep 1.5s ease-in-out infinite;
}

.ai-skeleton-line--short { width: 55%; }
.ai-skeleton-line--medium { width: 80%; }
.ai-skeleton-line--long { width: 100%; }

@keyframes shimmer-sweep {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* AI処理中ドット */
.ai-thinking-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ai-thinking-dots span {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--app-primary);
    animation: dot-bounce 1.1s ease-in-out infinite;
}

.ai-thinking-dots span:nth-child(2) { animation-delay: 0.16s; }
.ai-thinking-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes dot-bounce {
    0%, 80%, 100% { transform: translateY(0);    opacity: 0.35; }
    40%           { transform: translateY(-5px); opacity: 1;    }
}

/* ── 3. Result: Staggered Fade-in ──────── */
.result-stagger > * {
    opacity: 0;
    transform: translateY(10px);
    animation: result-slide-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.result-stagger > *:nth-child(1) { animation-delay: 0.04s; }
.result-stagger > *:nth-child(2) { animation-delay: 0.12s; }
.result-stagger > *:nth-child(3) { animation-delay: 0.20s; }
.result-stagger > *:nth-child(4) { animation-delay: 0.28s; }
.result-stagger > *:nth-child(5) { animation-delay: 0.36s; }
.result-stagger > *:nth-child(6) { animation-delay: 0.44s; }

@keyframes result-slide-in {
    to { opacity: 1; transform: translateY(0); }
}

/* ── 4. Toast Notification ─────────────── */
#lingua-toast {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: #1e293b;
    color: #f8fafc;
    border-radius: 99px;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
}

#lingua-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#lingua-toast .toast-icon {
    font-size: 1rem;
    line-height: 1;
}

body.dark-mode #lingua-toast {
    background: #334155;
    color: #f1f5f9;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

/* ── 5. Page Transition ─────────────────── */
.page-transition {
    animation: page-fade-in 0.22s ease-out both;
}

@keyframes page-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── reduced-motion: すべて無効化 ────── */
@media (prefers-reduced-motion: reduce) {
    .btn .ripple-wave,
    .ai-skeleton-line,
    .ai-thinking-dots span,
    .result-stagger > *,
    .page-transition {
        animation: none !important;
    }

    .btn:active:not(:disabled) {
        transform: none !important;
    }

    #lingua-toast {
        transition: opacity 0.15s ease !important;
    }
}

/* ========================================
   VOCAB DISCOVERY: final visual override
   Loaded after isolated CSS so this page wins against global theme rules.
======================================== */
.discovery-page {
    max-width: 1040px !important;
    padding-top: 0.85rem !important;
    color: #182235 !important;
}

.discovery-page .discovery-hero {
    position: relative !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 1rem !important;
    align-items: start !important;
    overflow: hidden !important;
    margin-bottom: 0 !important;
    padding: clamp(1.35rem, 4vw, 2.2rem) !important;
    border: 0 !important;
    border-radius: 8px !important;
    background:
        radial-gradient(circle at 94% 8%, rgba(129, 140, 248, 0.3) 0, transparent 28%),
        linear-gradient(135deg, #111827 0%, #263454 54%, #4f46e5 100%) !important;
    box-shadow: 0 22px 56px rgba(17, 24, 39, 0.24) !important;
}

.discovery-page .discovery-hero::after {
    content: "";
    position: absolute;
    inset: auto -10% -36% 36%;
    height: 12rem;
    background: rgba(255, 255, 255, 0.08);
    transform: rotate(-8deg);
    pointer-events: none;
}

.discovery-page .discovery-hero-copy,
.discovery-page .discovery-vocab-link {
    position: relative;
    z-index: 1;
}

.discovery-page .discovery-kicker {
    display: inline-flex !important;
    width: auto !important;
    min-height: 1.6rem !important;
    align-items: center !important;
    border: 1px solid rgba(255, 255, 255, 0.24) !important;
    border-radius: 999px !important;
    padding: 0.12rem 0.65rem !important;
    background: rgba(255, 255, 255, 0.12) !important;
    color: #e0f2fe !important;
    font-size: 0.72rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
}

.discovery-page .discovery-hero h2 {
    max-width: 11em !important;
    margin-top: 0.7rem !important;
    margin-bottom: 0.8rem !important;
    color: #ffffff !important;
    font-size: clamp(1.9rem, 8vw, 3.4rem) !important;
    font-weight: 950 !important;
    line-height: 1.08 !important;
}

.discovery-page .discovery-hero p:not(.discovery-kicker) {
    max-width: 34rem !important;
    color: rgba(255, 255, 255, 0.84) !important;
    font-size: 1rem !important;
    line-height: 1.85 !important;
}

.discovery-page .discovery-hero-points {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
    max-width: 34rem !important;
    margin-top: 1.05rem !important;
}

.discovery-page .discovery-hero-points span {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
    min-height: 2.35rem !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    border-radius: 8px !important;
    padding: 0.35rem 0.55rem !important;
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    font-size: 0.78rem !important;
    font-weight: 850 !important;
    line-height: 1.25 !important;
    text-align: center !important;
    backdrop-filter: blur(8px);
}

.discovery-page .discovery-vocab-link {
    min-width: 8.5rem !important;
    border: 1px solid rgba(255, 255, 255, 0.36) !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    color: #172033 !important;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18) !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
}

.discovery-page .discovery-search {
    position: relative !important;
    z-index: 2 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 0.75rem !important;
    align-items: end !important;
    margin: -0.7rem clamp(0.75rem, 2.4vw, 1.25rem) 1.35rem !important;
    padding: 0.9rem !important;
    border: 1px solid rgba(17, 24, 39, 0.08) !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    box-shadow: 0 18px 44px rgba(17, 24, 39, 0.13) !important;
}

.discovery-page .search-input-wrap .form-label {
    color: #475467 !important;
    font-weight: 850 !important;
}

.discovery-page .discovery-search .form-control {
    min-height: 3.35rem !important;
    border: 1px solid #dbe4ef !important;
    border-radius: 8px !important;
    background: #f8fafc !important;
    color: #172033 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

.discovery-page .discovery-search-btn {
    min-width: 10.5rem !important;
    min-height: 3.35rem !important;
    border-radius: 8px !important;
    background: linear-gradient(135deg, #4f46e5 0%, #8b5cf6 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 14px 28px rgba(79, 70, 229, 0.28) !important;
    font-size: 1.02rem !important;
    font-weight: 950 !important;
}

.discovery-page .starter-panel,
.discovery-page .saved-groups,
.discovery-page .discovery-result {
    border: 1px solid rgba(17, 24, 39, 0.08) !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 12px 32px rgba(17, 24, 39, 0.08) !important;
    padding: clamp(1rem, 3vw, 1.35rem) !important;
}

.discovery-page .starter-panel {
    display: grid !important;
    grid-template-columns: minmax(18rem, 1fr) minmax(16rem, 0.72fr) !important;
    gap: 1rem !important;
    align-items: center !important;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(240, 249, 255, 0.94)) !important;
}

.discovery-page .starter-panel > div {
    min-width: 0 !important;
}

.discovery-page .starter-panel h5,
.discovery-page .saved-groups h4,
.discovery-page .discovery-result h4 {
    color: #172033 !important;
    font-size: clamp(1.35rem, 5.4vw, 2rem) !important;
    font-weight: 950 !important;
    line-height: 1.25 !important;
}

.discovery-page .starter-panel p,
.discovery-page .saved-groups p,
.discovery-page .discovery-result p {
    color: #526173 !important;
}

.discovery-page .starter-chips {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    gap: 0.5rem !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

.discovery-page .sample-chip {
    width: auto !important;
    max-width: 100% !important;
    min-height: 2.4rem !important;
    border: 1px solid rgba(79, 70, 229, 0.24) !important;
    border-radius: 999px !important;
    background: #ffffff !important;
    color: #4338ca !important;
    padding: 0.42rem 0.8rem !important;
    box-shadow: 0 8px 18px rgba(17, 24, 39, 0.06) !important;
    font-weight: 900 !important;
    text-align: left !important;
    white-space: normal !important;
}

.discovery-page .candidate-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.9rem !important;
}

.discovery-page .candidate-card,
.discovery-page .source-group-card {
    border: 1px solid rgba(17, 24, 39, 0.1) !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.07) !important;
}

.discovery-page .candidate-card.selected {
    border-color: rgba(79, 70, 229, 0.52) !important;
    box-shadow: 0 16px 34px rgba(79, 70, 229, 0.15) !important;
}

.discovery-page .candidate-card h5 {
    color: #172033 !important;
    font-size: 1.45rem !important;
    font-weight: 950 !important;
}

.discovery-page .candidate-meta span {
    background: #eef4ff !important;
    color: #3538cd !important;
}

.discovery-page .candidate-example {
    border: 1px solid rgba(17, 24, 39, 0.08) !important;
    border-radius: 8px !important;
    background: #f8fafc !important;
}

.discovery-page .empty-source-panel {
    border: 1px dashed rgba(17, 24, 39, 0.18) !important;
    border-radius: 8px !important;
    background: #f8fafc !important;
    color: #667085 !important;
}

@media (max-width: 767.98px) {
    .discovery-page {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .discovery-page .discovery-hero,
    .discovery-page .discovery-search,
    .discovery-page .starter-panel,
    .discovery-page .candidate-grid {
        grid-template-columns: 1fr !important;
    }

    .discovery-page .discovery-hero {
        padding: 1.35rem 1rem 1.7rem !important;
    }

    .discovery-page .discovery-hero-points {
        grid-template-columns: 1fr !important;
    }

    .discovery-page .discovery-search {
        margin-left: 0.75rem !important;
        margin-right: 0.75rem !important;
    }

    .discovery-page .discovery-vocab-link,
    .discovery-page .discovery-search-btn {
        width: 100% !important;
    }

    .discovery-page .starter-chips {
        justify-content: flex-start !important;
    }

    .discovery-page .sample-chip {
        width: auto !important;
    }
}

body.dark-mode .discovery-page .discovery-search,
body.dark-mode .discovery-page .starter-panel,
body.dark-mode .discovery-page .saved-groups,
body.dark-mode .discovery-page .discovery-result,
body.dark-mode .discovery-page .candidate-card,
body.dark-mode .discovery-page .source-group-card {
    border-color: rgba(226, 232, 240, 0.14) !important;
    background: #111827 !important;
}

body.dark-mode .discovery-page .starter-panel h5,
body.dark-mode .discovery-page .saved-groups h4,
body.dark-mode .discovery-page .discovery-result h4,
body.dark-mode .discovery-page .candidate-card h5 {
    color: #f8fafc !important;
}

/* Mobile chrome refresh. This is global because the layout CSS is isolated and
   global theme rules are loaded later. */
@media (max-width: 640px) {
    .loading-card,
    .latest-card,
    .metric-card,
    .desk-today-card,
    .desk-streak-card,
    .diary-first-run-primary,
    .catalog-toolbar,
    .mobile-filter-bar {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .top-row.navbar {
        background: #1F2422 !important;
        border-bottom: 1px solid rgba(246, 241, 232, 0.08) !important;
        box-shadow: none !important;
        backdrop-filter: none;
    }

    .top-row.navbar .navbar-brand,
    .top-row.navbar .header-icon,
    .top-row.navbar .notification-button {
        color: #B7B2A7 !important;
    }

    .top-row.navbar .brand-wordmark {
        color: #F6F1E8 !important;
        font-weight: 400 !important;
        letter-spacing: 0.04em !important;
    }

    .bottom-nav {
        background: #1F2422 !important;
        border-top: 1px solid rgba(246, 241, 232, 0.08) !important;
        box-shadow: none !important;
        backdrop-filter: none;
    }

    .bottom-nav-item.active .bottom-nav-icon-shell,
    .bottom-nav-hit.active .bottom-nav-icon-shell {
        color: #F6F1E8 !important;
        background: rgba(246, 241, 232, 0.13) !important;
    }

    .bottom-nav-item.active .bottom-nav-label {
        color: #F6F1E8 !important;
        font-weight: 600 !important;
    }

    body.dark-mode .top-row.navbar {
        background: #1F2422 !important;
        border-bottom-color: rgba(246, 241, 232, 0.08) !important;
        box-shadow: none !important;
    }

    body.dark-mode .top-row.navbar .navbar-brand,
    body.dark-mode .top-row.navbar .brand-wordmark {
        color: #f8fafc !important;
        text-shadow: 0 0 1px rgba(248, 250, 252, 0.45);
    }

    body.dark-mode .top-row.navbar .header-icon,
    body.dark-mode .top-row.navbar .notification-button {
        color: #e2e8f0 !important;
    }

    body.dark-mode .top-row.navbar .header-icon:hover,
    body.dark-mode .top-row.navbar .notification-button:hover {
        background: rgba(129, 140, 248, 0.18) !important;
        color: #ffffff !important;
    }

    body.dark-mode .top-row.navbar .navbar-toggler {
        background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28183, 178, 167, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M5 8h20M5 15h20M5 22h20'/%3e%3c/svg%3e") no-repeat center/1.35rem !important;
        color: #B7B2A7 !important;
    }

    body.dark-mode .bottom-nav {
        background: #1F2422 !important;
        border-top-color: rgba(246, 241, 232, 0.08) !important;
        box-shadow: none !important;
    }

    body.dark-mode .bottom-nav-icon-shell,
    body.dark-mode .bottom-nav-label {
        color: #B7B2A7 !important;
    }

    body.dark-mode .bottom-nav-item.active .bottom-nav-icon-shell,
    body.dark-mode .bottom-nav-hit.active .bottom-nav-icon-shell {
        color: #F6F1E8 !important;
        background: rgba(246, 241, 232, 0.13) !important;
    }

    body.dark-mode .bottom-nav-item.active .bottom-nav-label {
        color: #F6F1E8 !important;
    }
}
