@import url("../src/styles/tokens.css");

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: 'WenKai';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../assets/fonts/wenkai-regular.woff2') format('woff2');
}

/* CSS Custom Properties (Design Tokens) */
:root {
    /* Color System */
    --color-white: var(--surface);
    --color-gray-50: var(--surface-subtle);
    --color-gray-100: var(--surface-subtle);
    --color-gray-200: var(--border);
    --color-gray-300: var(--border-strong);
    --color-gray-400: var(--text-tertiary);
    --color-gray-500: var(--text-secondary);
    --color-gray-600: var(--text-secondary);
    --color-gray-700: var(--text-primary);
    --color-gray-800: var(--text-primary);
    --color-gray-900: var(--text-primary);

    /* Brand Colors */
    --color-brand-primary: var(--accent);
    --color-brand-secondary: var(--danger);
    --color-brand-gradient: var(--accent);

    /* Semantic Colors */
    --color-success: var(--success);
    --color-success-bg: var(--success-subtle);
    --color-warning: var(--warning);
    --color-warning-bg: var(--warning-subtle);
    --color-error: var(--danger);
    --color-error-bg: var(--danger-subtle);
    --color-info: var(--accent);
    --color-info-bg: var(--accent-subtle);
    --color-primary: var(--accent);
    --color-danger: var(--danger);
    --color-text: var(--text-primary);
    --color-text-secondary: var(--text-secondary);
    --success-color: var(--success);
    --error-color: var(--danger);

    /* Spacing System */
    --space-xs: 0.25rem;
    /* 4px */
    --space-sm: 0.5rem;
    /* 8px */
    --space-md: 1rem;
    /* 16px */
    --space-lg: 1.5rem;
    /* 24px */
    --space-xl: 2rem;
    /* 32px */
    --space-2xl: 3rem;
    /* 48px */

    /* Font System */
    --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    --font-family-mono: 'SF Mono', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', monospace;

    /* Font Sizes */
    --font-size-xs: 0.75rem;
    /* 12px */
    --font-size-sm: 0.875rem;
    /* 14px */
    --font-size-base: 1rem;
    /* 16px */
    --font-size-lg: 1.125rem;
    /* 18px */
    --font-size-xl: 1.25rem;
    /* 20px */
    --font-size-2xl: 1.5rem;
    /* 24px */
    --font-size-3xl: 1.875rem;
    /* 30px */
    --font-size-4xl: 2.25rem;
    /* 36px */
    --font-size-5xl: 3rem;
    /* 48px */

    /* Font Weights */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;

    /* Border Radius */
    --border-radius-sm: 0.25rem;
    /* 4px */
    --border-radius-md: 0.375rem;
    /* 6px */
    --border-radius-lg: 0.5rem;
    /* 8px */
    --border-radius-xl: 0.75rem;
    /* 12px */
    --border-radius-2xl: 1rem;
    /* 16px */
    --border-radius-full: var(--radius-pill);

    /* Shadows */
    --shadow-sm: var(--elevation-1);
    --shadow-md: var(--elevation-1);
    --shadow-lg: var(--elevation-1);
    --shadow-xl: var(--elevation-1);

    /* Transitions */
    --transition-fast: 150ms ease-out;
    --transition-normal: 200ms ease-out;
    --transition-slow: 300ms ease-out;

    /* Library configuration panel */
    --library-config-bg: color-mix(in srgb, var(--surface) 74%, transparent);
    --library-config-border: color-mix(in srgb, var(--surface) 78%, transparent);
    --library-config-text: var(--text-primary);
    --library-config-meta: color-mix(in srgb, var(--text-primary) 62%, transparent);
    --library-config-item-bg: color-mix(in srgb, var(--surface) 58%, transparent);
    --library-config-item-border: color-mix(in srgb, var(--accent) 24%, transparent);
    --library-config-item-active-bg: color-mix(in srgb, var(--accent) 14%, transparent);
    --library-config-item-active-border: color-mix(in srgb, var(--accent) 38%, transparent);

    /* Exam item tokens */
    --exam-item-bg: var(--warning);
    --exam-item-border-color: var(--text-secondary);
    --exam-item-border-width: 2px;

    /* Suite practice card */
    --suite-card-title-color: var(--color-gray-900);
    --suite-card-description-color: var(--color-gray-600);
    --suite-card-icon-color: var(--color-brand-primary);
    --suite-card-icon-bg: color-mix(in srgb, var(--surface) 65%, transparent);
    --suite-card-accent-overlay: none;
    --suite-card-accent-opacity: 0.35;

    /* Vocab tokens */
    --bg: var(--background);
    --panel: var(--surface);
    --line: var(--border);
    --lineSubtle: var(--surface-subtle);
    --text: var(--text-primary);
    --muted: var(--text-secondary);
    --accentSoft: var(--accent-subtle);
    --warn: var(--warning);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-7: 28px;
    --sp-8: 32px;
    initial-value: 135deg;
}

body {
    font-family: var(--font-family-primary);
    background: var(--background);
    animation: none;
    min-height: 100vh;
    color: var(--color-gray-900);
    line-height: var(--line-height-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@keyframes bodyGradientRotation {
    0% {
        --body-gradient-angle: 135deg;
    }

    50% {
        --body-gradient-angle: 225deg;
    }

    100% {
        --body-gradient-angle: 495deg;
    }
}

body.no-scroll {
    overflow: hidden;
}

.is-hidden {
    display: none !important;
}

.view#more-view {
    display: none;
}

.view#more-view.active {
    display: block;
}

.container {
    color: var(--color-gray-900);
    margin-bottom: var(--space-sm);
    letter-spacing: 0;
}

.header p {
    font-size: var(--font-size-lg);
    color: var(--color-gray-600);
    font-weight: var(--font-weight-normal);
}

/* Message Notifications */
.message-container {
    position: fixed;
    top: clamp(126px, 14vh, 176px);
    left: 50%;
    right: auto;
    width: min(680px, calc(100vw - 40px));
    min-height: 58px;
    overflow: visible;
    z-index: 1400;
    pointer-events: none;
    display: grid;
    place-items: center;
    transform: translateX(-50%);
}

.message {
    --message-accent: color-mix(in srgb, var(--accent) 82%, transparent);
    --message-accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
    --message-surface: color-mix(in srgb, var(--surface) 44%, transparent);
    --message-collapsed-width: 48px;
    --message-expanded-width: min(680px, calc(100vw - 56px));
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    box-sizing: border-box;
    width: max-content;
    min-width: var(--message-collapsed-width);
    max-width: var(--message-expanded-width);
    min-height: 48px;
    padding: 10px 24px;
    border: 1px solid color-mix(in srgb, var(--surface) 62%, transparent);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: color-mix(in srgb, var(--text-primary) 88%, transparent);
    font-size: 0.88rem;
    line-height: var(--line-height-normal);
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
    clip-path: inset(0 0 0 0 round var(--radius-pill));
    box-shadow: var(--elevation-1);
font-weight: var(--font-weight-medium);
    text-align: center;
    transform-origin: center;
    overflow: hidden;
    will-change: max-width, clip-path, transform, opacity, filter;
}

.message::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: var(--elevation-1);
}

.message-label {
    font-weight: var(--font-weight-semibold);
}

.message-text {
    position: relative;
    z-index: 1;
    display: inline-block;
    font-weight: var(--font-weight-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 1;
    transform: translateX(0);
    will-change: opacity, transform;
}

.message-entering {
    z-index: 2;
    animation: messageIslandExpand 860ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.message-entering .message-text,
.message-entering .message-indicator {
    animation: messageContentReveal 620ms cubic-bezier(0.16, 1, 0.3, 1) 120ms both;
}

.message-visible {
    z-index: 2;
    opacity: 1;
    max-width: var(--message-expanded-width);
    transform: translateY(0);
    clip-path: inset(0 0 0 0 round var(--radius-pill));
    filter: blur(0) saturate(170%);
}

.message-leaving {
    z-index: 1;
    pointer-events: none;
    animation: messageIslandCollapse 520ms cubic-bezier(0.7, 0, 0.18, 1) both;
}

.message-leaving .message-text,
.message-leaving .message-indicator {
    animation: messageContentVeil 260ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes messageIslandExpand {
    0% {
        opacity: 0;
        max-width: var(--message-collapsed-width);
        transform: translateY(-10px);
        filter: blur(7px) saturate(125%);
        clip-path: inset(0 49% 0 49% round var(--radius-pill));
    }

    28% {
        opacity: 1;
        max-width: 92px;
        transform: translateY(-3px);
        filter: blur(2px) saturate(155%);
        clip-path: inset(0 34% 0 34% round var(--radius-pill));
    }

    66% {
        opacity: 1;
        max-width: calc(var(--message-expanded-width) + 22px);
        transform: translateY(1px);
        filter: blur(0) saturate(170%);
        clip-path: inset(0 -2% 0 -2% round var(--radius-pill));
    }

    84% {
        max-width: calc(var(--message-expanded-width) - 8px);
        transform: translateY(0);
        clip-path: inset(0 0 0 0 round var(--radius-pill));
    }

    100% {
        opacity: 1;
        max-width: var(--message-expanded-width);
        transform: translateY(0);
        filter: blur(0) saturate(170%);
        clip-path: inset(0 0 0 0 round var(--radius-pill));
    }
}

@keyframes messageIslandCollapse {
    0% {
        opacity: 1;
        max-width: var(--message-expanded-width);
        transform: translateY(0);
        filter: blur(0) saturate(170%);
        clip-path: inset(0 0 0 0 round var(--radius-pill));
    }

    38% {
        opacity: 0.86;
        max-width: 132px;
        transform: translateY(-2px);
        filter: blur(1px) saturate(145%);
        clip-path: inset(0 24% 0 24% round var(--radius-pill));
    }

    100% {
        opacity: 0;
        max-width: var(--message-collapsed-width);
        transform: translateY(-8px);
        filter: blur(7px) saturate(120%);
        clip-path: inset(0 49% 0 49% round var(--radius-pill));
    }
}

@keyframes messageContentReveal {
    0% {
        opacity: 0;
        transform: translateX(-8px);
    }

    42% {
        opacity: 0;
        transform: translateX(-8px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes messageContentVeil {
    0% {
        opacity: 1;
        transform: translateX(0);
    }

    100% {
        opacity: 0;
        transform: translateX(8px);
    }
}

.message.success {
    --message-accent: color-mix(in srgb, var(--success) 82%, transparent);
    --message-accent-soft: color-mix(in srgb, var(--success) 14%, transparent);
    color: color-mix(in srgb, var(--text-primary) 88%, transparent);
}

.message.error {
    --message-accent: color-mix(in srgb, var(--danger) 82%, transparent);
    --message-accent-soft: color-mix(in srgb, var(--danger) 14%, transparent);
    color: color-mix(in srgb, var(--danger) 90%, transparent);
}

.message.info {
    --message-accent: color-mix(in srgb, var(--accent) 82%, transparent);
    --message-accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
    color: color-mix(in srgb, var(--accent) 90%, transparent);
}

.message.warning {
    --message-accent: color-mix(in srgb, var(--warning) 82%, transparent);
    --message-accent-soft: color-mix(in srgb, var(--warning) 16%, transparent);
    color: color-mix(in srgb, var(--warning) 90%, transparent);
}

.message strong,
.message-indicator {
    position: relative;
    z-index: 1;
    display: inline-flex;
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--message-accent);
    box-shadow: none;
    color: transparent;
    font-size: 0;
    animation: messageIndicatorPulse 1800ms ease-in-out infinite;
}

.message strong::before,
.message-indicator::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: color-mix(in srgb, var(--surface) 46%, transparent);
    opacity: 0.65;
}

@keyframes messageIndicatorPulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow: none;
    }

    50% {
        transform: scale(1.12);
        box-shadow: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .message,
    .message-indicator {
        animation: none;
    }

    .message-leaving {
        animation: none;
        opacity: 0;
        transform: none;
        filter: none;
    }
}

.validation-report__card {
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    border-radius: var(--border-radius-xl);
    padding: var(--space-xl);
    margin: var(--space-xl) 0;
    box-shadow: var(--shadow-md);
color: var(--color-gray-900);
}

.validation-report__title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.validation-report__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    color: color-mix(in srgb, var(--accent) 85%, transparent);
}

.validation-report__meta-item strong {
    display: block;
    font-size: var(--font-size-sm);
    color: color-mix(in srgb, var(--accent) 65%, transparent);
}

.validation-report__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.validation-report__entry {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--border-radius-md);
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}

.validation-report__entry[data-validation-status="valid"] {
    border-color: color-mix(in srgb, var(--success) 45%, transparent);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.validation-report__entry[data-validation-status="error"] {
    border-color: color-mix(in srgb, var(--danger) 45%, transparent);
    background: color-mix(in srgb, var(--surface-subtle) 90%, transparent);
}

.validation-report__entry-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: var(--font-weight-medium);
}

.validation-report__errors {
    margin-left: var(--space-lg);
    color: color-mix(in srgb, var(--accent) 90%, transparent);
    font-size: var(--font-size-sm);
    list-style: disc;
}

.validation-report__status {
    margin-top: var(--space-md);
    font-weight: var(--font-weight-semibold);
    color: color-mix(in srgb, var(--text-primary) 95%, transparent);
}

.validation-report__actions {
    margin-top: var(--space-lg);
    display: flex;
    justify-content: flex-end;
}

.validation-report__actions .btn {
    pointer-events: auto;
}

.performance-report__card {
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    border-radius: var(--border-radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    margin: var(--space-xl) 0;
}

.performance-report__title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    color: var(--color-gray-900);
}

.performance-report__section {
    margin-bottom: var(--space-lg);
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    border-radius: var(--border-radius-lg);
    padding: var(--space-lg);
}

.performance-report__section-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-md);
    color: color-mix(in srgb, var(--text-primary) 90%, transparent);
}

.performance-report__metrics {
    display: grid;
    gap: var(--space-sm);
}

.performance-report__metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--border-radius-md);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.performance-report__metric-label {
    color: color-mix(in srgb, var(--accent) 90%, transparent);
    font-size: var(--font-size-sm);
}

.performance-report__metric-value {
    font-weight: var(--font-weight-semibold);
    color: color-mix(in srgb, var(--text-primary) 95%, transparent);
}

.performance-report__actions {
    margin-top: var(--space-lg);
    display: flex;
    justify-content: flex-end;
}

.performance-report__actions .btn {
    pointer-events: auto;
}

.performance-report__empty {
    color: color-mix(in srgb, var(--accent) 90%, transparent);
    font-size: var(--font-size-sm);
    margin: var(--space-md) 0;
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
    flex-wrap: wrap;
}

.nav-btn {
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    color: var(--color-gray-700);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--border-radius-full);
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-normal);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    position: relative;
    overflow: hidden;
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--color-brand-gradient);
    transition: left var(--transition-normal);
    z-index: -1;
}

.nav-btn:hover {
    border-color: var(--color-brand-primary);
    color: var(--color-white);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.nav-btn:hover::before {
    left: 0;
}

.nav-btn.active {
    background: var(--color-brand-gradient);
    border-color: transparent;
    color: var(--color-white);
    box-shadow: var(--shadow-md);
}

.nav-btn.active::before {
    left: 0;
}

.view {
    display: none;
    background: var(--surface-subtle);
    padding: var(--space-2xl);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--text-secondary);
    min-height: 400px;
}

#vocab-view.view {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    border-radius: var(--border-radius-2xl);
    overflow: hidden;
    min-height: 0;
}

.view.active {
    display: block;
}

.overview-view__header {
    align-items: flex-start;
    margin-bottom: 18px;
}

.hero-panel__eyebrow {
    margin: 0 0 8px;
    color: var(--success);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.overview-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.7fr);
    gap: 14px;
    margin-bottom: 30px;
}

.overview-workbench__primary {
    display: grid;
    align-content: center;
    gap: 14px;
    min-height: 260px;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--text-primary) 8%, transparent);
    background: var(--surface);
    padding: clamp(20px, 3vw, 32px);
    box-shadow: var(--elevation-1);
}

.overview-workbench__kicker,
.overview-shortcut span {
    color: var(--success);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.overview-workbench__primary h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: clamp(1.7rem, 3.7vw, 2.75rem);
    font-weight: 850;
    line-height: 1.05;
    letter-spacing: 0;
}

.overview-workbench__primary p {
    max-width: 620px;
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.55;
}

.overview-workbench__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.overview-workbench__action {
    min-height: 42px;
    border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    padding: 0 16px;
    transition: transform var(--transition-normal), background var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.overview-workbench__action--primary {
    border-color: var(--text-primary);
    background: var(--text-primary);
    color: var(--surface);
}

.overview-workbench__action:hover,
.overview-workbench__action:focus-visible,
.overview-shortcut:hover,
.overview-shortcut:focus-visible {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--text-primary) 36%, transparent);
    background: var(--surface);
    box-shadow: var(--elevation-1);
}

.overview-workbench__action--primary:hover,
.overview-workbench__action--primary:focus-visible {
    background: var(--text-primary);
    color: var(--surface);
}

.overview-workbench__side {
    display: grid;
    gap: 12px;
}

.overview-shortcut {
    display: grid;
    align-content: space-between;
    gap: 12px;
    min-height: 123px;
    border: 1px solid color-mix(in srgb, var(--text-primary) 8%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    padding: 18px;
    text-align: left;
    box-shadow: var(--elevation-1);
    transition: transform var(--transition-normal), background var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.overview-shortcut strong {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.25;
}

.overview-library-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 16px;
}

.overview-library-heading h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.14rem;
    font-weight: 850;
    letter-spacing: 0;
}

.overview-library-heading p {
    margin: 4px 0 0;
    color: color-mix(in srgb, var(--text-primary) 68%, transparent);
    font-size: 0.9rem;
    font-weight: 700;
}

.account-view__header {
    align-items: flex-start;
    margin-bottom: 18px;
}

.account-view__profile {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    padding: 18px;
    border: 1px solid color-mix(in srgb, var(--text-primary) 8%, transparent);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    box-shadow: var(--elevation-1);
}

.account-view__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--text-primary);
    color: var(--surface);
    font-size: 1.2rem;
    font-weight: 800;
}

.account-view__identity {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.account-view__identity strong {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    font-size: 1.08rem;
    line-height: 1.2;
    white-space: nowrap;
}

.account-view__identity span,
.account-view__stat-meta,
.account-view__stat-label {
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 700;
}

.account-view__section {
    display: grid;
    gap: 12px;
}

.account-view__section-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0;
}

