/* Review Workspace Mode (3-Pane Layout) */
/* ═══════════════════════════════════════════════════════════════════════════════
   KanjiOS HUD SYSTEM - Review Terminal Interface
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════════
   Mode Color System - Dynamic accent based on content type
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Default accent (green - KanjiOS signature) */
#review-session-modal {
    --kos-accent: #22c55e;
    --kos-accent-rgb: 34, 197, 94;
}

/* Kanji mode - Blue */
#review-session-modal[data-mode="kanji"],
#review-session-modal.mode-kanji {
    --kos-accent: #3b82f6;
    --kos-accent-rgb: 59, 130, 246;
}

/* Vocabulary mode - Green */
#review-session-modal[data-mode="vocab"],
#review-session-modal.mode-vocab {
    --kos-accent: #10b981;
    --kos-accent-rgb: 16, 185, 129;
}

/* Grammar mode - Yellow/Amber */
#review-session-modal[data-mode="grammar"],
#review-session-modal.mode-grammar {
    --kos-accent: #f59e0b;
    --kos-accent-rgb: 245, 158, 11;
}

/* Radicals mode - Purple */
#review-session-modal[data-mode="radicals"],
#review-session-modal.mode-radicals {
    --kos-accent: #a855f7;
    --kos-accent-rgb: 168, 85, 247;
}

/* Names mode - Pink */
#review-session-modal[data-mode="names"],
#review-session-modal.mode-names {
    --kos-accent: #ec4899;
    --kos-accent-rgb: 236, 72, 153;
}

/* Sentences mode - Teal */
#review-session-modal[data-mode="sentences"],
#review-session-modal.mode-sentences {
    --kos-accent: #14b8a6;
    --kos-accent-rgb: 20, 184, 166;
}

/* Pokemon mode - Red */
#review-session-modal[data-mode="pokemon"],
#review-session-modal.mode-pokemon {
    --kos-accent: #ef4444;
    --kos-accent-rgb: 239, 68, 68;
}

/* Numbers mode - Cyan */
#review-session-modal[data-mode="numbers"],
#review-session-modal.mode-numbers {
    --kos-accent: #06b6d4;
    --kos-accent-rgb: 6, 182, 212;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   REVIEW HUB MODAL - KanjiOS System Selector Interface
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Default accent (green) */
#review-hub-modal {
    --kos-hub-accent: #22c55e;
    --kos-hub-accent-rgb: 34, 197, 94;
}

/* Mode-specific colors for Review Hub */
#review-hub-modal[data-mode="kanji"] {
    --kos-hub-accent: #3b82f6;
    --kos-hub-accent-rgb: 59, 130, 246;
}

#review-hub-modal[data-mode="vocab"] {
    --kos-hub-accent: #10b981;
    --kos-hub-accent-rgb: 16, 185, 129;
}

#review-hub-modal[data-mode="grammar"] {
    --kos-hub-accent: #f59e0b;
    --kos-hub-accent-rgb: 245, 158, 11;
}

#review-hub-modal[data-mode="radicals"] {
    --kos-hub-accent: #a855f7;
    --kos-hub-accent-rgb: 168, 85, 247;
}

#review-hub-modal[data-mode="names"] {
    --kos-hub-accent: #ec4899;
    --kos-hub-accent-rgb: 236, 72, 153;
}

#review-hub-modal[data-mode="sentences"] {
    --kos-hub-accent: #14b8a6;
    --kos-hub-accent-rgb: 20, 184, 166;
}

#review-hub-modal[data-mode="pokemon"] {
    --kos-hub-accent: #ef4444;
    --kos-hub-accent-rgb: 239, 68, 68;
}

#review-hub-modal[data-mode="numbers"] {
    --kos-hub-accent: #06b6d4;
    --kos-hub-accent-rgb: 6, 182, 212;
}

/* Main container - deep space terminal */
#review-hub-modal > div {
    background: linear-gradient(180deg, #0a0a0c 0%, #050507 100%) !important;
    border: 2px solid rgba(var(--kos-hub-accent-rgb), 0.4) !important;
    border-radius: 16px !important;
    box-shadow: 
        0 0 60px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(var(--kos-hub-accent-rgb), 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    position: relative;
    overflow: hidden;
}

/* Subtle grid pattern overlay */
#review-hub-modal > div::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(var(--kos-hub-accent-rgb), 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--kos-hub-accent-rgb), 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 20%, transparent 70%);
}

/* Corner reticles */
#review-hub-modal > div::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    width: 28px;
    height: 28px;
    border-top: 1px solid rgba(var(--kos-hub-accent-rgb), 0.4);
    border-left: 1px solid rgba(var(--kos-hub-accent-rgb), 0.4);
    pointer-events: none;
    z-index: 10;
}

/* Header styling */
#review-hub-modal .flex.items-center.justify-between {
    background: transparent !important;
    border-bottom: 1px solid rgba(var(--kos-hub-accent-rgb), 0.12) !important;
    position: relative;
    z-index: 1;
}

#review-hub-modal h2 {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace !important;
    font-weight: 600 !important;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 1rem !important;
    color: rgba(255, 255, 255, 0.9) !important;
}

/* System status badge */
#review-hub-modal h2::before {
    content: '◈';
    margin-right: 0.75rem;
    color: var(--kos-hub-accent);
    animation: kos-hub-pulse 2s ease-in-out infinite;
}

@keyframes kos-hub-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; text-shadow: 0 0 8px rgba(var(--kos-hub-accent-rgb), 0.5); }
}

/* ESC hint */
#review-hub-modal kbd {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace !important;
    background: rgba(var(--kos-hub-accent-rgb), 0.1) !important;
    border-color: rgba(var(--kos-hub-accent-rgb), 0.2) !important;
    color: var(--kos-hub-accent) !important;
    font-size: 9px !important;
}

/* Close button */
#review-hub-modal .cancel-btn {
    border-radius: 6px;
    transition: all 0.2s ease;
}

#review-hub-modal .cancel-btn:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
}

/* Content area */
#review-hub-modal .p-8 {
    position: relative;
    z-index: 1;
}

/* Cards ready count - system readout */
#review-hub-count {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace !important;
    font-size: 1.125rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.8) !important;
}

/* SRS Priority indicator */
#card-ordering-indicator {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace !important;
    font-size: 0.6875rem !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--kos-hub-accent) !important;
    opacity: 0.8;
}

#card-ordering-indicator #ordering-icon {
    display: none; /* Hide emoji, use text only */
}

#card-ordering-indicator::before {
    content: '▸ ';
    color: var(--kos-hub-accent);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Review Mode Cards - KanjiOS System Selection Panels
   ═══════════════════════════════════════════════════════════════════════════════ */

#review-hub-modal .review-mode-card {
    background: rgba(255, 255, 255, 0.025) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    padding: 2rem 1.5rem !important;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Scan line effect */
#review-hub-modal .review-mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--kos-hub-accent) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Side accent line */
#review-hub-modal .review-mode-card::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--kos-hub-accent);
    border-radius: 0 2px 2px 0;
    transition: height 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Default "Selected" State for Multiple Choice (when no card is hovered)
   Uses :has() to detect if ANY review-mode-card is being hovered
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Multiple Choice gets "selected" state by DEFAULT when no other card is hovered */
#review-hub-modal .p-8:not(:has(.review-mode-card:hover)) #multiple-choice-card:not([style*="pointer-events: none"]) {
    background: rgba(var(--kos-hub-accent-rgb), 0.05) !important;
    border-color: rgba(var(--kos-hub-accent-rgb), 0.3) !important;
    transform: translateY(-4px) !important;
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 35px rgba(var(--kos-hub-accent-rgb), 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

#review-hub-modal .p-8:not(:has(.review-mode-card:hover)) #multiple-choice-card:not([style*="pointer-events: none"])::before {
    opacity: 0.7;
}

#review-hub-modal .p-8:not(:has(.review-mode-card:hover)) #multiple-choice-card:not([style*="pointer-events: none"])::after {
    height: 60%;
}

#review-hub-modal .p-8:not(:has(.review-mode-card:hover)) #multiple-choice-card:not([style*="pointer-events: none"]) .mode-card-icon img {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4)) brightness(1.1);
    transform: scale(1.05);
}

/* MC hotkey also brighter when default-selected */
#review-hub-modal .p-8:not(:has(.review-mode-card:hover)) #multiple-choice-card:not([style*="pointer-events: none"]) .mode-hotkey {
    opacity: 1;
    text-shadow: 
        0 0 10px rgba(var(--kos-hub-accent-rgb), 0.9),
        0 0 20px rgba(var(--kos-hub-accent-rgb), 0.6),
        0 0 35px rgba(var(--kos-hub-accent-rgb), 0.35);
}

/* Hover state - applies to whichever card is being hovered */
#review-hub-modal .review-mode-card:hover {
    background: rgba(var(--kos-hub-accent-rgb), 0.05) !important;
    border-color: rgba(var(--kos-hub-accent-rgb), 0.3) !important;
    transform: translateY(-4px) !important;
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 35px rgba(var(--kos-hub-accent-rgb), 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

#review-hub-modal .review-mode-card:hover::before {
    opacity: 0.7;
}

#review-hub-modal .review-mode-card:hover::after {
    height: 60%;
}

/* Active/pressed state */
#review-hub-modal .review-mode-card:active {
    transform: translateY(-2px) scale(0.99) !important;
}

/* Card icon styling (legacy emoji fallback) */
#review-hub-modal .review-mode-card .text-4xl {
    font-size: 2.5rem !important;
    margin-bottom: 1.25rem !important;
    filter: grayscale(30%) brightness(1.1);
    transition: filter 0.3s ease;
}

#review-hub-modal .review-mode-card:hover .text-4xl {
    filter: grayscale(0%) brightness(1.2);
}

/* Hide emoji icons when using new flex layout with SVGs */
#review-hub-modal .review-mode-card .flex .text-4xl {
    display: none;
}

/* Card titles - terminal style */
#review-hub-modal .review-mode-card h3 {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.95) !important;
    margin-bottom: 0.25rem !important;
}

/* Card descriptions - improved readability */
#review-hub-modal .review-mode-card p {
    font-size: 0.8125rem !important;
    line-height: 1.5 !important;
    color: rgba(255, 255, 255, 0.55) !important;
    margin-bottom: 0 !important;
}

/* Card counts - highlight number */
#review-hub-modal .review-mode-card .text-accent,
#review-hub-modal #multiple-choice-count,
#review-hub-modal #typing-count,
#review-hub-modal #production-count {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: var(--kos-hub-accent) !important;
    text-shadow: 0 0 12px rgba(var(--kos-hub-accent-rgb), 0.4);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Smaller count on the 2-column cards */
#review-hub-modal #typing-count,
#review-hub-modal #production-count {
    font-size: 0.9375rem !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Hotkey Indicators - Bright & Attractive
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Hotkey badge styling */
#review-hub-modal .mode-hotkey {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--kos-hub-accent);
    opacity: 0.85;
    text-shadow: 
        0 0 8px rgba(var(--kos-hub-accent-rgb), 0.5),
        0 0 16px rgba(var(--kos-hub-accent-rgb), 0.3);
    transition: all 0.3s ease;
    white-space: nowrap;
}

/* Brighten hotkeys on hover or when MC is default-selected */
#review-hub-modal .review-mode-card:hover .mode-hotkey {
    opacity: 1;
    text-shadow: 
        0 0 10px rgba(var(--kos-hub-accent-rgb), 0.9),
        0 0 20px rgba(var(--kos-hub-accent-rgb), 0.6),
        0 0 35px rgba(var(--kos-hub-accent-rgb), 0.35);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Mode Card Icons - SVG styling
   ═══════════════════════════════════════════════════════════════════════════════ */

#review-hub-modal .mode-card-icon img {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
    transition: all 0.3s ease;
}

#review-hub-modal .review-mode-card:hover .mode-card-icon img {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4)) brightness(1.1);
    transform: scale(1.05);
}

/* Disabled state for cards with 0 items */
#review-hub-modal .review-mode-card[style*="pointer-events: none"] {
    opacity: 0.35;
    filter: grayscale(60%);
}

#review-hub-modal .review-mode-card[style*="pointer-events: none"]:hover {
    transform: none !important;
    box-shadow: none !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}

/* Customization section - if visible */
#review-hub-modal #review-customization-section {
    border-color: rgba(var(--kos-hub-accent-rgb), 0.1) !important;
}

#review-hub-modal #review-customization-toggle {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

#review-hub-modal #review-customization-toggle:hover {
    color: var(--kos-hub-accent);
}

/* Add Katakana Button - Teal/Cyan gradient that harmonizes with blue Add Next and indigo Analytics */
.add-katakana-btn {
    background: linear-gradient(135deg, #0891b2, #0284c7);
}

.add-katakana-btn:hover {
    background: linear-gradient(135deg, #06b6d4, #0ea5e9);
}

/* Ensure the modal can still be hidden when Tailwind's `hidden` class is applied */
#review-session-modal.hidden,
#review-session-modal.workspace-mode.hidden {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Root modifier for the existing modal */
#review-session-modal.workspace-mode {
    --rw-gap: clamp(0.65rem, 1vw, 1.25rem);
    --rw-side-min: 220px;
    --rw-main-min: 540px;
    
    /* KanjiOS System Colors - using mode-aware accent */
    --kos-accent-dim: color-mix(in srgb, var(--kos-accent) 80%, black);
    --kos-accent-subtle: rgba(var(--kos-accent-rgb), 0.08);
    --kos-accent-glow: rgba(var(--kos-accent-rgb), 0.2);
    --kos-bg-deep: rgba(5, 5, 7, 0.85);
    --kos-bg-panel: #0a0a0c;
    --kos-border: rgba(var(--kos-accent-rgb), 0.35);
    
    display: grid !important;
    place-items: stretch !important;
    justify-content: stretch !important;
    align-content: stretch !important;
    padding: 0 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    z-index: 9999 !important;
    overflow: hidden !important;
    
    background-color: var(--kos-bg-deep) !important;
    backdrop-filter: blur(8px);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   KanjiOS Grid Background + Scan Line
   ═══════════════════════════════════════════════════════════════════════════════ */

#review-session-modal.workspace-mode::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(34, 197, 94, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 197, 94, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
    animation: kos-grid-fade 1s ease-out;
}

@keyframes kos-grid-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Boot scan lines - individual per panel for satisfying staggered effect */
/* Left and Right panels scan simultaneously, creating a "closing in" effect */

/* Left panel (Associations) - scans from outer side */
#review-session-modal.workspace-mode .rw-panel.rw-assoc::after {
    content: '';
    position: absolute;
    left: 8%;
    right: 8%;
    height: 2px;
    top: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--kos-accent) 25%,
        var(--kos-accent) 75%,
        transparent 100%
    );
    box-shadow: 0 0 12px rgba(var(--kos-accent-rgb), 0.5);
    opacity: 0;
    animation: kos-panel-scan 0.9s ease-out 0.2s forwards;
    pointer-events: none;
    z-index: 50;
    border-radius: 1px;
}

/* Right panel (AI/Explanations) - scans slightly after left */
#review-session-modal.workspace-mode .rw-panel.rw-ai::after {
    content: '';
    position: absolute;
    left: 8%;
    right: 8%;
    height: 2px;
    top: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--kos-accent) 25%,
        var(--kos-accent) 75%,
        transparent 100%
    );
    box-shadow: 0 0 12px rgba(var(--kos-accent-rgb), 0.5);
    opacity: 0;
    animation: kos-panel-scan 0.9s ease-out 0.35s forwards;
    pointer-events: none;
    z-index: 50;
    border-radius: 1px;
}

/* Main panel scan - dedicated scan line element */
#review-session-modal.workspace-mode .rw-panel.rw-main {
    animation: kos-main-panel-boot 0.6s ease-out backwards;
}

/* Main panel scan line - runs through entire center panel */
#review-session-modal.workspace-mode .rw-main-scanline {
    position: absolute;
    left: 8%;
    right: 8%;
    height: 2px;
    top: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--kos-accent) 25%,
        var(--kos-accent) 75%,
        transparent 100%
    );
    box-shadow: 0 0 12px rgba(var(--kos-accent-rgb), 0.5);
    opacity: 0;
    animation: kos-panel-scan-main 1s ease-out 0.45s forwards;
    pointer-events: none;
    z-index: 50;
    border-radius: 1px;
}

/* Hide scan line in simple mode */
#review-session-modal:not(.workspace-mode) .rw-main-scanline {
    display: none;
}

@keyframes kos-panel-scan-main {
    0% { top: 0%; opacity: 0; }
    8% { opacity: 0.5; }
    75% { opacity: 0.35; }
    100% { top: 100%; opacity: 0; }
}

@keyframes kos-panel-scan {
    0% { top: 0%; opacity: 0; }
    10% { opacity: 0.45; }
    80% { opacity: 0.3; }
    100% { top: 100%; opacity: 0; }
}

/* Shared styling for gray pill buttons */
.pressable-pill {
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
    will-change: border-color, box-shadow, background-color;
}

.pressable-pill:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.45);
    outline-offset: 2px;
}

.pressable-pill:active,
.pressable-pill.active,
.pressable-pill.is-held {
    border-color: var(--color-accent, #3b82f6) !important;
    box-shadow:
        0 0 0 1px rgba(59, 130, 246, 0.45),
        0 0 0 4px rgba(59, 130, 246, 0.15);
    background-color: rgba(37, 99, 235, 0.12) !important;
}

/* The grid container */
#review-session-modal.workspace-mode .rw-container {
    display: grid !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    
    /* Grid Layout - Let panels grow naturally */
    gap: var(--rw-gap) !important;
    padding: var(--rw-gap) !important;
    
    /* Layout: Responsive fixed-width - NO WOBBLING, scales on smaller screens */
    grid-template-areas: "assoc main ai";
    grid-template-columns: 
        minmax(var(--rw-side-min), 1fr)
        minmax(var(--rw-main-min), 1.45fr)
        minmax(var(--rw-side-min), 1fr) !important;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden !important;
}

