/* ==========================================================================
   DESIGN SYSTEM - TASTE-SKILL IMPLEMENTATION
   Vibe: Premium Dark Tech, Focused & Cognitive-optimized
   Dials: DESIGN_VARIANCE: 4 | MOTION_INTENSITY: 5 | VISUAL_DENSITY: 5
   ========================================================================== */

/* Design Tokens */
:root {
    --bg-color: #f3f2ed; /* Warm parchment bg matching the Hogwarts background */
    --card-bg: #ffffff; /* White lacquer card */
    --card-bg-hover: #f1f5f9;
    --border-color: #e5e7eb; /* default hairline border */
    --border-hover: rgba(0, 0, 0, 0.12);
    
    /* Typography Colors */
    --text-primary: #000000; /* Absolute black */
    --text-secondary: #505050; /* Slate secondary gray */
    --text-muted: #64748b; /* slate-500 for premium readability */
    
    /* Accents - High-contrast specs */
    --accent-color: #000000; /* Absolute black primary brand anchor */
    --accent-hover: #1a1a1a;
    --accent-alpha-10: rgba(0, 0, 0, 0.08);
    --accent-alpha-20: rgba(0, 0, 0, 0.15);
    
    /* Secondary Accent - Blue for secondary progress indicators */
    --secondary-accent: #3b82f6; /* Blue accent */
    --secondary-hover: #2563eb;
    --secondary-alpha-10: rgba(59, 130, 246, 0.08);
    
    --sky-accent: #92cfff;
    
    /* Feedback Accents */
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --danger-alpha-10: rgba(239, 68, 68, 0.08);
    
    /* Layout Constants */
    --sidebar-width: 280px;
    --radius-lg: 28px; /* 28px corners for cards */
    --radius-md: 18px;
    --radius-sm: 10px;
    --radius-pill: 9999px;
    
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.06), 0 8px 16px rgba(0, 0, 0, 0.02);
    --shadow-xl: 0 30px 60px rgba(0, 0, 0, 0.08), 0 12px 24px rgba(0, 0, 0, 0.03);
    --shadow-glow: 0 0 24px rgba(0, 0, 0, 0.06);
    
    /* Easing */
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.15);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Schibsted Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f0f0ee; /* From prompt */
    color: var(--text-primary);
    min-height: 100dvh;
}

button, input, select {
    font-family: inherit;
    color: inherit;
}

/* Utilities */
.hidden {
    display: none !important;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.items-center { align-items: center; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.w-full { width: 100%; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.pb-1 { padding-bottom: 4px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-base { font-size: 16px; }
.text-lg { font-size: 18px; }
.text-center { text-align: center; }
.font-semibold { font-weight: 600; }
.text-gray-400 { color: var(--text-secondary); }
.text-gray-500 { color: var(--text-muted); }
.text-danger { color: var(--danger-color) !important; }

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--accent-color);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(0);
    opacity: 1;
    transition: transform 0.4s var(--ease-spring), opacity 0.3s ease;
}

.toast.hidden {
    transform: translateY(100px);
    opacity: 0;
    pointer-events: none;
}

.toast i {
    color: var(--accent-color);
    font-size: 20px;
}

/* App Layout Structure */
.app-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    background-color: transparent; /* fully transparent layout to show video background */
    overflow-x: hidden;
    position: relative;
    z-index: 1;
}

/* Background Video Placement */
#bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    pointer-events: none;
}


/* Holographic Floating Nav Island */
.holo-nav-island {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 40px;
    padding: 12px 32px;
    gap: 40px;
    z-index: 1000;
    box-shadow: 0 20px 40px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.6);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
}

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

.nav-item {
    background: transparent;
    border: none;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: color 0.3s ease;
    position: relative;
    padding: 4px 0;
}

.nav-item:hover {
    color: #0f172a;
}

.nav-item.active {
    color: #0f172a;
    font-weight: 700;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--accent-color);
    border-radius: 4px;
    box-shadow: 0 0 8px var(--accent-color);
}

.nav-item .badge {
    position: absolute;
    top: -8px;
    right: -12px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

.nav-tools {
    display: flex;
    gap: 20px;
    align-items: center;
}

.btn-holo-icon {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #64748b;
    cursor: pointer;
    transition: color 0.3s ease;
}

.btn-holo-icon:hover {
    color: #0f172a;
}

.holo-select {
    background: transparent;
    border: none;
    color: #0f172a;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    text-align: center;
    padding: 0;
}

/* Mobile Holographic Dock */
@media (max-width: 850px) {
    .holo-nav-island {
        top: auto;
        bottom: 24px;
        left: 16px;
        transform: none; /* VERY IMPORTANT: Removes containing block so .nav-tools can escape to viewport */
        width: calc(100% - 32px);
        padding: 12px 16px;
        justify-content: center;
        gap: 0;
        border-radius: 30px;
    }
    
    .nav-brand {
        display: none;
    }
    
    .nav-links {
        gap: 0;
        width: 100%;
        justify-content: space-between;
        overflow-x: visible;
    }
    .nav-btn {
        padding: 10px 8px;
        font-size: 14px;
        letter-spacing: -0.5px;
    }
    
    .nav-tools {
        position: fixed;
        top: 20px;
        right: 16px;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border: 1px solid rgba(255, 255, 255, 0.6);
        box-shadow: 0 8px 24px rgba(0,0,0,0.06);
        border-radius: 24px;
        padding: 8px 12px;
        gap: 12px;
        margin: 0;
        z-index: 1000;
    }
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 120px 40px 40px 40px;
    overflow-y: visible;
    height: auto;
    position: relative;
    background: transparent;
}

/* Content Header */
.content-header {
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    margin-bottom: 32px;
    margin-top: 10px;
}

.header-title-area {
    display: block;
}

.header-title-area h2 {
    font-size: 2.25rem;
    line-height: 1.15;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 8px;
    color: #0f172a;
}

.header-title-area p {
    font-size: 1.125rem;
    color: #475569;
    font-weight: 400;
}

/* Tab Panes */
.tab-pane {
    display: none;
    flex: 1;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
}

/* Buttons Styling */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px; /* Adjusted padding for pill button elegance */
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
    border: 1px solid transparent;
}

.btn:active {
    transform: scale(0.96) translateY(0.5px);
}

.btn-primary {
    background-color: var(--accent-color);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(32, 42, 54, 0.12);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 12px 28px rgba(32, 42, 54, 0.20);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #e5e7eb; /* Premium light gray style */
    color: #374151;
    border-color: transparent;
}