.account-view__stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.account-view__stat {
    display: grid;
    gap: 6px;
    min-width: 0;
    min-height: 132px;
    border: 1px solid color-mix(in srgb, var(--text-primary) 8%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    padding: 16px;
    box-shadow: var(--elevation-1);
}

.account-view__stat-value {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    font-size: clamp(1.6rem, 3vw, 2.35rem);
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.account-view__stat-meta {
    align-self: end;
    line-height: 1.25;
}

.account-view__management {
    margin-top: 24px;
}

.account-view__forms {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.account-view__form {
    display: grid;
    align-content: start;
    gap: 12px;
    min-width: 0;
    border: 1px solid color-mix(in srgb, var(--text-primary) 8%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 84%, transparent);
    box-shadow: var(--elevation-1);
    padding: 16px;
}

.account-view__form--danger {
    border-color: color-mix(in srgb, var(--danger) 24%, transparent);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.account-view__form h4,
.account-view__form p {
    margin: 0;
}

.account-view__form h4 {
    color: var(--text-primary);
    font-size: 0.98rem;
    font-weight: 800;
    letter-spacing: 0;
}

.account-view__form p {
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
}

.account-view__form label {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 700;
}

.account-view__form input {
    min-height: 40px;
    min-width: 0;
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text-primary);
    font: inherit;
    padding: 0 11px;
}

.account-view__form input:focus {
    border-color: var(--accent);
    outline: 2px solid color-mix(in srgb, var(--accent) 18%, transparent);
}

.account-view__form-status {
    min-height: 1.1em;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
}

.account-view__form-status.is-error {
    color: var(--danger);
}

.account-view__form-status.is-success {
    color: var(--success);
}

.account-view__danger-button {
    background: var(--danger) !important;
    color: var(--surface) !important;
}

@media (max-width: 860px) {
    .overview-workbench {
        grid-template-columns: 1fr;
    }

    .overview-workbench__side {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .account-view__stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .account-view__forms {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .overview-workbench__actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .overview-workbench__side {
        grid-template-columns: 1fr;
    }

    .overview-workbench__action {
        width: 100%;
    }

    .overview-library-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .account-view__profile {
        align-items: flex-start;
    }

    .account-view__stats {
        grid-template-columns: 1fr;
    }
}

.view>h2 {
    margin-bottom: var(--space-xl);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-gray-900);
    letter-spacing: 0;
}

.more-view-subtitle {
    margin-bottom: var(--space-xl);
    font-size: var(--font-size-lg);
    color: color-mix(in srgb, var(--text-primary) 75%, transparent);
    text-align: center;
}

.more-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-xl);
}

.tool-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    padding: var(--space-xl);
    background: var(--surface);
    border: 2px solid color-mix(in srgb, var(--text-secondary) 40%, transparent);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: left;
    color: var(--color-gray-800);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
    cursor: pointer;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: color-mix(in srgb, var(--accent) 65%, transparent);
}

.tool-card-icon {
    font-size: 2.5rem;
}

.tool-card-content h3 {
    font-size: var(--font-size-2xl);
    color: var(--color-gray-900);
    margin-bottom: var(--space-sm);
}

.tool-card-content p {
    font-size: var(--font-size-sm);
    line-height: 1.65;
    color: color-mix(in srgb, var(--text-primary) 70%, transparent);
}

.tool-card-arrow {
    align-self: flex-end;
    font-weight: var(--font-weight-semibold);
    color: var(--color-brand-primary);
}

.tool-card.is-reading-memorize-active {
    border-color: color-mix(in srgb, var(--danger) 48%, transparent);
}

.tool-card.is-reading-memorize-active .tool-card-arrow {
    color: var(--danger);
}

.vocab-view-shell {
    --vocab-paper: var(--surface-subtle);
    --vocab-paper-deep: var(--surface-subtle);
    --vocab-paper-bright: var(--surface);
    --vocab-ink: var(--text-primary);
    --vocab-muted: var(--text-secondary);
    --vocab-accent: var(--danger);
    --vocab-accent-strong: var(--danger);
    --vocab-accent-soft: var(--surface-subtle);
    --vocab-surface: color-mix(in srgb, var(--surface) 92%, transparent);
    --vocab-line-strong: color-mix(in srgb, var(--warning) 55%, transparent);
    --vocab-line: var(--warning-subtle);
    --vocab-shadow: var(--elevation-1);
    --vocab-shadow-soft: var(--elevation-1);
    --vocab-shadow-fine: var(--elevation-1);
    --vocab-shadow-strong: var(--elevation-1);
    --vocab-font-body: 'WenKai', 'Kaiti SC', 'STKaiti', 'Songti SC', 'STSong', 'SimSun', serif;
    --vocab-font-title: 'WenKai', 'Kaiti SC', 'STKaiti', 'Songti SC', 'STSong', 'SimSun', serif;
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    color: var(--vocab-ink);
    font-family: var(--vocab-font-body);
    font-synthesis: weight;
    background-color: var(--vocab-paper);
    background-image: none;
    overflow: hidden;
}

.vocab-view-shell::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background: var(--surface);
    pointer-events: none;
}

.vocab-view-shell::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image: none;
    opacity: 0.35;
    pointer-events: none;
}

.vocab-view-shell > * {
    position: relative;
    z-index: 1;
}

@keyframes vocabSceneIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vocab-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
background: color-mix(in srgb, var(--surface-subtle) 92%, transparent);
    border-bottom: 1px solid var(--vocab-line);
    box-shadow: var(--elevation-1);
    padding: 0 var(--sp-6, 24px);
    animation: vocabSceneIn 0.6s ease both;
}

.vocab-topbar__container {
    margin: 0 auto;
    width: min(1400px, 100%);
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--sp-4, 16px);
    align-items: center;
    min-height: 64px;
}

.vocab-topbar__section {
    display: flex;
    align-items: center;
    gap: var(--sp-3, 12px);
    min-width: 0;
}

.vocab-topbar__section--left {
    grid-column: span 4;
}

.vocab-topbar__section--center {
    grid-column: span 4;
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-2, 8px);
}

.vocab-topbar__section--right {
    grid-column: span 4;
    justify-content: flex-end;
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 10px;
}

.vocab-topbar__titles {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vocab-topbar__heading {
    font-size: clamp(20px, 2vw, 26px);
    font-weight: 600;
    margin: 0;
    color: var(--vocab-ink);
    font-family: var(--vocab-font-title);
    letter-spacing: 0.02em;
}

.vocab-topbar__subtitle {
    font-size: 13px;
    color: var(--vocab-muted);
    margin: 0;
}

.vocab-progress {
    position: relative;
    width: 100%;
    height: 8px;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--warning) 25%, transparent);
    overflow: hidden;
}

.vocab-progress__track {
    width: 100%;
    height: 100%;
}

.vocab-progress__fill {
    height: 100%;
    width: 0%;
    background: var(--surface);
    transition: width 0.3s ease;
}

.vocab-progress__chips {
    display: flex;
    gap: var(--sp-2, 8px);
    flex-wrap: wrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 12px;
    border-radius: var(--radius-pill);
    font-size: var(--fz-xs, 12px);
    font-weight: 500;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border: 1px solid var(--vocab-line);
    color: var(--vocab-muted);
    box-shadow: var(--elevation-1);
}

.vocab-topbar__menu {
    position: relative;
    width: 40px;
    justify-self: end;
}

.vocab-topbar__section--right > .btn[data-action='primary-cta'] {
    white-space: nowrap;
    min-width: 152px;
    min-height: 40px;
    padding-inline: 18px;
}

.vocab-topbar__menu > .btn.btn-icon {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
}

.vocab-list-switcher {
    position: relative;
}

.vocab-list-switcher .switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--border-radius-lg, var(--radius-md, 12px));
    border: 1px solid var(--vocab-line);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    color: var(--vocab-ink);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--elevation-1);
    width: 100%;
}

.vocab-list-switcher .switcher-btn:hover {
    border-color: color-mix(in srgb, var(--warning) 80%, transparent);
    background: color-mix(in srgb, var(--surface) 96%, transparent);
}

.vocab-list-switcher .current-list-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vocab-list-switcher .switcher-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 240px;
    background: var(--surface);
    border: 1px solid var(--vocab-line);
    border-radius: 14px;
    box-shadow: var(--vocab-shadow-soft);
    overflow: hidden;
    z-index: 120;
}

.vocab-list-switcher .dropdown-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
}

.vocab-list-switcher .list-option {
    display: grid;
    grid-template-columns: 20px 1fr auto 18px;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--vocab-ink);
    font-size: 13px;
}

.vocab-list-switcher .list-option:hover {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.vocab-list-switcher .list-option.active {
    background: color-mix(in srgb, var(--danger) 20%, transparent);
}

.vocab-list-switcher .list-count {
    font-variant-numeric: tabular-nums;
    color: var(--vocab-muted);
}

.vocab-list-switcher .active-indicator {
    color: var(--vocab-accent);
    font-weight: 700;
}

@media (max-width: 768px) {
    .vocab-list-switcher .current-list-name {
        display: none;
    }

    .vocab-menu__list-switcher .vocab-list-switcher .current-list-name {
        display: inline;
    }

    .vocab-list-switcher .switcher-btn {
        padding: 8px 10px;
    }

    .vocab-list-switcher .switcher-dropdown {
        min-width: 200px;
    }
}

.vocab-view-shell .btn {
    gap: var(--space-2);
}

.vocab-view-shell .btn-link {
    min-height: auto;
    padding: 0;
}

.vocab-view-shell .btn.btn-sm {
    min-height: var(--control-height-sm);
}

.vocab-view-shell .btn-icon {
    width: var(--control-height);
    height: var(--control-height);
    padding: 0;
}

.vocab-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: flex;
    flex-direction: column;
    min-width: 220px;
    border-radius: var(--border-radius-xl, var(--radius-lg, 16px));
    background: var(--surface);
    box-shadow: var(--vocab-shadow-soft);
    border: 1px solid var(--vocab-line);
    padding: 8px;
    z-index: 120;
}

.vocab-menu[hidden] {
    display: none;
}

.vocab-menu button {
    appearance: none;
    background: none;
    border: none;
    padding: 10px 16px;
    font-size: var(--fz-sm, 14px);
    color: var(--vocab-ink);
    text-align: left;
    cursor: pointer;
}

.vocab-menu button:hover {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    color: var(--vocab-accent-strong);
}

.vocab-menu__panel {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vocab-menu__panel[hidden] {
    display: none;
}

.vocab-menu__list-switcher {
    padding-top: 2px;
}

.vocab-menu__list-switcher .vocab-list-switcher {
    width: 100%;
}

.vocab-menu__list-switcher .vocab-list-switcher .current-list-name {
    max-width: 140px;
}

.vocab-menu__list-switcher .vocab-list-switcher .switcher-dropdown {
    position: static;
    margin-top: 8px;
    min-width: 0;
    width: 100%;
}

.vocab-topbar-spacer {
    height: 72px;
}

.vocab-due-banner {
    padding: 0 var(--sp-6, 24px);
    margin-top: var(--sp-4, 16px);
    animation: vocabSceneIn 0.7s ease both;
}

.vocab-due-banner__container {
    width: min(1280px, 100%);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3, 12px);
    padding: var(--sp-3, 12px) var(--sp-4, 16px);
    border-radius: var(--border-radius-xl, var(--radius-lg, 16px));
    border: 1px solid color-mix(in srgb, var(--warning) 50%, transparent);
    background: var(--surface);
    color: var(--vocab-ink);
    box-shadow: var(--vocab-shadow-fine);
    position: relative;
    overflow: hidden;
}

.vocab-due-banner__container::after {
    content: '';
    position: absolute;
    right: 16px;
    top: -8px;
    width: 56px;
    height: 18px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface) 55%, transparent);
    box-shadow: var(--elevation-1);
    transform: rotate(2deg);
    opacity: 0.8;
    pointer-events: none;
}

.vocab-due-banner__content {
    display: flex;
    align-items: center;
    gap: var(--sp-2, 8px);
    font-size: var(--fz-sm, 14px);
}

.vocab-due-banner__icon {
    font-size: 18px;
}

.site-announcement-host {
    margin-bottom: var(--space-lg, 20px);
}

.site-announcement-host[hidden] {
    display: none;
}

.site-announcement {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md, 16px);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: var(--border-radius-lg, 16px);
    background: var(--surface);
    box-shadow: var(--elevation-1);
    padding: var(--space-md, 16px) var(--space-lg, 20px);
}

.site-announcement__text {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.site-announcement__title {
    color: var(--color-text, var(--text-primary));
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    font-weight: 800;
}

.site-announcement__body {
    color: var(--color-text-secondary, var(--text-secondary));
    font-size: var(--fz-sm, 14px);
    line-height: 1.55;
}

.site-announcement__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 38px;
    border-radius: var(--border-radius-md, 10px);
    background: var(--accent);
    color: var(--surface);
    font-size: var(--fz-sm, 14px);
    font-weight: 800;
    padding: 0 var(--space-md, 16px);
    text-decoration: none;
}

.site-login-notice-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--text-primary) 42%, transparent);
    padding: var(--space-lg, 20px);
}

.site-login-notice-backdrop[hidden] {
    display: none;
}

.site-login-notice {
    display: grid;
    gap: var(--space-md, 16px);
    width: min(480px, 100%);
    border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
    border-radius: var(--border-radius-lg, 16px);
    background: var(--surface);
    color: var(--color-text, var(--text-primary));
    box-shadow: var(--elevation-1);
    padding: clamp(20px, 3vw, 28px);
}

.site-login-notice h2 {
    margin: 0;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
}

.site-login-notice p {
    margin: 0;
    color: var(--color-text-secondary, var(--text-secondary));
    font-size: var(--fz-base, 16px);
    line-height: 1.6;
}

.site-login-notice__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm, 12px);
}

.site-login-notice__actions button {
    min-height: 38px;
    border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
    border-radius: var(--border-radius-md, 10px);
    background: var(--surface);
    color: var(--color-text, var(--text-primary));
    font-weight: 800;
    padding: 0 var(--space-md, 16px);
}

.site-login-notice__actions .site-login-notice__primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--surface);
}

@media (max-width: 720px) {
    .site-announcement {
        align-items: stretch;
        flex-direction: column;
    }

    .site-announcement__action {
        width: 100%;
    }
}

.vocab-body {
    flex: 1;
    padding: var(--sp-8, 32px) var(--sp-6, 24px) var(--sp-9, 40px);
}

.vocab-body__container {
    width: min(1400px, 100%);
    margin: 0 auto;
}

.vocab-body__grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--sp-5, 20px);
    align-items: start;
}

.vocab-view-shell[data-side-panel='hidden'] .vocab-body__grid {
    justify-content: center;
    justify-items: stretch;
}

.vocab-session-card {
    grid-column: span 12;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.vocab-session-card>.vocab-card {
    width: 100%;
    min-height: clamp(380px, 54vh, 640px);
    animation: vocabSceneIn 0.55s ease both;
}

.vocab-side-panel {
    grid-column: span 12;
    background: var(--surface);
    border-radius: var(--border-radius-xl, var(--radius-lg, 16px));
    border: 1px solid var(--vocab-line);
    border-left: 4px solid color-mix(in srgb, var(--danger) 50%, transparent);
    padding: var(--sp-5, 20px);
    display: flex;
    flex-direction: column;
    gap: var(--sp-4, 16px);
    box-shadow: var(--vocab-shadow-fine);
    animation: vocabSceneIn 0.7s ease both;
}

.vocab-side-panel[hidden] {
    display: none;
}

.vocab-card {
    background: var(--surface);
    border-radius: var(--border-radius-xl, var(--radius-lg, 16px));
    box-shadow: var(--vocab-shadow);
    border: 1px solid var(--vocab-line);
    padding: var(--sp-7, 28px) var(--sp-8, 32px);
    display: flex;
    flex-direction: column;
    gap: var(--sp-5, 20px);
    position: relative;
    overflow: hidden;
}

.vocab-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: none;
    opacity: 0.35;
    pointer-events: none;
}

.vocab-card > * {
    position: relative;
    z-index: 1;
}

.vocab-card--loading,
.vocab-card--placeholder {
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--vocab-muted);
    min-height: 280px;
}

.vocab-card--empty {
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: var(--sp-3, 12px);
    padding: var(--sp-7, 28px) var(--sp-6, 24px);
}

.vocab-card__illustration {
    font-size: 48px;
}

.vocab-card__empty-title {
    font-size: var(--fz-lg, 20px);
    font-weight: 600;
    color: var(--vocab-ink);
}

.vocab-card__empty-text {
    font-size: var(--fz-sm, 14px);
    color: var(--vocab-muted);
}

.vocab-card__wordline {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-3, 12px);
    padding-bottom: var(--sp-3, 12px);
    text-align: center;
    border-bottom: 1px dashed color-mix(in srgb, var(--warning) 35%, transparent);
}

.vocab-card__word {
    font-size: clamp(36px, 4vw, 46px);
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--vocab-ink);
    font-family: var(--vocab-font-title);
    text-align: center;
}

.vocab-card__meaning {
    padding: var(--sp-3, 12px) var(--sp-4, 16px);
    border-radius: var(--border-radius-lg, var(--radius-md, 12px));
    border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
    border-left: 4px solid color-mix(in srgb, var(--danger) 45%, transparent);
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    color: var(--vocab-ink);
    font-size: 16px;
    line-height: 1.7;
}

.vocab-card__reveal {
    display: flex;
    justify-content: center;
}

.vocab-card__instruction {
    font-size: var(--fz-sm, 14px);
    color: var(--vocab-muted);
    letter-spacing: 0.02em;
}

.vocab-card--recognition .vocab-card__actions {
    margin-top: auto;
}

.vocab-card--spelling .vocab-card__input-block {
    margin-top: auto;
}

.vocab-card__input-block {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3, 12px);
}

.vocab-card__input-block input {
    width: 100%;
    padding: var(--sp-4, 16px) var(--sp-5, 20px);
    font-size: 18px;
    border-radius: 16px;
    border: 1px solid var(--vocab-line);
    background: var(--surface);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    color: var(--vocab-ink);
    box-shadow: var(--elevation-1);
}

.vocab-card__input-block input:focus {
    outline: none;
    border-color: var(--vocab-accent);
    box-shadow: var(--elevation-1);
}

.vocab-card__input-actions,
.vocab-card__actions {
    display: flex;
    gap: var(--sp-3, 12px);
    justify-content: center;
    width: 100%;
}

.vocab-card__input-actions {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(180px, 1.4fr);
    align-items: stretch;
}

.vocab-card__input-actions .btn {
    width: 100%;
    min-height: 46px;
}

.vocab-card__actions--inline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    width: 100%;
    align-items: stretch;
    justify-content: stretch;
}

.vocab-card__actions--inline .btn {
    width: 100%;
}

.vocab-card__actions--center {
    justify-content: center;
}

.vocab-card__actions--stack {
    flex-direction: column;
    width: 100%;
    gap: var(--sp-2, 8px);
    align-items: stretch;
}

.vocab-card--summary,
.vocab-card--complete {
    align-items: center;
    text-align: center;
    gap: var(--sp-3, 12px);
}

.vocab-card__summary-head {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2, 8px);
    align-items: center;
}

.vocab-card__summary-queue {
    font-size: var(--fz-xs, 12px);
    color: var(--vocab-muted);
}

.vocab-card--feedback {
    gap: var(--sp-3, 12px);
    border: 1px solid var(--vocab-line);
    border-left-width: 4px;
    box-shadow: var(--vocab-shadow-soft);
    background: var(--surface);
}

.vocab-card--feedback.vocab-card--correct {
    border-color: color-mix(in srgb, var(--success) 55%, transparent);
    border-left-color: color-mix(in srgb, var(--success) 80%, transparent);
    background: var(--surface);
}

.vocab-card--feedback.vocab-card--near {
    border-color: color-mix(in srgb, var(--warning) 55%, transparent);
    border-left-color: color-mix(in srgb, var(--warning) 85%, transparent);
    background: var(--surface);
}