/* Ensure other modals (like detailModal) appear ON TOP of the workspace mode */
/* Standard modal z-index is typically 1000 or lower */
#detail-modal, .modal:not(#review-session-modal) {
    z-index: 10000 !important;
}

/* Detail modal edit panel */
#detail-edit-panel {
    padding: 1.5rem;
    backdrop-filter: blur(2px);
}

.detail-edit-card {
    background: rgba(24, 24, 27, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.95rem;
    padding: 1.5rem;
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.25);
}

.detail-edit-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.detail-edit-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.detail-edit-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.9);
}

.detail-edit-field input,
.detail-edit-field textarea,
.detail-edit-field select {
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.35);
    color: #f4f4f5;
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.detail-edit-field input:focus,
.detail-edit-field textarea:focus,
.detail-edit-field select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.7);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.detail-edit-field small {
    color: rgba(226, 232, 240, 0.65);
    font-size: 0.75rem;
}

.detail-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.detail-edit-error {
    color: #f87171;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Panels Styling - KanjiOS Enhanced */
#review-session-modal.workspace-mode .rw-panel {
    background: var(--kos-bg-panel) !important;
    border: 2px solid rgba(var(--kos-accent-rgb), 0.35) !important;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-width: 0;
    min-height: 0;
    opacity: 1 !important;
    box-shadow: 
        0 0 60px rgba(0, 0, 0, 0.5),
        0 0 1px var(--kos-accent-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.02) !important;
    transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.4s ease, border-color 0.4s ease;
    position: relative;
    z-index: 1;
    animation: kos-panel-boot 0.6s ease-out backwards;
}

/* Staggered panel entrance */
#review-session-modal.workspace-mode .rw-panel.rw-assoc {
    animation-delay: 0.1s;
}

#review-session-modal.workspace-mode .rw-panel.rw-main {
    animation-delay: 0s;
}

#review-session-modal.workspace-mode .rw-panel.rw-ai {
    animation-delay: 0.2s;
}

@keyframes kos-panel-boot {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Subtle breathing glow on side panels */
#review-session-modal.workspace-mode .rw-panel.rw-assoc,
#review-session-modal.workspace-mode .rw-panel.rw-ai {
    animation: kos-panel-boot 0.6s ease-out backwards, kos-panel-breathe 8s ease-in-out infinite 1s;
}

@keyframes kos-panel-breathe {
    0%, 100% { 
        box-shadow: 
            0 0 30px rgba(0, 0, 0, 0.4),
            0 0 12px rgba(var(--kos-accent-rgb, 34, 197, 94), 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.02);
    }
    50% { 
        box-shadow: 
            0 0 40px rgba(0, 0, 0, 0.4),
            0 0 20px rgba(var(--kos-accent-rgb, 34, 197, 94), 0.15),
            inset 0 1px 0 rgba(255, 255, 255, 0.03);
    }
}

/* Hover glow intensification on side panels - border only, let breathing animation continue smoothly */
#review-session-modal.workspace-mode .rw-panel.rw-assoc:hover,
#review-session-modal.workspace-mode .rw-panel.rw-ai:hover {
    border-color: rgba(var(--kos-accent-rgb), 0.55) !important;
}

.rw-assoc { grid-area: assoc; }
.rw-main { grid-area: main; position: relative; }
.rw-ai { grid-area: ai; }

/* ═══════════════════════════════════════════════════════════════════════════════
   KanjiOS Corner Reticles - All Four Corners on Main Panel
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Top-left and bottom-right via ::before and ::after */
#review-session-modal.workspace-mode .rw-main::before,
#review-session-modal.workspace-mode .rw-main::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    pointer-events: none;
    z-index: 10;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

#review-session-modal.workspace-mode .rw-main::before {
    top: 8px;
    left: 8px;
    border-top: 1px solid var(--kos-accent);
    border-left: 1px solid var(--kos-accent);
    animation: kos-reticle-pulse 3s ease-in-out infinite;
}

#review-session-modal.workspace-mode .rw-main::after {
    bottom: 8px;
    right: 8px;
    border-bottom: 1px solid var(--kos-accent);
    border-right: 1px solid var(--kos-accent);
    animation: kos-reticle-pulse 3s ease-in-out infinite 1.5s;
}

@keyframes kos-reticle-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Note: Additional corner reticles removed to avoid visual conflicts with header buttons */

/* Panel Header - KanjiOS Terminal Style */
.rw-panel-header {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid rgba(34, 197, 94, 0.12) !important;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, #111113 0%, #0a0a0c 100%) !important;
    color: #e4e4e7 !important;
    min-height: 3rem;
    flex-shrink: 0;
    position: relative;
}

/* KanjiOS header accent line + scanning effect */
.rw-panel-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(34, 197, 94, 0.2) 30%,
        rgba(34, 197, 94, 0.4) 50%,
        rgba(34, 197, 94, 0.2) 70%,
        transparent 100%
    );
}

.rw-panel-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(34, 197, 94, 0.25) 20%, 
        rgba(34, 197, 94, 0.25) 80%, 
        transparent 100%
    );
}

/* Panel header title - KanjiOS terminal aesthetic */
.rw-panel-header span:first-child,
.rw-panel-header > span {
    font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--kos-accent);
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

/* Status indicator dot before panel titles */
.rw-panel-header span:first-child::before {
    content: '▸';
    margin-right: 0.5rem;
    font-size: 0.625rem;
    opacity: 0.7;
}

/* Panel Content */
.rw-panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll */
    padding: 1rem;
    min-height: 0; /* Allow proper flex shrinking */
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

/* AI panel specific layout */
#review-session-modal.workspace-mode #rw-ai-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 0; /* spacing handled inside shell */
}

#review-session-modal.workspace-mode .rw-ai-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    min-height: 0;
    box-sizing: border-box;
}

#review-session-modal.workspace-mode .rw-ai-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

/* Sub-tab bar for MC explanations */
#review-session-modal.workspace-mode .rw-ai-subtabs {
    display: flex;
    gap: 0.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(63, 63, 70, 0.5);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

#review-session-modal.workspace-mode .rw-ai-subtabs.hidden {
    display: none;
}

#review-session-modal.workspace-mode .rw-ai-subtab {
    padding: 0.375rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 500;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    border-radius: 6px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.15s ease;
}

#review-session-modal.workspace-mode .rw-ai-subtab:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
}

#review-session-modal.workspace-mode .rw-ai-subtab.active {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.4);
}

#review-session-modal.workspace-mode .rw-ai-subtab:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* MC option subtabs - round like the option badges */
#review-session-modal.workspace-mode .rw-ai-subtab-mc {
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Error state for sub-tabs (when explain fails) */
#review-session-modal.workspace-mode .rw-ai-subtab.subtab-error {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
    animation: subtab-shake 0.5s ease-in-out;
}

@keyframes subtab-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Success state for sub-tabs (when explain succeeds) */
#review-session-modal.workspace-mode .rw-ai-subtab.subtab-success {
    background: #16a34a;
    border-color: #16a34a;
    color: white;
    animation: subtab-pulse 0.5s ease-in-out;
}

@keyframes subtab-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

#review-session-modal.workspace-mode .ai-status-area {
    position: relative;
    max-height: 240px;
    transition: max-height 0.25s ease, padding 0.25s ease;
    overflow: hidden;
}

#review-session-modal.workspace-mode .ai-status-area.collapsed {
    max-height: 2.75rem;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

#review-session-modal.workspace-mode .ai-status-log {
    overflow-y: auto;
    max-height: inherit;
    padding-right: 0.25rem;
}

#review-session-modal.workspace-mode .ai-status-summary {
    font-size: 0.85rem;
    color: #a1a1aa;
}

#review-session-modal.workspace-mode .ai-status-toggle {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: #a1a1aa;
    font-size: 0.85rem;
    opacity: 0.6;
    transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

#review-session-modal.workspace-mode .ai-status-toggle:hover {
    opacity: 1;
    border-color: #3b82f6;
    color: #3b82f6;
}

#review-session-modal.workspace-mode .ai-status-area.collapsed .ai-status-log {
    display: none;
}

#review-session-modal.workspace-mode .ai-status-area:not(.collapsed) .ai-status-summary {
    display: none;
}

#review-session-modal.workspace-mode .ai-status-area.collapsed .ai-status-summary {
    display: block;
    padding-bottom: 0.25rem;
}

#review-session-modal.workspace-mode .ai-status-area.auto-collapsed .ai-status-toggle::after {
    content: '↺';
    font-size: 0.75rem;
}

#review-session-modal.workspace-mode .ai-status-area.collapsed .ai-status-toggle {
    transform: rotate(180deg);
}

#review-session-modal.workspace-mode #ai-response-area {
    line-height: 1.4;
}

#review-session-modal.workspace-mode #ai-response-area > * {
    margin-top: 0.35rem;
    margin-bottom: 0.35rem;
}

#review-session-modal.workspace-mode #ai-response-area p {
    margin: 0.25rem 0;
}

#review-session-modal.workspace-mode #ai-response-area h3 {
    margin-top: 0.75rem;
    margin-bottom: 0.35rem;
}

#review-session-modal.workspace-mode #ai-response-area ul,
#review-session-modal.workspace-mode #ai-response-area ol {
    margin: 0.2rem 0 0.3rem;
    padding-left: 1rem;
}

#review-session-modal.workspace-mode #ai-response-area li {
    margin: 0.05rem 0;
    padding-left: 0.25rem;
    line-height: 1.35;
}

#review-session-modal.workspace-mode #ai-response-area li + li {
    margin-top: 0.05rem;
}

/* Edit Mode Styles */
#review-session-modal.workspace-mode .rw-ai-scroll.edit-mode {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#review-session-modal.workspace-mode #ai-edit-area {
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#review-session-modal.workspace-mode #ai-edit-area.hidden {
    display: none !important;
}

#review-session-modal.workspace-mode #ai-edit-area:not(.hidden) {
    display: flex;
}

#review-session-modal.workspace-mode #ai-edit-textarea {
    flex: 1;
    width: 100%;
    min-height: 0;
    background: var(--bg-tertiary, #1f1f23);
    border: 1px solid var(--border, #3f3f46);
    color: var(--text-primary, #fafafa);
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    resize: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#review-session-modal.workspace-mode #ai-edit-textarea:focus {
    border-color: var(--accent, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    outline: none;
}

#review-session-modal.workspace-mode #ai-edit-textarea::placeholder {
    color: var(--text-secondary, #a1a1aa);
    opacity: 0.6;
}

#review-session-modal.workspace-mode .ai-edit-save {
    background: var(--accent, #6366f1);
    font-weight: 500;
}

#review-session-modal.workspace-mode .ai-edit-save:hover {
    background: var(--accent-hover, #4f46e5);
}

#review-session-modal.workspace-mode .ai-edit-cancel {
    color: var(--text-secondary, #a1a1aa);
}

#review-session-modal.workspace-mode .ai-edit-cancel:hover {
    background: var(--bg-tertiary, #1f1f23);
    color: var(--text-primary, #fafafa);
}

/* --- Middle Panel (Main Review) Specifics --- */

/* Wrapper override - FORCE OVERRIDE TAILWIND UTILITIES - KanjiOS Enhanced */
#review-session-modal.workspace-mode #review-content-wrapper {
    width: 100% !important;
    max-width: none !important;
    background: #0a0a0c !important;
    height: 100% !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 12px !important;
    opacity: 1 !important;
    box-shadow: 
        0 0 60px rgba(0, 0, 0, 0.5),
        0 0 1px rgba(34, 197, 94, 0.2) !important;
    border: 1px solid rgba(34, 197, 94, 0.15) !important;
    min-width: 0 !important;
    overflow: hidden !important;
    position: relative;
}

/* Subtle inner glow for main panel */
#review-session-modal.workspace-mode #review-content-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(34, 197, 94, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SIMPLE MODE (Press F) - KanjiOS Focused Terminal
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Preserve original modal width when workspace mode is off */
#review-session-modal:not(.workspace-mode) #review-content-wrapper {
    max-width: 42rem;
}

/* Simple mode backdrop - semi-transparent with blur */
#review-session-modal:not(.workspace-mode) {
    background: rgba(3, 3, 5, 0.75) !important;
    backdrop-filter: blur(8px);
}

/* Simple mode grid background + boot scan */
#review-session-modal:not(.workspace-mode)::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(34, 197, 94, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 197, 94, 0.015) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
    animation: kos-grid-fade 0.8s ease-out;
}

/* Simple mode boot scan line */
#review-session-modal:not(.workspace-mode)::after {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    height: 2px;
    top: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--kos-accent, #22c55e) 20%,
        var(--kos-accent, #22c55e) 80%,
        transparent 100%
    );
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.25);
    opacity: 0;
    animation: kos-boot-scan 1.2s ease-out 0.1s forwards;
    pointer-events: none;
    z-index: 100;
}

/* Simple mode card - KanjiOS terminal card */
#review-session-modal:not(.workspace-mode) #review-content-wrapper {
    background: #080809 !important;
    border: 2px solid rgba(var(--kos-accent-rgb, 34, 197, 94), 0.4) !important;
    border-radius: 16px !important;
    box-shadow: 
        0 0 60px rgba(0, 0, 0, 0.5),
        0 0 4px rgba(var(--kos-accent-rgb, 34, 197, 94), 0.3),
        0 20px 60px rgba(0, 0, 0, 0.4) !important;
    position: relative;
    z-index: 1;
    animation: kos-card-boot 0.5s ease-out;
}

@keyframes kos-card-boot {
    from {
        opacity: 0;
        transform: scale(0.97) translateY(15px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Simple mode inner glow */
#review-session-modal:not(.workspace-mode) #review-content-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(34, 197, 94, 0.03) 0%, transparent 50%);
    pointer-events: none;
    border-radius: inherit;
    z-index: 0;
}

/* Simple mode all four corner accents */
#review-session-modal:not(.workspace-mode) #review-content-wrapper::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 28px;
    height: 28px;
    border-top: 1px solid rgba(34, 197, 94, 0.4);
    border-left: 1px solid rgba(34, 197, 94, 0.4);
    pointer-events: none;
    z-index: 10;
    animation: kos-reticle-pulse 3s ease-in-out infinite;
}

/* Simple mode header bar - KanjiOS style */
#review-session-modal:not(.workspace-mode) #review-content-wrapper > .flex.items-center.justify-between {
    background: linear-gradient(180deg, #0c0c0e 0%, #080809 100%) !important;
    border-bottom: 1px solid rgba(34, 197, 94, 0.1) !important;
    position: relative;
}

#review-session-modal:not(.workspace-mode) #review-content-wrapper > .flex.items-center.justify-between::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(34, 197, 94, 0.2) 30%,
        rgba(34, 197, 94, 0.35) 50%,
        rgba(34, 197, 94, 0.2) 70%,
        transparent 100%
    );
}

#review-session-modal:not(.workspace-mode) #review-content-wrapper > .flex.items-center.justify-between::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(34, 197, 94, 0.2) 50%, transparent 100%);
}

/* Simple mode card progress - KanjiOS style */
#review-session-modal:not(.workspace-mode) #review-progress {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace !important;
    letter-spacing: 0.03em;
}

#review-session-modal:not(.workspace-mode) #review-progress::before {
    content: '◈';
    margin-right: 0.5rem;
    color: var(--kos-accent, #22c55e);
    font-size: 0.75rem;
}

/* Simple mode header pills - same KanjiOS treatment */
#review-session-modal:not(.workspace-mode) .flex.items-center.gap-1\.5.px-2.py-1.rounded-full {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace !important;
    font-size: 0.6875rem !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 6px !important;
}

#review-session-modal:not(.workspace-mode) .bg-amber-500\/20 {
    background: rgba(34, 197, 94, 0.1) !important;
    border-color: rgba(34, 197, 94, 0.25) !important;
    color: #22c55e !important;
}

#review-session-modal:not(.workspace-mode) .bg-emerald-500\/20 {
    background: rgba(34, 197, 94, 0.12) !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
    color: #22c55e !important;
}

/* Simple mode MC options - full KanjiOS treatment (only when NOT answered) */
#review-session-modal:not(.workspace-mode) .option-btn:not(.bg-success):not(.bg-danger) {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.02),
        0 2px 8px rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

#review-session-modal:not(.workspace-mode) .option-btn:not(.bg-success):not(.bg-danger)::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, var(--kos-accent, #22c55e) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

#review-session-modal:not(.workspace-mode) .option-btn:not(.bg-success):not(.bg-danger):hover {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 4px 16px rgba(0, 0, 0, 0.25),
        0 0 30px rgba(59, 130, 246, 0.08);
    transform: translateY(-2px) scale(1.005);
}

#review-session-modal:not(.workspace-mode) .option-btn:not(.bg-success):not(.bg-danger):hover::before {
    opacity: 0.6;
}

/* Simple mode option number badges - mode-aware glow (when NOT answered) */
#review-session-modal:not(.workspace-mode) .option-btn:not(.bg-success):not(.bg-danger) .option-number {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.12);
    border: 1px solid rgba(var(--kos-accent-rgb, 34, 197, 94), 0.3);
    color: var(--kos-accent, #22c55e);
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(var(--kos-accent-rgb, 34, 197, 94), 0.4);
    transition: all 0.25s ease;
}

#review-session-modal:not(.workspace-mode) .option-btn:not(.bg-success):not(.bg-danger):hover .option-number {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.2);
    border-color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.5);
    box-shadow: 0 0 12px rgba(var(--kos-accent-rgb, 34, 197, 94), 0.3);
}