.btn-secondary:hover {
    background-color: #d1d5db;
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.12);
}

.btn-danger:hover {
    background-color: var(--danger-hover);
    box-shadow: 0 12px 28px rgba(239, 68, 68, 0.20);
    transform: translateY(-2px);
}

.btn-icon i {
    font-size: 18px;
}

/* Bento Grid Layout - Clean 4 Column */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-flow: row dense;
    gap: 20px;
    width: 100%;
}


/* Base Bento Box Styles - Spatial VisionOS Style */
.bento-box {
    border-radius: 36px;
    padding: 36px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: rgba(255, 255, 255, 0.35) !important; 
    border: none !important; /* NO BORDER for Spatial feel */
    backdrop-filter: blur(40px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(150%) !important;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
    transition: transform 350ms cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 350ms ease, background-color 200ms ease !important;
}

.bento-box:hover {
    transform: translateY(-4px) scale(1.01) !important;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
    background: rgba(255, 255, 255, 0.45) !important;
}

.bento-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    border-bottom: none; /* NO LINE */
    padding-bottom: 0;
}

.bento-header i {
    display: none; /* Hide icons for cinematic typography */
}

.bento-header h3 {
    font-size: 28px; /* Massive! */
    font-weight: 300; /* Thin, elegant */
    letter-spacing: -0.5px;
    color: rgba(0,0,0,0.85);
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
}

/* Bento Card Background Diversity */
#bento-daily-target, #bento-review-due, #bento-vocab-story {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(0, 0, 0, 0.06);
}
#bento-daily-target:hover, #bento-review-due:hover, #bento-vocab-story:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-xl);
}

.bento-large {
    grid-column: span 2;
    grid-row: span 2;
    min-height: 304px;
}

.bento-medium {
    grid-column: span 2;
    grid-row: span 1;
}

.bento-wide {
    grid-column: span 4;
    grid-row: span 1;
}

#bento-daily-target .bento-body {
    flex: 1;
    display: flex;
    align-items: center;
}

.bento-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.bento-header i {
    font-size: 20px;
    color: var(--accent-color);
}

.bento-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Bento Content specific - Daily Progress */
.target-circle-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring-circle-bg {
    stroke: #e2e8f0;
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.6s var(--ease-smooth);
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.target-text {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.target-text .learned-num {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.target-text .divider {
    font-size: 10px;
    color: var(--text-muted);
    margin: 2px 0;
}

.target-text .target-num {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Dual mode scaling for side-by-side rings */
.target-circle-container.dual-mode .learned-num {
    font-size: 20px;
}

.target-circle-container.dual-mode .target-num {
    font-size: 11px;
}

.target-circle-container.dual-mode .divider {
    font-size: 8px;
    margin: 1px 0;
}

/* Bento Content specific - Review */
.due-number-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.due-number {
    font-size: 54px;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: -2px;
    line-height: 1;
}

.due-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

/* Bento Content specific - Stages */
#bento-stats-levels .bento-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-top: 10px;
    padding-bottom: 4px;
}

.stage-bar-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stage-bar-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
}

.stage-bar-info span:first-child {
    color: var(--text-secondary);
}

.stage-bar-info span:last-child {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--text-primary);
}

.stage-bar-bg {
    height: 8px;
    background-color: var(--border-color);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.stage-bar-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    transition: width 0.6s var(--ease-smooth);
}

.stage-bar-fill.fill-0 { background-color: var(--border-color); }
.stage-bar-fill.fill-active { background-color: #1d4ed8; }
.stage-bar-fill.fill-solid { background-color: #b45309; }
.stage-bar-fill.fill-mastered { background-color: var(--accent-color); }
.stage-bar-fill.fill-solid { background-color: var(--secondary-accent); }

/* Activity Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(30, 1fr);
    gap: 6px;
}

.calendar-grid-cell {
    aspect-ratio: 1/1;
    background-color: #e2e8f0;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s var(--ease-smooth), background-color 0.3s ease;
}

.calendar-grid-cell:hover {
    transform: scale(1.15);
    z-index: 10;
}

.calendar-grid-cell.level-0 { background-color: #f1f5f9; }
.calendar-grid-cell.level-1 { background-color: hsla(43, 60%, 36%, 0.2); }
.calendar-grid-cell.level-2 { background-color: hsla(43, 60%, 36%, 0.5); }
.calendar-grid-cell.level-3 { background-color: hsla(43, 60%, 36%, 0.9); }

/* Tooltip for Calendar */
.calendar-grid-cell::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    background-color: #1e293b;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
    box-shadow: var(--shadow-md);
    transition: opacity 0.15s ease;
}

.calendar-grid-cell:hover::after {
    opacity: 1;
}

.legend-box {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}
.legend-box.level-0 { background-color: #f1f5f9; }
.legend-box.level-1 { background-color: hsla(43, 60%, 36%, 0.2); }
.legend-box.level-2 { background-color: hsla(43, 60%, 36%, 0.5); }
.legend-box.level-3 { background-color: hsla(43, 60%, 36%, 0.9); }

.kbd-shortcut {
    margin-left: 6px;
    font-size: 11px;
    opacity: 0.8;
}

.calendar-info-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
    text-align: center;
}

/* Flashcard Sessions Container */
.session-container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    padding-top: 16px;
}

.session-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    padding: 16px 40px;
    border-radius: 40px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    border: 1px solid rgba(255, 255, 255, 0.8);
    margin: 0 auto;
    width: max-content;
}

.session-progress-info {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    font-size: 13px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 500;
}

.session-progress-bar-bg {
    width: 100%;
    max-width: 400px;
    height: 2px;
    background-color: rgba(0,0,0,0.1);
    border-radius: 2px;
    overflow: hidden;
}

.session-progress-bar {
    height: 100%;
    background-color: var(--accent-color);
    border-radius: 2px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Flashcard 3D Hologram Card */
.flashcard-container {
    perspective: 1200px;
    width: 100%;
    height: 520px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.flashcard-container:hover {
    transform: translateY(-4px);
}

.flashcard {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(60px) saturate(200%);
    -webkit-backdrop-filter: blur(60px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 40px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 32px 64px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.8);
    transition: box-shadow 0.4s ease;
}

.flashcard-container:hover .card-face {
    box-shadow: 0 40px 80px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.9);
}

.card-face.card-back {
    transform: rotateY(180deg);
    justify-content: flex-start;
    align-items: stretch;
}

.card-tag {
    position: absolute;
    top: 32px;
    left: 40px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #94a3b8;
}

.review-stage-badge {
    position: absolute;
    top: 32px;
    right: 40px;
    font-size: 11px;
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 1px;
}

.card-english-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
}

