/* ============================================================
   BlitzSpeak CSS
   ============================================================ */

:root {
    --color-primary: #E8600A;
    --color-primary-light: #FFF3E0;
    --color-primary-hover: #D35400;
    --color-success: #16A34A;
    --color-danger: #DC2626;
    --color-warning: #F59E0B;
    --color-info: #3B82F6;
    --bg-sidebar: #FFFFFF;
    --bg-content: #F9FAFB;
    --bg-card: #FFFFFF;
    --bg-input: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border-color: #E5E7EB;
    --radius-card: 12px;
    --radius-btn: 8px;
    --sidebar-width: 240px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    color-scheme: light;
}

[data-theme="dark"] {
    --color-primary: #F28C38;
    --color-primary-light: #3D2410;
    --color-primary-hover: #F5A623;
    --color-success: #22C55E;
    --color-danger: #EF4444;
    --color-warning: #FBBF24;
    --color-info: #60A5FA;
    --bg-sidebar: #1A1A2E;
    --bg-content: #111827;
    --bg-card: #1F2937;
    --bg-input: #1F2937;
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --border-color: #374151;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
    color-scheme: dark;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background: var(--bg-content);
    line-height: 1.5;
    min-height: 100vh;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }

/* ============================================================
   Layout
   ============================================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: auto;
    color: var(--text-secondary);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    margin: 0.125rem 0.5rem;
    border-radius: var(--radius-btn);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-item:hover {
    background: var(--bg-content);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    overflow-y: auto;
    flex-shrink: 1;
    min-height: 0;
}

.sidebar-upgrade {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--color-primary), #f59e0b);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: opacity 0.15s;
}
.sidebar-upgrade:hover {
    opacity: 0.9;
    color: white;
}

/* Language pills */
.language-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.lang-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 99px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.lang-pill:hover {
    border-color: var(--color-primary);
}

.lang-pill-active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* Sidebar user */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 1.5rem 2rem;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

/* Hamburger */
.hamburger {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 90;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    padding: 0.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    line-height: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Mobile sidebar overlay backdrop — shown/hidden via JS */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   Auth layout
   ============================================================ */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-content);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.auth-logo .logo-icon {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
}

.auth-logo .logo-text {
    font-size: 1.5rem;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.auth-card h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--border-color);
}

/* ============================================================
   Forms
   ============================================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    font-size: 0.9rem;
    transition: border-color 0.15s;
    background: var(--bg-input);
    color: var(--text-primary);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(232, 96, 10, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    font-size: 0.9rem;
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-help {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.form-error {
    font-size: 0.8rem;
    color: var(--color-danger);
    margin-top: 0.25rem;
}

.form-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.form-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.9rem;
}

.form-checkbox-item:hover {
    border-color: var(--color-primary);
}

.form-checkbox-item input:checked + span {
    color: var(--color-primary);
}

.form-checkbox-item:has(input:checked) {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-btn);
    font-weight: 500;
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--color-primary-hover);
    color: white;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-content);
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger-outline {
    background: transparent;
    color: var(--color-danger);
    border: 1px solid var(--color-danger);
}
.btn-danger-outline:hover {
    background: var(--color-danger);
    color: white;
}

.btn-google {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    width: 100%;
    padding: 0.75rem;
}

.btn-google:hover {
    background: var(--bg-content);
    color: var(--text-primary);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0.375rem;
    border-radius: var(--radius-btn);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--bg-content);
    color: var(--text-primary);
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* ============================================================
   Cards (UI)
   ============================================================ */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

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

.card-title {
    font-weight: 600;
    font-size: 1rem;
}

/* ============================================================
   Metrics
   ============================================================ */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ============================================================
   Heatmap
   ============================================================ */

.heatmap-container {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.heatmap-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 10px);
    gap: 2px;
    justify-content: start;
}

.heatmap-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: #E5E7EB;
    cursor: default;
    position: relative;
}

.heatmap-dot.learned {
    background: #FDBA74;
    cursor: pointer;
}

.heatmap-dot.mastered {
    background: var(--color-primary);
    cursor: pointer;
}

.heatmap-dot:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