/* Simple mode correct answer - enhance with KanjiOS glow but KEEP green background */
#review-session-modal:not(.workspace-mode) .option-btn.bg-success {
    border-radius: 10px !important;
    border-color: #22c55e !important;
    box-shadow: 
        0 0 25px rgba(34, 197, 94, 0.3),
        inset 0 0 20px rgba(34, 197, 94, 0.1) !important;
    /* Force white text for better contrast on green background */
    color: #fff !important;
}

#review-session-modal:not(.workspace-mode) .option-btn.bg-success .option-number {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    color: #fff !important;
    text-shadow: none;
}

/* Simple mode incorrect answer - enhance with KanjiOS glow but KEEP red background */
#review-session-modal:not(.workspace-mode) .option-btn.bg-danger {
    border-radius: 10px !important;
    border-color: rgba(239, 68, 68, 0.8) !important;
    box-shadow: 
        0 0 25px rgba(239, 68, 68, 0.25),
        inset 0 0 20px rgba(239, 68, 68, 0.1) !important;
    /* Force white text for better contrast on red background */
    color: #fff !important;
}

#review-session-modal:not(.workspace-mode) .option-btn.bg-danger .option-number {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    color: #fff !important;
    text-shadow: none;
}

/* 1. Header Section - KanjiOS Terminal Bar */
#review-session-modal.workspace-mode #review-content-wrapper > .text-center.mb-8,
#review-session-modal.workspace-mode #review-content-wrapper > .flex.items-center.justify-between {
    padding: 0.5rem 1rem !important;
    margin-bottom: 0 !important;
    border-bottom: 1px solid rgba(34, 197, 94, 0.1) !important;
    background: linear-gradient(180deg, #0f0f11 0%, #0a0a0c 100%) !important;
    min-height: 3.5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

/* KanjiOS header glow lines */
#review-session-modal.workspace-mode #review-content-wrapper > .text-center.mb-8::before,
#review-session-modal.workspace-mode #review-content-wrapper > .flex.items-center.justify-between::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(34, 197, 94, 0.15) 30%,
        rgba(34, 197, 94, 0.3) 50%,
        rgba(34, 197, 94, 0.15) 70%,
        transparent 100%
    );
}

#review-session-modal.workspace-mode #review-content-wrapper > .text-center.mb-8::after,
#review-session-modal.workspace-mode #review-content-wrapper > .flex.items-center.justify-between::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(34, 197, 94, 0.2) 50%, transparent 100%);
}

/* Card progress text - KanjiOS style */
#review-session-modal.workspace-mode #review-progress {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.03em;
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Card progress - highlight the numbers */
#review-session-modal.workspace-mode #review-progress::before {
    content: '◈';
    margin-right: 0.5rem;
    color: var(--kos-accent);
    font-size: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   KanjiOS Header Pills (Local, Simple, etc.)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Local/Synced/Auth Status pill - KanjiOS terminal style */
#review-session-modal .flex.items-center.gap-1\.5.px-2.py-1.rounded-full {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace !important;
    font-size: 0.625rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 5px !important;
    padding: 0.25rem 0.5rem !important;
}

/* Local pill - use mode color */
#review-session-modal .bg-amber-500\/20 {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.12) !important;
    border-color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.3) !important;
    color: var(--kos-accent, #22c55e) !important;
}

/* Synced pill - use mode color */
#review-session-modal .bg-emerald-500\/20 {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.12) !important;
    border-color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.3) !important;
    color: var(--kos-accent, #22c55e) !important;
}

/* Blue signed-in pill - also use mode color */
#review-session-modal .bg-blue-500\/20 {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.12) !important;
    border-color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.3) !important;
    color: var(--kos-accent, #22c55e) !important;
}

/* Simple/Full (F) toggle button - KanjiOS terminal style */
#review-session-modal .pressable-pill,
#review-session-modal [class*="pressable-pill"] {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace !important;
    font-size: 0.6875rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.06) !important;
    border: 1px solid rgba(var(--kos-accent-rgb, 34, 197, 94), 0.2) !important;
    border-radius: 6px !important;
    color: var(--kos-accent, #22c55e) !important;
    padding: 0.375rem 0.75rem !important;
    transition: all 0.2s ease;
    box-shadow: none !important;
}

#review-session-modal .pressable-pill:hover,
#review-session-modal [class*="pressable-pill"]:hover {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.12) !important;
    border-color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.35) !important;
    box-shadow: 0 0 15px rgba(var(--kos-accent-rgb, 34, 197, 94), 0.15) !important;
}

#review-session-modal .pressable-pill:active,
#review-session-modal .pressable-pill.active,
#review-session-modal .pressable-pill.is-held {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.15) !important;
    border-color: var(--kos-accent, #22c55e) !important;
    box-shadow: 0 0 20px rgba(var(--kos-accent-rgb, 34, 197, 94), 0.25) !important;
}

/* ESC hint text - KanjiOS style */
#review-session-modal .text-text-muted {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.03em;
    opacity: 0.5;
}

/* Close X button - subtle KanjiOS */
#review-session-modal button[aria-label="Close"],
#review-session-modal .hover\:bg-white\/10 {
    border-radius: 6px;
    transition: all 0.2s ease;
}

#review-session-modal button[aria-label="Close"]:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
}

/* 2. Main Content */
#review-session-modal.workspace-mode #review-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll */
    padding: 1.5rem !important; /* Restore padding for answers */
    margin-bottom: 0 !important;
    width: 100% !important;
    min-height: 0; /* Allow proper flex shrinking */
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

/* CRITICAL FIX: Force inner answer grid to expand */
#review-session-modal.workspace-mode #review-content [class*='max-w-'] {
    max-width: none !important;
    width: 100% !important;
}

/* Ensure children use full width */
#review-session-modal.workspace-mode #review-content > * {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important; /* Include padding in width calculation */
}

/* Boost hero glyph size in workspace mode so the prompt fills the hero area */
#review-session-modal.workspace-mode .rw-main .hero-glyph {
    font-size: min(
        calc(var(--dynamic-font-size, 1em) * 1.65),
        clamp(3rem, 9vw, 11rem)
    ) !important;
    line-height: 1.05 !important;
}

/* Hide bottom-of-card associations since the left panel already shows them */
#review-session-modal.workspace-mode .rw-main .assoc-container {
    display: none !important;
}

/* 3. Footer Section - KanjiOS Command Bar */
#review-session-modal.workspace-mode #review-actions {
    padding: 1rem 1.5rem !important;
    margin: 0 0.75rem 0.75rem 0.75rem !important;
    border-radius: 10px !important;
    border: 1px solid rgba(34, 197, 94, 0.12) !important;
    background: linear-gradient(180deg, rgba(15, 15, 17, 0.9) 0%, rgba(8, 8, 10, 0.95) 100%) !important;
    min-height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    box-shadow: 
        0 -4px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

/* Footer top accent */
#review-session-modal.workspace-mode #review-actions::after {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(34, 197, 94, 0.15) 50%, transparent 100%);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MAIN PANEL - KanjiOS Enhanced MC Options
   ═══════════════════════════════════════════════════════════════════════════════ */

/* MC Options - KanjiOS terminal selection feel (only when NOT answered) */
#review-session-modal.workspace-mode .option-btn:not(.bg-success):not(.bg-danger) {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.02),
        0 2px 8px rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Subtle scan line on options (only when NOT answered) - mode-aware */
#review-session-modal.workspace-mode .option-btn:not(.bg-success):not(.bg-danger)::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, var(--kos-accent, #22c55e) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

#review-session-modal.workspace-mode .option-btn:not(.bg-success):not(.bg-danger):hover {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 4px 16px rgba(0, 0, 0, 0.25),
        0 0 30px rgba(59, 130, 246, 0.08);
    transform: translateY(-2px) scale(1.005);
}

#review-session-modal.workspace-mode .option-btn:not(.bg-success):not(.bg-danger):hover::before {
    opacity: 0.6;
}

/* Option number badges - mode-aware accent with glow (when NOT answered) */
#review-session-modal.workspace-mode .option-btn:not(.bg-success):not(.bg-danger) .option-number {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.12);
    border: 1px solid rgba(var(--kos-accent-rgb, 34, 197, 94), 0.3);
    color: var(--kos-accent);
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(var(--kos-accent-rgb, 34, 197, 94), 0.4);
    transition: all 0.25s ease;
}

#review-session-modal.workspace-mode .option-btn:not(.bg-success):not(.bg-danger):hover .option-number {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.2);
    border-color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.5);
    box-shadow: 0 0 12px rgba(var(--kos-accent-rgb, 34, 197, 94), 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MC Answer States - CRITICAL: Preserve bg-success and bg-danger colors!
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Correct answer - enhance with KanjiOS glow but KEEP the green background */
#review-session-modal.workspace-mode .option-btn.bg-success {
    border-radius: 10px !important;
    border-color: var(--kos-accent) !important;
    box-shadow: 
        0 0 25px rgba(34, 197, 94, 0.3),
        inset 0 0 20px rgba(34, 197, 94, 0.1) !important;
    /* Force white text for better contrast on green background */
    color: #fff !important;
}

#review-session-modal.workspace-mode .option-btn.bg-success .option-number {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    color: #fff !important;
    text-shadow: none;
}

/* Incorrect answer - enhance with KanjiOS glow but KEEP the red background */
#review-session-modal.workspace-mode .option-btn.bg-danger {
    border-radius: 10px !important;
    border-color: rgba(239, 68, 68, 0.8) !important;
    box-shadow: 
        0 0 25px rgba(239, 68, 68, 0.25),
        inset 0 0 20px rgba(239, 68, 68, 0.1) !important;
    /* Force white text for better contrast on red background */
    color: #fff !important;
}

#review-session-modal.workspace-mode .option-btn.bg-danger .option-number {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    color: #fff !important;
    text-shadow: none;
}

/* Number badge - subtle gradient */
#review-session-modal.workspace-mode .option-btn .mc-option-badge {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Reading Chips - Clickable TTS (matches detail modal style)
   ───────────────────────────────────────────────────────────────────────────── */

.reading-group {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.reading-label {
    font-size: 0.875rem;
    color: #a1a1aa;
    font-weight: 500;
}

.review-reading-chip {
    display: inline-block;
    padding: 0.375rem 0.625rem;
    font-size: 0.9rem;
    font-weight: 500;
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 0.5rem;
    color: #e4e4e7;
    cursor: pointer;
    transition: all 0.15s ease;
}

.review-reading-chip:hover {
    background: rgba(37, 99, 235, 0.15);
    border-color: #3b82f6;
    color: #3b82f6;
}

.review-reading-chip:active {
    transform: scale(0.96);
}

/* Post-answer details card - softer edges */
#review-session-modal.workspace-mode .bg-bg-tertiary\/40 {
    border-radius: 0.875rem;
    border-color: rgba(255, 255, 255, 0.04);
    background: rgba(39, 39, 42, 0.5);
}

/* --- Responsive Adjustments --- */

@media (max-width: 1500px) {
    #review-session-modal.workspace-mode .rw-container {
        grid-template-columns: 
            minmax(var(--rw-side-min), 1fr)
            minmax(var(--rw-main-min), 1.35fr)
            minmax(var(--rw-side-min), 1fr) !important;
    }
}

@media (max-width: 1320px) {
    #review-session-modal.workspace-mode {
        --rw-gap: clamp(0.55rem, 0.9vw, 1rem);
        --rw-side-min: 205px;
        --rw-main-min: 500px;
    }
    #review-session-modal.workspace-mode .rw-container {
        grid-template-columns: 
            minmax(var(--rw-side-min), 0.95fr)
            minmax(var(--rw-main-min), 1.25fr)
            minmax(var(--rw-side-min), 0.95fr) !important;
    }
}

@media (max-width: 1120px) {
    #review-session-modal.workspace-mode {
        --rw-gap: clamp(0.5rem, 1vw, 0.9rem);
        --rw-side-min: 190px;
        --rw-main-min: 420px;
    }
    #review-session-modal.workspace-mode .rw-container {
        grid-template-columns: 
            minmax(var(--rw-side-min), 0.9fr)
            minmax(var(--rw-main-min), 1.15fr)
            minmax(var(--rw-side-min), 0.9fr) !important;
    }
}

/* Mobile */
@media (max-width: 960px) {
    #review-session-modal.workspace-mode {
        display: block !important;
        background: #09090b !important;
    }
    
    #review-session-modal.workspace-mode .rw-container {
        display: flex !important;
        flex-direction: column !important;
        padding: 0 !important;
        gap: 0 !important;
        height: calc(100% - 50px) !important;
    }

    .rw-mobile-tabs {
        display: flex !important;
        background: #27272a !important;
        border-bottom: 1px solid #3f3f46;
        padding: 0 1rem;
        gap: 1rem;
        height: 50px;
        align-items: center;
    }

    .rw-tab-btn {
        padding: 0 0.5rem;
        height: 100%;
        display: flex;
        align-items: center;
        color: #a1a1aa;
        border-bottom: 2px solid transparent;
        font-weight: 600;
    }
    
    .rw-tab-btn.active {
        color: #3b82f6;
        border-bottom-color: #3b82f6;
    }

    #review-session-modal.workspace-mode .rw-panel {
        display: none;
        border: none !important;
        border-radius: 0 !important;
    }
    
    #review-session-modal.workspace-mode .rw-panel.active {
        display: flex !important;
    }
}

/* Default hidden tabs */
.rw-mobile-tabs {
    display: none;
}

/* Toggle Button */
.workspace-toggle-btn {
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: #a1a1aa;
    transition: all 0.2s;
}
.workspace-toggle-btn:hover {
    background: #27272a;
    color: #e4e4e7;
}
.workspace-toggle-btn.active {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   EXPLAIN BUTTON - Loading States & Animations
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Base loading state - accent blue glow */
#review-session-modal.workspace-mode .btn-ai-explain.loading {
    animation: explain-pulse 2s ease-in-out infinite;
    box-shadow: 
        0 0 0 2px rgba(59, 130, 246, 0.8),
        0 0 20px rgba(59, 130, 246, 0.4),
        0 0 40px rgba(59, 130, 246, 0.2);
    border-color: #3b82f6 !important;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.1) 100%) !important;
}

/* Slow loading state - yellow/amber warning */
#review-session-modal.workspace-mode .btn-ai-explain.loading-slow {
    animation: explain-pulse-slow 1.5s ease-in-out infinite;
    box-shadow: 
        0 0 0 2px rgba(245, 158, 11, 0.8),
        0 0 20px rgba(245, 158, 11, 0.4),
        0 0 40px rgba(245, 158, 11, 0.2);
    border-color: #f59e0b !important;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%) !important;
    color: #f59e0b !important;
}

/* Critical loading state - red/orange urgent */
#review-session-modal.workspace-mode .btn-ai-explain.loading-critical {
    animation: explain-pulse-urgent 1s ease-in-out infinite;
    box-shadow: 
        0 0 0 2px rgba(239, 68, 68, 0.8),
        0 0 20px rgba(239, 68, 68, 0.4),
        0 0 40px rgba(239, 68, 68, 0.2);
    border-color: #ef4444 !important;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.1) 100%) !important;
    color: #ef4444 !important;
}

/* Success state - green celebration */
#review-session-modal.workspace-mode .btn-ai-explain.success {
    animation: explain-success 0.6s ease-out;
    box-shadow: 
        0 0 0 3px rgba(34, 197, 94, 0.9),
        0 0 30px rgba(34, 197, 94, 0.5),
        0 0 60px rgba(34, 197, 94, 0.3);
    border-color: #22c55e !important;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.3) 0%, rgba(34, 197, 94, 0.15) 100%) !important;
    color: #22c55e !important;
    transform: scale(1.02);
}

/* Error state - red shake */
#review-session-modal.workspace-mode .btn-ai-explain.error {
    animation: explain-error 0.5s ease-in-out;
    box-shadow: 
        0 0 0 2px rgba(239, 68, 68, 0.9),
        0 0 20px rgba(239, 68, 68, 0.4);
    border-color: #ef4444 !important;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(239, 68, 68, 0.1) 100%) !important;
    color: #ef4444 !important;
}

/* Keyframe Animations */
@keyframes explain-pulse {
    0%, 100% {
        box-shadow: 
            0 0 0 2px rgba(59, 130, 246, 0.8),
            0 0 20px rgba(59, 130, 246, 0.4),
            0 0 40px rgba(59, 130, 246, 0.2);
    }
    50% {
        box-shadow: 
            0 0 0 4px rgba(59, 130, 246, 0.6),
            0 0 30px rgba(59, 130, 246, 0.5),
            0 0 60px rgba(59, 130, 246, 0.3);
    }
}

@keyframes explain-pulse-slow {
    0%, 100% {
        box-shadow: 
            0 0 0 2px rgba(245, 158, 11, 0.8),
            0 0 20px rgba(245, 158, 11, 0.4),
            0 0 40px rgba(245, 158, 11, 0.2);
    }
    50% {
        box-shadow: 
            0 0 0 4px rgba(245, 158, 11, 0.6),
            0 0 30px rgba(245, 158, 11, 0.5),
            0 0 60px rgba(245, 158, 11, 0.3);
    }
}

@keyframes explain-pulse-urgent {
    0%, 100% {
        box-shadow: 
            0 0 0 2px rgba(239, 68, 68, 0.8),
            0 0 20px rgba(239, 68, 68, 0.4),
            0 0 40px rgba(239, 68, 68, 0.2);
        transform: scale(1);
    }
    50% {
        box-shadow: 
            0 0 0 4px rgba(239, 68, 68, 0.6),
            0 0 30px rgba(239, 68, 68, 0.5),
            0 0 60px rgba(239, 68, 68, 0.3);
        transform: scale(1.01);
    }
}