.card-english {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    font-size: 64px;
    font-weight: 200;
    letter-spacing: -2px;
    line-height: 1;
    text-align: center;
    color: #0f172a;
}

.btn-voice-round {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill);
    background-color: var(--border-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-smooth);
}

.btn-voice-round:hover {
    background-color: var(--border-hover);
}

.btn-voice-round i {
    font-size: 18px;
    color: var(--text-primary);
}

.card-hint {
    position: absolute;
    bottom: 24px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Card Back specifics */
.card-back-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(0,0,0,0.05);
    padding-bottom: 24px;
    margin-bottom: 32px;
}

.card-back-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.card-back .card-tag {
    position: static;
    font-size: 11px;
}

.card-english-mini {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 1px;
    color: #64748b;
    margin-left: auto;
    margin-right: 90px;
    text-align: right;
    word-break: break-word;
}

.card-back-body {
    display: flex;
    flex-direction: column;
    gap: 32px;
    overflow-y: auto;
    flex: 1;
}

.card-chinese {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    font-size: 32px;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: 1px;
}

.explanation-container {
    background: transparent;
    padding: 0;
    border: none;
}

.explanation-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 12px;
}

.card-explanation {
    font-size: 16px;
    line-height: 1.6;
    color: #334155;
    max-width: 600px;
    white-space: pre-wrap;
    font-family: "Georgia", "Times New Roman", serif;
}

.related-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.related-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.related-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.related-tag {
    font-size: 11px;
    background-color: #e2e8f0;
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
}

.related-tag:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Card control panels */
.card-controls {
    display: flex;
    gap: 16px;
    width: 100%;
}

.controls-front {
    width: 100%;
}

.controls-back {
    display: flex;
    width: 100%;
    gap: 16px;
}

.shortcuts-legend {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
}

/* Empty states */
.empty-state-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background-color: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.empty-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-pill);
    background-color: var(--accent-alpha-10);
    border: 1px solid var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.empty-icon i {
    font-size: 36px;
    color: var(--accent-color);
}

.empty-state-view h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-state-view p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 300px;
    line-height: 1.5;
}

/* Dictionary layout */
.dictionary-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.dictionary-header {
    display: flex;
    gap: 16px;
}

.search-box-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    font-size: 18px;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 12px 40px 12px 48px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s var(--ease-smooth);
}

.search-input:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px hsla(43, 60%, 36%, 0.12);
}

.select-filter {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 12px 20px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: all 0.2s var(--ease-smooth);
}

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

.select-filter:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px hsla(43, 60%, 36%, 0.12);
}

.select-filter:active {
    transform: scale(0.98);
}

.search-stats {
    font-size: 12px;
    color: var(--text-muted);
}

.dict-list-wrapper {
    flex: 1;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.dict-list {
    overflow-y: auto;
    max-height: calc(100dvh - 300px);
}

.dict-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.4s ease;
    background: transparent;
}

.dict-row:hover {
    padding-left: 24px;
    padding-right: 24px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    border-bottom-color: transparent;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
}

.dict-row:last-child {
    border-bottom: none;
}

.dict-row-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
    margin-right: 32px;
}

.card-english {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    font-size: clamp(32px, 6vw, 64px);
    font-weight: 200;
    line-height: 1;
    letter-spacing: -2px;
    color: #0f172a;
    word-break: break-word;
    text-align: center;
}

.dict-row-english {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    font-size: 24px;
    font-weight: 400;
    letter-spacing: -0.5px;
    color: #0f172a;
    line-height: 1.2;
}

.dict-row-chinese {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #64748b;
}

.dict-row-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.dict-row-page {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #94a3b8;
    background: transparent;
}

.dict-row-stage {
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: transparent !important;
    border: 1px solid currentColor !important;
}