.heatmap-legend {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.heatmap-legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.heatmap-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.heatmap-stats {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.cefr-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin: 0.25rem 0;
    grid-column: 1 / -1;
}

/* ============================================================
   Vocabulary Cards
   ============================================================ */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.card-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.vocab-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}

.vocab-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.vocab-card-image {
    height: 100px;
    background: var(--color-primary-light);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    font-size: 2rem;
}

.vocab-card-target {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.vocab-card-native {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.vocab-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* List view */
.card-list .vocab-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
}

.card-list .vocab-card-image {
    width: 48px;
    height: 48px;
    margin: 0;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.card-list .vocab-card-content {
    flex: 1;
    min-width: 0;
}

.card-list .vocab-card-target {
    margin-bottom: 0;
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-new { background: var(--color-primary-light); color: var(--color-primary); }
.badge-learning { background: #DBEAFE; color: var(--color-info); }
.badge-graduated { background: #D1FAE5; color: var(--color-success); }
.badge-relearning { background: #FEE2E2; color: var(--color-danger); }
.badge-backlog { background: #F3F4F6; color: var(--text-secondary); }

.badge-word { background: #EDE9FE; color: #7C3AED; }
.badge-sentence { background: #DBEAFE; color: var(--color-info); }
.badge-phrase { background: #D1FAE5; color: var(--color-success); }

.badge-cefr { background: #F3F4F6; color: var(--text-secondary); }

/* ============================================================
   Flash messages
   ============================================================ */

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-btn);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
}

.flash-success { background: #D1FAE5; color: #065F46; }
.flash-error { background: #FEE2E2; color: #991B1B; }
.flash-warning { background: #FEF3C7; color: #92400E; }
.flash-info { background: #DBEAFE; color: #1E40AF; }

.flash-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    opacity: 0.7;
}

/* ============================================================
   Page headers
   ============================================================ */

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

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================================
   Toolbar / Filters
   ============================================================ */

.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    font-size: 0.9rem;
    background: var(--bg-input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 0.75rem center no-repeat;
    color: var(--text-primary);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.filter-pills {
    display: flex;
    gap: 0.375rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.filter-pill {
    padding: 0.375rem 0.75rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.filter-pill:hover {
    border-color: var(--color-primary);
}

.filter-pill.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.view-toggle {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-btn);
    overflow: hidden;
}

.view-toggle-btn {
    padding: 0.375rem 0.625rem;
    background: var(--bg-card);
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.view-toggle-btn.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

/* ============================================================
   Tabs
   ============================================================ */

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1rem;
}

.tab {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover { color: var(--text-primary); }
.tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-count {
    font-size: 0.75rem;
    background: var(--bg-content);
    padding: 0.1rem 0.4rem;
    border-radius: 99px;
    margin-left: 0.25rem;
}

/* ============================================================
   Practice
   ============================================================ */

.practice-queue {
    text-align: center;
    padding: 3rem 1rem;
}

.practice-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--color-success);
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.practice-circle svg {
    color: white;
}

.practice-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.practice-count {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.practice-card-wrapper {
    max-width: 500px;
    margin: 0 auto;
}

.practice-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.flashcard {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-md);
}

.flashcard-revealed {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.flashcard-image {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background: var(--color-primary-light);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.flashcard-revealed .flashcard-image {
    background: rgba(255,255,255,0.2);
}

.flashcard-text {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.5rem;
}

.flashcard-sub {
    font-size: 0.9rem;
    opacity: 0.8;
    text-align: center;
}

.flashcard-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1.5rem;
}

.flashcard-revealed .flashcard-hint {
    color: rgba(255,255,255,0.7);
}

.flashcard-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.flashcard-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.25);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.flashcard-action-btn:hover {
    background: rgba(255,255,255,0.4);
}

.flashcard-action-btn:active {
    background: rgba(255,255,255,0.5);
    transform: scale(0.95);
}

.rating-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.rating-btn {
    padding: 0.75rem 0.5rem;
    border-radius: var(--radius-btn);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.rating-btn:hover { border-color: var(--color-primary); }

.rating-btn-1 { border-left: 3px solid var(--color-danger); }
.rating-btn-2 { border-left: 3px solid var(--color-warning); }
.rating-btn-3 { border-left: 3px solid var(--color-success); }
.rating-btn-4 { border-left: 3px solid var(--color-info); }

.rating-label {
    font-weight: 600;
    display: block;
    margin-bottom: 0.125rem;
}

.rating-interval {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ============================================================
   Detail page
   ============================================================ */

.detail-header {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.detail-target {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.detail-native {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.detail-pronunciation {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

.detail-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.progress-stability {
    margin-top: 1rem;
}

.stability-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.stability-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 4px;
    transition: width 0.3s;
}

.srs-accordion-toggle {
    padding: 0.25rem 0;
}

.srs-accordion-toggle:hover {
    color: var(--color-primary);
}

/* ============================================================
   Stats
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.chart-title {
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Activity heatmap (GitHub style) */
.activity-heatmap {
    display: grid;
    grid-template-columns: repeat(53, 12px);
    grid-template-rows: repeat(7, 12px);
    gap: 2px;
    grid-auto-flow: column;
}

.activity-day {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background: #EBEDF0;
}

.activity-day.level-1 { background: #FDBA74; }
.activity-day.level-2 { background: #F97316; }
.activity-day.level-3 { background: #EA580C; }
.activity-day.level-4 { background: #C2410C; }

/* Stacked bar */
.stacked-bar {
    display: flex;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.stacked-segment {
    height: 100%;
    min-width: 2px;
    transition: width 0.3s;
}

.stacked-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.8rem;
}

.stacked-legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

/* ============================================================
   Settings
   ============================================================ */

.settings-section {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.settings-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* ============================================================
   Subscription
   ============================================================ */

.subscription-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.subscription-badge-success {
    background: rgba(34,197,94,0.15);
    color: #16a34a;
}
.subscription-badge-warning {
    background: rgba(234,179,8,0.15);
    color: #ca8a04;
}
.subscription-badge-error {
    background: rgba(239,68,68,0.15);
    color: #dc2626;
}
.subscription-badge-muted {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

[data-theme="dark"] .subscription-badge-success {
    color: #4ade80;
}
[data-theme="dark"] .subscription-badge-warning {
    color: #facc15;
}
[data-theme="dark"] .subscription-badge-error {
    color: #f87171;
}

/* ============================================================
   Utilities
   ============================================================ */

.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }

.htmx-indicator {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   Onboarding Wizard (two-column layout)
   ============================================================ */

.onboarding-body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg-content);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ob-wrapper {
    display: grid;
    grid-template-columns: 1fr 420px;
    width: 100%;
    max-width: 1100px;
    height: 700px;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Left panel: form */
.ob-left {
    padding: 2.5rem 3rem 2rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* The form must also be a flex column to pass height to .ob-steps */
.ob-left form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.ob-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-shrink: 0;
}

.ob-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-shrink: 0;
}

.ob-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.ob-progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.ob-progress-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Steps container: absolute children so height never shifts */
.ob-steps {
    flex: 1;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

.ob-step {
    position: absolute;
    inset: 0;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    transform: translateX(20px);
    overflow-y: auto;
    padding-right: 4px;
}

.ob-step.active {
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
}

.ob-step h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.ob-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

/* Chips */
.ob-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ob-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.875rem;
    user-select: none;
    background: var(--bg-card);
}

.ob-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ob-chip:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.ob-chip:has(input:checked) {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: white;
}

.ob-chips-sm .ob-chip {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* Referral detail area */
.ob-referral-detail {
    margin-top: 1.25rem;
    min-height: 90px;
}

.ob-ref-sub {
    display: none;
}

.ob-ref-sub.active {
    display: block;
    animation: obSubReveal 0.2s ease;
}

@keyframes obSubReveal {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ob-ref-sub .form-label {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Navigation: pinned at bottom, never moves */
.ob-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    flex-shrink: 0;
}

.ob-nav-spacer {
    flex: 1;
}

/* Continue / Get Started button — disabled state */
.ob-nav .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Right panel: illustration */
.ob-right {
    background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
}

.ob-illustration {
    text-align: center;
}

.ob-illust-content {
    transition: opacity 0.3s ease;
}

.ob-illust-emoji {
    font-size: 5rem;
    line-height: 1;
    margin-bottom: 1.5rem;
}

.ob-illustration h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.ob-illustration p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 260px;
    margin: 0 auto;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .sidebar-close {
        display: block;
    }

    .hamburger {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 4rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .page-header .btn-group {
        width: 100%;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr 1fr;
    }

    .metric-value {
        font-size: 1.4rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .rating-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-header {
        grid-template-columns: 1fr;
    }

    .detail-target {
        font-size: 1.5rem;
    }

    .detail-actions {
        flex-wrap: wrap;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar .search-input {
        min-width: 0;
    }

    .toolbar .form-select {
        width: 100% !important;
    }

    .toolbar .view-toggle {
        align-self: flex-end;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Scrollable heatmaps on mobile */
    .activity-heatmap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }

    .heatmap-grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }

    .heatmap-legend {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .heatmap-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    /* Settings language rows stack */
    .settings-section .btn-group {
        flex-wrap: wrap;
    }

    /* Settings language row: stack on mobile */
    .settings-lang-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }

    .flashcard {
        min-height: 240px;
        padding: 1.5rem;
    }

    .flashcard-text {
        font-size: 1.25rem;
    }

    /* Practice session full-screen feel */
    .practice-wrapper {
        margin: 1rem auto !important;
    }

    .practice-queue {
        padding: 2rem 0.5rem;
    }

    .auth-container {
        padding: 1rem;
    }

    .auth-card {
        padding: 1.5rem;
    }

    /* Onboarding: stack vertically on mobile */
    .ob-wrapper {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }

    .ob-right {
        display: none;
    }

    .ob-left {
        padding: 1.5rem;
    }

    .ob-steps {
        min-height: 320px;
    }

    /* Related words: wrap instead of horizontal scroll */
    .related-words-row {
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .related-words-row > a {
        min-width: calc(50% - 0.25rem);
        flex-shrink: 1;
    }

    /* Review history items */
    .review-history-item {
        gap: 0.5rem;
    }

    /* Stats page: chart title text wraps */
    .chart-title span {
        display: block;
        margin-left: 0;
    }

    /* Pricing page when shown inside app layout */
    .pricing-header {
        padding: 3rem 0 2rem;
    }

    .pricing-title {
        font-size: 2rem;
    }

    .pricing-subtitle {
        font-size: 1rem;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .pricing-card {
        padding: 1.5rem 1.25rem;
    }

    .pricing-toggle-btn {
        padding: 0.45rem 1rem;
        font-size: 0.85rem;
    }

    .pricing-faq-grid {
        grid-template-columns: 1fr;
    }

    /* Vocab form: stack type/cefr selects */
    .form-grid-2 {
        grid-template-columns: 1fr !important;
    }

    /* Tabs: allow horizontal scroll */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        white-space: nowrap;
    }

    /* Prevent horizontal overflow */
    .content-wrapper {
        overflow-x: hidden;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem;
        padding-top: 3.5rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .metric-card {
        padding: 0.75rem;
    }

    .metric-label {
        font-size: 0.7rem;
    }

    .metric-value {
        font-size: 1.25rem;
    }

    .metric-sub {
        font-size: 0.7rem;
    }

    .page-title {
        font-size: 1.15rem;
    }

    .detail-target {
        font-size: 1.25rem;
    }

    .detail-actions {
        flex-direction: column;
    }

    .detail-actions .btn,
    .detail-actions form {
        width: 100%;
    }

    .detail-actions form .btn {
        width: 100%;
    }

    .rating-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .card {
        padding: 1rem;
    }

    .btn-lg {
        font-size: 1rem;
        padding: 0.75rem;
    }

    .heatmap-container {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }

    /* SRS stats row: stack on very small screens */
    .srs-stats-row {
        grid-template-columns: 1fr !important;
        text-align: left !important;
    }

    .srs-stats-row > div {
        border-left: none !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color);
        padding: 0.5rem 0 !important;
    }

    .srs-stats-row > div:last-child {
        border-bottom: none;
    }

    .related-words-row > a {
        min-width: 100%;
    }

    .filter-pills {
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-footer {
        padding: 0.5rem 0.75rem;
    }

    .language-pills {
        gap: 0.25rem;
    }

    .lang-pill {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }

    /* Practice queue */
    .practice-circle {
        width: 90px;
        height: 90px;
    }

    .practice-circle svg {
        width: 36px;
        height: 36px;
    }

    .practice-title {
        font-size: 1.25rem;
    }

    /* Pricing on very small */
    .pricing-title {
        font-size: 1.6rem;
    }

    .pricing-amount {
        font-size: 2.5rem;
    }

    /* Stats chart containers */
    .chart-container {
        padding: 1rem;
    }

    .stacked-legend {
        gap: 0.5rem;
        font-size: 0.75rem;
    }

    /* Settings */
    .settings-section {
        padding: 1rem;
    }

    /* Subscription badge row */
    .settings-section .btn-group {
        flex-direction: column;
    }

    .settings-section .btn-group .btn {
        width: 100%;
    }
}

/* ── Landing page ───────────────────────────────── */

.landing-body {
    background: var(--bg-content);
    min-height: 100vh;
}

.landing {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Nav */
.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 0;
}

.landing-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.25rem;
}

.landing-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.landing-nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Hero */
.landing-hero {
    text-align: center;
    padding: 6rem 0 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: visible;
}

.hero-glow {
    position: absolute;
    top: -60px;
    left: 50%;
    translate: -50% 0;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(232,96,10,0.12) 0%, rgba(232,96,10,0.04) 40%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.landing-badge {
    position: relative;
    z-index: 1;
    display: inline-block;
    background: var(--bg-card);
    color: var(--color-primary);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.4rem 1.1rem;
    border-radius: 100px;
    margin-bottom: 1.75rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border: 1.5px solid rgba(232,96,10,0.2);
    box-shadow: 0 2px 12px rgba(232,96,10,0.1);
}

.landing-headline {
    position: relative;
    z-index: 1;
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--text-primary);
    margin: 0 0 1.25rem;
    line-height: 1.1;
    max-width: 680px;
    letter-spacing: -0.03em;
}

.gradient-text {
    background: linear-gradient(135deg, #E8600A 0%, #F59E0B 50%, #E8600A 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
}

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

.landing-sub {
    position: relative;
    z-index: 1;
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin: 0;
    line-height: 1.7;
    max-width: 500px;
}

.landing-cta {
    position: relative;
    z-index: 1;
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.landing-cta .btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 100px;
    box-shadow: 0 4px 20px rgba(232, 96, 10, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}

.landing-cta .btn-lg:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 30px rgba(232, 96, 10, 0.45);
}

.landing-cta-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Floating word bubbles */
.landing-word-bubbles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.word-bubble {
    position: absolute;
    border-radius: 100px;
    padding: 0.35rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    animation: float 5s ease-in-out infinite;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    backdrop-filter: blur(4px);
}

.wb-1 { top: 8%;  left: 4%;  animation-delay: 0s;   color: #E8600A; background: rgba(255,248,240,0.9); border: 1.5px solid #FDDCB5; }
.wb-2 { top: 18%; right: 2%; animation-delay: 0.8s; color: #2563EB; background: rgba(239,246,255,0.9); border: 1.5px solid #BFDBFE; }
.wb-3 { bottom: 32%; left: 1%; animation-delay: 2s;  color: #059669; background: rgba(236,253,245,0.9); border: 1.5px solid #A7F3D0; }
.wb-4 { top: 4%;  right: 10%; animation-delay: 1.2s; color: #7C3AED; background: rgba(245,243,255,0.9); border: 1.5px solid #DDD6FE; }
.wb-5 { bottom: 22%; right: 3%; animation-delay: 1.6s; color: #DB2777; background: rgba(253,242,248,0.9); border: 1.5px solid #FBCFE8; }
.wb-6 { bottom: 15%; left: 8%; animation-delay: 2.4s; color: #0891B2; background: rgba(236,254,255,0.9); border: 1.5px solid #A5F3FC; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(1deg); }
    75% { transform: translateY(4px) rotate(-1deg); }
}

/* Bento image grid */
.landing-bento {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    grid-template-rows: 1fr 1fr;
    gap: 0.75rem;
    padding: 0 0 4rem;
    min-height: 380px;
}

.bento-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1), box-shadow 0.3s;
    cursor: default;
}

.bento-card:hover {
    transform: translateY(-4px) scale(1.015);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.bento-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s;
}

.bento-card:hover img {
    transform: scale(1.05);
}

.bento-main {
    grid-row: 1 / 3;
}

.bento-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2.5rem 1.25rem 1.25rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: #fff;
}

.bento-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(6px);
    padding: 0.25rem 0.65rem;
    border-radius: 100px;
    margin-bottom: 0.5rem;
}

.bento-overlay h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.bento-main .bento-overlay h3 {
    font-size: 1.35rem;
}

/* Steps */
.landing-section-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
    margin: 0 0 2.5rem;
    letter-spacing: -0.02em;
}

.landing-steps {
    padding: 0 0 4rem;
}

.landing-steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.landing-step {
    text-align: center;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2.25rem 1.25rem;
    transition: transform 0.25s cubic-bezier(.4,0,.2,1), box-shadow 0.25s;
    border: 1.5px solid transparent;
}

.landing-step:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.07);
}

.step-orange { border-color: rgba(232,96,10,0.15); }
.step-orange:hover { border-color: rgba(232,96,10,0.3); }
.step-blue { border-color: rgba(37,99,235,0.12); }
.step-blue:hover { border-color: rgba(37,99,235,0.25); }
.step-green { border-color: rgba(5,150,105,0.12); }
.step-green:hover { border-color: rgba(5,150,105,0.25); }

.landing-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 1.25rem;
    color: #fff;
}

.step-orange .landing-step-num { background: linear-gradient(135deg, #E8600A, #F59E0B); }
.step-blue .landing-step-num   { background: linear-gradient(135deg, #2563EB, #06B6D4); }
.step-green .landing-step-num  { background: linear-gradient(135deg, #059669, #34D399); }

.landing-step h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.landing-step p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.55;
}

/* Features */
.landing-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    padding: 0 0 4rem;
}

.landing-feature {
    text-align: center;
    padding: 2rem 1.25rem;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    transition: transform 0.25s cubic-bezier(.4,0,.2,1), box-shadow 0.25s, border-color 0.25s;
}

.landing-feature:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.06);
    border-color: rgba(232,96,10,0.2);
}

.landing-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 14px;
    margin-bottom: 1rem;
}

.fi-orange  { background: #FFF3E0; color: #E8600A; }
.fi-blue    { background: #EFF6FF; color: #2563EB; }
.fi-purple  { background: #F5F3FF; color: #7C3AED; }

.landing-feature h3 {
    font-size: 0.95rem;
    font-weight: 800;
    margin: 0 0 0.4rem;
    color: var(--text-primary);
}

.landing-feature p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.55;
}

/* Bottom CTA */
.landing-bottom-cta {
    text-align: center;
    padding: 3.5rem 2rem;
    margin: 0 0 3rem;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
}

.landing-bottom-cta::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(232,96,10,0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.landing-bottom-cta h2 {
    font-size: 2rem;
    font-weight: 900;
    color: #fff;
    margin: 0 0 0.6rem;
    position: relative;
}

.landing-bottom-cta p {
    color: rgba(255,255,255,0.65);
    font-size: 1.05rem;
    margin: 0 0 2rem;
    position: relative;
}

.landing-bottom-cta .btn-lg {
    border-radius: 100px;
    padding: 1rem 2.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(232, 96, 10, 0.4);
    position: relative;
}

/* Footer */
.landing-footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.btn-ghost {
    background: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-btn);
    font-weight: 500;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-content);
}

/* ── Pricing page ──────────────────────────────── */

.pricing-header {
    text-align: center;
    padding: 5rem 0 3rem;
}

.pricing-title {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    letter-spacing: -0.03em;
}

.pricing-subtitle {
    color: var(--text-secondary);
    font-size: 1.15rem;
    margin: 0 0 2.5rem;
}

.pricing-toggle {
    display: inline-flex;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: 100px;
    padding: 4px;
    gap: 4px;
}

.pricing-toggle-btn {
    background: none;
    border: none;
    padding: 0.55rem 1.5rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.pricing-toggle-btn.active {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(232, 96, 10, 0.3);
}

.pricing-toggle-badge {
    font-size: 0.7rem;
    background: rgba(232, 96, 10, 0.1);
    color: var(--color-primary);
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
    font-weight: 700;
}

.pricing-toggle-btn.active .pricing-toggle-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 0 0 4rem;
    align-items: start;
}

.pricing-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2rem 1.75rem;
    border: 1.5px solid var(--border-color);
    position: relative;
    transition: transform 0.25s cubic-bezier(.4,0,.2,1), box-shadow 0.25s;
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.08);
}

.pricing-popular {
    border-color: var(--color-primary);
    box-shadow: 0 4px 20px rgba(232, 96, 10, 0.12);
}

.pricing-popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #E8600A, #F59E0B);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.3rem 1rem;
    border-radius: 100px;
    white-space: nowrap;
}

.pricing-card-header {
    margin-bottom: 1.5rem;
}

.pricing-plan-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
}

.pricing-plan-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.pricing-price {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.pricing-amount {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
}

.pricing-period {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.pricing-billed {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 1.25rem;
}

.pricing-save {
    display: inline-block;
    background: var(--pricing-check-bg, #ECFDF5);
    color: var(--pricing-save-color, #059669);
    font-weight: 700;
    font-size: 0.72rem;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
    margin-left: 0.25rem;
}

.pricing-features-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.pricing-features-list li {
    font-size: 0.88rem;
    color: var(--text-secondary);
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.4;
}

.pricing-features-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.25rem;
    width: 14px;
    height: 14px;
    background: var(--pricing-check-bg, #ECFDF5);
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23059669'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
    background-size: 10px;
    background-repeat: no-repeat;
    background-position: center;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.btn-outline-primary {
    background: none;
    color: var(--color-primary);
    border: 1.5px solid var(--color-primary);
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-btn);
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-outline-primary:hover {
    background: var(--color-primary);
    color: #fff;
}

.pricing-faq {
    padding: 0 0 4rem;
}

.pricing-faq-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.pricing-faq-item {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1.5px solid var(--border-color);
}

.pricing-faq-item h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.pricing-faq-item p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* ── Payment result ────────────────────────────── */

.payment-result {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 2rem;
}

.payment-result-card {
    text-align: center;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    border: 1.5px solid var(--border-color);
    max-width: 440px;
    width: 100%;
}

.payment-result-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.payment-result-icon.success {
    background: #ECFDF5;
    color: #059669;
}

.payment-result-icon.pending {
    background: #FFF3E0;
    color: #E8600A;
}

.payment-result-card h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 0.5rem;
}

.payment-result-card p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95rem;
}

/* ── Landing responsive ────────────────────────── */
@media (max-width: 700px) {
    .landing-hamburger {
        display: block;
    }

    .landing-nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-card);
        box-shadow: var(--shadow-lg);
        padding: 0.5rem;
        flex-direction: column;
        gap: 0.25rem;
        z-index: 100;
    }

    .landing-nav {
        position: relative;
    }

    .landing-nav.nav-open .landing-nav-links {
        display: flex;
    }

    .landing-nav-links .btn {
        width: 100%;
        text-align: center;
        padding: 0.625rem 1rem;
        font-size: 0.95rem;
    }

    .landing-nav.nav-open .hamburger-top {
        transform: translate(0, 6px) rotate(45deg);
        transform-origin: center;
    }
    .landing-nav.nav-open .hamburger-mid {
        opacity: 0;
    }
    .landing-nav.nav-open .hamburger-bot {
        transform: translate(0, -6px) rotate(-45deg);
        transform-origin: center;
    }

    .landing-hamburger svg line {
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    .landing-hero { padding: 3.5rem 0 2.5rem; }

    .landing-headline { font-size: 2.2rem; }

    .hero-glow { width: 300px; height: 300px; }

    .word-bubble { display: none; }

    .landing-bento {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        min-height: auto;
    }

    .bento-main { grid-row: auto; }

    .bento-card { min-height: 200px; }

    .landing-features,
    .landing-steps-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .landing-section-title { font-size: 1.5rem; }

    .landing-bottom-cta {
        padding: 2.5rem 1.25rem;
        border-radius: 20px;
    }

    .landing-bottom-cta h2 { font-size: 1.5rem; }

    .pricing-header { padding: 3rem 0 2rem; }
    .pricing-title { font-size: 1.8rem; }
    .pricing-grid { grid-template-columns: 1fr; max-width: 100%; margin: 0 auto; }
    .pricing-faq-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Dark theme overrides
   ============================================================ */

[data-theme="dark"] .heatmap-dot { background: #374151; }
[data-theme="dark"] .activity-day { background: #374151; }

[data-theme="dark"] .badge-learning { background: #1E3A5F; color: #60A5FA; }
[data-theme="dark"] .badge-graduated { background: #14532D; color: #4ADE80; }
[data-theme="dark"] .badge-relearning { background: #450A0A; color: #F87171; }
[data-theme="dark"] .badge-backlog { background: #1F2937; color: #9CA3AF; }
[data-theme="dark"] .badge-word { background: #2E1065; color: #A78BFA; }
[data-theme="dark"] .badge-sentence { background: #1E3A5F; color: #60A5FA; }
[data-theme="dark"] .badge-phrase { background: #14532D; color: #4ADE80; }
[data-theme="dark"] .badge-cefr { background: #1F2937; color: #9CA3AF; }

[data-theme="dark"] .flash-success { background: #14532D; color: #4ADE80; }
[data-theme="dark"] .flash-error { background: #450A0A; color: #F87171; }
[data-theme="dark"] .flash-warning { background: #451A03; color: #FBBF24; }
[data-theme="dark"] .flash-info { background: #1E3A5F; color: #60A5FA; }

[data-theme="dark"] .fi-orange { background: #3D2410; color: #F28C38; }
[data-theme="dark"] .fi-blue { background: #1E3A5F; color: #60A5FA; }
[data-theme="dark"] .fi-purple { background: #2E1065; color: #A78BFA; }

[data-theme="dark"] .ob-right {
    background: linear-gradient(135deg, #3D2410 0%, #2D1A0A 100%);
}

[data-theme="dark"] .form-input:focus {
    box-shadow: 0 0 0 3px rgba(242, 140, 56, 0.2);
}

/* Pricing dark overrides */
[data-theme="dark"] .pricing-toggle {
    background: var(--bg-content);
}
[data-theme="dark"] .pricing-toggle-badge {
    background: rgba(242, 140, 56, 0.15);
}
[data-theme="dark"] .pricing-features-list li::before {
    --pricing-check-bg: #14532D;
}
[data-theme="dark"] .pricing-save {
    --pricing-check-bg: #14532D;
    --pricing-save-color: #4ADE80;
}
[data-theme="dark"] .pricing-popular {
    box-shadow: 0 4px 20px rgba(242, 140, 56, 0.15);
}
[data-theme="dark"] .pricing-card:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
[data-theme="dark"] .payment-result-icon.success {
    background: #14532D;
    color: #4ADE80;
}
[data-theme="dark"] .payment-result-icon.pending {
    background: #3D2410;
    color: #F28C38;
}

/* Landing dark overrides */
[data-theme="dark"] .wb-1 { color: #F28C38; background: rgba(61,36,16,0.9); border-color: #5C3310; }
[data-theme="dark"] .wb-2 { color: #60A5FA; background: rgba(30,58,95,0.9); border-color: #1E3A5F; }
[data-theme="dark"] .wb-3 { color: #4ADE80; background: rgba(20,83,45,0.9); border-color: #14532D; }
[data-theme="dark"] .wb-4 { color: #A78BFA; background: rgba(46,16,101,0.9); border-color: #2E1065; }
[data-theme="dark"] .wb-5 { color: #F472B6; background: rgba(80,20,55,0.9); border-color: #501437; }
[data-theme="dark"] .wb-6 { color: #22D3EE; background: rgba(14,60,75,0.9); border-color: #0E3C4B; }
[data-theme="dark"] .landing-bottom-cta {
    background: linear-gradient(135deg, #111827 0%, #1F2937 50%, #1E3A5F 100%);
}

/* ============================================================
   Theme switcher
   ============================================================ */

.theme-switcher {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 99px;
    padding: 2px;
    gap: 0;
    background: var(--bg-content);
}

.theme-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
    padding: 0;
}

.theme-btn:hover {
    color: var(--text-primary);
}

.theme-btn.active {
    background: var(--bg-card);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.theme-btn svg {
    width: 16px;
    height: 16px;
}

.sidebar-footer .theme-switcher {
    margin-bottom: 0.75rem;
}

.landing-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.auth-theme-switcher {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
}