.vocab-card--feedback.vocab-card--wrong {
    border-color: color-mix(in srgb, var(--danger) 60%, transparent);
    border-left-color: color-mix(in srgb, var(--danger) 90%, transparent);
    background: var(--surface);
}

.vocab-card__attempts {
    margin: 0;
    font-size: var(--fz-xs, 12px);
    color: var(--danger);
}

.vocab-card-error {
    padding: var(--sp-4, 16px);
    border-radius: var(--border-radius-lg, var(--radius-md, 12px));
    border: 1px solid color-mix(in srgb, var(--danger) 50%, transparent);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    color: var(--danger);
    text-align: center;
}

.vocab-feedback__head {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3, 12px);
}

.vocab-feedback__icon {
    font-size: 32px;
}

.vocab-feedback__details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--sp-3, 12px);
    padding: var(--sp-3, 12px) var(--sp-4, 16px);
    border-radius: var(--border-radius-lg, var(--radius-md, 12px));
    border: 1px dashed color-mix(in srgb, var(--warning) 35%, transparent);
    background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.vocab-feedback__details dt {
    font-size: var(--fz-xs, 12px);
    font-weight: var(--fw-medium, 500);
    color: var(--vocab-muted);
}

.vocab-feedback__details dd {
    margin: 2px 0 0;
    font-size: var(--fz-sm, 14px);
    color: var(--vocab-ink);
}

.vocab-feedback__typed {
    font-size: var(--fz-sm, 14px);
    color: var(--vocab-muted);
}

.vocab-side-panel {
    position: relative;
}

.vocab-side-panel__section {
    padding-bottom: var(--sp-3, 12px);
    border-bottom: 1px dashed color-mix(in srgb, var(--warning) 28%, transparent);
}

.vocab-side-panel__section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.vocab-side-panel__toggle {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-3, 12px);
    border-radius: var(--border-radius-lg, var(--radius-md, 12px));
    border: 1px solid var(--vocab-line);
    background: var(--vocab-surface);
    box-shadow: var(--vocab-shadow-fine);
    color: var(--vocab-ink);
}

.vocab-side-panel__surface {
    display: flex;
    flex-direction: column;
    gap: var(--sp-5, 20px);
}

.vocab-side-panel__section h3 {
    font-size: var(--fz-sm, 14px);
    color: var(--vocab-muted);
    margin-bottom: var(--sp-2, 8px);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.vocab-side-panel__section p,
.vocab-side-panel__section textarea {
    font-size: var(--fz-sm, 14px);
    color: var(--vocab-ink);
    line-height: 1.6;
}

.vocab-side-panel__section textarea {
    width: 100%;
    min-height: 96px;
    resize: vertical;
    padding: var(--sp-3, 12px);
    border-radius: var(--border-radius-lg, var(--radius-md, 12px));
    border: 1px solid var(--vocab-line);
    background: var(--vocab-paper-bright);
    color: var(--vocab-ink);
    box-shadow: var(--elevation-1);
}

.vocab-side-panel__note-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2, 8px);
    justify-content: space-between;
    flex-wrap: wrap;
}

.vocab-side-panel__note-status {
    font-size: var(--fz-xs, 12px);
    color: var(--vocab-muted);
}

.vocab-bottom-bar {
    position: sticky;
    bottom: 0;
    z-index: 100;
    padding: var(--sp-3, 12px) var(--sp-6, 24px);
    background: color-mix(in srgb, var(--surface-subtle) 94%, transparent);
    border-top: 1px solid var(--vocab-line);
    box-shadow: var(--elevation-1);
}

.vocab-bottom-bar[hidden] {
    display: none;
}

.vocab-bottom-bar__container {
    width: min(860px, 100%);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
}

.vocab-bottom-bar__actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--sp-3, 12px);
    width: 100%;
}

.vocab-bottom-bar__actions .btn-result {
    width: 100%;
    min-height: 48px;
}

.btn-result {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 72px;
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid var(--vocab-line);
    font-weight: var(--fw-medium, 500);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: var(--vocab-surface);
    color: var(--vocab-ink);
    box-shadow: var(--vocab-shadow-fine);
}

.btn-result:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--elevation-1);
}

.btn-result[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-result--danger {
    background: color-mix(in srgb, var(--danger) 16%, transparent);
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 55%, transparent);
}

.btn-result--neutral {
    background: color-mix(in srgb, var(--warning) 12%, transparent);
    color: var(--vocab-muted);
    border-color: color-mix(in srgb, var(--warning) 40%, transparent);
}

.btn-result--success {
    background: color-mix(in srgb, var(--success) 20%, transparent);
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 50%, transparent);
}

.vocab-bottom-spacer {
    height: 72px;
}

.vocab-bottom-spacer[hidden] {
    display: none;
}

@media (min-width: 1024px) {
    .vocab-session-card {
        grid-column: span 8;
    }

    .vocab-side-panel {
        grid-column: span 4;
    }

    .vocab-view-shell[data-side-panel='hidden'] .vocab-session-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1023px) {
    .vocab-topbar__container {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .vocab-topbar__section--left,
    .vocab-topbar__section--center,
    .vocab-topbar__section--right {
        grid-column: span 6;
    }

    .vocab-topbar__section--right {
        justify-content: flex-start;
        grid-template-columns: auto auto;
        width: auto;
    }

    .vocab-bottom-bar__container {
        width: min(720px, 100%);
    }

    .vocab-bottom-bar__actions {
        gap: var(--sp-2, 8px);
    }

    .vocab-side-panel__toggle {
        display: inline-flex;
    }

    .vocab-side-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: var(--border-radius-xl, var(--radius-lg, 16px)) var(--border-radius-xl, var(--radius-lg, 16px)) 0 0;
        box-shadow: var(--elevation-1);
        transform: translateY(calc(100% - 52px));
        transition: transform 0.3s ease;
        max-height: 70vh;
    }

    .vocab-side-panel[data-expanded='true'] {
        transform: translateY(0);
    }

    .vocab-side-panel__surface {
        overflow-y: auto;
    }
}

@media (max-width: 767px) {
    .vocab-body {
        padding: var(--sp-4, 16px);
    }

    .vocab-topbar {
        padding: var(--sp-3, 12px) var(--sp-4, 16px);
    }

    .vocab-topbar__container {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .vocab-topbar__section--center {
        display: none;
    }

    .vocab-topbar__section--right {
        width: auto;
        grid-template-columns: auto auto;
        gap: 8px;
    }

    .vocab-topbar__section--right > .btn[data-action='primary-cta'] {
        min-width: 132px;
    }

    .vocab-topbar__menu {
        justify-self: end;
    }

    .vocab-bottom-bar__container {
        width: 100%;
    }

    .vocab-bottom-bar__actions {
        gap: var(--sp-2, 8px);
    }

    .vocab-bottom-bar__actions .btn-result {
        min-height: 48px;
    }

    .vocab-card__actions--inline {
        grid-template-columns: 1fr;
    }

    .vocab-card__input-actions {
        grid-template-columns: 1fr;
    }

    .vocab-session-card>.vocab-card {
        min-height: 360px;
        padding: var(--sp-5, 20px) var(--sp-5, 20px);
    }
}

.clock-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
    overflow: hidden;
}

.clock-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.clock-overlay:not(.is-hidden) {
    opacity: 1;
    visibility: visible;
}

.clock-overlay-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.clock-action-btn {
    position: absolute;
    top: clamp(16px, 4vw, 48px);
    width: 48px;
    height: 48px;
    border: none;
    background: transparent;
    color: color-mix(in srgb, var(--surface-subtle) 85%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    z-index: 20;
    pointer-events: auto;
    transition: opacity var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
}

.clock-action-btn:hover {
    color: var(--surface-subtle);
    transform: translateY(-1px);
}

.clock-action-btn:active {
    transform: translateY(0) scale(0.98);
}

.clock-fullscreen-btn {
    left: clamp(16px, 4vw, 48px);
}

.clock-action-btn .fullscreen-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transform: translate(-50%, -50%);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.clock-fullscreen-btn .icon-exit {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
}

.clock-close-btn .icon-close {
    opacity: 1;
}

.clock-fullscreen-btn.is-fullscreen .icon-enter {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
}

.clock-fullscreen-btn.is-fullscreen .icon-exit {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.clock-close-btn {
    right: clamp(16px, 4vw, 48px);
}

#analog-clock-canvas {
    width: 100vmin;
    height: 100vmin;
    max-width: none;
    max-height: none;
    display: block;
}

.clock-view-stack {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clock-view {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
}

.clock-view.is-active {
    display: flex;
}

.clock-pagination {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--text-primary) 35%, transparent);
transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.clock-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
    background: color-mix(in srgb, var(--accent) 45%, transparent);
    padding: 0;
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

.clock-dot.is-active {
    background: color-mix(in srgb, var(--surface-subtle) 85%, transparent);
    border-color: color-mix(in srgb, var(--surface-subtle) 90%, transparent);
    transform: scale(1.1);
}

.clock-dot:hover {
    background: color-mix(in srgb, var(--surface-subtle) 55%, transparent);
    border-color: color-mix(in srgb, var(--surface-subtle) 70%, transparent);
}

.clock-overlay-inner.controls-hidden .clock-close-btn,
.clock-overlay-inner.controls-hidden .clock-fullscreen-btn,
.clock-overlay-inner.controls-hidden .clock-pagination {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.flip-clock {
    display: flex;
    align-items: center;
    gap: clamp(16px, 4vw, 32px);
}

.flip-separator {
    color: color-mix(in srgb, var(--surface-subtle) 78%, transparent);
    font-size: clamp(48px, 14vmin, 112px);
    font-weight: 600;
    letter-spacing: 4px;
    text-shadow: none;
}

.flip-digit {
    position: relative;
    width: clamp(80px, 18vmin, 148px);
    height: clamp(118px, 28vmin, 228px);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--elevation-1);
    overflow: hidden;
    transform-style: preserve-3d;
}

.flip-digit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--surface);
    pointer-events: none;
    mix-blend-mode: screen;
    opacity: 0.55;
}

.flip-digit::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1.6px;
    background: color-mix(in srgb, var(--text-primary) 90%, transparent);
    box-shadow: var(--elevation-1);
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 6;
}

.flip-digit .digit-current,
.flip-digit .digit-next {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(62px, 15vmin, 150px);
    font-weight: 700;
    letter-spacing: 2px;
    color: color-mix(in srgb, var(--surface-subtle) 96%, transparent);
    text-shadow: none;
    transform: translateY(0);
    backface-visibility: hidden;
    will-change: transform;
}

.flip-digit .digit-next {
    transform: translateY(100%);
}

.flip-digit.is-rolling .digit-current {
    animation: digitRollCurrent 0.58s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

.flip-digit.is-rolling .digit-next {
    animation: digitRollNext 0.58s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

@keyframes digitRollCurrent {
    0% {
        transform: translateY(0%);
    }

    100% {
        transform: translateY(-100%);
    }
}

@keyframes digitRollNext {
    0% {
        transform: translateY(100%);
    }

    100% {
        transform: translateY(0%);
    }
}

.digital-clock {
    font-size: clamp(72px, 20vmin, 180px);
    font-weight: 700;
    letter-spacing: clamp(8px, 2vw, 24px);
    color: color-mix(in srgb, var(--surface-subtle) 95%, transparent);
    text-shadow: none;
    display: flex;
    align-items: center;
    gap: clamp(16px, 3vw, 28px);
}

.digital-clock .digital-pulse {
    animation: digitalPulse 1s infinite;
}

.ambient-clock {
    font-size: clamp(68px, 18vmin, 168px);
    font-weight: 600;
    letter-spacing: clamp(6px, 1.5vw, 18px);
    color: color-mix(in srgb, var(--accent) 22%, transparent);
    text-shadow: none;
    display: flex;
    align-items: center;
    gap: clamp(14px, 2.4vw, 22px);
}

.ambient-clock__colon {
    opacity: 0.4;
}

@keyframes digitalPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

@media (max-width: 768px) {
    .tool-card {
        padding: var(--space-lg);
    }

    .tool-card-content h3 {
        font-size: var(--font-size-xl);
    }

    .tool-card-content p {
        font-size: var(--font-size-sm);
    }
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.browse-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    position: relative;
}

.browse-title-trigger {
    border: none;
    background: color-mix(in srgb, var(--surface) 10%, transparent);
    border-radius: var(--border-radius-full);
    width: 42px;
    height: 42px;
    font-size: 1.4rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
    color: inherit;
    flex-shrink: 0;
    position: relative;
}

.browse-title-trigger:hover,
.browse-title-trigger:focus {
    background: color-mix(in srgb, var(--surface) 20%, transparent);
    transform: translateY(-1px);
    outline: none;
}

.browse-title-trigger::after {
    content: none;
}

.browse-title-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
    border: 1px solid color-mix(in srgb, var(--surface) 92%, transparent);
    box-shadow: var(--elevation-1);
    opacity: 0;
    transform: scale(0.7);
    transform-origin: center;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    pointer-events: none;
    z-index: 1;
}

#browse-title {
    margin: 0;
    flex: 1;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.browse-preference-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: color-mix(in srgb, var(--text-primary) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    border-radius: var(--border-radius-lg);
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-lg);
    z-index: 20;
    min-width: 180px;
}

.browse-preference-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-gray-100);
    cursor: pointer;
    user-select: none;
    padding: var(--space-xs) 0;
    border-radius: var(--border-radius-md);
    transition: color var(--transition-fast);
}

.browse-preference-option:hover {
    color: var(--surface);
}

.browse-preference-option input {
    appearance: none;
    width: 18px;
    height: 18px;
    cursor: pointer;
    border-radius: 6px;
    border: var(--exam-item-border-width) solid var(--exam-item-border-color);
    background: var(--exam-item-bg);
    display: grid;
    place-items: center;
    transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.browse-preference-option input::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--danger) 95%, transparent);
    transform: scale(0.25);
    opacity: 0;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.browse-preference-option input[type="checkbox"]:checked {
    border-color: var(--exam-item-border-color);
    background: var(--exam-item-bg);
}

.browse-preference-option input[type="checkbox"]:checked::after {
    transform: scale(1);
    opacity: 1;
}

.browse-preference-option input[type="checkbox"]:focus-visible {
    outline: none;
    border-color: color-mix(in srgb, var(--danger) 80%, transparent);
}

.browse-preference-text {
    color: var(--color-gray-100);
    font-size: var(--font-size-sm);
}

.browse-title-trigger.active {
    background: color-mix(in srgb, var(--surface) 16%, transparent);
    color: var(--color-brand-primary);
    box-shadow: none;
}

.browse-title-trigger.active::after {
    content: none;
}

.browse-title-trigger.active .browse-title-dot {
    opacity: 1;
    transform: scale(1);
}

.browse-title-trigger.active:hover,
.browse-title-trigger.active:focus {
    background: color-mix(in srgb, var(--surface) 22%, transparent);
    color: var(--color-brand-primary);
    box-shadow: none;
}

#type-filter-buttons {
    margin-left: auto;
    display: flex;
    gap: var(--space-sm);
}

/* Bloom Light Palette（青橙玻璃质感） */
:root {
    --bloom-surface: color-mix(in srgb, var(--surface) 95%, transparent);
    --bloom-surface-strong: color-mix(in srgb, var(--surface-subtle) 92%, transparent);
    --bloom-border: color-mix(in srgb, var(--warning) 35%, transparent);
    --bloom-border-strong: color-mix(in srgb, var(--warning) 50%, transparent);
    --bloom-sheen: none;
    --bloom-highlight: var(--accent);
    --bloom-shadow: var(--elevation-1);
}

.category-card {
    background: var(--bloom-surface);
    background-image: none;
    padding: var(--space-xl);
    border-radius: var(--border-radius-xl);
    border: 1px solid var(--bloom-border);
    transition: all var(--transition-normal);
    box-shadow: var(--bloom-shadow);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--bloom-highlight);
    opacity: 0.9;
    box-shadow: var(--elevation-1);
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--elevation-1);
    border-color: var(--bloom-border-strong);
}

.category-card:hover::before {
    opacity: 1;
}

.category-header {
    display: flex;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.category-icon {
    font-size: 2.5rem;
    margin-right: var(--space-lg);
    opacity: 0.8;
}

.category-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-gray-900);
    margin-bottom: var(--space-xs);
}

.category-meta {
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
    font-weight: var(--font-weight-medium);
}

.overview-section-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    grid-column: 1 / -1;
    margin: var(--space-lg) 0 var(--space-md);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-gray-800);
}

.overview-section-icon {
    font-size: 1.75rem;
}

.overview-section-label {
    letter-spacing: 0.01em;
}

.overview-empty {
    grid-column: 1 / -1;
    padding: var(--space-xl);
    text-align: center;
    border-radius: var(--border-radius-xl);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--color-gray-600);
    border: 1px dashed color-mix(in srgb, var(--accent) 35%, transparent);
}

.category-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-top: var(--space-xl);
}

.category-action-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--border-radius-lg);
    font-weight: var(--font-weight-medium);
}

.category-action-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.category-card .category-actions {
    display: flex !important;
    gap: var(--space-md) !important;
    margin-top: var(--space-xl) !important;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
}

.exam-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-md);
    max-height: 72vh;
    overflow-y: auto;
    padding-left: var(--space-sm);
    align-content: start;
}

.exam-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-2xl) var(--space-xl);
    text-align: center;
    border-radius: var(--border-radius-xl);
    background: color-mix(in srgb, var(--surface-subtle) 16%, transparent);
    border: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent);
    color: var(--color-gray-700);
}

.exam-list-empty-icon {
    font-size: 2.5rem;
}

.exam-list-empty-text {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
}

.exam-list-empty-hint {
    font-size: var(--font-size-sm);
    color: var(--color-gray-500);
}

.exam-list-empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
}

.exam-list-empty-action {
    min-width: 140px;
    font-weight: var(--font-weight-medium);
}

.completion-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    box-shadow: var(--elevation-1);
    background: var(--color-gray-400);
}

.completion-dot--excellent {
    background: var(--color-success-500, var(--success));
}

.completion-dot--strong {
    background: var(--warning);
}

.completion-dot--average {
    background: var(--danger);
}

.completion-dot--weak {
    background: var(--danger);
}

.exam-list::-webkit-scrollbar {
    width: 6px;
}

.exam-list::-webkit-scrollbar-track {
    background: var(--color-gray-100);
    border-radius: var(--border-radius-full);
}

.exam-list::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: var(--border-radius-full);
}

.exam-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-400);
}

.exam-item {
    background: var(--bloom-surface);
    background-image: none;
    padding: var(--space-lg);
    border-radius: var(--border-radius-xl);
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    transition: all var(--transition-normal);
    box-shadow: var(--bloom-shadow);
    position: relative;
}

.exam-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--elevation-1);
    border-color: color-mix(in srgb, var(--surface) 70%, transparent);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    background-image: none;
}

.exam-item:hover .exam-item-action-btn {
    opacity: 1;
    transform: scale(1);
}

.exam-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex: 1;
}

.exam-info h4 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-gray-900);
    line-height: var(--line-height-tight);
}