.dict-row-stage.stage-0 { color: #94a3b8 !important; }
.dict-row-stage.stage-active { color: #3b82f6 !important; }
.dict-row-stage.stage-solid { color: #f59e0b !important; }
.dict-row-stage.stage-mastered { color: #10b981 !important; }

/* Settings screen */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.settings-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
}

.setting-item:first-of-type {
    padding-top: 0;
}

.setting-item:last-of-type {
    padding-bottom: 0;
}

.setting-item.border-b {
    border-bottom: 1px solid var(--border-color);
}

.setting-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.setting-info p {
    font-size: 12px;
    color: var(--text-secondary);
    max-width: 420px;
    line-height: 1.4;
}

.input-number {
    background-color: hsl(210, 20%, 96%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    width: 80px;
    text-align: center;
    outline: none;
    font-size: 14px;
    transition: all 0.2s var(--ease-smooth);
}

.input-number:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px hsla(43, 60%, 36%, 0.12);
}

/* Switch Toggle Styling */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .3s;
    border-radius: 34px;
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.switch-toggle input:checked + .slider-toggle {
    background-color: var(--accent-color);
}

.switch-toggle input:checked + .slider-toggle:before {
    transform: translateX(20px);
}

.file-input-hidden {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Modal details styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(3, 7, 18, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background-color: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 550px;
    padding: 32px;
    box-shadow: var(--shadow-xl);
    position: relative;
    transform: scale(1);
    transition: transform 0.3s var(--ease-spring);
}

.modal-overlay.hidden .modal-card {
    transform: scale(0.9);
}

.modal-close-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

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

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 18px;
    margin-bottom: 20px;
}

.modal-header .card-tag {
    position: static;
    display: block;
    margin-bottom: 12px;
}

.modal-english {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.7px;
    line-height: 1.2;
}

.modal-status-tag {
    display: inline-block;
    font-size: 11px;
    background-color: var(--border-color);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    margin-top: 8px;
    font-weight: 500;
}

.modal-chinese {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 14px;
}

.modal-explanation {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.modal-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    background-color: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 20px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

.meta-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Glassmorphism Button */
.btn-glass {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 32px rgba(0,0,0,0.05);
    color: #475569;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.08);
}

/* Responsive Overrides */
@media (max-width: 1200px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bento-wide {
        grid-column: span 2;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(15, 1fr);
    }
}

@media (max-width: 850px) {
    .app-layout {
        height: auto;
        overflow: visible;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .sidebar {
        width: 100%;
        max-width: 100%;
        height: auto;
        position: relative;
        padding: 12px 24px;
        border-right: none;
        border-bottom: none;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-sizing: border-box;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .brand-section {
        margin-bottom: 0;
    }
    
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 4px;
        gap: 8px;
        width: 100%;
        justify-content: flex-start;
    }
    
    .nav-btn {
        padding: 8px 14px;
        flex-shrink: 0;
    }
    
    .sidebar-footer {
        display: none;
    }
    
    .main-content {
        padding: 120px 24px 120px 24px;
        height: auto;
        overflow-y: visible;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .content-header {
        display: flex !important;
        justify-content: flex-end;
        align-items: center;
        width: 100%;
        padding: 0 0 16px 0;
        margin-bottom: 8px;
    }
}

@media (max-width: 600px) {
    /* Layout & Sidebar overrides */
    .sidebar {
        padding: 12px 16px;
    }
    
    .brand-section {
        margin-bottom: 12px;
        justify-content: center;
    }
    
    .brand-logo {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    .brand-info h1 {
        font-size: 16px;
    }
    
    .brand-info span {
        font-size: 10px;
    }
    
    .nav-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .main-content {
        padding: 80px 16px 120px 16px !important;
    }

    /* Content Header overrides */
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 16px;
    }
    
    .header-actions {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }
    
    .wordbank-select-container, .wordbank-select {
        flex: 1;
        max-width: none;
        width: 100%;
    }
    
    #header-pronounce-toggle {
        flex-shrink: 0;
    }

    /* Bento Grid overrides */
    .bento-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .bento-large, .bento-medium, .bento-wide {
        grid-column: span 1;
    }
    
    .bento-box {
        padding: 16px;
    }
    
    #bento-daily-target .bento-body {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
    }
    
    .target-info {
        align-items: center;
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    #btn-start-learn-quick {
        width: 100%;
        justify-content: center;
    }
    
    .due-number-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    #btn-start-review-quick {
        width: 100%;
        justify-content: center;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(10, 1fr);
    }

    /* Session & Flashcard overrides */
    .session-container {
        gap: 16px;
    }
    
    .flashcard-container {
        height: 340px;
    }
    
    .card-face {
        padding: 20px;
    }
    
    .card-english {
        font-size: 22px;
    }
    
    .card-chinese {
        font-size: 20px;
    }
    
    .card-explanation {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .explanation-container {
        padding: 10px 12px;
    }
    
    .card-controls {
        gap: 12px;
    }
    
    .card-controls button {
        padding: 12px;
        font-size: 14px;
    }

    /* Dictionary List overrides */
    .dictionary-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .select-filter {
        width: 100%;
    }
    
    .dict-row {
        padding: 12px 16px;
    }
    
    .dict-row-english {
        font-size: 15px;
    }
    
    .dict-row-chinese {
        font-size: 12px;
    }
    
    .dict-row-right {
        gap: 8px;
    }

    /* Modal Popup overrides */
    .modal-card {
        padding: 20px;
        max-height: 80vh;
        overflow-y: auto;
        max-width: 95%;
        margin: 0 10px;
    }
    
    .modal-english {
        font-size: 20px;
    }
    
    .modal-chinese {
        font-size: 18px;
    }
    
    .modal-meta-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .btn-voice-round {
        width: 32px;
        height: 32px;
    }
}

/* Clear Search Icon */
.clear-search-icon {
    position: absolute;
    right: 16px;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.clear-search-icon:hover {
    color: var(--accent-color);
}

/* Search Results Highlighting */
.search-highlight {
    background-color: rgba(212, 163, 89, 0.18);
    color: var(--accent-color);
    font-weight: 600;
    border-radius: 2px;
    padding: 0 2px;
}

/* Dictionary Row Preview Snippet */
.dict-row-preview {
    font-family: "Georgia", "Times New Roman", serif;
    font-size: 14px;
    font-style: italic;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 4px;
}

/* No Results State */
.no-results-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    text-align: center;
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
    margin: 24px;
}

.no-results-icon {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.no-results-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.no-results-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    max-width: 340px;
    line-height: 1.5;
}

/* Header Actions Layout & Wordbank Selector */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wordbank-select {
    padding: 10px 32px 10px 16px;
    font-weight: 500;
    border-radius: var(--radius-md);
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    height: 42px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
}

.wordbank-select:hover {
    border-color: var(--accent-color);
}

.wordbank-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-alpha-20);
}

/* User Role Selector Dropdown */
.user-select {
    padding: 10px 32px 10px 32px;
    font-weight: 600;
    border-radius: var(--radius-md);
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    height: 42px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: 
        url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E"),
        url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: left 12px center, right 12px center;
    background-size: 14px, 12px;
}

.user-select:hover {
    border-color: var(--accent-color);
}

.user-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-alpha-20);
}

.family-progress-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    width: 100%;
    margin-top: 8px;
}

#bento-family-progress .family-progress-grid {
    grid-template-columns: 1fr;
    gap: 16px;
}

.family-member-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: var(--bg-color);
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all 300ms var(--ease-spring);
}

.family-member-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.member-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.member-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.member-name i.ph-gender-male {
    color: #3b82f6;
    font-size: 16px;
}

.member-name i.ph-gender-female {
    color: #ec4899;
    font-size: 16px;
}

.member-progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, monospace;
}

.member-bar-bg {
    height: 6px;
    background-color: var(--border-color);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.member-bar-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.member-bar-fill.fill-soap {
    background-color: var(--accent-color);
}

.member-bar-fill.fill-wife {
    background-color: var(--secondary-accent);
}

.member-dict-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent-color);
    background-color: var(--accent-alpha-10);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    margin-left: 10px;
    border: 1px solid var(--accent-alpha-20);
    display: inline-flex;
    align-items: center;
}

.member-name {
    flex-wrap: wrap;
    row-gap: 4px;
}