@keyframes explain-success {
    0% {
        transform: scale(1);
        box-shadow: 
            0 0 0 2px rgba(34, 197, 94, 0.8),
            0 0 20px rgba(34, 197, 94, 0.4);
    }
    30% {
        transform: scale(1.05);
        box-shadow: 
            0 0 0 6px rgba(34, 197, 94, 0.6),
            0 0 40px rgba(34, 197, 94, 0.6),
            0 0 80px rgba(34, 197, 94, 0.4);
    }
    100% {
        transform: scale(1.02);
        box-shadow: 
            0 0 0 3px rgba(34, 197, 94, 0.9),
            0 0 30px rgba(34, 197, 94, 0.5),
            0 0 60px rgba(34, 197, 94, 0.3);
    }
}

@keyframes explain-error {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-3px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(3px);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MC Explain Button ↔ Explain This Connection
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Attention shimmer when clicking ? with cached content */
#review-session-modal.workspace-mode .btn-ai-explain.explain-attention {
    animation: explain-attention-shimmer 0.5s ease-out 3;
}

@keyframes explain-attention-shimmer {
    0%, 100% {
        box-shadow: 
            0 0 0 2px rgba(59, 130, 246, 0.6),
            0 0 15px rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 
            0 0 0 4px rgba(59, 130, 246, 0.8),
            0 0 25px rgba(59, 130, 246, 0.6),
            0 0 40px rgba(59, 130, 246, 0.3);
        transform: scale(1.02);
    }
}

/* Cache indicator - ? button has existing explanation */
#review-session-modal.workspace-mode .mc-explain.has-cache {
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.3);
}

/* Cache indicator - subtab has existing explanation */
#review-session-modal.workspace-mode .rw-ai-subtab.has-cache:not(:disabled) {
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.3);
}

/* Attention pulse on Explain button when switching tabs via ? click */
#review-session-modal.workspace-mode .btn-ai-explain.explain-attention {
    animation: explain-attention-pulse 0.3s ease-out 3;
}

@keyframes explain-attention-pulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
    50% { 
        box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.4);
    }
}

/* Hover shimmer on ? button */
#review-session-modal.workspace-mode .mc-explain:hover {
    animation: mc-explain-hover-shimmer 1s ease-in-out infinite;
}

@keyframes mc-explain-hover-shimmer {
    0%, 100% { 
        box-shadow: 0 0 4px rgba(59, 130, 246, 0.3);
        border-color: rgba(59, 130, 246, 0.5);
    }
    50% { 
        box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
        border-color: rgba(59, 130, 246, 0.8);
    }
}

/* Connected shimmer effect - applied via JS to the right target */
#review-session-modal.workspace-mode .btn-ai-explain.explain-connected-shimmer {
    animation: explain-connection-shimmer 1s ease-in-out infinite;
}

#review-session-modal.workspace-mode .rw-ai-subtab.subtab-connected-shimmer {
    animation: subtab-connection-shimmer 1s ease-in-out infinite;
}

@keyframes explain-connection-shimmer {
    0%, 100% {
        box-shadow: 
            0 0 0 1px rgba(59, 130, 246, 0.4),
            0 0 10px rgba(59, 130, 246, 0.2);
    }
    50% {
        box-shadow: 
            0 0 0 2px rgba(59, 130, 246, 0.6),
            0 0 20px rgba(59, 130, 246, 0.4);
    }
}

@keyframes subtab-connection-shimmer {
    0%, 100% {
        box-shadow: 0 0 4px rgba(59, 130, 246, 0.3);
        background: rgba(59, 130, 246, 0.15);
    }
    50% {
        box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
        background: rgba(59, 130, 246, 0.25);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   AI PANEL - Futuristic Scanner Loading Animation
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Container for the scanner effect */
.ai-scanner-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.ai-scanner-container.active {
    opacity: 1;
}

/* Subtle mode - when refreshing existing content (Explain Again flow) */
.ai-scanner-container.active.scanner-subtle {
    opacity: 0.25;
}

.ai-scanner-container.active.scanner-subtle .ai-scanner-grid,
.ai-scanner-container.active.scanner-subtle .ai-scanner-focus,
.ai-scanner-container.active.scanner-subtle .ai-scanner-node,
.ai-scanner-container.active.scanner-subtle .ai-scanner-glow {
    display: none; /* Hide the busy center elements */
}

/* Only show corner reticles and scan line in subtle mode */
.ai-scanner-container.active.scanner-subtle .ai-scanner-reticle {
    opacity: 0.3;
}

.ai-scanner-container.active.scanner-subtle .ai-scanner-line {
    opacity: 0.4;
}

/* Scanner color states - synced with button states */
.ai-scanner-container.active.scanner-slow .ai-scanner-reticle::before,
.ai-scanner-container.active.scanner-slow .ai-scanner-reticle::after,
.ai-scanner-container.active.scanner-slow .ai-scanner-node {
    background: #f59e0b;
}
.ai-scanner-container.active.scanner-slow .ai-scanner-line {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(245, 158, 11, 0.5) 20%, 
        rgba(245, 158, 11, 0.8) 50%, 
        rgba(245, 158, 11, 0.5) 80%, 
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4), 0 0 20px rgba(245, 158, 11, 0.2);
}
.ai-scanner-container.active.scanner-slow .ai-scanner-focus::before {
    border-color: rgba(245, 158, 11, 0.3);
}
.ai-scanner-container.active.scanner-slow .ai-scanner-focus::after {
    border-color: rgba(245, 158, 11, 0.2);
}
.ai-scanner-container.active.scanner-slow .ai-scanner-glow {
    background: radial-gradient(circle, rgba(245, 158, 11, 0.1) 0%, transparent 70%);
}
.ai-scanner-container.active.scanner-slow .ai-scanner-grid {
    background-image: 
        linear-gradient(rgba(245, 158, 11, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(245, 158, 11, 0.04) 1px, transparent 1px);
}

/* Critical state - red/orange */
.ai-scanner-container.active.scanner-critical .ai-scanner-reticle::before,
.ai-scanner-container.active.scanner-critical .ai-scanner-reticle::after,
.ai-scanner-container.active.scanner-critical .ai-scanner-node {
    background: #ef4444;
}
.ai-scanner-container.active.scanner-critical .ai-scanner-line {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(239, 68, 68, 0.5) 20%, 
        rgba(239, 68, 68, 0.8) 50%, 
        rgba(239, 68, 68, 0.5) 80%, 
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4), 0 0 20px rgba(239, 68, 68, 0.2);
}
.ai-scanner-container.active.scanner-critical .ai-scanner-focus::before {
    border-color: rgba(239, 68, 68, 0.3);
}
.ai-scanner-container.active.scanner-critical .ai-scanner-focus::after {
    border-color: rgba(239, 68, 68, 0.2);
}
.ai-scanner-container.active.scanner-critical .ai-scanner-glow {
    background: radial-gradient(circle, rgba(239, 68, 68, 0.1) 0%, transparent 70%);
}
.ai-scanner-container.active.scanner-critical .ai-scanner-grid {
    background-image: 
        linear-gradient(rgba(239, 68, 68, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(239, 68, 68, 0.04) 1px, transparent 1px);
}

/* Success state - green celebration */
.ai-scanner-container.active.scanner-success .ai-scanner-reticle::before,
.ai-scanner-container.active.scanner-success .ai-scanner-reticle::after,
.ai-scanner-container.active.scanner-success .ai-scanner-node {
    background: #22c55e;
}
.ai-scanner-container.active.scanner-success .ai-scanner-line {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(34, 197, 94, 0.5) 20%, 
        rgba(34, 197, 94, 0.8) 50%, 
        rgba(34, 197, 94, 0.5) 80%, 
        transparent 100%
    );
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.5), 0 0 30px rgba(34, 197, 94, 0.3);
}
.ai-scanner-container.active.scanner-success .ai-scanner-focus::before {
    border-color: rgba(34, 197, 94, 0.4);
}
.ai-scanner-container.active.scanner-success .ai-scanner-focus::after {
    border-color: rgba(34, 197, 94, 0.25);
}
.ai-scanner-container.active.scanner-success .ai-scanner-glow {
    background: radial-gradient(circle, rgba(34, 197, 94, 0.15) 0%, transparent 70%);
}
.ai-scanner-container.active.scanner-success .ai-scanner-grid {
    background-image: 
        linear-gradient(rgba(34, 197, 94, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 197, 94, 0.05) 1px, transparent 1px);
}

/* Smooth color transitions for all scanner elements */
.ai-scanner-reticle::before,
.ai-scanner-reticle::after,
.ai-scanner-node,
.ai-scanner-line,
.ai-scanner-focus::before,
.ai-scanner-focus::after,
.ai-scanner-glow,
.ai-scanner-grid {
    transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease, background-image 0.5s ease;
}

/* Subtle grid background */
.ai-scanner-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 30%, transparent 70%);
}

/* Corner targeting reticles */
.ai-scanner-reticle {
    position: absolute;
    width: 40px;
    height: 40px;
    opacity: 0.25;
}

.ai-scanner-reticle::before,
.ai-scanner-reticle::after {
    content: '';
    position: absolute;
    background: #3b82f6;
}

/* Top-left */
.ai-scanner-reticle.tl {
    top: 20px;
    left: 20px;
}
.ai-scanner-reticle.tl::before {
    width: 16px;
    height: 2px;
    top: 0;
    left: 0;
}
.ai-scanner-reticle.tl::after {
    width: 2px;
    height: 16px;
    top: 0;
    left: 0;
}

/* Top-right */
.ai-scanner-reticle.tr {
    top: 20px;
    right: 20px;
}
.ai-scanner-reticle.tr::before {
    width: 16px;
    height: 2px;
    top: 0;
    right: 0;
}
.ai-scanner-reticle.tr::after {
    width: 2px;
    height: 16px;
    top: 0;
    right: 0;
}

/* Bottom-left */
.ai-scanner-reticle.bl {
    bottom: 20px;
    left: 20px;
}
.ai-scanner-reticle.bl::before {
    width: 16px;
    height: 2px;
    bottom: 0;
    left: 0;
}
.ai-scanner-reticle.bl::after {
    width: 2px;
    height: 16px;
    bottom: 0;
    left: 0;
}

/* Bottom-right */
.ai-scanner-reticle.br {
    bottom: 20px;
    right: 20px;
}
.ai-scanner-reticle.br::before {
    width: 16px;
    height: 2px;
    bottom: 0;
    right: 0;
}
.ai-scanner-reticle.br::after {
    width: 2px;
    height: 16px;
    bottom: 0;
    right: 0;
}

/* Reticle pulse animation */
.ai-scanner-container.active .ai-scanner-reticle {
    animation: reticle-pulse 2s ease-in-out infinite;
}

.ai-scanner-container.active .ai-scanner-reticle.tr { animation-delay: 0.5s; }
.ai-scanner-container.active .ai-scanner-reticle.bl { animation-delay: 1s; }
.ai-scanner-container.active .ai-scanner-reticle.br { animation-delay: 1.5s; }

@keyframes reticle-pulse {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.4; }
}

/* Horizontal scan line */
.ai-scanner-line {
    position: absolute;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(59, 130, 246, 0.5) 20%, 
        rgba(59, 130, 246, 0.8) 50%, 
        rgba(59, 130, 246, 0.5) 80%, 
        transparent 100%
    );
    box-shadow: 
        0 0 8px rgba(59, 130, 246, 0.4),
        0 0 20px rgba(59, 130, 246, 0.2);
    opacity: 0;
}

.ai-scanner-container.active .ai-scanner-line {
    animation: scan-sweep 3s ease-in-out infinite;
}

@keyframes scan-sweep {
    0% {
        top: 15%;
        opacity: 0;
    }
    5% {
        opacity: 0.6;
    }
    95% {
        opacity: 0.6;
    }
    100% {
        top: 85%;
        opacity: 0;
    }
}

/* Center focal point */
.ai-scanner-focus {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    transform: translate(-50%, -50%);
}

.ai-scanner-focus::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    animation: focus-pulse 2s ease-in-out infinite;
}

.ai-scanner-focus::after {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px dashed rgba(59, 130, 246, 0.15);
    border-radius: 50%;
    animation: focus-rotate 8s linear infinite;
}

@keyframes focus-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.5;
    }
}

@keyframes focus-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Floating data nodes */
.ai-scanner-node {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #3b82f6;
    border-radius: 50%;
    opacity: 0;
}

.ai-scanner-container.active .ai-scanner-node {
    animation: node-blink 2s ease-in-out infinite;
}

.ai-scanner-node.n1 { top: 25%; left: 30%; animation-delay: 0.2s; }
.ai-scanner-node.n2 { top: 35%; right: 25%; animation-delay: 0.7s; }
.ai-scanner-node.n3 { bottom: 30%; left: 25%; animation-delay: 1.2s; }
.ai-scanner-node.n4 { bottom: 25%; right: 35%; animation-delay: 0.4s; }
.ai-scanner-node.n5 { top: 45%; left: 20%; animation-delay: 1.5s; }
.ai-scanner-node.n6 { bottom: 40%; right: 20%; animation-delay: 0.9s; }

@keyframes node-blink {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 0.6; transform: scale(1); box-shadow: 0 0 8px rgba(59, 130, 246, 0.6); }
}

/* Subtle radial glow in center */
.ai-scanner-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    animation: glow-breathe 3s ease-in-out infinite;
}

@keyframes glow-breathe {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

/* Container needs relative positioning for scanner */
#review-session-modal.workspace-mode .rw-ai-scroll {
    position: relative;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   AI Response Typing Reveal Animation
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Typing reveal animation - uses mask for clean vertical slice reveal */
#review-session-modal.workspace-mode #ai-response-area.typing-reveal {
    --typing-progress: 0;
    position: relative;
}

/* Mask that reveals content progressively from top to bottom */
#review-session-modal.workspace-mode #ai-response-area.typing-reveal {
    mask-image: linear-gradient(
        to bottom,
        black 0%,
        black calc(var(--typing-progress) * 100%),
        transparent calc(var(--typing-progress) * 100% + 1.5em),
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(
        to bottom,
        black 0%,
        black calc(var(--typing-progress) * 100%),
        transparent calc(var(--typing-progress) * 100% + 1.5em),
        transparent 100%
    );
}

/* Subtle typing cursor indicator */
#review-session-modal.workspace-mode #ai-response-area.typing-reveal::after {
    content: '';
    position: absolute;
    left: 0;
    top: calc(var(--typing-progress) * 100%);
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(59, 130, 246, 0.4) 20%,
        rgba(59, 130, 246, 0.6) 50%,
        rgba(59, 130, 246, 0.4) 80%,
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
    opacity: 0.8;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MC Option Mini Scanner Animation
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Base setup for scanning MC option */
#review-session-modal.workspace-mode .option-btn.mc-scanning {
    /* Use outline instead of box-shadow spread to avoid layout shift */
    outline: 1px solid rgba(59, 130, 246, 0.4);
    outline-offset: -1px;
    box-shadow: 
        0 0 12px rgba(59, 130, 246, 0.2),
        inset 0 0 20px rgba(59, 130, 246, 0.03);
}

/* Hide action buttons while scanning - cleaner look, avoids layout issues */
#review-session-modal.workspace-mode .option-btn.mc-scanning .mc-explain,
#review-session-modal.workspace-mode .option-btn.mc-scanning .mc-copy {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Mini corner reticles - use inset box-shadows to avoid pseudo-element issues */
#review-session-modal.workspace-mode .option-btn.mc-scanning::before,
#review-session-modal.workspace-mode .option-btn.mc-scanning::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    pointer-events: none;
    opacity: 0.4;
    z-index: 1;
}

/* Top-left reticle */
#review-session-modal.workspace-mode .option-btn.mc-scanning::before {
    top: 4px;
    left: 4px;
    border-top: 2px solid #3b82f6;
    border-left: 2px solid #3b82f6;
    animation: mc-reticle-pulse 1.5s ease-in-out infinite;
}

/* Bottom-right reticle */
#review-session-modal.workspace-mode .option-btn.mc-scanning::after {
    bottom: 4px;
    right: 4px;
    border-bottom: 2px solid #3b82f6;
    border-right: 2px solid #3b82f6;
    animation: mc-reticle-pulse 1.5s ease-in-out infinite 0.75s;
}

@keyframes mc-reticle-pulse {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 0.6; }
}

/* Scanning line overlay */
.mc-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.mc-scan-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(59, 130, 246, 0.4) 30%, 
        rgba(59, 130, 246, 0.7) 50%, 
        rgba(59, 130, 246, 0.4) 70%, 
        transparent 100%
    );
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.3);
    animation: mc-scan-sweep 2s ease-in-out infinite;
}

@keyframes mc-scan-sweep {
    0% { top: 10%; opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { top: 90%; opacity: 0; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   MC Scanner Color States - Yellow (Slow)
   ───────────────────────────────────────────────────────────────────────────── */
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-slow::before {
    border-top-color: #f59e0b;
    border-left-color: #f59e0b;
}
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-slow::after {
    border-bottom-color: #f59e0b;
    border-right-color: #f59e0b;
}
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-slow {
    outline-color: rgba(245, 158, 11, 0.5);
    box-shadow: 
        0 0 12px rgba(245, 158, 11, 0.2),
        inset 0 0 20px rgba(245, 158, 11, 0.03);
}
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-slow .mc-scan-line::after {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(245, 158, 11, 0.4) 30%, 
        rgba(245, 158, 11, 0.7) 50%, 
        rgba(245, 158, 11, 0.4) 70%, 
        transparent 100%
    );
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.3);
}

/* ─────────────────────────────────────────────────────────────────────────────
   MC Scanner Color States - Red (Critical)
   ───────────────────────────────────────────────────────────────────────────── */
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-critical::before {
    border-top-color: #ef4444;
    border-left-color: #ef4444;
}
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-critical::after {
    border-bottom-color: #ef4444;
    border-right-color: #ef4444;
}
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-critical {
    outline-color: rgba(239, 68, 68, 0.5);
    box-shadow: 
        0 0 12px rgba(239, 68, 68, 0.2),
        inset 0 0 20px rgba(239, 68, 68, 0.03);
}
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-critical .mc-scan-line::after {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(239, 68, 68, 0.4) 30%, 
        rgba(239, 68, 68, 0.7) 50%, 
        rgba(239, 68, 68, 0.4) 70%, 
        transparent 100%
    );
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.3);
}