.exam-meta {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
    margin-top: var(--space-xs);
    padding: 6px 10px;
    border-radius: var(--border-radius-lg);
    background: color-mix(in srgb, var(--warning) 18%, transparent);
}

.exam-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-sm);
    width: 100%;
}

.exam-item-action-btn {
    opacity: 0.95;
    transform: translateY(0);
    transition: all var(--transition-normal);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    border-radius: var(--border-radius-lg);
    border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: var(--elevation-1);
}

.exam-item-action-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    background: var(--surface);
    box-shadow: var(--elevation-1);
}

.exam-item-action-btn.btn-secondary {
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    color: var(--text-primary);
    border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
    box-shadow: var(--elevation-1);
}

.exam-item-action-btn.btn-secondary:hover:not(:disabled) {
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: var(--elevation-1);
}

.exam-item-action-btn:disabled,
.exam-item-action-btn[aria-disabled="true"] {
    opacity: 0.45;
    filter: grayscale(0.3);
    box-shadow: none;
    cursor: not-allowed;
}

.exam-item--suite-selecting {
    border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, transparent);
    background: var(--surface);
    box-shadow: var(--elevation-1);
    cursor: pointer;
}

.exam-item--suite-selecting:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--accent) 80%, transparent);
    box-shadow: var(--elevation-1);
}

.exam-item--suite-selecting .exam-item-action-btn {
    opacity: 0.5;
}

.exam-item--suite-selected {
    border: 1px solid color-mix(in srgb, var(--success) 55%, transparent);
    box-shadow: var(--elevation-1);
}

.suite-custom-selection-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    align-self: center;
    min-height: 28px;
    margin-top: 0;
    margin-left: auto;
    padding: 0 10px;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--surface-subtle) 92%, transparent);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    box-shadow: var(--elevation-1);
}

@media (max-width: 520px) {
    .suite-custom-selection-badge {
        width: fit-content;
        margin-left: 0;
    }
}

.suite-custom-selection-portal {
    position: fixed;
    inset: 0;
    z-index: 2600;
    pointer-events: none;
}

.suite-custom-selection__backdrop {
    display: none;
}

.suite-custom-selection__panel {
    position: fixed;
    top: 50%;
    right: 24px;
    width: min(380px, calc(100vw - 48px));
    transform: translateY(-50%) scale(1);
    transform-origin: center center;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border-radius: 28px;
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--surface) 55%, transparent);
    box-shadow: var(--elevation-1);
transition: transform 420ms cubic-bezier(0.22, 1.15, 0.36, 1), right 420ms cubic-bezier(0.22, 1.15, 0.36, 1), width 420ms cubic-bezier(0.22, 1.15, 0.36, 1);
}

.suite-custom-selection__panel--floating {
    right: auto;
    left: 0;
    top: 0;
    transform: none !important;
    transition: box-shadow 220ms ease;
}

.suite-custom-selection__panel.is-dragging {
    box-shadow: var(--elevation-1);
}

.suite-custom-selection__panel--ready {
    right: auto;
    left: 50%;
    width: min(460px, calc(100vw - 32px));
    transform: translate(-50%, -50%) scale(1.08);
    animation: suiteCustomSelectionPop 420ms cubic-bezier(0.22, 1.15, 0.36, 1);
}

.suite-custom-selection__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.suite-custom-selection__panel.is-dragging .suite-custom-selection__header {
    cursor: grabbing;
}

.suite-custom-selection__eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--accent) 72%, transparent);
    margin-bottom: 4px;
}

.suite-custom-selection__title-main {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.suite-custom-selection__progress {
    flex: 0 0 auto;
    min-width: 84px;
    padding: 8px 12px;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    box-shadow: var(--elevation-1);
}

.suite-custom-selection__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.suite-custom-selection__group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suite-custom-selection__group-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--accent) 72%, transparent);
}

.suite-custom-selection__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    border: 1px solid color-mix(in srgb, var(--surface-subtle) 72%, transparent);
    box-shadow: var(--elevation-1);
}

.suite-custom-selection__row--selected {
    background: var(--surface);
    border-color: color-mix(in srgb, var(--accent) 18%, transparent);
}

.suite-custom-selection__row--pending {
    opacity: 0.86;
}

.suite-custom-selection__row-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.suite-custom-selection__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    word-break: break-word;
}

.suite-custom-selection__meta {
    font-size: 12px;
    color: color-mix(in srgb, var(--accent) 74%, transparent);
}

.suite-custom-selection__delete {
    flex: 0 0 auto;
    align-self: center;
    border: none;
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    color: var(--danger);
    font-size: 12px;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.suite-custom-selection__delete:hover {
    transform: translateY(-1px);
    background: color-mix(in srgb, var(--danger) 16%, transparent);
}

.suite-custom-selection__empty {
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent);
    color: color-mix(in srgb, var(--accent) 80%, transparent);
    background: color-mix(in srgb, var(--surface) 55%, transparent);
    font-size: 13px;
}

.suite-custom-selection__footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.suite-custom-selection__button {
    border: none;
    border-radius: var(--radius-pill);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.suite-custom-selection__button:hover {
    transform: translateY(-1px);
}

.suite-custom-selection__button--primary {
    color: var(--surface-subtle);
    background: var(--danger);
    box-shadow: var(--elevation-1);
}

.suite-custom-selection__button--primary:hover {
    background: var(--surface);
}

.suite-custom-selection__button--secondary {
    color: var(--text-primary);
    background: color-mix(in srgb, var(--surface) 74%, transparent);
    box-shadow: var(--elevation-1);
}

@keyframes suiteCustomSelectionPop {
    0% {
        transform: translate(-50%, -50%) scale(0.82);
    }

    70% {
        transform: translate(-50%, -50%) scale(1.12);
    }

    100% {
        transform: translate(-50%, -50%) scale(1.08);
    }
}

.practice-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

#browse-view .exam-list {
    padding-right: 5px;
    background: transparent;
    background-image: none;
    box-shadow: none;
}

#browse-view #exam-list-container {
    background: transparent;
    background-image: none;
    box-shadow: none;
}

.loading {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--color-gray-600);
}

.spinner {
    border: 3px solid var(--color-gray-200);
    border-radius: var(--border-radius-full);
    border-top: 3px solid var(--color-brand-primary);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-lg);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.search-box {
    margin-bottom: var(--space-xl);
    position: relative;
}

.search-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-input-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.search-input {
    width: 100%;
    padding: var(--space-md) 45px var(--space-md) var(--space-lg);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--border-radius-lg);
    background: var(--color-white);
    color: var(--color-gray-900);
    font-size: var(--font-size-base);
    font-family: var(--font-family-primary);
    transition: all var(--transition-normal);
    outline: none;

}

.search-clear-btn[hidden] {
    display: none !important;
}

.search-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--color-gray-100);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gray-500);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
    opacity: 0.8;
    box-shadow: var(--elevation-1);
    z-index: 2;
}

.search-input-wrap .search-clear-btn {
    right: 12px;
}

.search-clear-btn:hover {
    background: var(--color-gray-200);
    color: var(--color-gray-700);
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
    box-shadow: var(--elevation-1);
}

.search-clear-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.search-clear-btn svg {
    width: 14px;
    height: 14px;
}

.search-input:focus {
    border-color: var(--color-brand-primary);

}

.search-input::placeholder {
    color: var(--color-gray-400);
    font-weight: var(--font-weight-normal);
}

.browse-sort-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.browse-sort-icon {
    position: absolute;
    right: 14px;
    pointer-events: none;
    color: var(--color-gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
}

.browse-sort-select {
    min-width: 150px;
    appearance: none;
    -webkit-appearance: none;
    padding: var(--space-md) 36px var(--space-md) var(--space-lg);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--border-radius-lg);
    background: var(--color-white);
    color: var(--color-gray-900);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    outline: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.browse-sort-select:hover {
    border-color: var(--color-gray-400);
}

.browse-sort-select:focus {
    border-color: var(--color-brand-primary);
    box-shadow: var(--elevation-1);
}

@media (max-width: 768px) {
    .search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .browse-sort-select {
        width: 100%;
    }
}

/* 练习记录样式 */
.practice-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-2xl);
}

.stat-card {
    background: var(--surface-subtle);
    padding: var(--space-xl);
    border-radius: var(--border-radius-xl);
    text-align: center;
    border: 2px solid var(--text-secondary);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--color-brand-gradient);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-brand-primary);
    margin-bottom: var(--space-sm);
    line-height: var(--line-height-tight);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.practice-history {
    background: var(--surface);
    border-radius: var(--border-radius-xl);
    padding: var(--space-xl);
    border: 2px solid var(--text-secondary);
}

/* Override inline style for practice history header to fix button alignment */
.practice-history>div:first-of-type {
    justify-content: flex-start !important;
    gap: 20px;
}

.practice-history>div:first-of-type>div:last-child {
    margin-left: auto;
}

.practice-history-list,
#practice-history-list,
#history-list {
    overflow-y: visible;
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 8px;
    width: 100%;
}

.practice-history-list .record-selection,
#practice-history-list .record-selection {
    display: none;
    align-items: center;
    justify-content: center;
    margin-right: var(--space-sm);
}

.practice-history-list .history-item-selectable .record-selection,
#practice-history-list .history-item-selectable .record-selection {
    display: flex;
}

.practice-history-list .record-selection input[type="checkbox"],
#practice-history-list .record-selection input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.history-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: var(--space-lg);
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: var(--surface-subtle);
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--text-secondary);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    margin-bottom: 0;
    position: relative;
color: var(--text-primary);
}

.history-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-gray-300);
}

/* .history-item:last-child 规则不再需要 */

.delete-record-btn {
    background: none;
    border: none;
    font-size: var(--font-size-sm);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-normal);
    padding: var(--space-sm);
    border-radius: var(--border-radius-full);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gray-500);
}

.history-item:hover .delete-record-btn {
    opacity: 0.8;
}

.delete-record-btn:hover {
    opacity: 1;
    background: var(--color-error-bg);
    color: var(--color-error);
    transform: scale(1.1);
}

.history-item.deleting {
    opacity: 0.5;
    transform: scale(0.95);
    transition: all 0.3s ease;
}

.history-item.deleted {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border: none;
    margin-top: -1px;
    transform: translateX(50px);
    transition: all 0.5s ease;
}

.history-item-selected {
    background: var(--surface);
    border-color: var(--danger) !important;
    box-shadow: var(--elevation-1);
}

.history-item-selected:hover {
    background: var(--surface);
    border-color: var(--danger) !important;
}

.record-meta-line {
    display: flex;
    align-items: baseline;
    margin-top: 8px;
    gap: 20px;
    opacity: 0.8;
    color: var(--text-primary);
}

.record-date {
    white-space: nowrap;
}

.record-duration-value {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.record-duration-value .duration-time {
    font-size: 1.1em;
}

.record-percentage-container {
    justify-self: stretch;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    text-align: right;
    padding-right: var(--space-sm);
}

.record-actions-container {
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

.record-percentage {
    font-weight: bold;
    font-size: 1.2em;
    color: var(--text-primary);
}

.record-info-selectable {
    cursor: pointer;
}

.history-item-selectable {
    border-style: dashed;
}

.practice-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: var(--space-md);
    text-align: center;
    opacity: 0.7;
    color: var(--text-primary);
}

.practice-history-empty-icon {
    font-size: 3em;
}

.practice-history-empty-text {
    font-size: var(--font-size-base);
}

@media (max-width: 768px) {

    /* 练习历史列表 - 小屏幕单列 */
    .practice-history-list,
    #practice-history-list,
    #history-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .message-container {
        position: fixed;
        top: 112px;
        left: 50%;
        right: auto;
        width: min(620px, calc(100vw - 24px));
        min-height: 54px;
        margin-bottom: 0;
        transform: translateX(-50%);
    }

    .container {
        padding: 10px;
    }

    .header {
        padding: 20px;
        margin-bottom: 20px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .main-nav {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .nav-btn {
        width: 100%;
        max-width: 300px;
        padding: 12px 20px;
        font-size: 14px;
    }

    .category-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .category-card {
        padding: 20px;
    }

    .category-actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .exam-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
    }

    .exam-actions {
        width: 100%;
        justify-content: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .exam-actions .btn {
        width: 100%;
        margin: 0;
    }

    .view {
        padding: 20px;
    }

    .search-input {
        font-size: 16px;
        /* 防止iOS缩放 */
    }

    .practice-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-number {
        font-size: 1.5em;
    }

    /* 设置页面移动优化 */
    #settings-view div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 10px !important;
    }

    #settings-view .btn {
        width: 100%;
        margin: 5px 0 !important;
    }

    /* 报告显示优化 */
    .performance-report,
    .backup-list,
    .validation-report,
    .ux-report {
        margin: 10px 0 !important;
        padding: 15px !important;
    }

    /* 虚拟滚动容器优化 */
    #virtual-scroll-container {
        height: 400px !important;
    }
}

/* Developer Modal Styles */
.developer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: color-mix(in srgb, var(--text-primary) 48%, transparent);
display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.developer-modal.show {
    opacity: 1;
    visibility: visible;
}

.backup-list-container {
    width: 100%;
    max-width: 1080px;
    margin: var(--space-2xl) auto 0;
}

.backup-list-card {
    width: 100%;
    background: var(--bloom-surface-strong);
    background-image: none;
    border: 1px solid var(--bloom-border);
    border-radius: var(--border-radius-2xl);
    padding: var(--space-xl);
box-shadow: var(--bloom-shadow);
    color: var(--color-gray-700);
}

.backup-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.backup-list-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.backup-list-title-icon {
    font-size: 1.6rem;
    color: var(--warning);
}

.backup-list-dismiss {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--border-radius-md);
}

.backup-list-scroll {
    max-height: 640px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-md);
}

.backup-entry {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-radius: var(--border-radius-xl);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
    transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.backup-entry:hover {
    background: var(--surface);
    box-shadow: var(--elevation-1);
    transform: translateY(-1px);
}

.backup-entry-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--color-gray-700);
    word-break: break-all;
}

.backup-entry-meta {
    font-size: var(--font-size-sm);
    color: color-mix(in srgb, var(--accent) 60%, transparent);
}

.backup-entry-actions {
    display: flex;
    justify-content: flex-end;
}

.backup-entry-actions .btn {
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--border-radius-lg);
    font-size: var(--font-size-sm);
    box-shadow: none;
}

.backup-entry-restore {
    min-width: 88px;
}

.backup-list-empty {
    text-align: center;
    padding: var(--space-xl);
    border-radius: var(--border-radius-xl);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    color: var(--text-secondary);
    border: 1px dashed color-mix(in srgb, var(--warning) 35%, transparent);
}

.backup-list-empty-icon {
    font-size: 2.2rem;
    margin-bottom: var(--space-sm);
}

.backup-list-empty-hint {
    margin-top: var(--space-sm);
    font-size: var(--font-size-sm);
    color: color-mix(in srgb, var(--accent) 65%, transparent);
}

.library-config-list {
    margin-top: var(--space-xl);
    position: relative;
    z-index: 10;
}

.library-config-panel {
    background: var(--library-config-bg);
    border: 1px solid var(--library-config-border);
    border-radius: 18px;
    padding: var(--space-lg);
    color: var(--library-config-text);
    box-shadow: var(--elevation-1);
position: relative;
    overflow: hidden;
}

.library-config-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: var(--surface);
    opacity: 0.8;
}

.library-config-panel > * {
    position: relative;
    z-index: 1;
}

.library-config-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.library-config-panel__title {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--library-config-text);
    letter-spacing: 0;
}

.library-config-panel__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: var(--border-radius-full);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
    font-size: var(--font-size-xs);
    line-height: 1.2;
}

.library-config-panel__list {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin: var(--space-md) 0 var(--space-lg);
}

.library-config-panel__item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--border-radius-lg);
    background: var(--library-config-item-bg);
    border: 1px solid var(--library-config-item-border);
    box-shadow: var(--elevation-1);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

.library-config-panel__item:hover {
    transform: translateY(-1px);
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    box-shadow: var(--elevation-1);
}

.library-config-panel__item--active {
    background: var(--library-config-item-active-bg);
    border-color: var(--library-config-item-active-border);
    box-shadow: var(--elevation-1);
}

.library-config-panel__info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--library-config-text);
}

.library-config-panel__meta {
    font-size: var(--font-size-xs);
    color: var(--library-config-meta);
}

.library-config-panel__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.library-config-panel__actions .btn {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--border-radius-full);
    font-size: var(--font-size-xs);
    box-shadow: var(--elevation-1);
    min-width: 64px;
}

.library-config-panel__footer {
    margin-top: var(--space-md);
}

.library-config-panel__close {
    width: 100%;
}

.library-config-panel__empty {
    text-align: center;
    padding: var(--space-lg);
    border-radius: var(--border-radius-lg);
    background: var(--library-config-item-bg);
    border: 1px dashed var(--library-config-item-border);
    color: var(--library-config-meta);
}

.library-config-panel__empty-icon {
    display: block;
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.library-config-panel__empty-hint {
    font-size: var(--font-size-sm);
    color: var(--library-config-meta);
}

.library-config-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 4200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    background: var(--surface);
}

.library-config-confirm-dialog {
    width: min(420px, 92vw);
    position: relative;
    overflow: hidden;
    padding: 22px;
    border-radius: 18px;
    background: var(--library-config-bg);
    border: 1px solid var(--library-config-border);
    color: var(--library-config-text);
    box-shadow: var(--elevation-1);
}

.library-config-confirm-dialog::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: var(--surface);
}

.library-config-confirm-title,
.library-config-confirm-body,
.library-config-confirm-actions {
    position: relative;
    z-index: 1;
}

.library-config-confirm-title {
    margin: 0;
    color: var(--library-config-text);
    font-size: 1.1rem;
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0;
}

.library-config-confirm-body {
    margin: var(--space-sm) 0 0;
    color: var(--library-config-meta);
    line-height: 1.55;
}

.library-config-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.library-config-confirm-actions .btn {
    min-width: 76px;
    border-radius: var(--border-radius-full);
}

.backup-modal-overlay {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--text-primary) 45%, transparent);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-2xl) var(--space-lg);
    z-index: 3000;
}

.backup-modal {
    width: min(640px, 92vw);
    max-height: 80vh;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    border-radius: var(--border-radius-xl);
    border: 1px solid color-mix(in srgb, var(--text-secondary) 25%, transparent);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    color: var(--color-gray-700);
}

.backup-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid color-mix(in srgb, var(--text-secondary) 20%, transparent);
}

.backup-modal-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--color-gray-700);
}

.backup-modal-body {
    padding: var(--space-lg) var(--space-xl);
    overflow-y: auto;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.backup-modal-footer {
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid color-mix(in srgb, var(--text-secondary) 20%, transparent);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-xs);
}

.developer-modal-content {
    background: var(--color-white);
    border-radius: var(--border-radius-2xl);
    padding: var(--space-2xl);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9) translateY(-20px);
    transition: all var(--transition-normal);
    border: 1px solid var(--color-gray-200);
}

.developer-modal.show .developer-modal-content {
    transform: scale(1) translateY(0);
}

.developer-modal h2 {
    text-align: center;
    margin-bottom: var(--space-xl);
    color: var(--color-gray-900);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
}