/* Mobile responsive additions */
@media (max-width: 600px) {
    /* Fixed Bottom Tab Bar Navigation */
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        height: calc(60px + env(safe-area-inset-bottom, 0px));
        width: 100%;
        z-index: 1000;
        padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px)) 8px;
        background-color: var(--card-bg);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        border-top: 1px solid var(--border-color);
        border-bottom: none;
    }

    .app-layout {
        flex-direction: column;
    }

    .brand-section {
        display: none !important; /* Hide brand logo in bottom bar to save space */
    }

    .nav-actions {
        display: none !important; /* Hide user/wordbank selectors from mobile bottom tab bar */
    }

    .nav-menu {
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        width: 100%;
        height: 100%;
        padding: 0;
        margin: 0;
        overflow: hidden;
        gap: 0;
    }

    .nav-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 4px 0;
        font-size: 10px;
        background: transparent;
        border: none;
        color: var(--text-secondary);
        gap: 2px;
        border-radius: 8px;
        flex-shrink: 0;
        height: auto;
        min-height: 48px; /* good touch target size */
    }

    .nav-btn i {
        font-size: 20px;
        margin: 0;
    }

    .nav-btn.active {
        color: var(--accent-color) !important;
        background: transparent !important;
        font-weight: 600;
    }

    .nav-btn.active i, .nav-btn.active span {
        color: var(--accent-color) !important;
    }

    /* Disable hover slide translate on mobile bottom bar */
    .nav-btn:hover {
        transform: none !important;
        color: var(--text-primary) !important;
    }

    .nav-btn #review-badge-count {
        position: absolute;
        top: 2px;
        right: calc(50% - 22px);
        font-size: 9px;
        padding: 1px 5px;
        min-width: 16px;
        height: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-pill);
    }

    /* Padding offset to keep content above bottom nav bar */
    .main-content {
        padding: 80px 16px 120px 16px !important;
        height: auto;
        overflow-y: visible;
    }

    /* Header Actions Compression */
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 12px;
    }
    
    .header-actions {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
    }

    .user-select-container {
        flex: 1;
        max-width: none;
    }

    .user-select {
        padding: 8px 18px 8px 24px;
        font-size: 13px;
        height: 38px;
        width: 100%;
        background-position: left 8px center, right 8px center;
        background-size: 12px, 10px;
    }

    .wordbank-select-container {
        flex: 1.5;
        max-width: none;
    }

    .wordbank-select {
        padding: 8px 22px 8px 8px;
        font-size: 13px;
        height: 38px;
        width: 100%;
        background-position: right 8px center;
        background-size: 12px;
    }

    #header-pronounce-toggle {
        height: 38px;
        width: 38px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    #header-pronounce-toggle span {
        display: none !important; /* hide button text */
    }

    /* Hide keyboard shortcut hints on mobile */
    .kbd-shortcut {
        display: none !important;
    }

    .shortcuts-legend {
        display: none !important;
    }

    /* Hide dict row preview snippet on mobile for cleaner look */
    .dict-row-preview {
        display: none !important;
    }

    /* Modal Sizing Overrides */
    .modal-card {
        padding: 20px;
        max-height: 80vh;
        overflow-y: auto;
        max-width: 95%;
        margin: 0 10px;
    }

    .modal-close-btn {
        top: 14px;
        right: 14px;
        padding: 8px; /* larger tap area */
    }

    /* Toast Position Override */
    .toast {
        right: 16px;
        left: 16px;
        bottom: 76px; /* positioned above bottom nav bar */
        justify-content: center;
        text-align: center;
    }

    .family-progress-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .family-member-card {
        padding: 14px;
    }
}

/* Vocabulary Story Bento Box Styles */
#bento-vocab-story {
    margin-top: 12px;
}

.story-controls {
    display: flex;
    gap: 8px;
}

.btn-story-toggle {
    background-color: var(--card-bg);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease-smooth);
}

.btn-story-toggle:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-story-toggle.active {
    background-color: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
}

.story-metadata {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.story-word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.story-word-badge {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--accent-color);
    border: 1px dashed rgba(99, 102, 241, 0.3);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease-smooth);
}

.story-word-badge:hover {
    background-color: rgba(99, 102, 241, 0.2);
}

.story-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 12px;
    color: var(--text-main);
}

.story-paragraphs {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 12px;
    line-height: 1.7;
    font-size: 0.95rem;
}

.story-paragraph-pair {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 12px;
    border-bottom: 1px dotted var(--border-color);
}

.story-paragraph-pair:last-child {
    border-bottom: none;
}

.story-en-text {
    font-family: Georgia, Cambria, "Times New Roman", Times, serif;
    color: var(--text-primary);
    font-size: 1.05rem;
    line-height: 1.8;
    letter-spacing: -0.01em;
}

.story-zh-text {
    font-family: Georgia, "Noto Serif CJK SC", "Songti SC", STSong, serif;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.8;
}

/* Highlight studied words in stories */
.story-highlight {
    color: var(--accent-color);
    font-weight: 700;
    border-bottom: 1.5px dashed var(--accent-color);
    cursor: help;
    transition: all 0.2s var(--ease-smooth);
    display: inline;
    padding: 0 2px 1px 2px;
    border-radius: 2px;
}

.story-highlight:hover {
    background-color: var(--accent-alpha-20);
    color: var(--accent-hover);
}

/* Responsive adjustment for Mobile viewports */
@media (max-width: 600px) {
    .btn-story-toggle {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    .story-title {
        font-size: 1.1rem;
    }
    .story-paragraphs {
        font-size: 0.9rem;
    }
}

/* Learned words list inside empty state */
.learned-words-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--body-bg);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.learned-word-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}
.learned-word-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
}
.learned-word-eng {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
}
.learned-word-zh {
    font-size: 12px;
    color: var(--text-secondary);
}
.btn-learned-voice {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 16px;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
.btn-learned-voice:hover {
    background-color: var(--accent-alpha-10);
}

/* /* Outer Containers Glassmorphism Styling (Premium Glass) */
.settings-card, 
.dict-list-wrapper, 
.search-container-card {
    background: rgba(255, 255, 255, 0.35) !important;
    backdrop-filter: blur(40px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(150%) !important;
    border: none !important;
    border-radius: 36px !important;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

/* Removed nested white card styles for premium unified glassmorphism */
.bento-body-card,
.settings-body-card {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
}

/* Settings Body Card Content styling for light background readability */
.settings-body-card .setting-item {
    border-color: #f1f5f9 !important;
}
.settings-body-card .setting-item h4 {
    color: #1e293b !important;
}
.settings-body-card .setting-item p {
    color: #64748b !important;
}

/* Inner elements styling overrides for nested white cards */
.family-member-card {
    background: #f8fafc !important;
    color: #000000 !important;
    border: 1px solid #f1f5f9 !important;
    box-shadow: none !important;
    border-radius: 8px;
}

#daily-progress-dual-container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.user-calendar-section {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.user-calendar-section .calendar-info-text {
    color: #64748b !important;
}

.user-calendar-section span {
    color: #1e293b !important;
}

.stage-bar-info span {
    color: #334155 !important;
    font-weight: 500;
}

.bento-body-card .story-title {
    color: #1e293b !important;
}
.bento-body-card .story-en-text {
    color: #1e293b !important;
}
.bento-body-card .story-zh-text {
    color: #475569 !important;
}
.bento-body-card .story-empty-state p {
    color: #475569 !important;
}

/* Other solid white cards (not nested in white cards) */
.dict-row,
.card-face {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: var(--shadow-md) !important;
}

.dict-row:hover {
    background: #f1f5f9 !important;
}

/* Dictionary result stats text contrast & background pill fix */
.search-stats {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    padding: 6px 16px !important;
    border-radius: var(--radius-pill) !important;
    display: inline-block !important;
    margin: 12px 0 16px 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02) !important;
}

.search-stats span {
    color: #475569 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
}
.search-stats #dict-results-count {
    color: #0f172a !important;
    font-weight: 700 !important;
}