/* ─────────────────────────────────────────────────────────────────────────────
   MC Scanner Color States - Green (Success)
   ───────────────────────────────────────────────────────────────────────────── */
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-success::before {
    border-top-color: #22c55e;
    border-left-color: #22c55e;
}
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-success::after {
    border-bottom-color: #22c55e;
    border-right-color: #22c55e;
}
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-success {
    outline-color: rgba(34, 197, 94, 0.6);
    outline-width: 2px;
    box-shadow: 
        0 0 16px rgba(34, 197, 94, 0.25),
        inset 0 0 25px rgba(34, 197, 94, 0.05);
}
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-success .mc-scan-line::after {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(34, 197, 94, 0.5) 30%, 
        rgba(34, 197, 94, 0.8) 50%, 
        rgba(34, 197, 94, 0.5) 70%, 
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MC Option Badge Color States
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Base badge transition */
.mc-option-badge {
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

/* Badge scanning glow - default blue */
#review-session-modal.workspace-mode .option-btn.mc-scanning .mc-option-badge {
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
    animation: mc-badge-pulse 1.5s ease-in-out infinite;
}

@keyframes mc-badge-pulse {
    0%, 100% { box-shadow: 0 0 6px currentColor; transform: scale(1); }
    50% { box-shadow: 0 0 12px currentColor; transform: scale(1.05); }
}

/* Badge slow state - yellow */
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-slow .mc-option-badge {
    background-color: #f59e0b !important;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

/* Badge critical state - red */
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-critical .mc-option-badge {
    background-color: #ef4444 !important;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

/* Badge success state - green */
#review-session-modal.workspace-mode .option-btn.mc-scanning.mc-scanning-success .mc-option-badge {
    background-color: #22c55e !important;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.7);
    animation: mc-badge-success 0.5s ease-out;
}

@keyframes mc-badge-success {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Main Hero Item Scanner (for Main tab explain flow)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Wrapper for the hero scanner effect */
#review-session-modal.workspace-mode .hero-glyph.hero-scanning {
    position: relative;
}

/* Subtle corner brackets on the hero item - KanjiOS green accent */
#review-session-modal.workspace-mode .hero-glyph.hero-scanning::before,
#review-session-modal.workspace-mode .hero-glyph.hero-scanning::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    pointer-events: none;
    opacity: 0.4;
    z-index: 1;
}

#review-session-modal.workspace-mode .hero-glyph.hero-scanning::before {
    top: -10px;
    left: -10px;
    border-top: 2px solid var(--kos-accent, #22c55e);
    border-left: 2px solid var(--kos-accent, #22c55e);
    animation: hero-reticle-pulse 2s ease-in-out infinite;
}

#review-session-modal.workspace-mode .hero-glyph.hero-scanning::after {
    bottom: -10px;
    right: -10px;
    border-bottom: 2px solid var(--kos-accent, #22c55e);
    border-right: 2px solid var(--kos-accent, #22c55e);
    animation: hero-reticle-pulse 2s ease-in-out infinite 1s;
}

@keyframes hero-reticle-pulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.5; }
}

/* Subtle glow on the hero text - KanjiOS green */
#review-session-modal.workspace-mode .hero-glyph.hero-scanning {
    text-shadow: 0 0 20px rgba(34, 197, 94, 0.15);
    animation: hero-text-pulse 2s ease-in-out infinite;
}

@keyframes hero-text-pulse {
    0%, 100% { text-shadow: 0 0 15px rgba(34, 197, 94, 0.1); }
    50% { text-shadow: 0 0 25px rgba(34, 197, 94, 0.2); }
}

/* Color states for hero scanner */
#review-session-modal.workspace-mode .hero-glyph.hero-scanning.hero-scanning-slow::before {
    border-top-color: #f59e0b;
    border-left-color: #f59e0b;
}
#review-session-modal.workspace-mode .hero-glyph.hero-scanning.hero-scanning-slow::after {
    border-bottom-color: #f59e0b;
    border-right-color: #f59e0b;
}
#review-session-modal.workspace-mode .hero-glyph.hero-scanning.hero-scanning-slow {
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
}

#review-session-modal.workspace-mode .hero-glyph.hero-scanning.hero-scanning-critical::before {
    border-top-color: #ef4444;
    border-left-color: #ef4444;
}
#review-session-modal.workspace-mode .hero-glyph.hero-scanning.hero-scanning-critical::after {
    border-bottom-color: #ef4444;
    border-right-color: #ef4444;
}
#review-session-modal.workspace-mode .hero-glyph.hero-scanning.hero-scanning-critical {
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

#review-session-modal.workspace-mode .hero-glyph.hero-scanning.hero-scanning-success::before {
    border-top-color: #22c55e;
    border-left-color: #22c55e;
}
#review-session-modal.workspace-mode .hero-glyph.hero-scanning.hero-scanning-success::after {
    border-bottom-color: #22c55e;
    border-right-color: #22c55e;
}
#review-session-modal.workspace-mode .hero-glyph.hero-scanning.hero-scanning-success {
    text-shadow: 0 0 25px rgba(34, 197, 94, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SRS Speed Settings Modal - Segmented Control & Animations
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Modal entrance animation */
.srs-speed-modal-content {
    animation: srs-speed-modal-enter 0.25s ease-out;
}

@keyframes srs-speed-modal-enter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Mode row container */
.srs-speed-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary, #27272a);
    border: 1px solid var(--border, #3f3f46);
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.srs-speed-row:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

/* Mode label with icon */
.srs-speed-mode-label {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 7.5rem;
}

.srs-speed-mode-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.srs-speed-mode-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary, #fafafa);
}

/* Segmented control container */
.srs-speed-segments {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--bg-primary, #18181b);
    border-radius: 0.5rem;
    position: relative;
}

/* Individual segment button */
.srs-speed-segment {
    position: relative;
    padding: 0.375rem 0.5rem;
    min-width: 2.75rem;
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-muted, #71717a);
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s ease;
    z-index: 1;
}

.srs-speed-segment:hover:not(.active) {
    color: var(--text-secondary, #a1a1aa);
    background: rgba(255, 255, 255, 0.05);
}

.srs-speed-segment.active {
    color: white;
    font-weight: 600;
}

/* Active segment background - inherits mode color */
.srs-speed-segment.active::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 0.375rem;
    background: var(--segment-color, #6366f1);
    z-index: -1;
    animation: segment-activate 0.2s ease-out;
}

@keyframes segment-activate {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Non-default indicator dot */
.srs-speed-segment.active:not([data-preset="normal"])::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: white;
    opacity: 0.7;
}

/* Tooltip on hover */
.srs-speed-segment[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.375rem 0.625rem;
    background: #18181b;
    border: 1px solid #3f3f46;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    color: #e4e4e7;
    z-index: 100;
    pointer-events: none;
    animation: tooltip-fade 0.15s ease-out;
}

/* Hide dot when showing tooltip */
.srs-speed-segment[data-tooltip]:hover.active:not([data-preset="normal"])::after {
    /* Tooltip takes precedence - dot is hidden */
    top: auto;
    right: auto;
    width: auto;
    height: auto;
    border-radius: 0.375rem;
    background: #18181b;
    opacity: 1;
}

@keyframes tooltip-fade {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Reset cascade animation - uses mode-specific color via --mode-flash-color */
.srs-speed-row.resetting {
    --flash-color: var(--mode-flash-color, rgb(34, 197, 94));
    animation: row-reset-pulse 0.4s ease-out;
}

@keyframes row-reset-pulse {
    0% { background: var(--bg-tertiary, #27272a); }
    30% { background: color-mix(in srgb, var(--flash-color) 15%, transparent); border-color: color-mix(in srgb, var(--flash-color) 40%, transparent); }
    100% { background: var(--bg-tertiary, #27272a); }
}

/* Header success flash on reset */
#srs-speed-header.reset-success {
    animation: header-reset-flash 0.5s ease-out;
}

@keyframes header-reset-flash {
    0% { background: var(--bg-primary); }
    30% { background: rgba(34, 197, 94, 0.2); }
    100% { background: var(--bg-primary); }
}

/* Save button states */
#srs-speed-save {
    transition: all 0.2s ease;
}

#srs-speed-save:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--bg-tertiary, #3f3f46) !important;
    color: var(--text-tertiary, #71717a);
}

#srs-speed-save.has-changes:not(:disabled) {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    animation: pulse-attention 2s ease-in-out infinite;
}

@keyframes pulse-attention {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0); }
}

#srs-speed-save.saved {
    background: #22c55e !important;
    animation: save-success 0.4s ease-out;
}

@keyframes save-success {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Keyboard focus styles */
.srs-speed-segment:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.6);
    outline-offset: 2px;
}

.srs-speed-row:focus-within {
    border-color: rgba(99, 102, 241, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   JP Definition Inline Scanner Animation
   Adapted from MC Option Scanner for detail modal JP Description area
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Base setup for scanning JP definition area */
#detail-jpdef-display.jpdef-scanning {
    position: relative;
    outline: 1px solid rgba(59, 130, 246, 0.4);
    outline-offset: -1px;
    box-shadow: 
        0 0 12px rgba(59, 130, 246, 0.2),
        inset 0 0 20px rgba(59, 130, 246, 0.03);
    cursor: default;
    transition: outline-color 0.4s ease, box-shadow 0.4s ease;
}

/* Corner reticles for scanning state */
#detail-jpdef-display.jpdef-scanning::before,
#detail-jpdef-display.jpdef-scanning::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    pointer-events: none;
    opacity: 0.5;
    z-index: 1;
}

/* Top-left reticle */
#detail-jpdef-display.jpdef-scanning::before {
    top: 6px;
    left: 6px;
    border-top: 2px solid #3b82f6;
    border-left: 2px solid #3b82f6;
    animation: jpdef-reticle-pulse 1.5s ease-in-out infinite;
}

/* Bottom-right reticle */
#detail-jpdef-display.jpdef-scanning::after {
    bottom: 6px;
    right: 6px;
    border-bottom: 2px solid #3b82f6;
    border-right: 2px solid #3b82f6;
    animation: jpdef-reticle-pulse 1.5s ease-in-out infinite 0.75s;
}

@keyframes jpdef-reticle-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Scanning line overlay */
.jpdef-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
    border-radius: inherit;
}

.jpdef-scan-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(59, 130, 246, 0.4) 30%, 
        rgba(59, 130, 246, 0.8) 50%, 
        rgba(59, 130, 246, 0.4) 70%, 
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
    animation: jpdef-scan-sweep 2s ease-in-out infinite;
}

@keyframes jpdef-scan-sweep {
    0% { top: 10%; opacity: 0; }
    10% { opacity: 0.9; }
    90% { opacity: 0.9; }
    100% { top: 90%; opacity: 0; }
}

/* Scanning text placeholder */
.jpdef-scanning-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(59, 130, 246, 0.8);
    font-size: 0.875rem;
    padding: 0.75rem;
}

.jpdef-scanning-text::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-top-color: rgba(59, 130, 246, 0.8);
    border-radius: 50%;
    animation: jpdef-spinner 0.8s linear infinite;
}

@keyframes jpdef-spinner {
    to { transform: rotate(360deg); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   JP Definition Scanner Color States
   ───────────────────────────────────────────────────────────────────────────── */

/* Slow state - yellow (after 3s) */
#detail-jpdef-display.jpdef-scanning.jpdef-scanning-slow {
    outline-color: rgba(245, 158, 11, 0.5);
    box-shadow: 
        0 0 12px rgba(245, 158, 11, 0.2),
        inset 0 0 20px rgba(245, 158, 11, 0.03);
}

#detail-jpdef-display.jpdef-scanning.jpdef-scanning-slow::before {
    border-top-color: #f59e0b;
    border-left-color: #f59e0b;
}

#detail-jpdef-display.jpdef-scanning.jpdef-scanning-slow::after {
    border-bottom-color: #f59e0b;
    border-right-color: #f59e0b;
}

#detail-jpdef-display.jpdef-scanning.jpdef-scanning-slow .jpdef-scan-line::after {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(245, 158, 11, 0.4) 30%, 
        rgba(245, 158, 11, 0.8) 50%, 
        rgba(245, 158, 11, 0.4) 70%, 
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

#detail-jpdef-display.jpdef-scanning.jpdef-scanning-slow .jpdef-scanning-text {
    color: rgba(245, 158, 11, 0.8);
}

#detail-jpdef-display.jpdef-scanning.jpdef-scanning-slow .jpdef-scanning-text::before {
    border-color: rgba(245, 158, 11, 0.3);
    border-top-color: rgba(245, 158, 11, 0.8);
}

/* Success state - green */
#detail-jpdef-display.jpdef-scanning.jpdef-scanning-success {
    outline-color: rgba(34, 197, 94, 0.6);
    outline-width: 2px;
    box-shadow: 
        0 0 16px rgba(34, 197, 94, 0.25),
        inset 0 0 25px rgba(34, 197, 94, 0.05);
}

#detail-jpdef-display.jpdef-scanning.jpdef-scanning-success::before {
    border-top-color: #22c55e;
    border-left-color: #22c55e;
}

#detail-jpdef-display.jpdef-scanning.jpdef-scanning-success::after {
    border-bottom-color: #22c55e;
    border-right-color: #22c55e;
}

#detail-jpdef-display.jpdef-scanning.jpdef-scanning-success .jpdef-scan-line::after {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(34, 197, 94, 0.5) 30%, 
        rgba(34, 197, 94, 0.9) 50%, 
        rgba(34, 197, 94, 0.5) 70%, 
        transparent 100%
    );
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.5);
}

/* Error state - red */
#detail-jpdef-display.jpdef-scanning.jpdef-scanning-error {
    outline-color: rgba(239, 68, 68, 0.5);
    box-shadow: 
        0 0 12px rgba(239, 68, 68, 0.2),
        inset 0 0 20px rgba(239, 68, 68, 0.03);
}

#detail-jpdef-display.jpdef-scanning.jpdef-scanning-error::before {
    border-top-color: #ef4444;
    border-left-color: #ef4444;
}

#detail-jpdef-display.jpdef-scanning.jpdef-scanning-error::after {
    border-bottom-color: #ef4444;
    border-right-color: #ef4444;
}

/* ─────────────────────────────────────────────────────────────────────────────
   JP Definition Preview State (after AI generation)
   ───────────────────────────────────────────────────────────────────────────── */

.jpdef-preview-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary, #fafafa);
    padding: 0.5rem 0;
    user-select: none;
    cursor: default;
}