.developer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.developer-card {
    background: var(--color-gray-50);
    padding: var(--space-lg);
    border-radius: var(--border-radius-lg);
    text-align: center;
    border: 1px solid var(--color-gray-200);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.developer-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-brand-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.developer-card:hover {
    background: var(--color-white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-gray-300);
}

.developer-card:hover::before {
    opacity: 1;
}

.developer-name {
    font-weight: var(--font-weight-semibold);
    color: var(--color-gray-900);
    font-size: var(--font-size-base);
    margin-bottom: var(--space-sm);
}

.developer-emoji {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-md);
    display: block;
}

.modal-close-btn {
    background: var(--color-white);
    border: 1px solid var(--color-gray-300);
    color: var(--color-gray-700);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-normal);
    display: block;
    margin: 0 auto;
}

.modal-close-btn:hover {
    background: var(--color-gray-50);
    border-color: var(--color-gray-400);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Redesigned Theme Modal */
.theme-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--text-primary) 65%, transparent);
z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.theme-modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.theme-modal-content {
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    border-radius: var(--radius-xl);
    width: min(900px, 92vw);
    max-height: 85vh;
    box-shadow: var(--elevation-1);
    border: 1px solid color-mix(in srgb, var(--surface) 40%, transparent);
display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-modal.show .theme-modal-content {
    transform: scale(1);
}

.theme-modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid color-mix(in srgb, var(--text-primary) 6%, transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.theme-modal-header h3 {
    font-size: 1.75rem;
    font-weight: 800;
    background: var(--surface);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    letter-spacing: 0;
}

.theme-modal-close {
    background: color-mix(in srgb, var(--text-primary) 5%, transparent);
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-modal-close:hover {
    background: color-mix(in srgb, var(--text-primary) 10%, transparent);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.theme-modal-body {
    padding: 0;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.theme-options-viewport {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

/* Theme switcher cards */
.theme-options-viewport > div {
    display: flex;
    gap: 24px;
    padding: 20px 20px 30px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
}

.theme-options-viewport > div::-webkit-scrollbar {
    display: none;
}

.theme-card {
    flex-shrink: 0;
    scroll-snap-align: center;
    position: relative;
    width: 250px;
    height: 350px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--elevation-1);
    transition:
        transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    text-align: left;
}

.theme-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--elevation-1);
}

.theme-card-bg {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.theme-bg-misty {
    background: var(--surface);
}

.theme-bg-misty::after {
    content: "";
    position: absolute;
    top: 15%;
    left: 25%;
    width: 90px;
    height: 90px;
    background: var(--surface);
    opacity: 0.85;
}

.theme-bg-ocean {
    background: var(--surface);
}

.theme-bg-ocean::after {
    content: "";
    position: absolute;
    bottom: 35%;
    left: 30%;
    right: 0;
    width: 100px;
    height: 20px;
    background: var(--surface);
    opacity: 0.6;
}

.theme-bg-floral {
    background: var(--surface);
}

.theme-bg-floral::after {
    content: "";
    position: absolute;
    top: 15%;
    left: 40%;
    width: 100px;
    height: 100px;
    background: var(--surface);
    opacity: 0.8;
    mix-blend-mode: multiply;
}

.theme-bg-floral::before {
    content: "";
    position: absolute;
    top: 40%;
    left: 10%;
    width: 120px;
    height: 100px;
    background: var(--surface);
    opacity: 0.8;
    filter: blur(5px);
}

.theme-card > div {
    position: relative;
    z-index: 2;
    padding: 36px 16px 16px;
    background: color-mix(in srgb, var(--text-primary) 45%, transparent);
-webkit-mask-image: none;
    mask-image: none;
    color: var(--surface);
}

.theme-card-header {
    margin-bottom: 20px;
}

.theme-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 6px 0;
    letter-spacing: 0.5px;
    text-shadow: none;
}

.theme-card-subtitle {
    font-size: 0.8rem;
    color: color-mix(in srgb, var(--surface) 70%, transparent);
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-card-tag {
    background: color-mix(in srgb, var(--text-primary) 50%, transparent);
    color: var(--surface);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid color-mix(in srgb, var(--surface) 8%, transparent);
    letter-spacing: 0.5px;
}

.theme-card-btn {
    background: var(--surface);
    color: var(--text-primary);
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--elevation-1);
}

.theme-card-btn:hover {
    background: var(--surface-subtle);
    transform: scale(1.04);
}

.theme-card-btn:active {
    transform: scale(0.98);
}

.theme-option {
    background: var(--surface);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    border: 1px solid color-mix(in srgb, var(--text-primary) 4%, transparent);
    box-shadow: var(--elevation-1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.theme-option::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--surface);
    opacity: 0.1;
    z-index: 0;
    transition: opacity 0.3s ease;
}

.theme-option:hover {
    transform: translateY(-6px);
    box-shadow: var(--elevation-1);
    border-color: color-mix(in srgb, var(--text-primary) 8%, transparent);
}

.theme-option:hover::before {
    opacity: 0.2;
}

.theme-info {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.theme-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.theme-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.theme-option .btn {
    width: 100%;
    margin-top: auto;
    justify-content: center;
}

.theme-option:nth-child(1) {
    --theme-accent-start: var(--accent);
    --theme-accent-end: var(--accent-strong);
}

/* Academic */
.theme-option:nth-child(2) {
    --theme-accent-start: var(--warning);
    --theme-accent-end: var(--warning);
}

/* Bloom */
.theme-option:nth-child(3) {
    --theme-accent-start: var(--accent);
    --theme-accent-end: var(--accent);
}

/* Blue */
.theme-option:nth-child(4) {
    --theme-accent-start: var(--accent);
    --theme-accent-end: var(--accent);
}

/* Melody */
.theme-option:nth-child(5) {
    --theme-accent-start: var(--accent);
    --theme-accent-end: var(--accent);
}

/* HarryPotter */
.theme-option:nth-child(6) {
    --theme-accent-start: var(--warning-subtle);
    --theme-accent-end: var(--warning);
}

/* XiaoDaiDai */

/* Responsive */
@media (max-width: 640px) {
    .theme-options {
        grid-template-columns: 1fr;
    }

    .theme-modal-header h3 {
        font-size: 1.25rem;
    }
}

/* License Modal */
#license-modal {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
        sans-serif;
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--surface-subtle) 88%, transparent);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    z-index: 9999;
}

#license-modal:not(.show) {
    display: none;
}

#license-modal.show {
    opacity: 1;
    pointer-events: auto;
}

#license-modal .lm-card {
    max-width: 480px;
    width: calc(100% - 48px);
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--text-primary) 7%, transparent);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--elevation-1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    transform: translateY(8px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#license-modal.show .lm-card {
    transform: translateY(0);
}

#license-modal .lm-title {
    color: var(--text-primary);
    font-size: 22px;
    line-height: 32px;
    font-weight: 600;
    margin: 0 0 24px 0;
}

#license-modal .lm-body {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}

#license-modal .lm-body p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 24px;
}

#license-modal .lm-body .lm-warning {
    color: var(--danger);
    font-weight: 600;
}

#license-modal .lm-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

#license-modal .lm-info-box {
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--surface-subtle);
    border-radius: 10px;
}

#license-modal .lm-footer {
    margin-top: 24px;
    width: 100%;
    display: flex;
    justify-content: center;
}

#license-modal .lm-btn {
    background: var(--text-primary);
    color: var(--surface);
    border: none;
    border-radius: 8px;
    padding: 12px 40px;
    font-size: 15px;
    line-height: 24px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--elevation-1);
    transition:
        background 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.12s ease;
}

#license-modal .lm-btn:hover {
    background: var(--text-primary);
    box-shadow: var(--elevation-1);
    transform: translateY(-1px);
}

#license-modal .lm-btn:active {
    background: var(--text-primary);
    box-shadow: var(--elevation-1);
    transform: translateY(0);
}

/* 设置界面模块样式 */
#settings-view>div>div {
    position: relative;
    border: 1px solid var(--bloom-border);
    border-radius: var(--border-radius-lg);
    margin-bottom: var(--space-xl);
    padding: var(--space-xl);
    background: var(--bloom-surface-strong);
    background-image: none;
    box-shadow: var(--bloom-shadow);
}

#settings-view>div>div>div {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

#settings-view>div>div>div>div {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.reading-candidate-code-settings {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-md);
    width: min(100%, 720px);
    margin: 0 auto;
}

.reading-candidate-code-option {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
    border: 1px solid var(--bloom-border);
    border-radius: var(--border-radius-md);
    background: color-mix(in srgb, var(--surface) 58%, transparent);
    color: var(--color-text);
    cursor: pointer;
}

.reading-candidate-code-option input {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--color-primary);
}

.reading-candidate-code-option span {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.reading-candidate-code-option strong {
    font-size: 0.95rem;
    line-height: 1.25;
}

.reading-candidate-code-option small {
    color: var(--color-text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}

.reading-candidate-code-controls {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.reading-candidate-code-input {
    width: 160px;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--bloom-border);
    border-radius: var(--border-radius-md);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    color: var(--color-text);
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
}

.reading-candidate-code-input:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

.reading-candidate-code-status {
    min-height: 20px;
    color: var(--color-text-secondary);
    font-size: 0.86rem;
    text-align: center;
}

.reading-candidate-code-status[data-state="error"] {
    color: var(--color-danger, var(--danger));
}

.reading-candidate-code-status[data-state="success"] {
    color: var(--color-success, var(--success));
}

body.bloom-dark-mode .reading-candidate-code-option,
body.blue-dark-mode .reading-candidate-code-option {
    background: color-mix(in srgb, var(--text-primary) 58%, transparent);
}

body.bloom-dark-mode .reading-candidate-code-input,
body.blue-dark-mode .reading-candidate-code-input {
    background: color-mix(in srgb, var(--text-primary) 72%, transparent);
    color: var(--surface-subtle);
}

/* 小屏幕设备进一步优化 */
@media (max-width: 480px) {
    .container {
        padding: 5px;
    }

    .header {
        padding: 15px;
    }

    .header h1 {
        font-size: 1.3em;
    }

    .nav-btn {
        padding: 10px 15px;
        font-size: 13px;
    }

    .category-card,
    .exam-item {
        padding: 12px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }

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

    .message {
        min-width: min(248px, calc(100vw - 40px));
        min-height: 44px;
        padding: 9px 18px;
        font-size: 12.5px;
    }

    .developer-modal-content {
        padding: 20px;
        margin: 20px;
    }

    .developer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .developer-card {
        padding: 12px;
    }

    .developer-name {
        font-size: 0.9em;
    }
}

/* Modal System */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: color-mix(in srgb, var(--text-primary) 48%, transparent);
display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.modal-overlay.show {
    opacity: 1;
}

.modal-container {
    background: var(--color-white);
    border-radius: var(--border-radius-2xl);
    box-shadow: var(--shadow-xl);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(-20px) scale(0.95);
    transition: all var(--transition-normal);
    color: var(--color-gray-900);
    border: 1px solid var(--color-gray-200);
}

.modal-overlay.show .modal-container {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xl) var(--space-2xl);
    border-bottom: 1px solid var(--color-gray-200);
    background: var(--color-gray-50);
}

.modal-title {
    margin: 0;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-gray-900);
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--font-size-xl);
    color: var(--color-gray-500);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--border-radius-md);
    transition: all var(--transition-normal);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--color-gray-200);
    color: var(--color-gray-700);
}

.modal-body {
    padding: var(--space-2xl);
    max-height: 60vh;
    overflow-y: auto;
}

.record-summary h4 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 12px 16px;
    background: var(--color-brand-gradient);
    color: var(--surface);
    border-radius: 8px;
}

.record-summary .record-summary-replay-trigger {
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.record-summary .record-summary-replay-trigger:hover {
    transform: translateY(-1px);
    box-shadow: var(--elevation-1);
}

.record-summary .record-summary-replay-trigger:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--surface) 85%, transparent);
    outline-offset: 2px;
}

.record-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface-subtle);
    border-radius: 8px;
    border-left: 4px solid var(--border);
}

.meta-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.meta-value {
    font-weight: 600;
    color: var(--text-color, var(--text-primary));
}

.score-highlight {
    color: var(--success) !important;
    font-size: 1.1em;
}

.answer-details h5 {
    margin: 0 0 16px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.suite-entry {
    margin: var(--space-lg) 0;
    padding: var(--space-lg);
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--border-radius-lg);
}

.suite-entry+.suite-entry {
    margin-top: var(--space-xl);
}

.suite-entry h5 {
    margin: 0 0 var(--space-md) 0;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-gray-800);
}

.suite-entry .answers-summary {
    margin-top: 0;
    margin-bottom: var(--space-md);
}

.answer-table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color, var(--border));
}

.answer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: var(--bg-color, var(--surface));
}

.answer-table thead {
    background: var(--header-bg, var(--surface-subtle));
}

.answer-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color, var(--text-primary));
    border-bottom: 2px solid var(--border-color, var(--border));
}

.answer-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light, var(--surface-subtle));
    color: var(--text-color, var(--text-primary));
}

.answer-row.correct {
    background: var(--success-bg, var(--success-subtle));
}

.answer-row.incorrect {
    background: var(--error-bg, var(--danger-subtle));
}

.question-num {
    font-weight: 600;
    color: var(--text-color, var(--text-primary));
    text-align: center;
    width: 80px;
}

.user-answer {
    color: var(--text-color, var(--text-primary));
    font-family: 'Courier New', monospace;
}