/* Dictionary Search Widget Styling */
.search-container-card .bento-header h3,
.search-container-card .bento-header i {
    color: #0f172a !important;
}

.search-bottom-row {
    padding: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 16px !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.search-bottom-row .search-box-wrapper {
    flex: 1 !important;
}

.search-bottom-row .search-input {
    background: transparent !important;
    border: none !important;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 0 !important; /* sleek line */
    color: #000000 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    font-size: 24px !important;
    font-weight: 300 !important;
    padding: 12px 0 !important;
    transition: border-color 0.3s ease !important;
}

.search-bottom-row .search-input:focus {
    border-bottom: 2px solid var(--accent-color) !important;
    box-shadow: none !important;
}

/* Cinematic HUD Numbers */
#daily-learned-count, #due-vocab-count {
    font-size: 80px !important;
    font-weight: 200 !important;
    line-height: 1 !important;
    letter-spacing: -4px !important;
    background: linear-gradient(135deg, var(--accent-color), #818cf8) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    text-shadow: 0 12px 32px rgba(99, 102, 241, 0.4) !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif !important;
    display: inline-block;
}

.due-label, .target-text {
    font-size: 14px !important;
    font-weight: 500 !important;
    letter-spacing: 3px !important;
    text-transform: uppercase !important;
    color: rgba(0,0,0,0.5) !important;
    margin-top: 12px !important;
    display: block;
}

.search-bottom-row .select-filter {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #000000 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.search-bottom-row .search-input:focus,
.search-bottom-row .select-filter:focus {
    border-color: var(--accent-color) !important;
    background: #ffffff !important;
}

.search-bottom-row .search-icon {
    color: #64748b !important;
}

.brand-logo-text {
    font-family: 'Ma Shan Zheng', 'Kaiti', 'STKaiti', cursive, sans-serif !important;
    font-size: 34px !important;
    font-weight: 400 !important;
    letter-spacing: 3px !important;
    background: linear-gradient(135deg, #1e293b 0%, #000000 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    filter: drop-shadow(0 2px 5px rgba(255, 255, 255, 0.9)) !important;
    display: inline-block !important;
}

.nav-btn {
    color: #475569 !important;
}

.nav-btn span {
    color: inherit !important;
}

.nav-btn:hover {
    color: #0f172a !important;
}

.nav-btn.active {
    color: #0f172a !important;
}

.nav-btn.active span {
    color: #0f172a !important;
}

.nav-btn.active::after {
    background-color: #0f172a !important;
    box-shadow: none !important;
}

.sidebar .select-filter {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    color: #0f172a !important;
}

/* Pronounce toggle fix */
.btn-holo-icon.btn-secondary {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.btn-holo-icon.btn-primary {
    border: none !important;
    background: transparent !important;
    color: var(--accent-color) !important;
    box-shadow: none !important;
}

/* Session progress and styling readability overrides */
/* session-progress-info override removed */

.session-progress-bar-bg {
    background-color: rgba(0, 0, 0, 0.08) !important;
}

.session-progress-bar {
    background-color: var(--secondary-accent) !important;
    box-shadow: none !important;
}

.shortcuts-legend {
    color: #64748b !important;
}

/* =========================================================
   BASE STYLES & TYPOGRAPHY
   ========================================================= */

/* Avant-Garde Scrollbar */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.25);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 23, 42, 0.15) transparent;
}

/* =========================================================
   LINEAR-STYLE MINIMALIST DASHBOARD
   ========================================================= */
:root {
    --lin-bg: transparent;
    --lin-card-bg: rgba(255, 255, 255, 0.55);
    --lin-card-backdrop: blur(24px);
    --lin-border: rgba(0, 0, 0, 0.08);
    --lin-text-primary: #171717;
    --lin-text-muted: #737373;
    --lin-soap: #2563eb; /* Mature cobalt blue */
    --lin-wife: #e11d48; /* Mature deep rose */
    --lin-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.02);
}

.lin-dashboard {
    width: 100%;
    max-width: 1280px;
    margin: 40px auto 60px;
    display: grid;
    grid-template-columns: minmax(360px, 1.2fr) minmax(0, 1.5fr);
    grid-auto-rows: min-content;
    gap: 24px;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--lin-text-primary);
    z-index: 10;
    position: relative;
}

.lin-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.4) 100%);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.lin-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #111;
    margin: 0 0 28px 0;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 10px;
}
.lin-section-title::before {
    content: '';
    display: block;
    width: 4px;
    height: 14px;
    border-radius: 2px;
    background: #111;
}
.lin-section-title .en-title {
    opacity: 0.4;
    font-weight: 600;
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Header */
.lin-header {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 28px 36px;
}
.lin-sys-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--lin-text-muted);
    font-family: ui-monospace, SFMono-Regular, monospace;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    display: block;
    text-transform: uppercase;
}
.lin-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #000 0%, #444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}
.lin-search {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 12px 20px;
    width: 280px;
    color: var(--lin-text-muted);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.lin-search:focus-within {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05), inset 0 2px 4px rgba(0,0,0,0.01);
}
.lin-search input {
    background: transparent;
    border: none;
    outline: none;
    margin-left: 8px;
    font-size: 14px;
    width: 100%;
    color: var(--lin-text-primary);
}