.jpdef-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.jpdef-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.375rem;
    border: 1px solid var(--border, #3f3f46);
    background: var(--bg-tertiary, #27272a);
    color: var(--text-secondary, #a1a1aa);
    cursor: pointer;
    transition: all 0.15s ease;
}

.jpdef-actions button:hover {
    background: var(--bg-primary, #18181b);
    color: var(--text-primary, #fafafa);
}

/* Accept button - green accent */
.jpdef-actions .jpdef-accept,
.jpdef-actions .jpdef-save-accept {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.jpdef-actions .jpdef-accept:hover,
.jpdef-actions .jpdef-save-accept:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(34, 197, 94, 0.5);
}

/* Retry button - blue accent */
.jpdef-actions .jpdef-retry {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.jpdef-actions .jpdef-retry:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
}

/* Cancel button - subtle */
.jpdef-actions .jpdef-cancel {
    padding: 0.375rem 0.5rem;
    min-width: 1.75rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   JP Definition Edit State (inline textarea)
   ───────────────────────────────────────────────────────────────────────────── */

#detail-jpdef-display.jpdef-editing {
    border-style: solid;
    border-color: rgba(59, 130, 246, 0.4);
}

.jpdef-edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary, #fafafa);
    background: var(--bg-primary, #18181b);
    border: 1px solid var(--border, #3f3f46);
    border-radius: 0.5rem;
    resize: vertical;
    font-family: inherit;
}

.jpdef-edit-textarea:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.jpdef-edit-textarea::placeholder {
    color: var(--text-muted, #71717a);
}

/* Save button in edit mode - accent color */
.jpdef-actions .jpdef-save {
    background: var(--accent, #6366f1);
    border-color: var(--accent, #6366f1);
    color: white;
}

.jpdef-actions .jpdef-save:hover {
    background: var(--accent-hover, #4f46e5);
    border-color: var(--accent-hover, #4f46e5);
}

/* Success flash animation after save */
#detail-jpdef-display.jpdef-save-success {
    animation: jpdef-save-flash 0.5s ease-out;
}

@keyframes jpdef-save-flash {
    0% { box-shadow: inset 0 0 0 rgba(34, 197, 94, 0); }
    30% { box-shadow: inset 0 0 30px rgba(34, 197, 94, 0.15); }
    100% { box-shadow: inset 0 0 0 rgba(34, 197, 94, 0); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Detail Modal Explanation AI Generation
   Follows jpdef pattern exactly - display box IS the scanner area
   Uses blue color scheme to match jpdef
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Hide blinking text cursor but allow selection */
#detail-explain-display {
    caret-color: transparent;
}

#detail-explain-display.explain-editing {
    caret-color: auto;
}

#detail-explain-display .explain-edit-textarea {
    caret-color: auto;
}

/* Pending content indicator - subtle border pulse */
.explain-content-pending {
    position: relative;
}

#detail-explain-display:has(.explain-content-pending) {
    border-color: rgba(59, 130, 246, 0.4);
    animation: explain-pending-pulse 2s ease-in-out infinite;
}

@keyframes explain-pending-pulse {
    0%, 100% { border-color: rgba(59, 130, 246, 0.3); }
    50% { border-color: rgba(59, 130, 246, 0.5); }
}

/* Base scanning state for explanation display - starts with BLUE like jpdef */
#detail-explain-display.explain-scanning {
    position: relative;
    outline: 1px solid rgba(59, 130, 246, 0.4);
    outline-offset: -1px;
    box-shadow: 
        0 0 12px rgba(59, 130, 246, 0.2),
        inset 0 0 20px rgba(59, 130, 246, 0.03);
    cursor: default;
    transition: outline-color 0.4s ease, box-shadow 0.4s ease;
}

/* Corner reticles for scanning state */
#detail-explain-display.explain-scanning::before,
#detail-explain-display.explain-scanning::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    pointer-events: none;
    opacity: 0.5;
    z-index: 1;
}

/* Top-left reticle - starts blue */
#detail-explain-display.explain-scanning::before {
    top: 6px;
    left: 6px;
    border-top: 2px solid #3b82f6;
    border-left: 2px solid #3b82f6;
    animation: explain-reticle-pulse 1.5s ease-in-out infinite;
}

/* Bottom-right reticle - starts blue */
#detail-explain-display.explain-scanning::after {
    bottom: 6px;
    right: 6px;
    border-bottom: 2px solid #3b82f6;
    border-right: 2px solid #3b82f6;
    animation: explain-reticle-pulse 1.5s ease-in-out infinite 0.75s;
}

@keyframes explain-reticle-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Scanning line overlay */
.explain-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
    border-radius: inherit;
}

.explain-scan-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(59, 130, 246, 0.4) 30%, 
        rgba(59, 130, 246, 0.8) 50%, 
        rgba(59, 130, 246, 0.4) 70%, 
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
    animation: explain-scan-sweep 2s ease-in-out infinite;
}

@keyframes explain-scan-sweep {
    0% { top: 10%; opacity: 0; }
    10% { opacity: 0.9; }
    90% { opacity: 0.9; }
    100% { top: 90%; opacity: 0; }
}

/* Scanning text placeholder - starts blue */
.explain-scanning-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(59, 130, 246, 0.9);
    font-size: 0.875rem;
    padding: 0.75rem;
}

.explain-scanning-text::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-top-color: rgba(59, 130, 246, 0.9);
    border-radius: 50%;
    animation: explain-spinner 0.8s linear infinite;
}

@keyframes explain-spinner {
    to { transform: rotate(360deg); }
}

/* Slow state (after 3s) - transitions to amber/yellow */
#detail-explain-display.explain-scanning.explain-scanning-slow {
    outline-color: rgba(245, 158, 11, 0.5);
    box-shadow: 
        0 0 12px rgba(245, 158, 11, 0.2),
        inset 0 0 20px rgba(245, 158, 11, 0.03);
}

#detail-explain-display.explain-scanning.explain-scanning-slow::before {
    border-top-color: #f59e0b;
    border-left-color: #f59e0b;
}

#detail-explain-display.explain-scanning.explain-scanning-slow::after {
    border-bottom-color: #f59e0b;
    border-right-color: #f59e0b;
}

#detail-explain-display.explain-scanning.explain-scanning-slow .explain-scan-line::after {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(245, 158, 11, 0.4) 30%, 
        rgba(245, 158, 11, 0.8) 50%, 
        rgba(245, 158, 11, 0.4) 70%, 
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

#detail-explain-display.explain-scanning.explain-scanning-slow .explain-scanning-text {
    color: rgba(245, 158, 11, 0.9);
}

#detail-explain-display.explain-scanning.explain-scanning-slow .explain-scanning-text::before {
    border-color: rgba(245, 158, 11, 0.3);
    border-top-color: rgba(245, 158, 11, 0.9);
}

/* Critical state (after 25s) - transitions to red */
#detail-explain-display.explain-scanning.explain-scanning-critical {
    outline-color: rgba(239, 68, 68, 0.5);
    box-shadow: 
        0 0 12px rgba(239, 68, 68, 0.2),
        inset 0 0 20px rgba(239, 68, 68, 0.03);
}

#detail-explain-display.explain-scanning.explain-scanning-critical::before {
    border-top-color: #ef4444;
    border-left-color: #ef4444;
}

#detail-explain-display.explain-scanning.explain-scanning-critical::after {
    border-bottom-color: #ef4444;
    border-right-color: #ef4444;
}

#detail-explain-display.explain-scanning.explain-scanning-critical .explain-scan-line::after {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(239, 68, 68, 0.4) 30%, 
        rgba(239, 68, 68, 0.8) 50%, 
        rgba(239, 68, 68, 0.4) 70%, 
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

#detail-explain-display.explain-scanning.explain-scanning-critical .explain-scanning-text {
    color: rgba(239, 68, 68, 0.9);
}

#detail-explain-display.explain-scanning.explain-scanning-critical .explain-scanning-text::before {
    border-color: rgba(239, 68, 68, 0.3);
    border-top-color: rgba(239, 68, 68, 0.9);
}

/* Success state - green flash */
#detail-explain-display.explain-scanning.explain-scanning-success {
    outline-color: rgba(34, 197, 94, 0.6);
    box-shadow: 
        0 0 16px rgba(34, 197, 94, 0.3),
        inset 0 0 25px rgba(34, 197, 94, 0.05);
    transition: all 0.3s ease;
}

#detail-explain-display.explain-scanning.explain-scanning-success::before {
    border-top-color: #22c55e;
    border-left-color: #22c55e;
    opacity: 0.8;
}

#detail-explain-display.explain-scanning.explain-scanning-success::after {
    border-bottom-color: #22c55e;
    border-right-color: #22c55e;
    opacity: 0.8;
}

#detail-explain-display.explain-scanning.explain-scanning-success .explain-scan-line::after {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(34, 197, 94, 0.5) 30%, 
        rgba(34, 197, 94, 1) 50%, 
        rgba(34, 197, 94, 0.5) 70%, 
        transparent 100%
    );
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.6);
}

/* Error state - red flash */
#detail-explain-display.explain-scanning.explain-scanning-error {
    outline-color: rgba(239, 68, 68, 0.6);
    box-shadow: 
        0 0 16px rgba(239, 68, 68, 0.3),
        inset 0 0 25px rgba(239, 68, 68, 0.05);
}

/* Action buttons - same style as jpdef */
.explain-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border, #3f3f46);
}