.correct-answer {
    color: var(--success-color, var(--success));
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.result {
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    width: 60px;
}

.result.correct {
    color: var(--success-color, var(--success));
}

.result.incorrect {
    color: var(--error-color, var(--danger));
}

.no-details {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 40px 20px;
    background: var(--surface-subtle);
    border-radius: 8px;
    margin: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    padding: var(--space-xl) var(--space-2xl);
    border-top: 1px solid var(--color-gray-200);
    background: var(--color-gray-50);
}

.modal-footer .btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Modal Button Styles */
.modal-footer .btn-primary {
    background: var(--color-brand-gradient);
    color: var(--color-white);
}

.modal-footer .btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.modal-footer .btn-secondary {
    background: var(--color-gray-600);
    color: var(--color-white);
}

.modal-footer .btn-secondary:hover:not(:disabled) {
    background: var(--color-gray-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* 可点击的练习记录标题样式 */
.practice-record-title {
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
    font-size: 1.1em;
    /* 加大标题字体 */
}

/* Library loader modal */
.library-loader-overlay {
    align-items: center;
    justify-content: center;
}

.library-loader-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.library-loader-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.library-loader-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.library-loader-instructions-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.7;
}

.library-loader-input {
    display: none;
}

.library-loader-report {
    margin-top: 18px;
    padding: 16px;
}

.library-loader-report[hidden] {
    display: none;
}

.library-loader-report__title {
    font-weight: 700;
    margin-bottom: 10px;
}

.library-loader-report__message,
.library-loader-report__note {
    margin: 8px 0 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.library-loader-report-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.library-loader-report-stat {
    min-width: 0;
    padding: 10px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 75%, transparent);
    border: 1px solid color-mix(in srgb, var(--surface-subtle) 80%, transparent);
}

.library-loader-report-stat__label,
.library-loader-report-stat__value {
    display: block;
}

.library-loader-report-stat__value {
    margin-top: 2px;
    font-size: 1.1rem;
}

.library-loader-report-reasons {
    margin: 12px 0 0;
    padding-left: 20px;
    line-height: 1.6;
}

.library-loader-report-samples {
    margin-top: 10px;
    display: grid;
    gap: 6px;
}

.library-loader-report-sample {
    padding: 8px 10px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .library-loader-report-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.library-loader-overlay {
    background: var(--surface);
}

.library-loader-modal {
    width: min(92vw, 920px);
    max-height: min(88vh, 820px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    background: color-mix(in srgb, var(--surface) 76%, transparent);
    color: var(--text-primary);
    border: 1px solid color-mix(in srgb, var(--surface) 78%, transparent);
    border-radius: 22px;
    box-shadow: var(--elevation-1);
}

.library-loader-modal::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: var(--surface);
}

.library-loader-header,
.library-loader-body,
.library-loader-footer {
    position: relative;
    z-index: 1;
}

.library-loader-header {
    background: transparent;
    color: var(--text-primary);
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    border-radius: 0;
    padding: 22px 28px 18px;
}

.library-loader-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.library-loader-eyebrow,
.library-loader-card-kicker {
    color: color-mix(in srgb, var(--text-primary) 56%, transparent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
}

.library-loader-header .modal-title {
    color: var(--text-primary);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
}

.library-loader-close {
    width: 36px;
    height: 36px;
    background: color-mix(in srgb, var(--surface) 62%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    color: var(--text-primary);
    box-shadow: var(--elevation-1);
}

.library-loader-close:hover {
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    transform: translateY(-1px);
}

.library-loader-body {
    padding: 26px 28px;
    overflow: auto;
}

.library-loader-grid {
    gap: 16px;
}

.library-loader-card {
    border-radius: 8px;
    padding: 18px;
    background: color-mix(in srgb, var(--surface) 54%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    box-shadow: var(--elevation-1);
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.library-loader-card:hover {
    transform: translateY(-2px);
    background: color-mix(in srgb, var(--surface) 68%, transparent);
    box-shadow: var(--elevation-1);
}

.library-loader-card--reading {
    border-color: color-mix(in srgb, var(--accent) 20%, transparent);
}

.library-loader-card--listening {
    border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}

.library-loader-card-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: 0;
}

.library-loader-card--reading .library-loader-card-title,
.library-loader-card--listening .library-loader-card-title {
    color: var(--text-primary);
}

.library-loader-card-description {
    color: color-mix(in srgb, var(--text-primary) 70%, transparent);
    line-height: 1.55;
}

.library-loader-primary,
.library-loader-secondary {
    border-radius: var(--border-radius-full);
    padding: 10px 16px;
    min-height: 40px;
    font-weight: 700;
    letter-spacing: 0;
}

.library-loader-primary,
.library-loader-card--listening .library-loader-primary {
    color: var(--surface);
    background: var(--accent);
    box-shadow: var(--elevation-1);
}

.library-loader-card--listening .library-loader-primary {
    background: var(--accent);
    box-shadow: var(--elevation-1);
}

.library-loader-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--elevation-1);
}

.library-loader-secondary,
.library-loader-card--listening .library-loader-secondary {
    background: color-mix(in srgb, var(--surface) 62%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    color: var(--text-primary);
}

.library-loader-secondary:hover,
.library-loader-card--listening .library-loader-secondary:hover {
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    transform: translateY(-1px);
}

.library-loader-hint {
    color: color-mix(in srgb, var(--text-primary) 56%, transparent);
    font-size: 0.84rem;
    line-height: 1.5;
}

.library-loader-instructions {
    margin-top: 16px;
    padding: 16px 18px;
    background: color-mix(in srgb, var(--surface) 48%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
    border-radius: 8px;
    color: color-mix(in srgb, var(--text-primary) 72%, transparent);
    box-shadow: var(--elevation-1);
}

.library-loader-instructions-title {
    color: var(--text-primary);
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0;
}

.library-loader-footer {
    padding: 16px 28px 22px;
    background: color-mix(in srgb, var(--surface) 38%, transparent);
    border-top: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    border-radius: 0;
}

.library-loader-close-btn {
    background: color-mix(in srgb, var(--surface) 62%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    color: var(--text-primary);
    border-radius: var(--border-radius-full);
    box-shadow: var(--elevation-1);
}

.library-loader-report {
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    background: color-mix(in srgb, var(--surface) 62%, transparent);
    color: var(--text-primary);
    box-shadow: var(--elevation-1);
}

.library-loader-report--success {
    border-color: color-mix(in srgb, var(--success) 34%, transparent);
    background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.library-loader-report--empty,
.library-loader-report--warning {
    border-color: color-mix(in srgb, var(--warning) 34%, transparent);
    background: color-mix(in srgb, var(--surface) 78%, transparent);
}

.library-loader-report--error {
    border-color: color-mix(in srgb, var(--danger) 34%, transparent);
    background: color-mix(in srgb, var(--surface-subtle) 80%, transparent);
}

@media (prefers-reduced-transparency: reduce), (forced-colors: active) {
    .library-loader-overlay,
    .library-loader-modal,
    .library-loader-card,
    .library-loader-instructions,
    .library-config-panel,
    .library-config-panel__item,
    .library-config-confirm-overlay,
    .library-config-confirm-dialog {
background: var(--surface);
    }
}

@media (prefers-reduced-motion: reduce) {
    .library-loader-card,
    .library-loader-primary,
    .library-loader-secondary,
    .library-config-panel__item,
    .library-config-confirm-dialog {
        transition: none;
    }
}

@media (max-width: 900px) {
    .library-loader-modal {
        width: min(94vw, 720px);
        max-height: 90vh;
    }

    .library-loader-header,
    .library-loader-body,
    .library-loader-footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .library-loader-grid {
        grid-template-columns: 1fr;
    }
}

.practice-record-title:hover {
    color: var(--text-primary);
    /* A dark gray for hover */
    border-bottom-color: var(--text-primary);
    text-decoration: none;
}

.practice-record-title:active {
    color: var(--text-secondary);
}

/* 导出对话框样式 */
.export-options h4 {
    margin: 0 0 16px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.format-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.format-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.format-option:hover {
    border-color: var(--accent);
    background: var(--surface-subtle);
}

.format-option input[type="radio"] {
    margin-top: 2px;
}

.format-option input[type="radio"]:checked+.option-content {
    color: var(--accent);
}

.format-option:has(input[type="radio"]:checked) {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.option-content strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.option-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        margin: 20px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }

    .record-meta {
        grid-template-columns: 1fr;
    }

    .meta-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .answer-table {
        font-size: 0.8rem;
    }

    .answer-table th,
    .answer-table td {
        padding: 8px 12px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    .format-option {
        padding: 12px;
    }

    .option-content strong {
        font-size: 0.9rem;
    }

    .option-content p {
        font-size: 0.8rem;
    }
}

.exam-item-action-btn {
    padding: 8px 16px;
    font-size: 14px;
}

/* Bloom Theme Dark Mode Styles */
body.bloom-dark-mode {
    background: var(--surface);
    color: var(--surface-subtle);
    --exam-item-bg: color-mix(in srgb, var(--text-primary) 92%, transparent);
    --exam-item-border-color: color-mix(in srgb, var(--success) 45%, transparent);
    --exam-item-border-width: 1.5px;
}

.bloom-dark-mode .container {
    color: var(--surface-subtle);
}

.bloom-dark-mode .header {
    background: color-mix(in srgb, var(--text-primary) 94%, transparent);
    border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
}

.bloom-dark-mode .header h1,
.bloom-dark-mode .header p {
    color: var(--surface-subtle);
}

.bloom-dark-mode .nav-btn {
    background: color-mix(in srgb, var(--text-primary) 90%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
    color: var(--surface-subtle);
}

.bloom-dark-mode .nav-btn:hover {
    background: var(--surface);
    border-color: color-mix(in srgb, var(--warning) 50%, transparent);
    color: var(--surface);
}

.bloom-dark-mode .nav-btn.active {
    background: var(--color-brand-gradient);
    border-color: transparent;
    color: var(--color-white);
}

body.bloom-dark-mode,
body.blue-dark-mode,
:root[data-theme="blue"] body.blue-dark-mode {
    --library-config-bg: color-mix(in srgb, var(--text-primary) 85%, transparent);
    --library-config-border: color-mix(in srgb, var(--accent) 35%, transparent);
    --library-config-text: var(--border);
    --library-config-meta: color-mix(in srgb, var(--surface-subtle) 75%, transparent);
    --library-config-item-bg: color-mix(in srgb, var(--accent) 14%, transparent);
    --library-config-item-border: color-mix(in srgb, var(--accent) 25%, transparent);
    --library-config-item-active-bg: color-mix(in srgb, var(--accent) 24%, transparent);
    --library-config-item-active-border: color-mix(in srgb, var(--accent) 55%, transparent);
}

.bloom-dark-mode .view {
    background: color-mix(in srgb, var(--text-primary) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 28%, transparent);
    color: var(--surface-subtle);
}

.bloom-dark-mode .view>h2 {
    color: var(--surface-subtle);
}

.bloom-dark-mode .category-card {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
    color: var(--surface-subtle);
}

.bloom-dark-mode .category-title,
.bloom-dark-mode .category-meta {
    color: var(--surface-subtle);
}

.bloom-dark-mode .exam-item {
    background: var(--exam-item-bg);
    border: var(--exam-item-border-width) solid var(--exam-item-border-color);
    color: var(--surface-subtle);
}

.bloom-dark-mode .exam-info h4,
.bloom-dark-mode .exam-meta {
    color: var(--surface-subtle);
}

.bloom-dark-mode .stat-card {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
    color: var(--surface-subtle);
}

.bloom-dark-mode .stat-number {
    color: var(--success);
}

.bloom-dark-mode .stat-label {
    color: var(--surface-subtle);
}

.bloom-dark-mode .practice-history {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
}

.bloom-dark-mode .history-item {
    background: color-mix(in srgb, var(--text-primary) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
    color: var(--surface-subtle);
}

.bloom-dark-mode .record-meta-line,
.bloom-dark-mode .record-date,
.bloom-dark-mode .record-duration-value,
.bloom-dark-mode .record-percentage {
    color: var(--surface-subtle);
}

.bloom-dark-mode .search-input {
    background: color-mix(in srgb, var(--text-primary) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 28%, transparent);
    color: var(--surface-subtle);
}

.bloom-dark-mode .search-input:focus {
    border-color: var(--warning);
    box-shadow: var(--elevation-1);
}

.bloom-dark-mode .search-input::placeholder {
    color: color-mix(in srgb, var(--surface-subtle) 70%, transparent);
}

.bloom-dark-mode #settings-view>div>div {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
    color: var(--surface-subtle);
    box-shadow: var(--elevation-1);
}

.bloom-dark-mode .modal-container {
    background: color-mix(in srgb, var(--text-primary) 98%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 32%, transparent);
    color: var(--surface-subtle);
}

.bloom-dark-mode .modal-header {
    background: color-mix(in srgb, var(--text-primary) 95%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--success) 32%, transparent);
}

.bloom-dark-mode .modal-title {
    color: var(--surface-subtle);
}

.bloom-dark-mode .modal-close {
    color: var(--surface-subtle);
}

.bloom-dark-mode .modal-close:hover {
    background: color-mix(in srgb, var(--text-primary) 92%, transparent);
    color: var(--surface);
}

.bloom-dark-mode .modal-body {
    color: var(--surface-subtle);
}

.bloom-dark-mode .modal-footer {
    background: color-mix(in srgb, var(--text-primary) 95%, transparent);
    border-top: 1px solid color-mix(in srgb, var(--success) 32%, transparent);
}

.bloom-dark-mode .developer-modal-content {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
}

.bloom-dark-mode .developer-modal h2,
.bloom-dark-mode .developer-name {
    color: var(--surface-subtle);
}

.bloom-dark-mode .developer-card {
    background: color-mix(in srgb, var(--text-primary) 95%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 28%, transparent);
}

.bloom-dark-mode .developer-card:hover {
    background: color-mix(in srgb, var(--text-primary) 96%, transparent);
    border-color: color-mix(in srgb, var(--warning) 45%, transparent);
}

.bloom-dark-mode .modal-close-btn {
    background: color-mix(in srgb, var(--text-primary) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
    color: var(--surface-subtle);
}

.bloom-dark-mode .modal-close-btn:hover {
    background: color-mix(in srgb, var(--text-primary) 96%, transparent);
    border-color: color-mix(in srgb, var(--warning) 45%, transparent);
}

.bloom-dark-mode .theme-modal-content {
    background: color-mix(in srgb, var(--text-primary) 98%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 28%, transparent);
}

.bloom-dark-mode .theme-modal-header {
    background: color-mix(in srgb, var(--text-primary) 95%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--success) 28%, transparent);
}

.bloom-dark-mode .theme-modal-header h3 {
    color: var(--surface-subtle);
}

.bloom-dark-mode .theme-modal-close {
    color: var(--surface-subtle);
}

.bloom-dark-mode .theme-modal-close:hover {
    background: color-mix(in srgb, var(--surface) 10%, transparent);
    color: var(--surface-subtle);
}

.bloom-dark-mode .theme-option {
    background: color-mix(in srgb, var(--text-primary) 90%, transparent);
    border: 1px solid color-mix(in srgb, var(--success) 28%, transparent);
}

.bloom-dark-mode .theme-option:hover {
    background: color-mix(in srgb, var(--text-primary) 92%, transparent);
    border-color: color-mix(in srgb, var(--warning) 45%, transparent);
}

.bloom-dark-mode .theme-name,
.bloom-dark-mode .theme-desc {
    color: var(--surface-subtle);
}

.bloom-dark-mode .practice-record-title {
    color: var(--surface-subtle);
}

.bloom-dark-mode .practice-record-title:hover {
    color: var(--surface);
    border-bottom-color: var(--surface);
}

.bloom-dark-mode .practice-record-title:active {
    color: var(--accent);
}

/* Dark mode scrollbar */
.bloom-dark-mode ::-webkit-scrollbar {
    width: 8px;
}

.bloom-dark-mode ::-webkit-scrollbar-track {
    background: var(--text-primary);
    border-radius: 4px;
}

.bloom-dark-mode ::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--success) 55%, transparent);
    border-radius: 4px;
}

.bloom-dark-mode ::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--warning) 70%, transparent);
}

/* Bloom theme dark mode button style */
.btn-bloom-dark {
    background: var(--surface);
    color: var(--surface-subtle);
    border-color: color-mix(in srgb, var(--success) 32%, transparent);
}

.btn-bloom-dark:hover:not(:disabled) {
    background: var(--surface);
    border-color: color-mix(in srgb, var(--warning) 45%, transparent);
}

.btn-bloom-light {
    background: var(--surface);
    color: var(--text-primary);
    border-color: color-mix(in srgb, var(--warning) 60%, transparent);
}

.btn-bloom-light:hover:not(:disabled) {
    background: var(--surface);
    border-color: color-mix(in srgb, var(--warning) 75%, transparent);
}

:root[data-theme="blue"],
body.theme-blue {
    /* Override brand tokens to drive existing gradient usages */
    --color-brand-primary: var(--accent);
    --color-brand-secondary: var(--accent);
    --color-brand-gradient: var(--accent);

    /* Additional semantic tokens for overrides */
    --blue-primary: var(--accent);
    --blue-primary-600: var(--accent);
    --blue-primary-400: var(--accent);
    --blue-secondary: var(--accent);
    --blue-accent: var(--accent);
    --blue-accent-600: var(--accent);
    --blue-accent-500: var(--accent);
    --blue-success: var(--success-subtle);
    --blue-bg-tint: var(--accent-subtle);
    /* container half-width approximation for boat path */
    --blue-container-half: min(600px, 46vw);
    --blue-boat-outside: 12vw;
    --blue-boat-top: 46vh;
    /* Move waves from page bottom to boat position */
    --blue-wave-front-y: calc(var(--blue-boat-top) + 8px);
    --blue-wave-back-y: calc(var(--blue-boat-top) - 32px);
    /* how far boat starts/ends outside container */
    --blue-boat-width: 140px;
    --blue-boat-half: 70px;

    /* Exam item tokens */
    --exam-item-bg: var(--surface);
    --exam-item-border-color: color-mix(in srgb, var(--accent) 18%, transparent);
    --exam-item-border-width: 1px;
}

/* Base */
:root[data-theme="blue"] body,
body.theme-blue {
    background: var(--background);
    color: var(--text-primary);

}

@keyframes blueSeaSlide {
    0% {
        background-position: 0 var(--blue-wave-front-y), 0 var(--blue-wave-back-y), 0 calc(100% - 220px), 0 8%, center, 0% 0%, 100% 100%, center;
    }

    100% {
        background-position: 200% var(--blue-wave-front-y), 200% var(--blue-wave-back-y), 0 calc(100% - 220px), 0 8%, center, 0% 0%, 100% 100%, center;
    }
}

/* Boat element: behind all content, drifting right->left with gentle bobbing */
:root[data-theme="blue"] body::before,
body.theme-blue::before {
    display: none;
    content: none;

}

/* Blue dark mode boat with light */
body.theme-blue.blue-dark-mode::before,
:root[data-theme="blue"] body.blue-dark-mode::before {
    display: none;
    content: none;

}

@keyframes boatDrift {

    /* Uniform speed leftward, with gentler bow bob/tilt */
    0% {
        left: calc(100vw + var(--blue-boat-outside));
        transform: translateY(0) rotate(-2deg);
    }

    10% {
        transform: translateY(-3px) rotate(2.5deg);
    }

    20% {
        transform: translateY(3px) rotate(-2.5deg);
    }

    30% {
        transform: translateY(-3px) rotate(3deg);
    }

    40% {
        transform: translateY(3px) rotate(-2deg);
    }

    50% {
        transform: translateY(-3px) rotate(3deg);
    }

    60% {
        transform: translateY(3px) rotate(-2.5deg);
    }

    70% {
        transform: translateY(-3px) rotate(2deg);
    }

    80% {
        transform: translateY(3px) rotate(-2deg);
    }

    90% {
        transform: translateY(-3px) rotate(2deg);
    }

    100% {
        left: calc(-1 * (var(--blue-boat-width) + var(--blue-boat-outside)));
        transform: translateY(0) rotate(-2deg);
    }
}

/* Ensure content paints above the boat pseudo element */
:root[data-theme="blue"] .container,
body.theme-blue .container,
:root[data-theme="blue"] .view,
body.theme-blue .view,
:root[data-theme="blue"] header,
body.theme-blue header,
:root[data-theme="blue"] nav,
body.theme-blue nav,
:root[data-theme="blue"] footer,
body.theme-blue footer {
    position: relative;
    z-index: 1;
}

/* Header */
:root[data-theme="blue"] .header,
body.theme-blue .header {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

:root[data-theme="blue"] .header h1,
body.theme-blue .header h1 {
    color: var(--text-primary);
}

/* Views */
:root[data-theme="blue"] .view,
body.theme-blue .view {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}

/* Category/Card */
:root[data-theme="blue"] .category-card,
body.theme-blue .category-card {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    box-shadow: var(--elevation-1);
}

:root[data-theme="blue"] .category-card::before,
body.theme-blue .category-card::before {
    background: var(--color-brand-gradient);
    opacity: 1;
}

/* Exam items */
:root[data-theme="blue"] .exam-item,
body.theme-blue .exam-item {
    background: var(--exam-item-bg);
    border: var(--exam-item-border-width) solid var(--exam-item-border-color);
}

:root[data-theme="blue"] .exam-item:hover,
body.theme-blue .exam-item:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
    box-shadow: var(--elevation-1);
}

/* Search input, inputs */
:root[data-theme="blue"] .search-input,
:root[data-theme="blue"] input,
:root[data-theme="blue"] select,
:root[data-theme="blue"] textarea,
body.theme-blue .search-input,
body.theme-blue input,
body.theme-blue select,
body.theme-blue textarea {
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    background: var(--surface);
    color: var(--color-gray-900);
}

:root[data-theme="blue"] .search-input:focus,
:root[data-theme="blue"] input:focus,
:root[data-theme="blue"] select:focus,
:root[data-theme="blue"] textarea:focus,
body.theme-blue .search-input:focus,
body.theme-blue input:focus,
body.theme-blue select:focus,
body.theme-blue textarea:focus {
    border-color: var(--blue-primary-400);
    box-shadow: var(--elevation-1);
    outline: none;
}

:root[data-theme="blue"],
body.theme-blue {
    --library-config-bg: var(--surface);
    --library-config-border: color-mix(in srgb, var(--accent) 18%, transparent);
    --library-config-text: var(--text-primary);
    --library-config-meta: color-mix(in srgb, var(--accent) 65%, transparent);
    --library-config-item-bg: color-mix(in srgb, var(--accent) 8%, transparent);
    --library-config-item-border: color-mix(in srgb, var(--accent) 20%, transparent);
    --library-config-item-active-bg: color-mix(in srgb, var(--accent) 16%, transparent);
    --library-config-item-active-border: color-mix(in srgb, var(--accent) 45%, transparent);
}

body.theme-blue .library-config-panel__badge,
:root[data-theme="blue"] .library-config-panel__badge {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--text-primary);
}

/* Nav buttons use brand gradient via tokens */
:root[data-theme="blue"] .nav-btn:hover,
body.theme-blue .nav-btn:hover {
    border-color: var(--color-brand-primary);
}

:root[data-theme="blue"] .nav-btn.active,
body.theme-blue .nav-btn.active {
    background: var(--color-brand-gradient);
}

/* Panels/Stats */
:root[data-theme="blue"] .stat-card,
body.theme-blue .stat-card {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}

/* Settings sections */
:root[data-theme="blue"] #settings-view>div>div,
body.theme-blue #settings-view>div>div {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    box-shadow: var(--elevation-1);
}

/* Practice history container + items */
:root[data-theme="blue"] .practice-history,
body.theme-blue .practice-history {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}

:root[data-theme="blue"] .history-item,
body.theme-blue .history-item {
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--text-primary);
}

:root[data-theme="blue"] .history-item:hover,
body.theme-blue .history-item:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
    box-shadow: var(--elevation-1);
}

:root[data-theme="blue"] .record-meta-line,
body.theme-blue .record-meta-line {
    color: var(--accent);
}

:root[data-theme="blue"] .record-percentage,
body.theme-blue .record-percentage {
    color: var(--text-primary);
}

/* Blue dark mode text color fixes */
body.theme-blue.blue-dark-mode .history-item,
:root[data-theme="blue"] body.blue-dark-mode .history-item {
    color: var(--surface) !important;
}

body.theme-blue.blue-dark-mode .record-meta-line,
body.theme-blue.blue-dark-mode .record-date,
body.theme-blue.blue-dark-mode .record-duration-value,
body.theme-blue.blue-dark-mode .record-percentage,
:root[data-theme="blue"] body.blue-dark-mode .record-meta-line,
:root[data-theme="blue"] body.blue-dark-mode .record-date,
:root[data-theme="blue"] body.blue-dark-mode .record-duration-value,
:root[data-theme="blue"] body.blue-dark-mode .record-percentage {
    color: var(--surface) !important;
}