/* Timeline */
.lin-timeline { 
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    margin-bottom: 0;
}
.lin-timeline-content {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-top: auto;
    margin-bottom: auto;
}
.lin-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.lin-user-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}
.lin-user-details {
    display: flex;
    flex-direction: column;
    white-space: nowrap;
}
.lin-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 2px solid rgba(255, 255, 255, 0.8);
}
.lin-avatar.soap-theme { background: var(--lin-soap); }
.lin-avatar.wife-theme { background: var(--lin-wife); }

.lin-user-details .lin-name {
    font-weight: 600;
    font-size: 16px;
}
.lin-user-details .lin-stats {
    font-size: 13px;
    color: var(--lin-text-muted);
    margin-top: 2px;
}
.lin-user-data {
    display: flex;
    align-items: center;
    gap: 24px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
}
.lin-user-data::-webkit-scrollbar {
    display: none;
}

/* Radar */
.lin-radar { 
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}
.lin-radar-bars {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: auto;
    margin-bottom: auto;
}
.lin-radar-meta {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}
.lin-radar-track {
    height: 8px;
    background: rgba(0,0,0,0.04);
    border-radius: 4px;
    overflow: hidden;
}
.lin-radar-fill {
    height: 100%;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 4px;
}
.lin-radar-fill.fill-soap { background: var(--lin-soap); }
.lin-radar-fill.fill-wife { background: var(--lin-wife); }