.explain-actions button {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 0.375rem;
    border: 1px solid var(--border, #3f3f46);
    background: var(--bg-secondary, #27272a);
    color: var(--text-secondary, #a1a1aa);
    cursor: pointer;
    transition: all 0.15s ease;
}

.explain-actions button:hover {
    background: var(--bg-tertiary, #3f3f46);
    color: var(--text-primary, #fafafa);
}

/* Accept button - green */
.explain-actions .explain-accept {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
    color: #22c55e;
}

.explain-actions .explain-accept:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: rgba(34, 197, 94, 0.6);
}

/* Retry button - blue */
.explain-actions .explain-retry {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.explain-actions .explain-retry:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
}

/* Edit state */
#detail-explain-display.explain-editing {
    border-style: solid;
    border-color: rgba(245, 158, 11, 0.4);
}

.explain-edit-textarea {
    width: 100%;
    min-height: 280px;
    padding: 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary, #fafafa);
    background: var(--bg-primary, #18181b);
    border: 1px solid var(--border, #3f3f46);
    border-radius: 0.5rem;
    resize: vertical;
    font-family: inherit;
}

.explain-edit-textarea:focus {
    outline: none;
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

.explain-edit-textarea::placeholder {
    color: var(--text-muted, #71717a);
}

/* Save button in edit mode */
.explain-actions .explain-save {
    background: var(--accent, #6366f1);
    border-color: var(--accent, #6366f1);
    color: white;
}

.explain-actions .explain-save:hover {
    background: var(--accent-hover, #4f46e5);
    border-color: var(--accent-hover, #4f46e5);
}

/* Success flash animation after save */
#detail-explain-display.explain-save-success {
    animation: explain-save-flash 0.5s ease-out;
}

@keyframes explain-save-flash {
    0% { box-shadow: inset 0 0 0 rgba(34, 197, 94, 0); }
    30% { box-shadow: inset 0 0 30px rgba(34, 197, 94, 0.15); }
    100% { box-shadow: inset 0 0 0 rgba(34, 197, 94, 0); }
}

/* Explanation content styling - vibrant, not grey */
.explain-content {
    color: var(--text-primary, #fafafa);
}

.explain-content h2, .explain-content h3, .explain-content h4 {
    color: var(--text-primary, #fafafa);
}

.explain-content p {
    color: var(--text-primary, #e4e4e7);
}

.explain-content li {
    color: var(--text-primary, #e4e4e7);
}

.explain-content strong {
    color: var(--accent, #a78bfa);
}

.explain-content code {
    background: var(--bg-tertiary, #3f3f46);
    color: var(--text-primary, #fafafa);
}

/* ===============================================
   Unscheduled Toggle Button - Queue Icon
   =============================================== */

.unscheduled-toggle {
    --toggle-color: var(--color-text-secondary, #6b7280);
    --toggle-active-color: #14b8a6; /* teal-500 */
    --toggle-active-bg: rgba(20, 184, 166, 0.12);
    --toggle-active-border: rgba(20, 184, 166, 0.5);
    color: var(--toggle-color);
}

/* Active state - showing unscheduled items */
.unscheduled-toggle.active {
    color: var(--toggle-active-color);
    background: var(--toggle-active-bg);
    border-color: var(--toggle-active-border);
    box-shadow: 
        0 0 0 1px rgba(20, 184, 166, 0.2),
        0 0 12px -2px rgba(20, 184, 166, 0.25);
}

.unscheduled-toggle.active:hover {
    background: rgba(20, 184, 166, 0.18);
    border-color: rgba(20, 184, 166, 0.65);
}

/* Inactive state - hiding unscheduled items */
.unscheduled-toggle:not(.active) {
    opacity: 0.55;
}

.unscheduled-toggle:not(.active):hover {
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.03);
}

/* SVG icon styling */
.unscheduled-toggle svg {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
    transition: transform 0.2s ease;
}

.unscheduled-toggle.active svg {
    filter: drop-shadow(0 0 4px rgba(20, 184, 166, 0.35));
}

/* Queue card stack elements */
.unscheduled-toggle .queue-card-back,
.unscheduled-toggle .queue-card-mid,
.unscheduled-toggle .queue-card-front {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Inactive state dims the cards */
.unscheduled-toggle:not(.active) .queue-card-back {
    opacity: 0.15;
}

.unscheduled-toggle:not(.active) .queue-card-mid {
    opacity: 0.3;
}

.unscheduled-toggle:not(.active) .queue-card-front {
    opacity: 0.5;
}

/* Clock indicator dims when inactive */
.unscheduled-toggle .queue-wait-dot,
.unscheduled-toggle .queue-wait-hand {
    transition: opacity 0.2s ease;
}

.unscheduled-toggle:not(.active) .queue-wait-dot,
.unscheduled-toggle:not(.active) .queue-wait-hand {
    opacity: 0.4;
}

/* Subtle hover animation - cards fan out */
.unscheduled-toggle:hover .queue-card-back {
    transform: translate(-1px, -1px);
}

.unscheduled-toggle:hover .queue-card-mid {
    transform: translate(-0.5px, -0.5px);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   UNIFIED SRS SETTINGS MODAL - KanjiOS HUD STYLE
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
    --srs-accent: #22c55e;
    --srs-accent-glow: rgba(34, 197, 94, 0.3);
    --srs-bg: #08080a;
    --srs-border: rgba(34, 197, 94, 0.15);
}

/* Main content container */
.unified-srs-content {
    position: relative;
    background: var(--srs-bg);
    border: 1px solid var(--srs-border);
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 
        0 0 80px rgba(34, 197, 94, 0.08),
        0 25px 100px rgba(0, 0, 0, 0.6);
    animation: unified-srs-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes unified-srs-enter {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Grid background */
.unified-srs-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(34, 197, 94, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 197, 94, 0.03) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, black 10%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, black 10%, transparent 70%);
    pointer-events: none;
}

/* Scan line animation */
.unified-srs-scanline {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    top: 0;
    background: linear-gradient(90deg, transparent 0%, var(--srs-accent) 30%, var(--srs-accent) 70%, transparent 100%);
    box-shadow: 0 0 20px var(--srs-accent-glow);
    opacity: 0;
    animation: srs-scan 1.8s ease-out 0.3s forwards;
    pointer-events: none;
    z-index: 10;
}

@keyframes srs-scan {
    0% { top: 0%; opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.6; }
    100% { top: 100%; opacity: 0; }
}

/* Corner reticles */
.unified-srs-reticle {
    position: absolute;
    width: 16px;
    height: 16px;
    pointer-events: none;
    z-index: 5;
}

.unified-srs-reticle::before,
.unified-srs-reticle::after {
    content: '';
    position: absolute;
    background: var(--srs-accent);
}

.unified-srs-reticle-tl { top: 8px; left: 8px; }
.unified-srs-reticle-tl::before { width: 10px; height: 1px; top: 0; left: 0; }
.unified-srs-reticle-tl::after { width: 1px; height: 10px; top: 0; left: 0; }

.unified-srs-reticle-tr { top: 8px; right: 8px; }
.unified-srs-reticle-tr::before { width: 10px; height: 1px; top: 0; right: 0; }
.unified-srs-reticle-tr::after { width: 1px; height: 10px; top: 0; right: 0; }

.unified-srs-reticle-bl { bottom: 8px; left: 8px; }
.unified-srs-reticle-bl::before { width: 10px; height: 1px; bottom: 0; left: 0; }
.unified-srs-reticle-bl::after { width: 1px; height: 10px; bottom: 0; left: 0; }

.unified-srs-reticle-br { bottom: 8px; right: 8px; }
.unified-srs-reticle-br::before { width: 10px; height: 1px; bottom: 0; right: 0; }
.unified-srs-reticle-br::after { width: 1px; height: 10px; bottom: 0; right: 0; }

/* ═══════════════════════════════════════════════════════════════════════════════
   Header
   ═══════════════════════════════════════════════════════════════════════════════ */

.unified-srs-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(34, 197, 94, 0.1);
    z-index: 1;
    cursor: default;
    user-select: none;
}

.unified-srs-header-left {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.unified-srs-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--srs-accent);
    animation: srs-icon-pulse 0.6s ease-out;
}

@keyframes srs-icon-pulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.unified-srs-header-text h2 {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 1rem;
    font-weight: 700;
    color: #fafafa;
    letter-spacing: 0.02em;
    margin: 0;
}

.unified-srs-header-text p {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
    margin: 0.125rem 0 0 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.unified-srs-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.unified-srs-close-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Body
   ═══════════════════════════════════════════════════════════════════════════════ */

.unified-srs-body {
    position: relative;
    flex: 1;
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    z-index: 1;
}

/* Sections */
.unified-srs-section {
    margin-bottom: 1.25rem;
}

.unified-srs-section:last-child {
    margin-bottom: 0;
}

.unified-srs-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.unified-srs-section-marker {
    color: var(--srs-accent);
    font-size: 0.5rem;
}

.unified-srs-section-label {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--srs-accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.unified-srs-section-hint {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.35);
    margin-left: auto;
}

.unified-srs-loading {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Profile Cards - KanjiOS Style
   ═══════════════════════════════════════════════════════════════════════════════ */

.unified-srs-profiles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.unified-srs-profile-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    overflow: hidden;
}

.unified-srs-profile-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 85%, var(--profile-color, rgba(34, 197, 94, 0.08)) 100%);
    opacity: 0;
    transition: opacity 0.25s;
}

.unified-srs-profile-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.unified-srs-profile-card:hover::before {
        opacity: 1;
    }

.unified-srs-profile-card.active {
    border-color: var(--profile-color, var(--srs-accent));
    background: rgba(255, 255, 255, 0.03);
    box-shadow: 0 0 20px var(--profile-glow, var(--srs-accent-glow));
}

.unified-srs-profile-card.active::before {
    opacity: 1;
}

.unified-srs-profile-card.active .unified-profile-indicator {
    opacity: 1;
}

/* Color variants */
.unified-srs-profile-card[data-preset="conservative"] {
    --profile-color: #10b981;
    --profile-glow: rgba(16, 185, 129, 0.25);
}

.unified-srs-profile-card[data-preset="balanced"] {
    --profile-color: #6366f1;
    --profile-glow: rgba(99, 102, 241, 0.25);
}

.unified-srs-profile-card[data-preset="aggressive"] {
    --profile-color: #f59e0b;
    --profile-glow: rgba(245, 158, 11, 0.25);
}

.unified-profile-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.unified-profile-info {
    text-align: center;
    position: relative;
    z-index: 1;
}

.unified-profile-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.25rem;
}

.unified-srs-profile-card.active .unified-profile-name {
    color: var(--profile-color);
}

.unified-profile-retention {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
}

.unified-profile-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.5625rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 4px;
    color: #818cf8;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
}

.unified-profile-indicator {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: var(--profile-color, var(--srs-accent));
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.25s;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Per-Mode Rows - KanjiOS Style
   ═══════════════════════════════════════════════════════════════════════════════ */

.unified-srs-mode-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.unified-mode-row {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.unified-mode-row:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

/* Mode icon */
.unified-mode-icon {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Mode label */
.unified-mode-label {
    flex: 1;
    min-width: 0;
    padding: 0 0.625rem;
    display: flex;
    align-items: center;
}

.unified-mode-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

/* Retention estimate badge */
.unified-retention-badge {
    font-size: 0.5625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
    margin-left: 0.5rem;
    transition: all 0.25s ease;
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
}

.unified-retention-badge.high {
    background: rgba(34, 197, 94, 0.15);
    color: rgba(34, 197, 94, 0.9);
}

.unified-retention-badge.low {
    background: rgba(245, 158, 11, 0.15);
    color: rgba(245, 158, 11, 0.9);
}

.unified-retention-badge.updating {
    animation: badge-pulse 0.3s ease;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Intensity Control - KanjiOS Segmented Buttons
   ═══════════════════════════════════════════════════════════════════════════════ */

.unified-intensity-control {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.unified-intensity-btn {
    position: relative;
    padding: 0.3125rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
}

.unified-intensity-btn:hover:not(.active) {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.06);
}

.unified-intensity-btn.active {
    color: white;
    font-weight: 600;
    background: var(--mode-color, var(--srs-accent));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Row flash animation when intensity changes */
.unified-mode-row.intensity-changed {
    animation: row-flash-kanjios 0.3s ease-out;
}

@keyframes row-flash-kanjios {
    0% { background: rgba(34, 197, 94, 0.15); border-color: rgba(34, 197, 94, 0.3); }
    100% { background: rgba(255, 255, 255, 0.02); border-color: rgba(255, 255, 255, 0.04); }
}

/* Cascade highlight */
.unified-mode-row.cascade-highlight {
    animation: mode-cascade 0.5s ease-out;
}

@keyframes mode-cascade {
    0% { background: transparent; border-color: rgba(255, 255, 255, 0.04); }
    30% { background: rgba(34, 197, 94, 0.1); border-color: rgba(34, 197, 94, 0.3); }
    100% { background: rgba(255, 255, 255, 0.02); border-color: rgba(255, 255, 255, 0.04); }
}

/* Reset row */
.unified-srs-reset-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.5rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.unified-srs-reset-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.unified-srs-reset-btn:hover {
    color: var(--srs-accent);
    background: rgba(34, 197, 94, 0.08);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Maintenance Tools - KanjiOS Style
   ═══════════════════════════════════════════════════════════════════════════════ */

.unified-srs-tools-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.unified-srs-tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.unified-srs-tool-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
}

.unified-srs-tool-btn:hover {
    background: rgba(34, 197, 94, 0.06);
    border-color: rgba(34, 197, 94, 0.2);
}

.unified-srs-tool-btn:hover .unified-tool-icon {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--srs-accent);
}

.unified-srs-tool-btn:hover .unified-tool-icon--boost {
    background: rgba(45, 212, 191, 0.15);
    border-color: rgba(45, 212, 191, 0.3);
    color: #2dd4bf;
}

.unified-tool-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
    transition: all 0.25s;
}

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

.unified-tool-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.125rem;
}

.unified-tool-desc {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
}

.unified-tool-result {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(34, 197, 94, 0.05);
    border: 1px solid rgba(34, 197, 94, 0.15);
    border-radius: 6px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Footer - KanjiOS Style
   ═══════════════════════════════════════════════════════════════════════════════ */

.unified-srs-footer {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(34, 197, 94, 0.1);
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.unified-srs-footer-reset {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.unified-srs-footer-reset:hover {
    color: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.15);
}

.unified-srs-footer-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.unified-srs-btn-secondary {
    padding: 0.625rem 1.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.unified-srs-btn-secondary:hover {
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
}

.unified-srs-btn-primary {
    position: relative;
    padding: 0.625rem 1.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--srs-accent);
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.unified-srs-btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, var(--srs-accent-glow), transparent);
    transform: translateX(-100%);
    transition: transform 0.3s;
}

.unified-srs-btn-primary:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--srs-accent);
    box-shadow: 0 0 20px var(--srs-accent-glow);
}

.unified-srs-btn-primary:hover:not(:disabled)::before {
    transform: translateX(100%);
}

.unified-srs-btn-primary:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Save button states */
.unified-srs-save-btn.has-changes {
    background: rgba(245, 158, 11, 0.15) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
    color: #f59e0b !important;
    animation: save-attention-kanjios 2s ease-in-out infinite;
}

@keyframes save-attention-kanjios {
    0%, 100% { box-shadow: 0 0 10px rgba(245, 158, 11, 0.2); }
    50% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.35); }
}

.unified-srs-save-btn.saved {
    background: rgba(34, 197, 94, 0.2) !important;
    border-color: var(--srs-accent) !important;
    color: var(--srs-accent) !important;
    animation: save-success-kanjios 0.5s ease-out;
}

@keyframes save-success-kanjios {
    0% { transform: scale(1); }
    30% { transform: scale(0.95); }
    60% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

/* KanjiOS Watermark */
.unified-srs-watermark {
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.5625rem;
    color: rgba(255, 255, 255, 0.15);
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    letter-spacing: 0.1em;
    pointer-events: none;
    z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Mobile Responsive
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
    .unified-srs-content {
        max-height: 90vh;
        border-radius: 12px;
    }
    
    .unified-srs-header {
        padding: 1rem;
    }
    
    .unified-srs-body {
        padding: 1rem;
    }
    
    .unified-srs-profiles-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .unified-srs-profile-card {
        flex-direction: row;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    
    .unified-profile-icon {
        margin-bottom: 0;
    }
    
    .unified-profile-info {
        text-align: left;
        flex: 1;
    }
    
    .unified-profile-indicator {
        top: 50%;
        bottom: auto;
        left: auto;
        right: 0;
        transform: translateY(-50%);
        width: 2px;
        height: 20px;
    }
    
    .unified-srs-tools-grid {
        grid-template-columns: 1fr;
    }
    
    .unified-srs-footer {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .unified-srs-footer-reset {
        width: 100%;
        justify-content: center;
        order: 2;
    }
    
    .unified-srs-footer-actions {
        width: 100%;
        order: 1;
    }
    
    .unified-srs-btn-secondary,
    .unified-srs-btn-primary {
        flex: 1;
    }
    
    .unified-srs-reticle {
        display: none;
    }
    
    .unified-srs-watermark {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Reset Cascade Animation
   ═══════════════════════════════════════════════════════════════════════════════ */

.unified-mode-row.resetting {
    animation: row-reset 0.4s ease-out;
}

@keyframes row-reset {
    0% { 
        background: rgba(34, 197, 94, 0.2);
        transform: translateX(0);
    }
    25% {
        transform: translateX(-3px);
    }
    75% {
        transform: translateX(3px);
    }
    100% { 
        background: rgba(255, 255, 255, 0.02);
        transform: translateX(0);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Tool Result Messages - KanjiOS Maintenance Tools
   ═══════════════════════════════════════════════════════════════════════════════ */

#unified-tool-result {
    transition: all 0.3s ease;
}

#unified-tool-result.fading {
    opacity: 0;
    transform: translateY(-8px);
}

/* Animation for result entry */
@keyframes tool-result-enter {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Rich Tool Result - Title/Subtitle/Detail */
.tool-result-rich {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    position: relative;
    overflow: hidden;
}

.tool-result-rich::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--result-accent, #6366f1), transparent);
    opacity: 0.6;
}

.tool-result-rich.success { --result-accent: #10b981; }
.tool-result-rich.warning { --result-accent: #f59e0b; }
.tool-result-rich.error { --result-accent: #ef4444; }
.tool-result-rich.info { --result-accent: #6366f1; }

.tool-result-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.tool-result-icon {
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
}

.tool-result-titles {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.tool-result-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.tool-result-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.tool-result-detail {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    font-style: italic;
}

/* Cards List Result - For showing boosted cards */
.tool-result-cards {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.02) 100%);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 12px;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.tool-result-cards::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #10b981, transparent);
}

.tool-result-cards-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.tool-result-icon-badge {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.tool-result-cards-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    flex: 1;
}

.tool-result-cards-count {
    font-size: 0.7rem;
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-weight: 500;
}

/* Boosted cards grid */
.boosted-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.boosted-cards-grid::-webkit-scrollbar {
    width: 4px;
}

.boosted-cards-grid::-webkit-scrollbar-track {
    background: transparent;
}

.boosted-cards-grid::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.2);
    border-radius: 2px;
}

.boosted-card-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    transition: all 0.2s ease;
    animation: boosted-card-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.boosted-card-item:hover {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
    transform: translateY(-1px);
}

@keyframes boosted-card-pop {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.boosted-card-char {
    font-size: 1.1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.boosted-card-ease {
    font-size: 0.6rem;
    color: rgba(16, 185, 129, 0.8);
    font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace;
    white-space: nowrap;
}

.boosted-card-more {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

/* Legacy simple result classes (fallback) */
#unified-tool-result.success {
    color: rgba(16, 185, 129, 0.9);
}

#unified-tool-result.warning {
    color: rgba(245, 158, 11, 0.9);
}

#unified-tool-result.error {
    color: rgba(239, 68, 68, 0.9);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Scrollbar Styling for Modal Body
   ═══════════════════════════════════════════════════════════════════════════════ */

.unified-srs-body::-webkit-scrollbar {
    width: 6px;
}

.unified-srs-body::-webkit-scrollbar-track {
    background: transparent;
}

.unified-srs-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.unified-srs-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Focus and Accessibility
   ═══════════════════════════════════════════════════════════════════════════════ */

.unified-srs-profile-card:focus-visible,
.unified-intensity-btn:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.6);
    outline-offset: 2px;
}

.unified-srs-section > summary:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.6);
    outline-offset: 2px;
    border-radius: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SRS State Filter - Custom Icon Dropdown
   Replaces native select with SVG icon-rich dropdown
   ═══════════════════════════════════════════════════════════════════════════════ */

.srs-state-dropdown {
    position: relative;
    display: inline-block;
}

/* Hide the native select but keep it accessible */
.srs-state-dropdown select {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* Custom trigger button */
.srs-state-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    background: var(--color-bg-primary, #0a0a0a);
    border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
    border-radius: 0.5rem;
    cursor: pointer;
    min-width: 145px;
    transition: all 0.15s ease;
}

.srs-state-trigger:hover {
    background: var(--color-bg-tertiary, rgba(255, 255, 255, 0.05));
    border-color: rgba(255, 255, 255, 0.2);
}

.srs-state-trigger:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
}

.srs-state-trigger.open {
    border-color: rgba(99, 102, 241, 0.5);
}

.srs-state-trigger-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.srs-state-trigger-icon svg {
    width: 100%;
    height: 100%;
}

.srs-state-trigger-label {
    flex: 1;
    font-size: 0.875rem;
    color: var(--color-text-main, #fafafa);
    text-align: left;
}

.srs-state-trigger-arrow {
    width: 16px;
    height: 16px;
    color: var(--color-text-muted, #71717a);
    transition: transform 0.2s ease;
}

.srs-state-trigger.open .srs-state-trigger-arrow {
    transform: rotate(180deg);
}

/* Dropdown menu */
.srs-state-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 165px;
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.625rem;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.375rem;
    overflow: hidden;
}

.srs-state-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Option items */
.srs-state-option {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.1s ease;
}

.srs-state-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.srs-state-option.selected {
    background: rgba(99, 102, 241, 0.15);
}

.srs-state-option-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.srs-state-option-icon svg {
    width: 100%;
    height: 100%;
}

.srs-state-option-label {
    font-size: 0.875rem;
    color: var(--color-text-primary, #fafafa);
}

.srs-state-option.selected .srs-state-option-label {
    color: #a5b4fc;
}

/* Checkmark for selected item */
.srs-state-option-check {
    margin-left: auto;
    width: 16px;
    height: 16px;
    color: #818cf8;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.15s ease;
}

.srs-state-option.selected .srs-state-option-check {
    opacity: 1;
    transform: scale(1);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Fancy Select Dropdowns
   Reusable styled dropdowns matching the SRS state filter aesthetic
   ═══════════════════════════════════════════════════════════════════════════════ */

.fancy-select {
    position: relative;
    display: inline-block;
}

/* Hide native select */
.fancy-select select {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

/* Trigger button */
.fancy-select-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    background: var(--color-bg-primary, #0a0a0a);
    border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
    border-radius: 0.5rem;
    cursor: pointer;
    min-width: 140px;
    transition: all 0.15s ease;
}

.fancy-select-trigger:hover {
    background: var(--color-bg-tertiary, rgba(255, 255, 255, 0.05));
    border-color: rgba(255, 255, 255, 0.2);
}

.fancy-select-trigger:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
}

.fancy-select-trigger.open {
    border-color: rgba(99, 102, 241, 0.5);
}

.fancy-select-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--color-text-muted, #71717a);
}

.fancy-select-icon svg {
    width: 100%;
    height: 100%;
}

/* Icon color variants */
.fancy-select-icon.accent { color: #818cf8; }
.fancy-select-icon.orange { color: #fb923c; }
.fancy-select-icon.green { color: #4ade80; }
.fancy-select-icon.blue { color: #60a5fa; }
.fancy-select-icon.purple { color: #c084fc; }

.fancy-select-label {
    flex: 1;
    font-size: 0.875rem;
    color: var(--color-text-main, #fafafa);
    text-align: left;
    white-space: nowrap;
}

.fancy-select-arrow {
    width: 16px;
    height: 16px;
    color: var(--color-text-muted, #71717a);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.fancy-select-trigger.open .fancy-select-arrow {
    transform: rotate(180deg);
}

/* Dropdown menu */
.fancy-select-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.625rem;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.375rem;
    overflow: hidden;
}

.fancy-select-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Option items */
.fancy-select-option {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.1s ease;
}

.fancy-select-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.fancy-select-option.selected {
    background: rgba(99, 102, 241, 0.15);
}

.fancy-select-option-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--color-text-muted, #71717a);
}

.fancy-select-option-icon svg {
    width: 100%;
    height: 100%;
}

/* Option icon color variants */
.fancy-select-option-icon.accent { color: #818cf8; }
.fancy-select-option-icon.orange { color: #fb923c; }
.fancy-select-option-icon.green { color: #4ade80; }
.fancy-select-option-icon.blue { color: #60a5fa; }
.fancy-select-option-icon.purple { color: #c084fc; }
.fancy-select-option-icon.rose { color: #fb7185; }
.fancy-select-option-icon.cyan { color: #22d3ee; }

.fancy-select-option-label {
    font-size: 0.875rem;
    color: var(--color-text-primary, #fafafa);
    flex: 1;
}

.fancy-select-option.selected .fancy-select-option-label {
    color: #a5b4fc;
}

/* Checkmark for selected item */
.fancy-select-option-check {
    margin-left: auto;
    width: 16px;
    height: 16px;
    color: #818cf8;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.fancy-select-option.selected .fancy-select-option-check {
    opacity: 1;
    transform: scale(1);
}

/* Muted options (e.g., grid limit options that won't change anything) */
.fancy-select-option.muted {
    opacity: 0.5;
}

.fancy-select-option.muted:hover {
    background: rgba(255, 255, 255, 0.04);
}

.fancy-select-option.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* Hint text for options (e.g., showing counts) */
.fancy-select-option-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted, #71717a);
    margin-left: auto;
    padding-right: 0.25rem;
}

.fancy-select-option.selected .fancy-select-option-hint {
    color: rgba(129, 140, 248, 0.7);
}

/* Specific dropdown widths */
#sort-by-dropdown .fancy-select-trigger {
    min-width: 150px;
}

#sort-direction-dropdown .fancy-select-trigger {
    min-width: 130px;
}

#grid-limit-dropdown .fancy-select-trigger {
    min-width: 90px;
}

#grid-limit-dropdown .fancy-select-menu {
    min-width: 140px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Fancy Menu Dropdowns (for button menus like Add menu)
   ═══════════════════════════════════════════════════════════════════════════════ */

.fancy-menu {
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.625rem;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 2px 10px rgba(0, 0, 0, 0.3);
    padding: 0.375rem;
    min-width: 200px;
}

.fancy-menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.1s ease;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--color-text-primary, #fafafa);
    font-size: 0.875rem;
}

.fancy-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.fancy-menu-item-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--color-text-muted, #71717a);
}

.fancy-menu-item-icon svg {
    width: 100%;
    height: 100%;
}

/* Menu item icon color variants */
.fancy-menu-item-icon.accent { color: #818cf8; }
.fancy-menu-item-icon.orange { color: #fb923c; }
.fancy-menu-item-icon.green { color: #4ade80; }
.fancy-menu-item-icon.blue { color: #60a5fa; }
.fancy-menu-item-icon.purple { color: #c084fc; }
.fancy-menu-item-icon.rose { color: #fb7185; }
.fancy-menu-item-icon.cyan { color: #22d3ee; }

.fancy-menu-item-label {
    flex: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Display & Sound Modal - Icon Animations
   Gear spin, eye shimmer, sound wave pulse
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Modal header - no text cursor, not selectable */
.modal-header {
    cursor: default;
    user-select: none;
}

/* Gear icon - spins once when modal opens, and on click! */
.settings-icon-gear {
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.settings-icon-gear:hover {
    filter: brightness(1.15);
}

.settings-icon-gear.spin {
    animation: gear-spin 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes gear-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Eye icon - periodic shimmer glint */
.settings-icon-eye {
    position: relative;
    overflow: visible;
}

/* Shimmer overlay via pseudo-element would require inline SVG changes,
   so we use a filter-based pulse instead */
.settings-icon-eye {
    animation: eye-glimmer 4s ease-in-out infinite;
    animation-delay: 1.5s;
}

@keyframes eye-glimmer {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 0 0 transparent);
    }
    15% {
        filter: brightness(1.3) drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
    }
    30% {
        filter: brightness(1) drop-shadow(0 0 0 transparent);
    }
}

/* Soundscapes icon - wave pulse animation */
.settings-icon-sound {
    animation: sound-pulse 2.5s ease-in-out infinite;
}

@keyframes sound-pulse {
    0%, 100% {
        filter: brightness(1);
        transform: scale(1);
    }
    50% {
        filter: brightness(1.1);
        transform: scale(1.02);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Sidebar Account Stats - Streak & Sync Styling
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Streak icon wrapper */
.streak-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.streak-icon {
    filter: drop-shadow(0 0 4px rgba(249, 115, 22, 0.3));
    transition: filter 0.3s;
}

/* Active streak glow animation */
.streak-icon-wrap.streak-active .streak-icon {
    animation: streak-glow 2s ease-in-out infinite;
}

@keyframes streak-glow {
    0%, 100% {
        filter: drop-shadow(0 0 4px rgba(249, 115, 22, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.6));
    }
}

/* Sync icon spin animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ADD ITEM MODAL - KanjiOS HUD STYLE
   Unified modal for adding items across all modes
   ═══════════════════════════════════════════════════════════════════════════════ */

/* CSS Variables - inherit from mode when available */
.add-item-content {
    --add-accent: var(--mode-color, #3B82F6);
    --add-accent-glow: color-mix(in srgb, var(--add-accent) 30%, transparent);
    --add-bg: #08080a;
    --add-border: color-mix(in srgb, var(--add-accent) 15%, transparent);
}

/* Main content container */
.add-item-content {
    position: relative;
    background: var(--add-bg);
    border: 1px solid var(--add-border);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 
        0 0 80px var(--add-accent-glow),
        0 25px 100px rgba(0, 0, 0, 0.6);
    animation: add-item-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes add-item-enter {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Grid background */
.add-item-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(color-mix(in srgb, var(--add-accent) 3%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--add-accent) 3%, transparent) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, black 10%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, black 10%, transparent 70%);
    pointer-events: none;
}

/* Scan line animation */
.add-item-scanline {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    top: 0;
    background: linear-gradient(90deg, transparent 0%, var(--add-accent) 30%, var(--add-accent) 70%, transparent 100%);
    box-shadow: 0 0 20px var(--add-accent-glow);
    opacity: 0;
    animation: add-item-scan 1.8s ease-out 0.3s forwards;
    pointer-events: none;
    z-index: 10;
}

@keyframes add-item-scan {
    0% { top: 0%; opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.6; }
    100% { top: 100%; opacity: 0; }
}

/* Corner reticles */
.add-item-reticle {
    position: absolute;
    width: 16px;
    height: 16px;
    pointer-events: none;
    z-index: 5;
}

.add-item-reticle::before,
.add-item-reticle::after {
    content: '';
    position: absolute;
    background: var(--add-accent);
    opacity: 0.6;
}

.add-item-reticle-tl { top: 8px; left: 8px; }
.add-item-reticle-tl::before { width: 10px; height: 1px; top: 0; left: 0; }
.add-item-reticle-tl::after { width: 1px; height: 10px; top: 0; left: 0; }

.add-item-reticle-tr { top: 8px; right: 8px; }
.add-item-reticle-tr::before { width: 10px; height: 1px; top: 0; right: 0; }
.add-item-reticle-tr::after { width: 1px; height: 10px; top: 0; right: 0; }

.add-item-reticle-bl { bottom: 8px; left: 8px; }
.add-item-reticle-bl::before { width: 10px; height: 1px; bottom: 0; left: 0; }
.add-item-reticle-bl::after { width: 1px; height: 10px; bottom: 0; left: 0; }

.add-item-reticle-br { bottom: 8px; right: 8px; }
.add-item-reticle-br::before { width: 10px; height: 1px; bottom: 0; right: 0; }
.add-item-reticle-br::after { width: 1px; height: 10px; bottom: 0; right: 0; }

/* ═══════════════════════════════════════════════════════════════════════════════
   Header
   ═══════════════════════════════════════════════════════════════════════════════ */

.add-item-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid color-mix(in srgb, var(--add-accent) 10%, transparent);
    z-index: 1;
    cursor: default;
    user-select: none;
}

.add-item-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.add-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--add-accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--add-accent) 25%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--add-accent);
    font-size: 1.25rem;
    font-weight: 700;
    animation: add-item-icon-pop 0.4s ease-out 0.2s backwards;
}

@keyframes add-item-icon-pop {
    0% { transform: scale(0.5) rotate(-10deg); opacity: 0; }
    60% { transform: scale(1.1) rotate(3deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.add-item-header-text h2 {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 1rem;
    font-weight: 700;
    color: #fafafa;
    letter-spacing: 0.02em;
    margin: 0;
}

.add-item-header-text p {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
    margin: 0.125rem 0 0 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.add-item-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.add-item-kbd-hint {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.35);
}

.add-item-kbd-hint kbd {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.5);
}

.add-item-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.add-item-close-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Body / Form
   ═══════════════════════════════════════════════════════════════════════════════ */

.add-item-body {
    position: relative;
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
    z-index: 1;
}

.add-item-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.add-item-fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.add-item-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.add-item-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.add-item-field-half {
    flex: 1;
    min-width: 0; /* Prevent flex items from overflowing */
}

/* Ensure inputs in row have matching heights */
.add-item-row .add-item-input,
.add-item-row .add-item-select {
    height: 42px;
}

.add-item-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.add-item-label-text {
    color: rgba(255, 255, 255, 0.7);
}

.add-item-required {
    color: var(--add-accent);
    font-weight: 700;
}

/* Input fields */
.add-item-input,
.add-item-select,
.add-item-textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    color: #fafafa;
    transition: all 0.2s;
    outline: none;
}

.add-item-input::placeholder,
.add-item-textarea::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.add-item-input:hover,
.add-item-select:hover,
.add-item-textarea:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
}

.add-item-input:focus,
.add-item-select:focus,
.add-item-textarea:focus {
    border-color: var(--add-accent);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px var(--add-accent-glow);
}

/* Large input for main character/word field */
.add-item-input-large {
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
    padding: 0.75rem 1rem;
    letter-spacing: 0.02em;
    font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic Pro', sans-serif;
}

.add-item-input-wrap {
    position: relative;
}

.add-item-char-count {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6875rem;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

/* Select dropdown */
.add-item-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.4)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
    cursor: pointer;
}

.add-item-select option {
    background: #18181b;
    color: #fafafa;
}

/* Textarea */
.add-item-textarea {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

/* Hint text */
.add-item-hint {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.35);
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Validation / Errors
   ═══════════════════════════════════════════════════════════════════════════════ */

.add-item-errors {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    color: #fca5a5;
    font-size: 0.8125rem;
    animation: add-item-error-shake 0.4s ease-out;
}

@keyframes add-item-error-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.add-item-error-icon {
    color: #ef4444;
    font-size: 0.875rem;
}

/* Invalid field state */
.add-item-input:invalid:not(:placeholder-shown),
.add-item-input.invalid {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.05);
}

.add-item-input:invalid:not(:placeholder-shown):focus,
.add-item-input.invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Valid field state */
.add-item-input.valid {
    border-color: rgba(34, 197, 94, 0.5);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Action Buttons
   ═══════════════════════════════════════════════════════════════════════════════ */

.add-item-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.add-item-btn-primary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: color-mix(in srgb, var(--add-accent) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--add-accent) 30%, transparent);
    border-radius: 8px;
    color: var(--add-accent);
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.add-item-btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, var(--add-accent-glow), transparent);
    transform: translateX(-100%);
    transition: transform 0.3s;
}

.add-item-btn-primary:hover {
    background: color-mix(in srgb, var(--add-accent) 25%, transparent);
    border-color: var(--add-accent);
    box-shadow: 0 0 20px var(--add-accent-glow);
}

.add-item-btn-primary:hover::before {
    transform: translateX(100%);
}

.add-item-btn-primary:active {
    transform: scale(0.98);
}

.add-item-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.add-item-btn-primary:disabled:hover {
    background: color-mix(in srgb, var(--add-accent) 15%, transparent);
    box-shadow: none;
}

.add-item-btn-icon {
    font-size: 1.125rem;
    font-weight: 700;
}

.add-item-btn-secondary {
    padding: 0.75rem 1rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.add-item-btn-secondary:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.03);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════════════════════════════════ */

.add-item-footer {
    position: relative;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1;
}

.add-item-footer-hint {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Mode-Specific Color Overrides
   ═══════════════════════════════════════════════════════════════════════════════ */

.add-item-content[data-mode="kanji"] { --add-accent: #3B82F6; }
.add-item-content[data-mode="vocab"] { --add-accent: #10B981; }
.add-item-content[data-mode="grammar"] { --add-accent: #FACC15; }
.add-item-content[data-mode="names"] { --add-accent: #EC4899; }
.add-item-content[data-mode="numbers"] { --add-accent: #06B6D4; }
.add-item-content[data-mode="sentences"] { --add-accent: #2DD4BF; }
.add-item-content[data-mode="pokemon"] { --add-accent: #EF4444; }
.add-item-content[data-mode="radicals"] { --add-accent: #C084FC; }

/* Grammar mode: darker yellow text for readability */
.add-item-content[data-mode="grammar"] .add-item-btn-primary {
    color: #CA8A04;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .add-item-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .add-item-header {
        padding: 1rem;
    }
    
    .add-item-kbd-hint {
        display: none;
    }
    
    .add-item-body {
        padding: 1rem;
    }
    
    .add-item-row {
        flex-direction: column;
    }
    
    .add-item-input-large {
        font-size: 1.75rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TYPING MODE - HUD Scanner UI System
   Recognition (Type English) & Production (Type Japanese)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Color definitions */
:root {
    --color-success: #22c55e;
    --color-info: #3b82f6;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Match Scanner HUD
   ═══════════════════════════════════════════════════════════════════════════════ */

.match-scanner-container {
    perspective: 1000px;
}

.match-scanner-hud {
    background: linear-gradient(180deg, rgba(15, 15, 20, 0.95) 0%, rgba(10, 10, 15, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 4px 24px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Subtle scan line effect - runs only twice then stops */
.match-scanner-hud::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--scanner-color, var(--color-info)), transparent);
    animation: scanline 1.5s ease-in-out 1;
    opacity: 0.5;
}

@keyframes scanline {
    0%, 100% { transform: translateY(0); opacity: 0.2; }
    50% { transform: translateY(50px); opacity: 0.5; }
}

.match-scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.match-scanner-title {
    font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.match-scanner-score {
    font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--scanner-color, var(--color-info));
    text-shadow: 0 0 20px var(--scanner-color, var(--color-info));
}

.match-scanner-bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    position: relative;
}

.match-scanner-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--scanner-color, var(--color-info)), color-mix(in srgb, var(--scanner-color, var(--color-info)) 80%, white));
    border-radius: 4px;
    transition: width 0s;
    position: relative;
    box-shadow: 0 0 12px var(--scanner-color, var(--color-info));
}

.match-scanner-bar.animate {
    width: var(--scanner-width, 0%);
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Glow pulse on the bar tip */
.match-scanner-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 12px;
    background: white;
    border-radius: 2px;
    box-shadow: 0 0 8px white, 0 0 16px var(--scanner-color, var(--color-info));
    opacity: 0;
}

.match-scanner-bar.animate::after {
    animation: barTipPulse 0.6s ease-out 0.3s forwards;
}

@keyframes barTipPulse {
    0% { opacity: 1; transform: translateY(-50%) scale(1); }
    100% { opacity: 0; transform: translateY(-50%) scale(1.5); }
}

.match-scanner-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

/* Status color classes */
.match-exact { --scanner-color: var(--color-success); }
.match-close { --scanner-color: var(--color-info); }
.match-partial { --scanner-color: var(--color-warning); }
.match-incorrect { --scanner-color: var(--color-danger); }

/* ═══════════════════════════════════════════════════════════════════════════════
   Typing Input Field Styling
   ═══════════════════════════════════════════════════════════════════════════════ */

.typing-input-container,
.production-input-container {
    position: relative;
}

.typing-input-field,
.production-input-field {
    background: rgba(15, 15, 20, 0.8) !important;
    border: 2px solid rgba(var(--kos-accent-rgb, 59, 130, 246), 0.3) !important;
    color: #fff;
    transition: all 0.2s ease;
}

.typing-input-field:focus,
.production-input-field:focus {
    border-color: rgba(var(--kos-accent-rgb, 59, 130, 246), 0.8) !important;
    box-shadow: 
        0 0 0 3px rgba(var(--kos-accent-rgb, 59, 130, 246), 0.15),
        0 0 20px rgba(var(--kos-accent-rgb, 59, 130, 246), 0.2) !important;
}

.typing-input-field::placeholder,
.production-input-field::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Typing Action Buttons
   ═══════════════════════════════════════════════════════════════════════════════ */

.typing-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.typing-action-primary {
    background: linear-gradient(135deg, rgba(var(--kos-accent-rgb, 59, 130, 246), 0.9), rgba(var(--kos-accent-rgb, 59, 130, 246), 0.7));
    color: white;
    border-color: rgba(var(--kos-accent-rgb, 59, 130, 246), 0.5);
    box-shadow: 0 4px 12px rgba(var(--kos-accent-rgb, 59, 130, 246), 0.3);
}

.typing-action-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(var(--kos-accent-rgb, 59, 130, 246), 0.4);
}

.typing-action-secondary {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.3);
}

.typing-action-secondary:hover {
    background: rgba(245, 158, 11, 0.25);
    border-color: rgba(245, 158, 11, 0.5);
}

.typing-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.125rem 0.375rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 1.25rem;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Grading Buttons - HUD Style
   ═══════════════════════════════════════════════════════════════════════════════ */

.grade-buttons-hud {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.grade-btn-hud {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-width: 4.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    border: 1.5px solid transparent;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
}

.grade-btn-hud::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.15s;
}

.grade-btn-hud:hover::before {
    opacity: 1;
}

.grade-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 3px;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.6875rem;
    font-weight: 600;
    opacity: 0.7;
}

.grade-label {
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
}

/* Again Button - Red */
.grade-btn-again {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(185, 28, 28, 0.2) 100%);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.grade-btn-again:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.35) 0%, rgba(185, 28, 28, 0.35) 100%);
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* Hard Button - Amber */
.grade-btn-hard {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(180, 83, 9, 0.2) 100%);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fcd34d;
}

.grade-btn-hard:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.35) 0%, rgba(180, 83, 9, 0.35) 100%);
    border-color: rgba(245, 158, 11, 0.6);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

/* Good Button - Green */
.grade-btn-good {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(22, 163, 74, 0.2) 100%);
    border-color: rgba(34, 197, 94, 0.4);
    color: #86efac;
}

.grade-btn-good:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.35) 0%, rgba(22, 163, 74, 0.35) 100%);
    border-color: rgba(34, 197, 94, 0.6);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

/* Easy Button - Blue */
.grade-btn-easy {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(37, 99, 235, 0.2) 100%);
    border-color: rgba(59, 130, 246, 0.4);
    color: #93c5fd;
}

.grade-btn-easy:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.35) 0%, rgba(37, 99, 235, 0.35) 100%);
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

/* Selected/Pre-selected state */
.grade-btn-hud.grade-btn-selected {
    transform: scale(1.05);
    box-shadow: 
        0 0 0 3px rgba(var(--kos-accent-rgb, 168, 85, 247), 0.4),
        0 0 30px rgba(var(--kos-accent-rgb, 168, 85, 247), 0.3);
}

.grade-btn-again.grade-btn-selected {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.5) 0%, rgba(185, 28, 28, 0.5) 100%);
    border-color: #ef4444;
}

.grade-btn-hard.grade-btn-selected {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.5) 0%, rgba(180, 83, 9, 0.5) 100%);
    border-color: #f59e0b;
}

.grade-btn-good.grade-btn-selected {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.5) 0%, rgba(22, 163, 74, 0.5) 100%);
    border-color: #22c55e;
}

.grade-btn-easy.grade-btn-selected {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.5) 0%, rgba(37, 99, 235, 0.5) 100%);
    border-color: #3b82f6;
}

/* Focus state for keyboard navigation */
.grade-btn-hud:focus {
    outline: none;
}

.grade-btn-hud:focus-visible {
    box-shadow: 
        0 0 0 3px rgba(var(--kos-accent-rgb, 168, 85, 247), 0.5),
        0 0 20px rgba(var(--kos-accent-rgb, 168, 85, 247), 0.3);
}

/* Grading suggestion hint */
.grade-suggestion-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.625rem;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    letter-spacing: 0.02em;
}

.grade-suggestion-hint #suggested-grade-label {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Answer Box Styling
   ═══════════════════════════════════════════════════════════════════════════════ */

.answer-box {
    text-align: center;
}

/* Border colors for match status */
.border-success { border-color: var(--color-success) !important; }
.border-info { border-color: var(--color-info) !important; }
.border-warning { border-color: var(--color-warning) !important; }
.border-danger { border-color: var(--color-danger) !important; }

/* Text colors for status */
.text-success { color: var(--color-success) !important; }
.text-info { color: var(--color-info) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger { color: var(--color-danger) !important; }

/* ═══════════════════════════════════════════════════════════════════════════════
   Responsive Adjustments for Typing Modes
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
    .match-scanner-hud {
        padding: 0.875rem 1rem;
    }
    
    .match-scanner-score {
        font-size: 1.25rem;
    }
    
    .grade-buttons-hud {
        gap: 0.375rem;
    }
    
    .grade-btn-hud {
        min-width: 4rem;
        padding: 0.625rem 0.75rem;
    }
    
    .grade-label {
        font-size: 0.75rem;
    }
    
    .typing-action-btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}