body.theme-blue.blue-dark-mode .exam-info h4,
body.theme-blue.blue-dark-mode .exam-meta,
:root[data-theme="blue"] body.blue-dark-mode .exam-info h4,
:root[data-theme="blue"] body.blue-dark-mode .exam-meta {
    color: var(--surface) !important;
}

/* Blue dark mode practice record titles */
body.theme-blue.blue-dark-mode .practice-record-title,
body.theme-blue.blue-dark-mode .record-title,
body.theme-blue.blue-dark-mode .record-title.clickable,
:root[data-theme="blue"] body.blue-dark-mode .practice-record-title,
:root[data-theme="blue"] body.blue-dark-mode .record-title,
:root[data-theme="blue"] body.blue-dark-mode .record-title.clickable {
    color: var(--surface) !important;
}

body.theme-blue.blue-dark-mode .practice-record-title:hover,
body.theme-blue.blue-dark-mode .record-title:hover,
body.theme-blue.blue-dark-mode .record-title.clickable:hover,
:root[data-theme="blue"] body.blue-dark-mode .practice-record-title:hover,
:root[data-theme="blue"] body.blue-dark-mode .record-title:hover,
:root[data-theme="blue"] body.blue-dark-mode .record-title.clickable:hover {
    color: var(--surface-subtle) !important;
}

/* Blue dark mode header and overview titles */
body.theme-blue.blue-dark-mode .header h1,
body.theme-blue.blue-dark-mode .header p,
body.theme-blue.blue-dark-mode .view>h2,
:root[data-theme="blue"] body.blue-dark-mode .header h1,
:root[data-theme="blue"] body.blue-dark-mode .header p,
:root[data-theme="blue"] body.blue-dark-mode .view>h2 {
    color: var(--surface) !important;
}

/* Blue dark mode additional text contrast fixes */
body.theme-blue.blue-dark-mode .container,
body.theme-blue.blue-dark-mode .view,
body.theme-blue.blue-dark-mode .category-card,
body.theme-blue.blue-dark-mode .exam-item,
body.theme-blue.blue-dark-mode .stat-card,
body.theme-blue.blue-dark-mode .practice-history,
body.theme-blue.blue-dark-mode .more-view-subtitle,
body.theme-blue.blue-dark-mode .overview-section-title,
body.theme-blue.blue-dark-mode .tool-card-content h3,
body.theme-blue.blue-dark-mode .tool-card-content p,
:root[data-theme="blue"] body.blue-dark-mode .container,
:root[data-theme="blue"] body.blue-dark-mode .view,
:root[data-theme="blue"] body.blue-dark-mode .category-card,
:root[data-theme="blue"] body.blue-dark-mode .exam-item,
:root[data-theme="blue"] body.blue-dark-mode .stat-card,
:root[data-theme="blue"] body.blue-dark-mode .practice-history,
:root[data-theme="blue"] body.blue-dark-mode .more-view-subtitle,
:root[data-theme="blue"] body.blue-dark-mode .overview-section-title,
:root[data-theme="blue"] body.blue-dark-mode .tool-card-content h3,
:root[data-theme="blue"] body.blue-dark-mode .tool-card-content p {
    color: var(--surface) !important;
}

/* Blue dark mode stat card numbers */
body.theme-blue.blue-dark-mode .stat-number,
body.theme-blue.blue-dark-mode .stat-label,
:root[data-theme="blue"] body.blue-dark-mode .stat-number,
:root[data-theme="blue"] body.blue-dark-mode .stat-label {
    color: var(--surface) !important;
}

/* Blue dark mode search and form elements */
body.theme-blue.blue-dark-mode .search-input,
body.theme-blue.blue-dark-mode .search-input::placeholder,
:root[data-theme="blue"] body.blue-dark-mode .search-input,
:root[data-theme="blue"] body.blue-dark-mode .search-input::placeholder {
    color: var(--surface) !important;
    background: color-mix(in srgb, var(--text-primary) 90%, transparent) !important;
    border-color: color-mix(in srgb, var(--accent) 40%, transparent) !important;
}

/* Blue dark mode moon effect for header */
body.theme-blue.blue-dark-mode .header h1::before,
:root[data-theme="blue"] body.blue-dark-mode .header h1::before {
    content: "🌙";
    margin-right: 8px;
    filter: none;
    animation: moon-emphasis 5s ease-in-out infinite alternate;
    display: inline-block;
}

@keyframes moon-emphasis {
    0% {
        filter: none;
        transform: scale(1) rotate(-5deg);
    }

    50% {
        filter: none;
        transform: scale(1.05) rotate(3deg);
    }

    100% {
        filter: none;
        transform: scale(1.02) rotate(-2deg);
    }
}

/* Blue dark mode navigation and tool cards */
body.theme-blue.blue-dark-mode .nav-btn,
body.theme-blue.blue-dark-mode .tool-card,
body.theme-blue.blue-dark-mode .more-tools-grid .tool-card,
:root[data-theme="blue"] body.blue-dark-mode .nav-btn,
:root[data-theme="blue"] body.blue-dark-mode .tool-card,
:root[data-theme="blue"] body.blue-dark-mode .more-tools-grid .tool-card {
    color: var(--surface) !important;
    background: color-mix(in srgb, var(--text-primary) 90%, transparent) !important;
    border-color: color-mix(in srgb, var(--accent) 40%, transparent) !important;
}

/* Blue dark mode empty states and hints */
body.theme-blue.blue-dark-mode .exam-list-empty,
body.theme-blue.blue-dark-mode .exam-list-empty-text,
body.theme-blue.blue-dark-mode .exam-list-empty-hint,
body.theme-blue.blue-dark-mode .practice-history-empty,
body.theme-blue.blue-dark-mode .practice-history-empty-text,
body.theme-blue.blue-dark-mode .overview-empty,
:root[data-theme="blue"] body.blue-dark-mode .exam-list-empty,
:root[data-theme="blue"] body.blue-dark-mode .exam-list-empty-text,
:root[data-theme="blue"] body.blue-dark-mode .exam-list-empty-hint,
:root[data-theme="blue"] body.blue-dark-mode .practice-history-empty,
:root[data-theme="blue"] body.blue-dark-mode .practice-history-empty-text,
:root[data-theme="blue"] body.blue-dark-mode .overview-empty {
    color: var(--surface) !important;
    background: color-mix(in srgb, var(--text-primary) 80%, transparent) !important;
    border-color: color-mix(in srgb, var(--accent) 30%, transparent) !important;
}

/* Blue Dark Mode (toggle via .blue-dark-mode on body) */
body.theme-blue.blue-dark-mode,
:root[data-theme="blue"] body.blue-dark-mode {
    --exam-item-bg: var(--surface);
    --exam-item-border-color: var(--border);
    --exam-item-border-width: 1px;
    background: var(--background);
    color: var(--text-primary);

}

body.theme-blue.blue-dark-mode .header,
body.theme-blue.blue-dark-mode .view,
body.theme-blue.blue-dark-mode .category-card,
body.theme-blue.blue-dark-mode .exam-item,
body.theme-blue.blue-dark-mode .stat-card,
body.theme-blue.blue-dark-mode #settings-view>div>div,
body.theme-blue.blue-dark-mode .practice-history,
body.theme-blue.blue-dark-mode .history-item {
    background: var(--exam-item-bg);
    border: var(--exam-item-border-width) solid var(--exam-item-border-color);
    color: var(--surface-subtle);
}

body.theme-blue.blue-dark-mode .record-meta-line,
body.theme-blue.blue-dark-mode .record-percentage,
body.theme-blue.blue-dark-mode .category-title,
body.theme-blue.blue-dark-mode .category-meta {
    color: var(--surface);
}

/* Blue dark mode text color - precise selectors only */
body.theme-blue.blue-dark-mode .view > h2,
body.theme-blue.blue-dark-mode .more-view-subtitle,
body.theme-blue.blue-dark-mode .overview-section-title,
body.theme-blue.blue-dark-mode .overview-section-label,
body.theme-blue.blue-dark-mode .tool-card-content h3,
body.theme-blue.blue-dark-mode .tool-card-content p,
body.theme-blue.blue-dark-mode .practice-history > div:first-child,
body.theme-blue.blue-dark-mode .browse-title-bar h2,
body.theme-blue.blue-dark-mode #browse-title,
body.theme-blue.blue-dark-mode .hero-header h1,
body.theme-blue.blue-dark-mode .hero-panel h3,
body.theme-blue.blue-dark-mode .hero-panel__title,
body.theme-blue.blue-dark-mode .hero-panel__muted,
body.theme-blue.blue-dark-mode .hero-section h3,
body.theme-blue.blue-dark-mode .hero-surface,
body.theme-blue.blue-dark-mode .system-management-panel h3,
body.theme-blue.blue-dark-mode .data-management-panel h3,
body.theme-blue.blue-dark-mode .hero-settings-group h3,
:root[data-theme="blue"] body.blue-dark-mode .view > h2,
:root[data-theme="blue"] body.blue-dark-mode .more-view-subtitle,
:root[data-theme="blue"] body.blue-dark-mode .overview-section-title,
:root[data-theme="blue"] body.blue-dark-mode .overview-section-label,
:root[data-theme="blue"] body.blue-dark-mode .tool-card-content h3,
:root[data-theme="blue"] body.blue-dark-mode .tool-card-content p,
:root[data-theme="blue"] body.blue-dark-mode .practice-history > div:first-child,
:root[data-theme="blue"] body.blue-dark-mode .browse-title-bar h2,
:root[data-theme="blue"] body.blue-dark-mode #browse-title,
:root[data-theme="blue"] body.blue-dark-mode .hero-header h1,
:root[data-theme="blue"] body.blue-dark-mode .hero-panel h3,
:root[data-theme="blue"] body.blue-dark-mode .hero-panel__title,
:root[data-theme="blue"] body.blue-dark-mode .hero-panel__muted,
:root[data-theme="blue"] body.blue-dark-mode .hero-section h3,
:root[data-theme="blue"] body.blue-dark-mode .hero-surface,
:root[data-theme="blue"] body.blue-dark-mode .system-management-panel h3,
:root[data-theme="blue"] body.blue-dark-mode .data-management-panel h3,
:root[data-theme="blue"] body.blue-dark-mode .hero-settings-group h3 {
    color: var(--surface) !important;
}

body.theme-blue.blue-dark-mode .btn,
body.theme-blue.blue-dark-mode .btn-primary,
body.theme-blue.blue-dark-mode .btn-info {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--surface);
}

body.theme-blue.blue-dark-mode .btn:hover:not(:disabled) {
    background: var(--accent);
    box-shadow: var(--elevation-1);
}

/* Blue dark mode practice stats cards */
body.theme-blue.blue-dark-mode .practice-stats .stat-card,
:root[data-theme="blue"] body.blue-dark-mode .practice-stats .stat-card {
    background: var(--exam-item-bg) !important;
    border-color: var(--exam-item-border-color) !important;
    color: var(--surface) !important;
}

body.theme-blue.blue-dark-mode .practice-stats .stat-number,
body.theme-blue.blue-dark-mode .practice-stats .stat-label,
:root[data-theme="blue"] body.blue-dark-mode .practice-stats .stat-number,
:root[data-theme="blue"] body.blue-dark-mode .practice-stats .stat-label {
    color: var(--surface) !important;
}

/* Blue waves now drawn as body background layers; pseudo-elements removed to ensure waves stay behind content. */

/* Footer or subtle tinted sections */
:root[data-theme="blue"] footer,
body.theme-blue footer {
    background: var(--blue-bg-tint);
}

/* Scrollbar */
:root[data-theme="blue"] ::-webkit-scrollbar-thumb,
body.theme-blue ::-webkit-scrollbar-thumb {
    background: var(--blue-primary-400);
    border: 3px solid var(--surface);
    border-radius: 10px;
}

@keyframes sailDrift {
    0% {
        left: calc(100vw + var(--blue-boat-outside));
    }

    100% {
        left: calc(-1 * (var(--blue-boat-width) + var(--blue-boat-outside)));
    }
}

@keyframes sailFlutter {
    0% {
        transform: rotate(0deg) skewX(0deg) scaleX(1);
        transform-origin: 70% 28%;
    }

    15% {
        transform: rotate(12deg) skewX(8deg) scaleX(0.985);
        transform-origin: 74% 26%;
    }

    30% {
        transform: rotate(-16deg) skewX(-11deg) scaleX(1.03);
        transform-origin: 68% 30%;
    }

    45% {
        transform: rotate(14deg) skewX(9deg) scaleX(0.99);
        transform-origin: 75% 27%;
    }

    60% {
        transform: rotate(-12deg) skewX(-8deg) scaleX(1.02);
        transform-origin: 69% 30%;
    }

    75% {
        transform: rotate(10deg) skewX(7deg) scaleX(0.99);
        transform-origin: 72% 28%;
    }

    100% {
        transform: rotate(-10deg) skewX(-7deg) scaleX(1.01);
        transform-origin: 70% 29%;
    }
}

/* Mini game modal */
.mini-game-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--text-primary) 48%, transparent);
opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1200;
}

.mini-game-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.mini-game-modal[hidden] {
    display: none;
}

.mini-game-content {
    width: min(440px, 92vw);
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--elevation-1);
    border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
    padding: 28px;
    color: var(--text-primary);
}

.mini-game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.mini-game-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--danger);
    margin: 0;
}

.mini-game-close {
    border: none;
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    color: var(--danger);
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.mini-game-close:hover {
    background: color-mix(in srgb, var(--danger) 22%, transparent);
    transform: rotate(8deg);
}

.mini-game-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.mini-game-question {
    font-size: 1.08rem;
    font-weight: 600;
    margin: 0;
    padding: 12px 16px;
    border-radius: 18px;
    background: color-mix(in srgb, var(--warning-subtle) 75%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 20%, transparent);
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.mini-game-question.reveal {
    background: var(--surface);
    color: var(--danger);
    transform: scale(1.01);
}

.mini-game-input {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mini-game-input.hidden {
    display: none;
}

.mini-game-input input {
    width: 100%;
    border-radius: 18px;
    border: 2px solid color-mix(in srgb, var(--danger) 18%, transparent);
    padding: 12px 16px;
    font-size: 1rem;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mini-game-input input:focus {
    border-color: var(--danger);
    box-shadow: var(--elevation-1);
}

.mini-game-input input.is-error {
    border-color: var(--danger);
    box-shadow: var(--elevation-1);
    animation: sparkShake 0.42s ease;
    background: color-mix(in srgb, var(--danger) 6%, transparent);
}

.mini-game-feedback {
    min-height: 24px;
    font-size: 0.92rem;
    margin: 0;
    color: var(--danger);
}

.mini-game-footer {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mini-game-progress {
    font-size: 0.85rem;
    color: var(--danger);
}

.mini-game-next {
    border: none;
    border-radius: 20px;
    padding: 11px 22px;
    background: var(--surface);
    color: var(--surface);
    font-weight: 650;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.mini-game-next:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.mini-game-next:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: var(--elevation-1);
}

@keyframes sparkShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-4px);
    }

    40% {
        transform: translateX(4px);
    }

    60% {
        transform: translateX(-3px);
    }

    80% {
        transform: translateX(3px);
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#overview-quick-lane.quick-lane {
    margin: 24px 0 28px;
    padding: 22px;
    border-radius: var(--radius-xl);
    background: var(--surface);
    border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
    box-shadow: var(--elevation-1);
}

.quick-lane-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.quick-lane-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--danger);
}

.quick-lane-header p {
    margin: 6px 0 0;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.quick-lane-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--danger);
    font-weight: 600;
    font-size: 0.82rem;
    box-shadow: var(--elevation-1);
}

.quick-lane-actions {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.lane-chip {
    border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent);
    background: var(--surface);
    color: var(--danger);
    border-radius: var(--radius-pill);
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.lane-chip:hover,
.lane-chip:focus-visible {
    transform: translateY(-1px);
    border-color: var(--danger);
    box-shadow: var(--elevation-1);
    outline: none;
}

.lane-chip:active {
    transform: translateY(0);
    box-shadow: var(--elevation-1);
}

.vocab-settings-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--warning) 35%, transparent);
z-index: 1200;
    padding: 24px;
}

.vocab-settings-modal[hidden] {
    display: none;
}

.vocab-settings-modal__dialog {
    width: min(420px, 100%);
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--vocab-line);
    box-shadow: var(--vocab-shadow-strong);
    padding: 24px;
    color: var(--vocab-ink);
    position: relative;
    z-index: 1;
}

.vocab-settings-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.vocab-settings-modal__header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-family: var(--vocab-font-title);
}

.vocab-settings-modal__subtitle {
    margin: 6px 0 0;
    font-size: 0.9rem;
    color: var(--vocab-muted);
}

.vocab-settings-modal__backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.vocab-settings-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.vocab-settings-form__group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vocab-settings-form__group label {
    font-weight: 600;
    font-size: 0.95rem;
}

.vocab-settings-form__group input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--vocab-line);
    background: var(--vocab-paper-bright);
    color: var(--vocab-ink);
    font-size: 0.95rem;
    box-shadow: var(--elevation-1);
}

.vocab-settings-form__group input[type="number"]:focus {
    outline: none;
    border-color: var(--vocab-accent);
    box-shadow: var(--elevation-1);
}

.vocab-settings-form__hint {
    margin: 0;
    font-size: 0.82rem;
    color: var(--vocab-muted);
}

.vocab-settings-form__checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.vocab-settings-form__checkbox input {
    width: 18px;
    height: 18px;
}

.vocab-settings-form__error {
    min-height: 20px;
    font-size: 0.85rem;
    color: var(--danger);
}

.vocab-settings-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.vocab-settings-modal__actions .btn {
    min-width: 96px;
}

@media (max-width: 768px) {
    .vocab-settings-modal {
        padding: 16px;
    }

    .vocab-settings-modal__dialog {
        width: 100%;
        padding: 20px;
    }
}

/* Developer Easter Egg - Connected Heart */
#dev-poi {
    overflow: visible;
    z-index: 10;
}

.heart-interaction {
    position: absolute;
    /* Position at the center of the gap (assuming --space-lg gap) */
    left: calc(100% + var(--space-lg) / 2);
    top: 50%;
    /* Center the element itself on that point */
    transform: translate(-50%, -50%) scale(0);
    font-size: 1.5rem;
    color: var(--danger);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    filter: none;
    z-index: 20;
    line-height: 1;
    user-select: none;
}

#dev-poi:hover .heart-interaction,
#dev-poi:has(+ #dev-nana:hover) .heart-interaction {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
    animation: heartBeat 1s infinite ease-in-out;
}

@keyframes heartBeat {
    0% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    14% {
        transform: translate(-50%, -50%) scale(1.35);
    }

    28% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    42% {
        transform: translate(-50%, -50%) scale(1.35);
    }

    70% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1.1);
    }
}

@media (max-width: 480px) {
    .heart-interaction {
        /* Mobile gap is 10px, so half is 5px */
        left: calc(100% + 5px);
        font-size: 1.2rem;
    }
}

/* Achievement System Styles */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
    gap: 12px;
    padding: 18px;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.achievements-modal-content {
    max-width: 720px;
}