/* Actions */
.lin-actions {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    display: flex;
    gap: 24px;
    align-self: center;
}
.lin-btn {
    flex: 1;
    border-radius: 20px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.lin-btn:active { transform: scale(0.96); }
.lin-btn.primary {
    background: var(--lin-text-primary);
    color: #fff;
    border: 1px solid var(--lin-text-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.lin-btn.primary { 
    background: #fff; 
    color: #000; 
    box-shadow: 0 16px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.06);
}
.lin-btn.primary .lin-btn-num {
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: #000;
    color: #000;
    text-shadow: none;
}
.lin-btn.primary .lin-btn-label {
    opacity: 0.6;
    color: #000;
}
.lin-btn.primary:hover {
    box-shadow: 0 24px 48px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.06);
}
.lin-btn.secondary { 
    background: rgba(255,255,255,0.6); 
    color: #111; 
    border-color: rgba(255,255,255,0.8);
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}
.lin-btn.secondary .lin-btn-num {
    background: linear-gradient(135deg, #4f46e5 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.lin-btn.secondary:hover { background: rgba(255,255,255,0.9); }

.lin-btn-label { font-size: 14px; font-weight: 600; opacity: 0.8; display: block; margin-bottom: 12px; letter-spacing: 0.02em; }
.lin-btn-num { font-size: 48px; font-weight: 800; line-height: 1; letter-spacing: -0.04em; }
.lin-btn i { font-size: 24px; opacity: 0.5; transition: transform 0.3s ease; }
.lin-btn:hover i { transform: translateX(4px); }

/* Story */
.lin-story { 
    grid-column: 1 / 3;
    grid-row: 3 / 4;
    flex: 1;
    min-height: 400px; 
    max-height: calc(100vh - 160px); 
}
.lin-story-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.lin-story-header .lin-section-title { margin-bottom: 0; }
.lin-toggles {
    display: flex;
    background: #f5f5f5;
    padding: 4px;
    border-radius: 8px;
}
.lin-toggles button {
    background: transparent;
    border: none;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    color: var(--lin-text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.lin-toggles button.active {
    background: #fff;
    color: var(--lin-text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.lin-story-body {
    flex: 1;
    overflow-y: auto;
    font-size: 16px;
    line-height: 1.8;
    color: #222;
    padding-right: 24px;
}
.lin-story-body p { 
    margin-bottom: 24px; 
}
.lin-story-body .story-en-text {
    font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    font-size: 18px;
    line-height: 1.7;
    color: #111;
    letter-spacing: -0.01em;
}
.lin-story-body .story-zh-text {
    font-size: 15px;
    color: #666;
    margin-top: -12px;
}

@media (max-width: 1024px) {
    .lin-dashboard {
        grid-template-columns: 1fr;
        gap: 16px;
        margin: 20px auto 80px;
    }
    .lin-header, .lin-actions, .lin-timeline, .lin-radar, .lin-story {
        grid-column: 1 / -1;
        grid-row: auto;
    }
    
    .lin-header { order: 1; flex-direction: column; align-items: flex-start; gap: 16px; }
    .lin-search { width: 100%; }
    
    .lin-actions { order: 2; flex-direction: column; gap: 16px; }
    .lin-btn { padding: 20px; }
    .lin-btn-num { font-size: 36px; }
    
    .lin-timeline { order: 3; }
    .lin-radar { order: 4; }
    .lin-story { order: 5; min-height: 300px; max-height: unset; padding: 24px; }
    
    .lin-card { padding: 24px 20px; border-radius: 20px; }
    .lin-title { font-size: 28px; }
}

/* Brutalist Calendar Overrides - Restored to Minimalist */
.calendar-grid-cell { outline: none !important; border: 1px solid rgba(0,0,0,0.04) !important; border-radius: 2px; }
.calendar-grid-cell.level-0 { background-color: #f5f5f5 !important; }
.calendar-grid-cell.fill-soap.level-1 { background-color: rgba(37, 99, 235, 0.2) !important; }
.calendar-grid-cell.fill-soap.level-2 { background-color: rgba(37, 99, 235, 0.5) !important; }
.calendar-grid-cell.fill-soap.level-3 { background-color: rgba(37, 99, 235, 1) !important; }
.calendar-grid-cell.fill-wife.level-1 { background-color: rgba(225, 29, 72, 0.2) !important; }
.calendar-grid-cell.fill-wife.level-2 { background-color: rgba(225, 29, 72, 0.5) !important; }
.calendar-grid-cell.fill-wife.level-3 { background-color: rgba(225, 29, 72, 1) !important; }


.holo-timeline-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #94a3b8;
}

.holo-timeline-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
}

.holo-timeline-divider {
    width: 2px;
    height: 60px;
    background: rgba(0,0,0,0.05);
    border-radius: 2px;
}

.holo-timeline-user {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 24px;
}

.holo-user-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: rgba(255,255,255,0.4);
    border-radius: 20px;
    transition: transform 0.3s ease, background 0.3s ease;
}

.holo-user-row:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.7);
}

.holo-user-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 140px;
}

.holo-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 24px;
    background: linear-gradient(135deg, #818cf8, var(--accent-color));
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 20px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.holo-user-avatar.wife {
    background: linear-gradient(135deg, #f43f5e, #ec4899);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

.holo-user-name {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.2;
}

.holo-user-stats {
    font-size: 14px;
    color: #64748b;
    font-family: ui-monospace, SFMono-Regular, monospace;
}

.holo-progress-ring-container {
    position: relative;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-circle {
    stroke-dasharray: 163.36; /* 2 * PI * 26 */
    stroke-dashoffset: 163.36;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.holo-calendar-grid {
    display: flex;
    gap: 4px;
    flex: 1;
    justify-content: flex-end;
}

.calendar-grid-cell {
    width: 8px;
    height: 8px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-grid-cell:hover {
    transform: scale(1.5);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.calendar-grid-cell.level-1 { 
    background-color: var(--accent-alpha-20); 
}
.calendar-grid-cell.level-2 { 
    background-color: var(--accent-alpha-50); 
    box-shadow: 0 0 8px var(--accent-alpha-20);
}
.calendar-grid-cell.level-3 { 
    background-color: var(--accent-color); 
    box-shadow: 0 0 12px var(--accent-alpha-50);
}

.calendar-grid-cell.fill-wife.level-1 { background-color: rgba(244, 63, 94, 0.2); }
.calendar-grid-cell.fill-wife.level-2 { background-color: rgba(244, 63, 94, 0.5); box-shadow: 0 0 8px rgba(244, 63, 94, 0.2); }
.calendar-grid-cell.fill-wife.level-3 { background-color: rgba(244, 63, 94, 1); box-shadow: 0 0 12px rgba(244, 63, 94, 0.5); }

.calendar-grid-cell[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    margin-bottom: 8px;
    pointer-events: none;
    z-index: 100;
}

/* Mobile Responsiveness for Canvas */
@media (max-width: 1024px) {
    .avant-garde-canvas {
        flex-direction: column;
        height: auto;
        overflow: visible;
        padding-bottom: 80px;
    }
    
    .hero-command-center {
        padding: 40px 24px;
        flex: none;
        width: 100%;
    }
    
    .hero-greeting {
        font-size: 64px;
    }
    
    .hero-search-line {
        width: 100%;
    }

    .hero-family-radar {
        width: 100%;
    }
    
    .editorial-story-zone {
        padding: 24px;
        mask-image: none;
        -webkit-mask-image: none;
        overflow: visible;
    }
    
    .bottom-timeline-bar {
        left: 0;
        bottom: calc(60px + env(safe-area-inset-bottom, 0px)); /* Above mobile nav */
        padding: 0 24px;
    }
}

/* =========================================================
   HOLOGRAPHIC DICTIONARY CANVAS
   ========================================================= */

.holo-dictionary-canvas {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 120px);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 40px;
    gap: 40px;
}

.holo-search-hero {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.holo-search-wrapper {
    position: relative;
    width: 100%;
}

.holo-massive-search {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(0,0,0,0.1);
    font-size: 48px;
    font-weight: 200;
    color: #0f172a;
    padding: 16px 0;
    outline: none;
    transition: border-color 0.4s ease;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
}

.holo-massive-search::placeholder {
    color: rgba(15, 23, 42, 0.2);
}

.holo-massive-search:focus {
    border-bottom-color: var(--accent-color);
}

.holo-filters {
    display: flex;
    align-items: center;
    gap: 32px;
}

.holo-select-large {
    background: transparent;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: #64748b;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    padding-right: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: 16px;
}

.holo-results-count {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-color);
}

.holo-typographic-scroll {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 80px;
}

/* =========================================================
   HOLOGRAPHIC SETTINGS CANVAS
   ========================================================= */

.holo-settings-canvas {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.holo-settings-group {
    display: flex;
    flex-direction: column;
    gap: 32px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: 30px;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 24px 48px rgba(0,0,0,0.05);
}

.holo-settings-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #94a3b8;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    padding-bottom: 16px;
}

.holo-settings-group.danger-zone .holo-settings-title {
    color: #ef4444;
}

.holo-setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.holo-setting-info h4 {
    font-size: 20px;
    font-weight: 300;
    color: #0f172a;
    margin-bottom: 4px;
}

.holo-setting-info p {
    font-size: 14px;
    color: #64748b;
}

.holo-input-number {
    width: 60px;
    background: transparent;
    border: none;
    border-bottom: 2px solid #cbd5e1;
    font-size: 24px;
    font-weight: 300;
    color: #0f172a;
    text-align: center;
    outline: none;
    transition: border-color 0.3s ease;
}

.holo-input-number:focus {
    border-bottom-color: var(--accent-color);
}

.holo-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.holo-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.holo-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.1);
    border-radius: 24px;
    transition: .4s;
}

.holo-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .holo-slider {
    background-color: var(--accent-color);
}

input:checked + .holo-slider:before {
    transform: translateX(24px);
}

.holo-setting-actions {
    display: flex;
    gap: 12px;
}

.btn-holo {
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-holo.outline {
    border: 1px solid #cbd5e1;
    color: #475569;
}

.btn-holo.outline:hover {
    border-color: #0f172a;
    color: #0f172a;
}

.btn-holo.danger {
    background: #fef2f2;
    color: #ef4444;
}

.btn-holo.danger:hover {
    background: #ef4444;
    color: white;
}

/* =========================================================
   MOBILE RESPONSIVENESS OPTIMIZATIONS
   ========================================================= */

@media (max-width: 850px) {
    .avant-garde-canvas {
        flex-direction: column;
        padding-bottom: 20px;
    }
    
    .hero-command-center {
        width: 100%;
        padding: 20px 16px;
    }
    
    .editorial-story-zone {
        width: 100%;
        padding: 20px 16px;
    }
    
    .radar-bars {
        flex-direction: column;
        gap: 20px !important;
    }
    
    .hero-greeting {
        font-size: 48px;
    }
    
    .hero-actions-container {
        flex-direction: column;
        gap: 12px;
    }
    
    .hero-family-radar {
        padding: 16px !important;
    }
    
    .holo-dictionary-canvas {
        padding: 20px 16px;
    }
    
    .holo-massive-search {
        font-size: 32px;
    }
    
    .holo-filters {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .holo-settings-canvas {
        padding: 20px 16px;
    }
    
    .holo-settings-group {
        padding: 20px;
    }
    
    .holo-setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .flashcard {
        height: 60vh;
    }
    
    .card-english {
        font-size: 32px;
    }
}