.achievements-grid::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.achievement-card {
    background: color-mix(in srgb, var(--surface) 50%, transparent);
    border-radius: 14px;
    min-height: 118px;
    padding: 12px;
    text-align: center;
    border: 1px solid color-mix(in srgb, var(--surface-subtle) 90%, transparent);
    transition: all 0.3s ease;
    opacity: 0.6;
    filter: grayscale(1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.achievement-card.unlocked {
    background: var(--surface);
    border-color: var(--warning);
    opacity: 1;
    filter: grayscale(0);
    box-shadow: var(--elevation-1);
    transform: translateY(-2px);
}

.achievement-icon {
    font-size: 2.15em;
    margin-bottom: 8px;
    display: block;
}

.achievement-title {
    font-weight: bold;
    font-size: 0.9em;
    margin-bottom: 5px;
    color: var(--color-gray-800);
}

.achievement-desc {
    font-size: 0.75em;
    color: var(--color-gray-500);
    line-height: 1.3;
}

/* Achievement Tiers */
.achievement-card.tier-1.unlocked {
    border-color: var(--warning); /* Bronze */
    box-shadow: var(--elevation-1);
    background: var(--surface);
}

.achievement-card.tier-2.unlocked {
    border-color: var(--border-strong); /* Silver */
    box-shadow: var(--elevation-1);
    background: var(--surface);
}

.achievement-card.tier-3.unlocked {
    border-color: var(--warning); /* Gold */
    box-shadow: var(--elevation-1);
    background: var(--surface);
}

.achievement-card.tier-1 .achievement-icon { text-shadow: none; }
.achievement-card.tier-2 .achievement-icon { text-shadow: none; }
.achievement-card.tier-3 .achievement-icon { text-shadow: none; }

.inline-hover-link:hover {
    opacity: 0.7;
}

.remote-auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--surface-subtle);
}

.remote-auth-overlay[hidden],
.remote-auth-account[hidden],
.remote-auth-account__menu[hidden],
.remote-auth-account__admin[hidden],
#settings-totp-btn[hidden],
.remote-auth-token-field[hidden],
.remote-auth-setup[hidden],
.remote-auth-recovery[hidden],
.remote-auth-totp[hidden] {
    display: none;
}

html.remote-auth-gated,
body.remote-auth-gated {
    overflow: hidden;
}

body.remote-auth-gated > :not(#remote-auth-overlay):not(.remote-auth-account):not(.remote-auth-totp) {
    visibility: hidden;
    pointer-events: none;
}

.remote-auth-panel {
    width: min(440px, 100%);
    border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: var(--elevation-1);
    padding: 24px;
}

.remote-auth-title {
    margin: 0 0 18px;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0;
}

.remote-auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 18px;
    border-radius: 8px;
    background: var(--surface-subtle);
    padding: 4px;
}

.remote-auth-tab,
.remote-auth-submit,
.remote-auth-recovery__confirm,
.remote-auth-account__admin,
.remote-auth-account__logout,
.remote-auth-totp button {
    border: 0;
    cursor: pointer;
    font: inherit;
}

.remote-auth-tab {
    min-height: 36px;
    border-radius: 6px;
    color: var(--text-secondary);
    background: transparent;
}

.remote-auth-tab.is-active {
    color: var(--text-primary);
    background: var(--surface);
    box-shadow: var(--elevation-1);
}

.remote-auth-form,
.remote-auth-setup,
.remote-auth-recovery,
.remote-auth-totp__form,
.remote-auth-totp__body {
    display: grid;
    gap: 14px;
}

.remote-auth-field {
    display: grid;
    gap: 6px;
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 600;
}

.remote-auth-field input,
.remote-auth-totp__input {
    min-height: 42px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 0 12px;
    color: var(--text-primary);
    background: var(--surface);
    font: inherit;
}

.remote-auth-field input:focus,
.remote-auth-totp__input:focus {
    outline: 2px solid color-mix(in srgb, var(--accent) 24%, transparent);
    border-color: var(--accent);
}

.remote-auth-field input[aria-invalid="true"] {
    border-color: var(--danger);
    outline: 2px solid color-mix(in srgb, var(--danger) 14%, transparent);
}

.remote-auth-help,
.remote-auth-totp__note {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.35;
}

.remote-auth-error {
    border-radius: 6px;
    background: var(--danger-subtle);
    color: var(--danger-strong);
    padding: 10px 12px;
    font-size: 0.9rem;
}

.remote-auth-submit,
.remote-auth-recovery__confirm,
.remote-auth-totp__primary,
.remote-auth-totp__secondary {
    min-height: 42px;
    border-radius: 6px;
    font-weight: 700;
}

.remote-auth-totp__primary {
    background: var(--text-primary);
    color: var(--surface);
}

.remote-auth-totp__secondary {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-primary);
}

.remote-auth-totp__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.remote-auth-submit:disabled,
.remote-auth-recovery__confirm:disabled,
.remote-auth-account__logout:disabled,
.remote-auth-totp button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.remote-auth-setup p,
.remote-auth-recovery p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.45;
}

.remote-auth-setup__qr,
.remote-auth-totp__qr {
    width: 180px;
    height: 180px;
    justify-self: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
}

.remote-auth-setup__secret,
.remote-auth-totp__secret {
    display: block;
    overflow-wrap: anywhere;
    border-radius: 6px;
    background: var(--surface-subtle);
    color: var(--text-primary);
    padding: 10px;
    font-size: 0.82rem;
}

.remote-auth-recovery__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
    margin: 0;
    padding-left: 22px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.84rem;
}

.remote-auth-account {
    position: relative;
    z-index: 9000;
    color: var(--text-primary);
}

body > .remote-auth-account {
    position: fixed;
    top: 16px;
    right: 16px;
}

.remote-auth-account__trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    border: 1px solid color-mix(in srgb, var(--surface) 72%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 76%, transparent);
    color: var(--text-primary);
    box-shadow: var(--elevation-1);
    cursor: pointer;
    font: inherit;
    padding: 5px 9px 5px 6px;
}

.remote-auth-account.is-open .remote-auth-account__trigger,
.remote-auth-account__trigger:hover,
.remote-auth-account__trigger:focus-visible {
    background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.remote-auth-account__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--text-primary);
    color: var(--surface);
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1;
}

.remote-auth-account__identity {
    display: grid;
    gap: 1px;
    min-width: 0;
    text-align: left;
}

.remote-auth-account__name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.86rem;
    font-weight: 700;
}

.remote-auth-account__role {
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.1;
}

.remote-auth-account__chevron {
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 800;
    transform: translateY(-1px);
}

.remote-auth-account__menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(360px, calc(100vw - 32px));
    border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 98%, transparent);
    color: var(--text-primary);
    box-shadow: var(--elevation-1);
    padding: 8px;
    display: grid;
    gap: 4px;
}

.remote-auth-account__menu-head {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    border-bottom: 1px solid var(--border);
    margin: 0 2px 4px;
    padding: 10px 8px 12px;
}

.remote-auth-account__menu-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--text-primary);
    color: var(--surface);
    font-size: 0.92rem;
    font-weight: 850;
}

.remote-auth-account__menu-identity {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.remote-auth-account__menu-name {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    font-size: 0.94rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.remote-auth-account__menu-role {
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 750;
    line-height: 1.2;
}

.remote-auth-account__menu-item {
    display: flex;
    align-items: flex-start;
    width: 100%;
    min-height: 54px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    padding: 9px 10px;
    text-align: left;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
}

.remote-auth-account__menu-item:hover,
.remote-auth-account__menu-item:focus-visible {
    border-color: color-mix(in srgb, var(--accent) 24%, transparent);
    background: var(--surface-subtle);
}

.remote-auth-account__menu-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.remote-auth-account__menu-title {
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.25;
}

.remote-auth-account__menu-desc {
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.3;
}

.remote-auth-account__admin .remote-auth-account__menu-title {
    color: var(--accent);
}

.remote-auth-account__logout {
    border-top-color: var(--border);
    margin-top: 4px;
}

.remote-auth-account__logout .remote-auth-account__menu-title {
    color: var(--danger);
}

.remote-auth-account__logout .remote-auth-account__menu-desc {
    color: var(--danger-strong);
}

.remote-auth-totp {
    position: fixed;
    top: 64px;
    right: 16px;
    z-index: 9001;
    width: min(380px, calc(100vw - 32px));
    max-height: calc(100vh - 88px);
    overflow: auto;
    border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: var(--elevation-1);
    padding: 14px;
}

.remote-auth-totp__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.remote-auth-totp__head h3 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0;
}

.remote-auth-totp__close {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: var(--surface-subtle);
    color: var(--text-primary);
    font-size: 1.2rem;
    line-height: 1;
}

.remote-auth-totp__status {
    margin: 0 0 10px;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.4;
}

.remote-auth-totp__danger {
    min-height: 38px;
    border-radius: 6px;
    background: var(--danger-subtle);
    color: var(--danger-strong);
    font-weight: 700;
}

@media (max-width: 768px) {
    .app-topbar .remote-auth-account__menu {
        position: fixed;
        top: 142px;
        left: 16px;
        right: 16px;
        width: auto;
        max-height: calc(100vh - 160px);
        overflow: auto;
    }
}

@media (max-width: 520px) {
    .remote-auth-overlay {
        align-items: flex-start;
        padding: 72px 14px 20px;
    }

    .remote-auth-panel {
        padding: 20px;
    }

    body > .remote-auth-account {
        top: 10px;
        right: 10px;
    }

    .remote-auth-account__identity {
        max-width: 116px;
    }

    .remote-auth-account__menu {
        position: fixed;
        top: 140px;
        left: 10px;
        right: 10px;
        width: auto;
        max-height: calc(100vh - 154px);
        overflow: auto;
    }

    .remote-auth-totp {
        top: 58px;
        right: 10px;
        width: calc(100vw - 20px);
    }
}

.practice-timer-settings {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: var(--space-md);
    width: min(100%, 960px);
    margin: 0 auto;
}

.practice-timer-card {
    display: grid;
    gap: var(--space-md);
    padding: var(--space-md);
    border: 1px solid var(--bloom-border);
    border-radius: var(--border-radius-md);
    background: color-mix(in srgb, var(--surface) 58%, transparent);
    color: var(--color-text);
}

.practice-timer-card__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.practice-timer-card__header h4 {
    margin: 0;
    font-size: 1rem;
}

.practice-timer-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-sm);
}

.practice-timer-field {
    display: grid;
    gap: 6px;
    color: var(--color-text-secondary);
    font-size: 0.84rem;
    text-align: left;
}

.practice-timer-field select,
.practice-timer-field input[type="number"] {
    min-height: 42px;
    border: 1px solid var(--bloom-border);
    border-radius: var(--border-radius-md);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    color: var(--color-text);
    font: inherit;
    padding: 0 12px;
}

.practice-timer-check {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    color: var(--color-text);
}

.practice-timer-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

.practice-timer-status {
    min-height: 18px;
    color: var(--color-text-secondary);
    font-size: 0.8rem;
}

.practice-timer-status[data-state="error"] {
    color: var(--color-danger, var(--danger));
}

.practice-timer-status[data-state="success"] {
    color: var(--color-success, var(--success));
}

.practice-timer-save {
    justify-self: center;
}

body.bloom-dark-mode .practice-timer-card,
body.blue-dark-mode .practice-timer-card {
    background: color-mix(in srgb, var(--text-primary) 58%, transparent);
}

body.bloom-dark-mode .practice-timer-field select,
body.bloom-dark-mode .practice-timer-field input[type="number"],
body.blue-dark-mode .practice-timer-field select,
body.blue-dark-mode .practice-timer-field input[type="number"] {
    background: color-mix(in srgb, var(--text-primary) 72%, transparent);
    color: var(--surface-subtle);
}

@media (max-width: 760px) {
    .practice-timer-settings,
    .practice-timer-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Product-style settings workspace */
#settings-view {
    max-width: 1280px;
    margin-inline: auto;
}

#settings-view .settings-page-header {
    align-items: flex-start;
    margin-bottom: var(--space-lg);
}

#settings-view .settings-layout {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
    gap: var(--space-xl);
    align-items: start;
}

#settings-view .settings-sidebar {
    position: sticky;
    top: calc(var(--header-height, 72px) + var(--space-md));
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--bloom-border);
    border-radius: var(--border-radius-lg);
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    box-shadow: var(--elevation-1);
}

#settings-view .settings-sidebar__item {
    width: 100%;
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    padding: 0 12px;
    background: transparent;
    color: var(--color-text-secondary);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

#settings-view .settings-sidebar__item:hover {
    background: color-mix(in srgb, var(--text-primary) 6%, transparent);
    color: var(--color-text);
}

#settings-view .settings-sidebar__item.is-active {
    background: var(--surface);
    color: var(--surface) !important;
    box-shadow: var(--elevation-1);
}

#settings-view .settings-sidebar__item.is-active:hover {
    background: var(--surface);
    color: var(--surface) !important;
}

#settings-view .settings-content {
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--space-lg);
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

#settings-view .settings-section-card {
    grid-column: 1 / -1;
    scroll-margin-top: calc(var(--header-height, 72px) + var(--space-lg));
    display: grid;
    gap: var(--space-md);
    min-width: 0;
    margin: 0 !important;
    padding: clamp(18px, 2vw, 28px) !important;
    border: 1px solid var(--bloom-border) !important;
    border-radius: var(--border-radius-lg) !important;
    background: var(--bloom-surface-strong) !important;
    background-image: none;
    box-shadow: var(--bloom-shadow) !important;
}

#settings-view .settings-section-card__header,
#settings-view .settings-section-card > h3,
#settings-view .settings-section-card > .hero-panel__muted {
    max-width: 760px;
}

#settings-view .settings-section-card h3 {
    margin: 0;
    font-size: clamp(1.05rem, 1.4vw, 1.3rem);
}

#settings-view .settings-action-grid,
#settings-view .hero-settings-actions {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-sm);
    justify-content: stretch !important;
    width: 100%;
}

#settings-view .settings-action-grid .btn,
#settings-view .hero-settings-actions .btn {
    width: 100%;
    min-width: 0;
}

#settings-view .reading-candidate-code-settings {
    width: 100%;
    max-width: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
}

#settings-view .reading-candidate-code-controls,
#settings-view .reading-candidate-code-status {
    grid-column: 1 / -1;
}

#settings-view .practice-timer-settings {
    width: 100%;
    max-width: none;
    grid-template-columns: repeat(2, minmax(320px, 1fr));
    align-items: stretch;
}

#settings-view .practice-timer-card {
    padding: clamp(16px, 1.8vw, 24px);
}

#settings-view .practice-timer-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

#settings-view .practice-timer-field {
    grid-column: span 3;
}

#settings-view .practice-timer-check {
    grid-column: 1 / -1;
}

#settings-view .practice-timer-save {
    justify-self: end;
}

#settings-view .settings-session-manager {
    display: grid;
    gap: var(--space-md);
    width: 100%;
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
}

#settings-view .settings-session-manager[hidden] {
    display: none !important;
}

#settings-view .settings-session-manager__header,
#settings-view .settings-session-card {
    display: grid;
    gap: var(--space-sm);
}

#settings-view .settings-session-manager__header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}

#settings-view .settings-session-manager__header h4 {
    margin: 0 0 4px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 800;
}

#settings-view .settings-session-list {
    display: grid;
    gap: 10px;
}

#settings-view .settings-session-list__empty,
#settings-view .settings-session-manager__status {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

#settings-view .settings-session-list__group {
    margin: 8px 0 0;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 900;
    letter-spacing: 0.02em;
}

#settings-view .settings-session-manager__status[data-kind="error"] {
    color: var(--danger);
}

#settings-view .settings-session-manager__status[data-kind="success"] {
    color: var(--success);
}

#settings-view .settings-session-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 72%, transparent);
    padding: 12px;
}

#settings-view .settings-session-card__head,
#settings-view .settings-session-card__meta,
#settings-view .settings-session-card__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

#settings-view .settings-session-card__head {
    min-width: 0;
}

#settings-view .settings-session-card__head strong {
    overflow: hidden;
    max-width: 100%;
    color: var(--text-primary);
    font-size: 0.96rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#settings-view .settings-session-card__meta {
    grid-column: 1;
    color: var(--text-secondary);
    font-size: 0.84rem;
}

#settings-view .settings-session-card__badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent-strong);
    font-size: 0.74rem;
    font-weight: 800;
    padding: 0 8px;
}

#settings-view .settings-session-card__badge.is-current {
    background: color-mix(in srgb, var(--success) 12%, transparent);
    color: var(--success);
}

#settings-view .settings-session-card__hint {
    flex-basis: 100%;
    border-color: color-mix(in srgb, var(--accent) 16%, transparent);
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    color: var(--accent-strong);
}

#settings-view .settings-session-card__actions {
    grid-column: 2;
    grid-row: 1 / span 2;
}

#settings-view .settings-session-card__revoke {
    min-width: 128px;
}

body.bloom-dark-mode #settings-view .settings-session-card,
body.blue-dark-mode #settings-view .settings-session-card {
    background: color-mix(in srgb, var(--text-primary) 48%, transparent);
    border-color: color-mix(in srgb, var(--accent) 26%, transparent);
}

body.bloom-dark-mode #settings-view .settings-session-card__badge,
body.blue-dark-mode #settings-view .settings-session-card__badge {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent-subtle);
}

body.bloom-dark-mode #settings-view .settings-session-card__badge.is-current,
body.blue-dark-mode #settings-view .settings-session-card__badge.is-current {
    background: color-mix(in srgb, var(--success) 18%, transparent);
    color: var(--success-subtle);
}

body.bloom-dark-mode #settings-view .settings-session-card__hint,
body.blue-dark-mode #settings-view .settings-session-card__hint {
    border-color: color-mix(in srgb, var(--accent) 20%, transparent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent-subtle);
}

body.bloom-dark-mode #settings-view .settings-sidebar,
body.blue-dark-mode #settings-view .settings-sidebar {
    background: color-mix(in srgb, var(--text-primary) 68%, transparent);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

body.bloom-dark-mode #settings-view .settings-sidebar__item:hover,
body.blue-dark-mode #settings-view .settings-sidebar__item:hover {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--surface-subtle);
}

body.bloom-dark-mode #settings-view .settings-sidebar__item,
body.blue-dark-mode #settings-view .settings-sidebar__item {
    color: var(--border-strong);
}

body.bloom-dark-mode #settings-view .settings-sidebar__item.is-active,
body.blue-dark-mode #settings-view .settings-sidebar__item.is-active {
    background: var(--surface);
    color: var(--surface) !important;
    box-shadow: var(--elevation-1);
}

@media (max-width: 980px) {
    #settings-view .settings-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    #settings-view .settings-sidebar {
        position: static;
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        overflow-x: auto;
    }

    #settings-view .settings-sidebar__item {
        white-space: nowrap;
        text-align: center;
    }
}

@media (max-width: 760px) {
    #settings-view .settings-content,
    #settings-view .reading-candidate-code-settings,
    #settings-view .practice-timer-settings,
    #settings-view .practice-timer-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    #settings-view .practice-timer-field,
    #settings-view .practice-timer-check {
        grid-column: 1;
    }

    #settings-view .practice-timer-save {
        justify-self: stretch;
    }
}
