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

/* ═══════════════════════════════════════════════════════════════════════════════
   Answer Feedback - Rainbow Success / Vivid Danger
   Echoes the hero-spotlight effect from question introduction
   ═══════════════════════════════════════════════════════════════════════════════ */

@property --answer-rainbow-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes answer-rainbow-rotate {
    0% { --answer-rainbow-angle: 0deg; }
    100% { --answer-rainbow-angle: 360deg; }
}

@keyframes answer-glow-pulse {
    0%, 100% { filter: brightness(0.95); }
    50% { filter: brightness(1.1); }
}

/* Reduced motion: disable looping animations for answer feedback */
@media (prefers-reduced-motion: reduce) {
    .option-btn.bg-success,
    .option-btn.bg-danger {
        animation: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   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;
}

/* Hiragana mode - Orange */
#review-session-modal[data-mode="hiragana"],
#review-session-modal.mode-hiragana {
    --kos-accent: #f97316;
    --kos-accent-rgb: 249, 115, 22;
}

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

/* 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;
}

/* 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="hiragana"] {
    --kos-hub-accent: #f97316;
    --kos-hub-accent-rgb: 249, 115, 22;
}

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

#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="numbers"] {
    --kos-hub-accent: #06b6d4;
    --kos-hub-accent-rgb: 6, 182, 212;
}

/* Global mode (All Modes) - white accent */
#review-hub-modal[data-mode="global"] {
    --kos-hub-accent: #ffffff;
    --kos-hub-accent-rgb: 255, 255, 255;
}

/* 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;
}

/* Auto-mode card needs overflow visible so preset tooltips can escape */
#auto-mode-card {
    overflow: visible !important;
}

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

/* Auto mode gets "selected" state by DEFAULT when no other card is hovered */
#review-hub-modal .p-8:not(:has(.review-mode-card:hover)) #auto-mode-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)) #auto-mode-card:not([style*="pointer-events: none"])::before {
    opacity: 0.7;
}

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

#review-hub-modal .p-8:not(:has(.review-mode-card:hover)) #auto-mode-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);
}

/* Auto mode hotkey also brighter when default-selected */
#review-hub-modal .p-8:not(:has(.review-mode-card:hover)) #auto-mode-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%;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Global Mode - Enhanced Auto Hover (since Auto is always "selected", hover needs extra punch)
   ═══════════════════════════════════════════════════════════════════════════════ */
#review-hub-modal[data-mode="global"] #auto-mode-card:hover {
    background: rgba(var(--kos-hub-accent-rgb), 0.12) !important;
    border-color: rgba(var(--kos-hub-accent-rgb), 0.6) !important;
    transform: translateY(-6px) scale(1.01) !important;
    box-shadow:
        0 16px 50px rgba(0, 0, 0, 0.5),
        0 0 50px rgba(var(--kos-hub-accent-rgb), 0.25),
        0 0 80px rgba(var(--kos-hub-accent-rgb), 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

#review-hub-modal[data-mode="global"] #auto-mode-card:hover::before {
    opacity: 1;
}

#review-hub-modal[data-mode="global"] #auto-mode-card:hover::after {
    height: 80%;
    box-shadow: 0 0 12px rgba(var(--kos-hub-accent-rgb), 0.6);
}

#review-hub-modal[data-mode="global"] #auto-mode-card:hover .mode-card-icon img {
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.5)) brightness(1.25);
    transform: scale(1.1);
}

#review-hub-modal[data-mode="global"] #auto-mode-card:hover .mode-hotkey {
    text-shadow:
        0 0 12px rgba(var(--kos-hub-accent-rgb), 1),
        0 0 25px rgba(var(--kos-hub-accent-rgb), 0.8),
        0 0 45px rgba(var(--kos-hub-accent-rgb), 0.5);
}

/* 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;
}

/* Auto-mode preset buttons — single-select progression speed */
.auto-mode-preset {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.auto-mode-preset.active {
    background: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.15);
    color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.9);
    border-color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.3);
}

.auto-mode-preset:hover {
    border-color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.4);
    color: rgba(255, 255, 255, 0.55);
}

.auto-mode-preset.active:hover {
    color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.9);
    border-color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.5);
}

.auto-mode-preset:focus-visible {
    outline: 2px solid rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.8);
    outline-offset: 2px;
}

/* Auto-mode tooltips — child span shown on hover (same pattern as swk-tooltip) */
.auto-mode-preset,
.auto-mode-toggle {
    position: relative;
}

.auto-preset-tip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: rgba(12, 14, 20, 0.97);
    border: 1px solid rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.15);
    border-radius: 0.6rem;
    padding: 0.75rem 0.9rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.4;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.55);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 50;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.auto-preset-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(12, 14, 20, 0.97);
}

.auto-mode-preset:hover .auto-preset-tip,
.auto-mode-preset:focus-visible .auto-preset-tip {
    opacity: 1;
}

/* ── Progression ladder ── */
.apt-ladder {
    display: flex;
    align-items: flex-start;
    gap: 0;
}

.apt-node {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.9);
    padding: 0.2rem 0.4rem;
    background: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.1);
    border: 1px solid rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.2);
    border-radius: 0.2rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.apt-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0.4rem;
    flex-shrink: 0;
}

.apt-bar {
    width: 100%;
    height: 1px;
    background: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.3);
    margin-top: 0.55rem;
    margin-bottom: 0.35rem;
    position: relative;
}

.apt-bar::after {
    content: '';
    position: absolute;
    right: -3px;
    top: 50%;
    transform: translateY(-50%);
    border: 3px solid transparent;
    border-left-color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.4);
}

.apt-reqs {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.4);
}

.apt-num {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-weight: 700;
    color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.9);
}

.apt-plus {
    color: #4ade80;
    font-weight: 700;
}

/* ── Hide Type JP gate when checkbox unchecked ── */
#auto-mode-presets.no-type-jp .apt-gate-jp,
#auto-mode-presets.no-type-jp .apt-node-jp {
    display: none;
}


/* Auto-mode Type JP toggle — compact checkbox + label */
.auto-mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    user-select: none;
    padding: 0.15rem 0.45rem;
    border-radius: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}

.auto-mode-toggle:hover {
    border-color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.3);
}

.auto-mode-toggle input[type="checkbox"] {
    width: 0.75rem;
    height: 0.75rem;
    accent-color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 1);
    cursor: pointer;
    margin: 0;
}

.auto-mode-toggle-label {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    transition: color 0.2s ease;
}

.auto-mode-toggle:has(input:checked) .auto-mode-toggle-label {
    color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.8);
}

.auto-mode-toggle:has(input:not(:checked)) {
    opacity: 0.5;
}

/* MC card Adaptive JP — unified pill with label + gear */
.mc-adaptive-jp-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.15rem 0.2rem 0.5rem;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 2;
}

.mc-adaptive-jp-pill.active {
    background: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.15);
    color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.9);
    border-color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.3);
}

.mc-adaptive-jp-pill:hover {
    border-color: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.4);
}

.mc-adaptive-jp-pill-sep {
    width: 1px;
    height: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.mc-adaptive-jp-pill.active .mc-adaptive-jp-pill-sep {
    background: rgba(var(--kos-hub-accent-rgb, 59, 130, 246), 0.25);
}

.mc-adaptive-jp-pill-gear {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.1rem 0.2rem;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    border-radius: 0.15rem;
    transition: background 0.15s ease;
    cursor: pointer;
}

.mc-adaptive-jp-pill-gear svg {
    width: 0.65rem;
    height: 0.65rem;
    opacity: 0.5;
}

.mc-adaptive-jp-pill-gear:hover {
    background: rgba(255, 255, 255, 0.08);
}

.mc-adaptive-jp-pill-gear:hover svg {
    opacity: 0.9;
}

.mc-adaptive-jp-pill.active .mc-adaptive-jp-pill-gear svg {
    opacity: 0.7;
}

.mc-adaptive-jp-pill.active .mc-adaptive-jp-pill-gear:hover svg {
    opacity: 1;
}


/* MC card solo layout — mirrors the auto card's expanded style.
   JS moves the Adaptive JP pill to be a sibling of .flex-1 (like auto-mode-settings). */
#multiple-choice-card.mc-solo {
    padding: 1.5rem;
}

#multiple-choice-card.mc-solo > .flex {
    gap: 1.5rem;
}

#multiple-choice-card.mc-solo .mode-card-icon img {
    width: 4rem;
    height: 4rem;
}

#multiple-choice-card.mc-solo h3 {
    font-size: 1.25rem;
}

#multiple-choice-card.mc-solo .mc-adaptive-jp-pill {
    margin-top: 0;
}

/* 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);
}

/* 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-modal-backdrop-bg, var(--kos-bg-deep)) !important;
    backdrop-filter: var(--kos-modal-backdrop-filter, blur(6px));
    -webkit-backdrop-filter: var(--kos-modal-backdrop-filter, blur(6px));
}

/* ═══════════════════════════════════════════════════════════════════════════════
   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,
.assoc-lang-toggle.active {
    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;
}

/* When analytics modal is open, detail modal needs higher z-index to appear on top */
body.analytics-open #detail-modal {
    z-index: 20000 !important;
}

/* Knowledge Calibration can remain open while peeking item details. */
body.knowledge-calibration-open #detail-modal {
    z-index: 20000 !important;
}

/* Component Analyzer and the detail modal can be open simultaneously.
   Whichever was opened most recently needs to sit on top of the other,
   overriding the shared `10000 !important` rule above. Two cases:

   1. Detail was open, user opened Analyzer on top of it → analyzer-on-top
      class is added by the associator's open() when it sees a visible
      detail modal. Lift the analyzer.
   2. Analyzer was open, user peeked a detail from it → app.js's
      onNavigate clears analyzer-on-top (the default) and shows the
      detail modal, which the first rule below lifts above the analyzer.

   Match the `body.analytics-open` pattern used a few lines above. */
body.analyzer-open:not(.analyzer-on-top) #detail-modal {
    z-index: 20000 !important;
}
body.analyzer-on-top #manual-radical-associator-modal {
    z-index: 20000 !important;
}

/* Detail modal edit panel */
#detail-edit-panel {
    padding: 1.5rem;
    backdrop-filter: blur(2px);
    -webkit-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-field--aliases {
    padding-top: 0.25rem;
}

.detail-edit-field--aliases textarea {
    border-color: rgba(59, 130, 246, 0.28);
}

.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; }

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

/* 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;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Shared Panel Footer
   ═══════════════════════════════════════════════════════════════════════════════ */

.rw-panel-footer {
    padding: 8px 16px;
    border-top: 1px solid rgba(var(--kos-accent-rgb), 0.15);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2));
    flex-shrink: 0;
}

/* Center footer: transparent in non-workspace mode */
#review-session-modal:not(.workspace-mode) #rw-main-footer {
    padding: 0.5rem 2rem 1rem;
    background: transparent;
    border-top: none;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Association Boost Toggle - Button Style CTA
   ═══════════════════════════════════════════════════════════════════════════════ */

.assoc-boost-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    position: relative;
    width: 100%;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    transition: all 0.2s ease;
}

.assoc-boost-toggle:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-color: rgba(255, 255, 255, 0.15);
}

/* When checked - accent styling like Explain This button */
.assoc-boost-toggle:has(#assoc-boost-checkbox:checked) {
    background: linear-gradient(135deg, rgba(var(--kos-accent-rgb), 0.15) 0%, rgba(var(--kos-accent-rgb), 0.05) 100%);
    border-color: rgba(var(--kos-accent-rgb), 0.4);
    box-shadow:
        0 0 0 1px rgba(var(--kos-accent-rgb), 0.1),
        0 0 20px rgba(var(--kos-accent-rgb), 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.assoc-boost-toggle:has(#assoc-boost-checkbox:checked):hover {
    background: linear-gradient(135deg, rgba(var(--kos-accent-rgb), 0.2) 0%, rgba(var(--kos-accent-rgb), 0.08) 100%);
    border-color: rgba(var(--kos-accent-rgb), 0.5);
    box-shadow:
        0 0 0 1px rgba(var(--kos-accent-rgb), 0.2),
        0 0 25px rgba(var(--kos-accent-rgb), 0.15);
}

.assoc-boost-track {
    position: relative;
    width: 36px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.assoc-boost-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

#assoc-boost-checkbox:checked + .assoc-boost-track {
    background: rgba(var(--kos-accent-rgb), 0.5);
    border-color: rgba(var(--kos-accent-rgb), 0.7);
}

#assoc-boost-checkbox:checked + .assoc-boost-track .assoc-boost-thumb {
    transform: translateX(16px);
    box-shadow: 0 0 8px rgba(var(--kos-accent-rgb), 0.6);
}

.assoc-boost-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #9ca3af);
    transition: color 0.2s ease;
    letter-spacing: 0.3px;
}

#assoc-boost-checkbox:checked ~ .assoc-boost-label {
    color: rgba(var(--kos-accent-rgb), 1);
}

/* Sparkle icon before label when active */
.assoc-boost-toggle:has(#assoc-boost-checkbox:checked) .assoc-boost-label::before {
    content: '✦ ';
    opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Adaptive JP Levels Toggle (Main Review Panel)
   ═══════════════════════════════════════════════════════════════════════════════ */

.adaptive-jp-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    transition: all 0.2s ease;
    font-size: 11px;
}

.adaptive-jp-toggle:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-color: rgba(255, 255, 255, 0.15);
}

/* When checked - accent styling */
.adaptive-jp-toggle:has(#adaptive-jp-checkbox:checked) {
    background: linear-gradient(135deg, rgba(var(--kos-accent-rgb), 0.15) 0%, rgba(var(--kos-accent-rgb), 0.05) 100%);
    border-color: rgba(var(--kos-accent-rgb), 0.4);
    box-shadow: 0 0 12px rgba(var(--kos-accent-rgb), 0.1);
}

.adaptive-jp-toggle:has(#adaptive-jp-checkbox:checked):hover {
    background: linear-gradient(135deg, rgba(var(--kos-accent-rgb), 0.2) 0%, rgba(var(--kos-accent-rgb), 0.08) 100%);
    border-color: rgba(var(--kos-accent-rgb), 0.5);
}

.adaptive-jp-track {
    position: relative;
    width: 28px;
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.adaptive-jp-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#adaptive-jp-checkbox:checked + .adaptive-jp-track {
    background: rgba(var(--kos-accent-rgb), 0.5);
    border-color: rgba(var(--kos-accent-rgb), 0.7);
}

#adaptive-jp-checkbox:checked + .adaptive-jp-track .adaptive-jp-thumb {
    transform: translateX(12px);
    box-shadow: 0 0 6px rgba(var(--kos-accent-rgb), 0.6);
}

.adaptive-jp-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary, #9ca3af);
    transition: color 0.2s ease;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

#adaptive-jp-checkbox:checked ~ .adaptive-jp-label {
    color: rgba(var(--kos-accent-rgb), 1);
}


/* Ensure .hidden overrides display: inline-flex (CSS specificity fix) */
.adaptive-jp-toggle.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MC Direction Button (JP→EN / EN→JP mode)
   ═══════════════════════════════════════════════════════════════════════════════ */

.mc-direction-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    transition: all 0.2s ease;
    font-size: 11px;
    min-width: 60px;
}

.mc-direction-btn:focus-visible {
    outline: 2px solid rgba(var(--kos-accent-rgb), 0.45);
    outline-offset: 2px;
}

.mc-direction-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-color: rgba(255, 255, 255, 0.15);
}

/* When EN→JP mode is active - accent styling */
.mc-direction-btn[data-direction="en-to-jp"] {
    background: linear-gradient(135deg, rgba(var(--kos-accent-rgb), 0.15) 0%, rgba(var(--kos-accent-rgb), 0.05) 100%);
    border-color: rgba(var(--kos-accent-rgb), 0.4);
    box-shadow: 0 0 12px rgba(var(--kos-accent-rgb), 0.1);
}

.mc-direction-btn[data-direction="en-to-jp"]:hover {
    background: linear-gradient(135deg, rgba(var(--kos-accent-rgb), 0.2) 0%, rgba(var(--kos-accent-rgb), 0.08) 100%);
    border-color: rgba(var(--kos-accent-rgb), 0.5);
}

.mc-direction-text {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary, #9ca3af);
    transition: color 0.2s ease;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.mc-direction-btn[data-direction="en-to-jp"] .mc-direction-text {
    color: rgba(var(--kos-accent-rgb), 1);
}

/* Ensure .hidden overrides display (CSS specificity fix) */
.mc-direction-btn.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Skip WK Toggle (filter out active WaniKani items)
   ═══════════════════════════════════════════════════════════════════════════════ */

.skip-wk-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    transition: all 0.2s ease;
    font-size: 11px;
}

.skip-wk-toggle:focus-within {
    outline: 2px solid rgba(var(--kos-accent-rgb), 0.45);
    outline-offset: 2px;
}

#skip-wk-checkbox:focus-visible + .skip-wk-track {
    box-shadow: 0 0 0 3px rgba(var(--kos-accent-rgb), 0.25);
}

.skip-wk-toggle:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-color: rgba(255, 255, 255, 0.15);
}

/* When checked (Skip WK active) - accent styling */
@supports (selector(:has(*))) {
    .skip-wk-toggle:has(#skip-wk-checkbox:checked) {
        background: linear-gradient(135deg, rgba(var(--kos-accent-rgb), 0.15) 0%, rgba(var(--kos-accent-rgb), 0.05) 100%);
        border-color: rgba(var(--kos-accent-rgb), 0.4);
        box-shadow: 0 0 12px rgba(var(--kos-accent-rgb), 0.1);
    }

    .skip-wk-toggle:has(#skip-wk-checkbox:checked):hover {
        background: linear-gradient(135deg, rgba(var(--kos-accent-rgb), 0.2) 0%, rgba(var(--kos-accent-rgb), 0.08) 100%);
        border-color: rgba(var(--kos-accent-rgb), 0.5);
    }
}

/* Disabled state - wrapped in @supports for browsers without :has() */
@supports (selector(:has(*))) {
    .skip-wk-toggle:has(#skip-wk-checkbox:disabled) {
        opacity: 0.5;
        cursor: not-allowed;
    }
}

.skip-wk-track {
    position: relative;
    width: 28px;
    height: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.skip-wk-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#skip-wk-checkbox:checked + .skip-wk-track {
    background: rgba(var(--kos-accent-rgb), 0.5);
    border-color: rgba(var(--kos-accent-rgb), 0.7);
}

#skip-wk-checkbox:checked + .skip-wk-track .skip-wk-thumb {
    transform: translateX(12px);
    box-shadow: 0 0 6px rgba(var(--kos-accent-rgb), 0.6);
}

.skip-wk-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary, #9ca3af);
    transition: color 0.2s ease;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

#skip-wk-checkbox:checked ~ .skip-wk-label {
    color: rgba(var(--kos-accent-rgb), 1);
}

/* Ensure .hidden overrides display: inline-flex */
.skip-wk-toggle.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Review Options Dropdown (compact menu for MC options)
   ═══════════════════════════════════════════════════════════════════════════════ */

.review-options-dropdown {
    position: relative;
    display: inline-block;
}

.review-options-dropdown.hidden {
    display: none !important;
}

/* Trigger button - compact, matches existing toggle aesthetic */
.review-options-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    transition: all 0.2s ease;
    font-size: 11px;
    min-width: 70px;
}

.review-options-trigger:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-color: rgba(255, 255, 255, 0.15);
}

.review-options-trigger:focus-visible {
    outline: 2px solid rgba(var(--kos-accent-rgb), 0.45);
    outline-offset: 2px;
}

.review-options-trigger.open {
    background: linear-gradient(135deg, rgba(var(--kos-accent-rgb), 0.1) 0%, rgba(var(--kos-accent-rgb), 0.03) 100%);
    border-color: rgba(var(--kos-accent-rgb), 0.3);
}

.review-options-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary, #9ca3af);
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.review-options-trigger.open .review-options-label {
    color: rgba(var(--kos-accent-rgb), 0.9);
}

.review-options-arrow {
    width: 12px;
    height: 12px;
    color: var(--text-muted, #6b7280);
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.review-options-trigger.open .review-options-arrow {
    transform: rotate(180deg);
    color: rgba(var(--kos-accent-rgb), 0.8);
}

/* Dropdown menu */
.review-options-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 130px;
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    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(-6px) scale(0.98);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 4px;
    overflow: hidden;
    max-height: min(60vh, 260px);
    overflow-y: auto;
}

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

/* Option items */
.review-options-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.1s ease;
}

.review-options-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.review-options-item:focus-visible {
    outline: 2px solid rgba(var(--kos-accent-rgb), 0.45);
    outline-offset: 2px;
}

.review-options-item.active {
    background: rgba(var(--kos-accent-rgb), 0.12);
}

.review-options-item.active:hover {
    background: rgba(var(--kos-accent-rgb), 0.18);
}

.review-options-item.hidden {
    display: none !important;
}

.review-options-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent;
}

.review-options-item.disabled:hover {
    background: transparent;
}

/* Ensure disabled items don't appear selected even if marked active */
.review-options-item.disabled.active {
    background: transparent;
}

.review-options-item.disabled .review-options-item-label {
    color: var(--text-muted, #6b7280);
}

.review-options-item.disabled .review-options-item-check {
    opacity: 0 !important;
}

/* Forced-on state: disabled but shows as active (e.g., Names mode where audio is mandatory) */
.review-options-item.disabled.forced-on {
    opacity: 0.6;
    background: rgba(var(--kos-accent-rgb), 0.08);
}

.review-options-item.disabled.forced-on .review-options-item-label {
    color: rgba(var(--kos-accent-rgb), 0.7);
}

.review-options-item.disabled.forced-on .review-options-item-check {
    opacity: 0.7 !important;
    transform: scale(1);
}

.review-options-item-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #9ca3af);
    white-space: nowrap;
    transition: color 0.15s ease;
}

.review-options-item.active .review-options-item-label {
    color: rgba(var(--kos-accent-rgb), 1);
}

/* Checkmark for active items */
.review-options-item-check {
    width: 14px;
    height: 14px;
    color: rgba(var(--kos-accent-rgb), 0.9);
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.review-options-item.active .review-options-item-check {
    opacity: 1;
    transform: scale(1);
}

/* Toggle button inside items with separate gear action */
.review-options-item-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.review-options-item-toggle:focus-visible {
    outline: 2px solid rgba(var(--kos-accent-rgb), 0.45);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Actions container for items with gear button */
.review-options-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Gear button for settings */
.review-options-gear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-muted, #6b7280);
    opacity: 0.5;
    transition: all 0.15s ease;
}

.review-options-gear svg {
    width: 14px;
    height: 14px;
}

.review-options-gear:hover {
    opacity: 1;
    color: rgba(var(--kos-accent-rgb), 0.9);
    background: rgba(var(--kos-accent-rgb), 0.1);
}

.review-options-gear:focus-visible {
    outline: 2px solid rgba(var(--kos-accent-rgb), 0.45);
    outline-offset: 1px;
    opacity: 1;
}

.review-options-item.active .review-options-gear {
    opacity: 0.7;
}

.review-options-item.active .review-options-gear:hover {
    opacity: 1;
}

/* Compact reusable mode-setting popover */
@keyframes review-mode-setting-in {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(0.975);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.review-mode-setting-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(3px);
}

.review-mode-setting-popover {
    width: min(380px, calc(100vw - 32px));
    max-height: min(660px, calc(100vh - 32px));
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 92px),
        #141414;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.62),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    padding: 10px;
    animation: review-mode-setting-in 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.review-mode-setting-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 6px 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    margin-bottom: 8px;
}

.review-mode-setting-heading {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.review-mode-setting-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.14);
    border: 1px solid rgba(var(--kos-accent-rgb, 34, 197, 94), 0.32);
    color: var(--kos-accent, #22c55e);
    flex: 0 0 auto;
}

.review-mode-setting-mark svg {
    width: 16px;
    height: 16px;
}

.review-mode-setting-copy {
    min-width: 0;
}

.review-mode-setting-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #f3f4f6);
    letter-spacing: 0;
    line-height: 1.25;
}

.review-mode-setting-subtitle {
    margin-top: 2px;
    color: var(--text-secondary, #9ca3af);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.35;
}

.review-mode-setting-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.review-mode-setting-close svg {
    width: 14px;
    height: 14px;
}

.review-mode-setting-close:hover,
.review-mode-setting-close:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #f3f4f6);
    outline: none;
}

.review-mode-setting-list {
    display: grid;
    gap: 5px;
}

.review-mode-setting-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 38px;
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-secondary, #9ca3af);
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}

.review-mode-setting-row:hover,
.review-mode-setting-row:focus-visible {
    border-color: var(--mode-line);
    background: var(--mode-soft);
    color: var(--text-primary, #f3f4f6);
    outline: none;
}

.review-mode-setting-row:active {
    transform: scale(0.99);
}

.review-mode-setting-row.is-active {
    border-color: var(--mode-line);
    background:
        linear-gradient(90deg, var(--mode-soft), rgba(255, 255, 255, 0.035));
    color: var(--text-primary, #f3f4f6);
}

.review-mode-setting-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--mode-soft);
    border: 1px solid var(--mode-line);
    color: var(--mode-color);
    font-size: 13px;
    font-weight: 750;
    line-height: 1;
}

.review-mode-setting-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
}

.review-mode-setting-state {
    min-width: 32px;
    text-align: center;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted, #6b7280);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
}

.review-mode-setting-row.is-active .review-mode-setting-state {
    background: var(--mode-soft);
    color: var(--mode-color);
}

.review-mode-setting-footer {
    margin-top: 9px;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-secondary, #9ca3af);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.45;
}

.review-mode-setting-footer-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 2px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.review-mode-setting-footer-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-secondary, #9ca3af);
    font-size: 11px;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}

.review-mode-setting-footer-action:hover,
.review-mode-setting-footer-action:focus-visible {
    border-color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.34);
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.1);
    color: var(--text-primary, #f3f4f6);
    outline: none;
}

.review-mode-setting-footer-action:active {
    transform: scale(0.99);
}

.review-mode-setting-footer-action.is-active {
    border-color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.48);
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.16);
    color: var(--kos-accent, #22c55e);
}

@media (prefers-reduced-motion: reduce) {
    .review-mode-setting-popover {
        animation: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SRS Status Indicators for Association Pills
   ═══════════════════════════════════════════════════════════════════════════════ */

.srs-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

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

.srs-time {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    min-width: 20px;
}

/* SRS dot colors */
.srs-dot.srs-scheduled { background-color: #22c55e; }
.srs-dot.srs-due { background-color: #f97316; }
.srs-dot.srs-overdue { background-color: #ef4444; }
.srs-dot.srs-new { background-color: #3b82f6; }
.srs-dot.srs-unscheduled { background-color: #9ca3af; }

/* Pulse animation for due/overdue items */
.srs-indicator .srs-dot.srs-due,
.srs-indicator .srs-dot.srs-overdue {
    animation: srs-pulse 2s ease-in-out infinite;
}

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

/* Mini SRS dots for inline pills */
.assoc-pill .srs-mini-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 3px;
    vertical-align: middle;
}

.assoc-pill.srs-scheduled .srs-mini-dot { background-color: #22c55e; }
.assoc-pill.srs-due .srs-mini-dot { background-color: #f97316; }
.assoc-pill.srs-overdue .srs-mini-dot { background-color: #ef4444; }
.assoc-pill.srs-new .srs-mini-dot { background-color: #3b82f6; }
.assoc-pill.srs-unscheduled .srs-mini-dot { background-color: #9ca3af; }

/* 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: 0;
    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;
    padding-right: 0.25rem;
}

/* Toolbar — sticky at top of scroll area */
#review-session-modal.workspace-mode .rw-ai-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 0.375rem 0;
    border-bottom: 1px solid rgba(63, 63, 70, 0.3);
    background: var(--color-bg, #0a0a0e);
}

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

/* Sub-tab bar for MC explanations */
#review-session-modal.workspace-mode .rw-ai-subtabs {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(63, 63, 70, 0.5);
    margin-bottom: 0;
    flex-shrink: 0;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

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

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

/* Context header: inline in subtab bar, shows target text on secondary tabs */
#review-session-modal.workspace-mode .rw-ai-context-header {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

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

#review-session-modal.workspace-mode .rw-ai-context-sep {
    color: rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
    font-size: 0.625rem;
}

#review-session-modal.workspace-mode .rw-ai-context-detail {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.35);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    font-family: 'Noto Sans JP', system-ui, sans-serif;
}

#review-session-modal.workspace-mode .rw-ai-subtab {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3125rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 500;
    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;
    white-space: nowrap;
    max-width: 10rem;
    flex-shrink: 0;
}

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

/* Active state uses mode color via CSS variable */
#review-session-modal.workspace-mode .rw-ai-subtab.active {
    background: color-mix(in srgb, var(--subtab-mode-color, #22c55e) 15%, transparent);
    color: var(--subtab-mode-color, #22c55e);
    border-color: color-mix(in srgb, var(--subtab-mode-color, #22c55e) 40%, transparent);
}

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

#review-session-modal.workspace-mode .rw-ai-subtab.disabled-loading {
    pointer-events: none;
    opacity: 0.45;
}

/* Mode-colored dot in main tab */
.rw-ai-subtab-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Truncated text in pills */
.rw-ai-subtab-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Noto Sans JP', system-ui, sans-serif;
    font-weight: 500;
}

/* Number prefix in MC/grammar pills */
.rw-ai-subtab-num {
    opacity: 0.5;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.625rem;
    flex-shrink: 0;
}

/* ── Subtab identity borders ── */

/* Main item tab: mode color border */
#review-session-modal.workspace-mode .rw-ai-subtab[data-subtab="main"] {
    border-color: color-mix(in srgb, var(--subtab-mode-color, #22c55e) 40%, transparent);
}

/* MC option tabs: cool blue */
#review-session-modal.workspace-mode .rw-ai-subtab-mc:not(.rw-ai-subtab-ge, :disabled) {
    border-color: rgba(59, 130, 246, 0.25);
}

/* Grammar example tabs: warm amber */
#review-session-modal.workspace-mode .rw-ai-subtab-mc.rw-ai-subtab-ge:not(:disabled) {
    border-color: rgba(250, 204, 21, 0.25);
}

/* MC/grammar subtabs — pill shape, compact */
#review-session-modal.workspace-mode .rw-ai-subtab-mc {
    max-width: 8rem;
    flex-shrink: 0;
}

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

/* 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;
}

/* Explanation Blur State - clean text obfuscation */
#review-session-modal.workspace-mode #ai-response-area.explanation-blurred {
    pointer-events: none;
    user-select: none;
    color: transparent;
    text-shadow: 0 0 8px rgba(var(--text-primary-rgb, 200, 200, 200), 0.5);
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

/* Blur inherits to all nested text */
#review-session-modal.workspace-mode #ai-response-area.explanation-blurred * {
    color: transparent !important;
    text-shadow: 0 0 8px rgba(var(--text-primary-rgb, 200, 200, 200), 0.5);
}

/* Keep structural elements like bullets visible but muted */
#review-session-modal.workspace-mode #ai-response-area.explanation-blurred li::marker {
    color: rgba(var(--text-secondary-rgb, 150, 150, 150), 0.3);
}

/* Blur toggle button in toolbar */
#review-session-modal.workspace-mode .explain-blur-toggle {
    min-width: 2.5rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}

/* blur-active class kept for JS toggle but no extra visual treatment —
   action-oriented text ("Show"/"Blur") is sufficient */

/* 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: var(--kos-modal-backdrop-bg, rgba(3, 3, 5, 0.72)) !important;
    backdrop-filter: var(--kos-modal-backdrop-filter, blur(6px));
    -webkit-backdrop-filter: var(--kos-modal-backdrop-filter, blur(6px));
}

/* 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);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MC Answer States - Rainbow Success / Vivid Danger (shared across modes)
   Echoes the hero-spotlight effect from question introduction
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Correct answer - rainbow border echoing hero-spotlight (both modes) */
#review-session-modal .option-btn.bg-success {
    --answer-rainbow-angle: 0deg;
    border-radius: 10px !important;
    border: 2px solid transparent !important;
    background:
        linear-gradient(var(--color-bg-secondary, #1a1a1f), var(--color-bg-secondary, #1a1a1f)) padding-box,
        conic-gradient(
            from var(--answer-rainbow-angle),
            #3B82F6, #10B981, #FACC15, #EC4899, #2DD4BF, #C084FC, #3B82F6
        ) border-box !important;
    box-shadow:
        0 0 20px rgba(59, 130, 246, 0.25),
        0 0 40px rgba(16, 185, 129, 0.15),
        inset 0 0 20px rgba(34, 197, 94, 0.05) !important;
    animation: answer-rainbow-rotate 3s linear infinite, answer-glow-pulse 2s ease-in-out infinite !important;
    color: #fff !important;
}

#review-session-modal .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;
}

#review-session-modal #review-actions.has-auto-next-status {
    flex-direction: column;
    align-items: center;
    gap: 0 !important;
}

#review-session-modal #review-actions.has-auto-next-status .mc-feedback-footer {
    width: 100%;
}

#review-session-modal .auto-next-status {
    display: block;
    max-width: min(20rem, 100%);
    min-height: 0.875rem;
    margin-top: 0.35rem;
    padding: 0;
    color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.68);
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    text-transform: none;
}

#review-session-modal .auto-next-status-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: opacity 0.14s ease, transform 0.14s ease;
}

#review-session-modal .auto-next-status.is-changing .auto-next-status-label {
    opacity: 0.45;
    transform: translateY(1px);
}

/* Incorrect answer - red border glow, dark interior (both modes) */
#review-session-modal .option-btn.bg-danger {
    border-radius: 10px !important;
    border: 2px solid #ef4444 !important;
    /* Use hardcoded dark background - the red glow effect requires dark interior in both themes */
    background: #1a1a1f !important;
    box-shadow:
        0 0 0 1px rgba(239, 68, 68, 0.3),
        0 0 20px rgba(239, 68, 68, 0.35),
        0 0 40px rgba(239, 68, 68, 0.15),
        inset 0 0 30px rgba(239, 68, 68, 0.08) !important;
    color: #fff !important;
}

#review-session-modal .option-btn.bg-danger .option-number {
    background: rgba(239, 68, 68, 0.25) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    /* Use darker red for better contrast on semi-transparent red background */
    color: #f87171 !important;
    text-shadow: none;
}

#review-session-modal .option-btn.mc-wrong-source-annotated .option-text {
    display: block;
    min-width: 0;
    flex: 1 1 auto;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

#review-session-modal .mc-wrong-source-prefix {
    display: inline-flex;
    align-items: baseline;
    max-width: 100%;
    margin-right: 0.45rem;
    vertical-align: baseline;
    white-space: nowrap;
}

#review-session-modal .mc-wrong-source-item {
    appearance: none;
    display: inline-block;
    max-width: min(18ch, 42vw);
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    padding: 0.08rem 0.42rem 0.12rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font: inherit;
    font-weight: 800;
    letter-spacing: 0;
    line-height: inherit;
    cursor: pointer;
    vertical-align: baseline;
}

#review-session-modal .mc-wrong-source-item:hover,
#review-session-modal .mc-wrong-source-item:focus-visible {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.22);
    outline: none;
}

#review-session-modal .mc-wrong-source-item:focus-visible {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
}

#review-session-modal .mc-wrong-source-reading {
    margin-left: 0.32rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78em;
    font-weight: 600;
}

#review-session-modal .mc-wrong-source-divider {
    margin-right: 0.45rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 700;
}

/* ── MC Options Collapse (Desktop) ─────────────────────────────
   After answer, hide irrelevant distractors to surface pitch accent
   and grading controls without scrolling.
   
   Uses CSS Grid grid-template-rows: 0fr technique for GPU-accelerated
   smooth collapse animation (no layout thrashing like max-height). */

/* Wrapper provides the smooth height collapse via grid-template-rows */
#review-session-modal .mc-option-wrap {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.28s ease-out,
                margin-top 0.28s ease-out;
}

/* Inner button must have overflow:hidden and min-height:0 for 0fr to work */
#review-session-modal .mc-option-wrap > .option-btn {
    overflow: hidden;
    min-height: 0;
    transition: opacity 0.2s ease-out;
}

/* Collapsed state - height smoothly goes to 0 */
#review-session-modal .mc-option-wrap.mc-collapse {
    grid-template-rows: 0fr;
}

#review-session-modal .mc-option-wrap.mc-collapse > .option-btn {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.22s ease-out, visibility 0s linear 0.22s;
}

/* Visible state - ensures smooth expansion */
#review-session-modal .mc-option-wrap.mc-visible > .option-btn {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease-in 0.05s, visibility 0s linear 0s;
}

/* Collapse the grid gap when answered. Must be 0 — after Phase 2 applies
   display:none on collapsed items, gap:0 ensures no residual spacing. */
#review-session-modal .mc-options-answered {
    gap: 0 !important;
    transition: gap 0.28s ease-out;
}

/* Wrong-answer case: spacing between the two visible items (wrong pick + correct).
   After Phase 2 display:none, collapsed items between them are gone, so the
   general sibling combinator (~) correctly targets the second visible wrapper. */
#review-session-modal .mc-options-answered .mc-option-wrap.mc-visible ~ .mc-option-wrap.mc-visible {
    margin-top: 0.5rem;
}

/* "Show other choices" link */
#review-session-modal .mc-show-others {
    display: block;
    text-align: center;
    margin: 0.25rem 0 0;
    padding: 0;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease-in;
    user-select: none;
}

#review-session-modal .mc-show-others.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#review-session-modal .mc-show-others:hover {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
    #review-session-modal .mc-option-wrap,
    #review-session-modal .mc-option-wrap > .option-btn,
    #review-session-modal .mc-option-wrap.mc-collapse > .option-btn,
    #review-session-modal .mc-option-wrap.mc-visible > .option-btn,
    #review-session-modal .mc-options-answered,
    #review-session-modal .mc-show-others {
        transition: none;
    }
}

/* 1. Header Section - KanjiOS Terminal Bar */
#review-session-modal.workspace-mode #review-content-wrapper > .text-center.mb-2,
#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-2::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-2::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;
}

/* Pressable pill generic styles (for other UI elements if needed) */
#review-session-modal .pressable-pill {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.06);
    border: 1px solid rgba(var(--kos-accent-rgb, 34, 197, 94), 0.2);
    border-radius: 6px;
    color: var(--kos-accent, #22c55e);
    padding: 0.375rem 0.75rem;
    transition: all 0.2s ease;
}

#review-session-modal .pressable-pill:hover {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.12);
    border-color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.35);
}

/* MC TTS replay button on correct option */
#review-session-modal .mc-tts-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
}
#review-session-modal .mc-tts-btn:hover { opacity: 1; }
#review-session-modal .mc-tts-btn svg {
    width: 14px;
    height: 14px;
    stroke: var(--kos-accent, #22c55e);
    flex-shrink: 0;
}

/* MC Copy button icon - explicit styling for visibility */
#review-session-modal .mc-copy-icon {
    width: 14px;
    height: 14px;
    stroke: var(--kos-accent, #22c55e);
    flex-shrink: 0;
}

#review-session-modal .pressable-pill:hover .mc-copy-icon {
    stroke: var(--kos-accent, #22c55e);
}

/* Review action buttons - unified KanjiOS style */
.review-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.06);
    border: 1px solid rgba(var(--kos-accent-rgb, 34, 197, 94), 0.2);
    border-radius: 6px;
    color: var(--kos-accent, #22c55e);
    padding: 0.5rem 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.review-action-btn:hover:not(:disabled) {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.12);
    border-color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.35);
}

.review-action-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.review-action-btn-primary {
    background: var(--kos-accent, #22c55e);
    border-color: var(--kos-accent, #22c55e);
    color: #000;
    padding: 0.625rem 1.25rem;
}

.review-action-btn-primary:hover:not(:disabled) {
    background: var(--kos-accent-hover, #16a34a);
    border-color: var(--kos-accent-hover, #16a34a);
}

.review-action-btn-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* MC feedback footer: Continue dead-center, replay/volume left, Edit right */
.mc-feedback-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}
.mc-feedback-left {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.mc-feedback-right {
    justify-self: start;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
/* Compact replay button with kbd hint */
.mc-feedback-replay {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    border: 1px solid var(--kos-border, rgba(255,255,255,0.1));
    background: var(--kos-bg-tertiary, rgba(255,255,255,0.05));
    color: var(--kos-accent, #22c55e);
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    flex-shrink: 0;
    height: 1.75rem;
}
.mc-feedback-replay:hover { background: var(--kos-bg-secondary, rgba(255,255,255,0.08)); }
.mc-feedback-replay:active,
.mc-feedback-replay.active,
.mc-feedback-replay.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;
}
.mc-feedback-replay-kbd {
    font-size: 0.6rem;
    font-family: inherit;
    color: var(--kos-text-muted, rgba(255,255,255,0.4));
    line-height: 1;
}
/* Compact inline volume slider */
.mc-feedback-vol {
    width: 3.5rem;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--kos-border, rgba(255,255,255,0.1));
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.mc-feedback-vol:hover { opacity: 1; }
.mc-feedback-vol::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--kos-accent, #22c55e);
    cursor: pointer;
}
.mc-feedback-vol::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--kos-accent, #22c55e);
    border: none;
    cursor: pointer;
}
/* Narrow screens: collapse to centered single row */
@media (max-width: 480px) {
    .mc-feedback-footer {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
}

.review-action-kbd {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.15);
    color: inherit;
    opacity: 0.7;
}

.review-action-btn-primary .review-action-kbd {
    background: rgba(0, 0, 0, 0.2);
}

/* Review feedback status - KanjiOS style */
.review-feedback-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
}

.review-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.review-status-correct {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.review-status-incorrect {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.review-timing-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.review-timing-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.review-timing-desc {
    color: var(--color-text-secondary, #9ca3af);
    font-weight: 400;
}

.review-timing-quality {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.review-quality-again { color: #ef4444; }
.review-quality-hard { color: #f59e0b; }
.review-quality-good { color: #22c55e; }
.review-quality-easy { color: #3b82f6; }

/* ===== MC Performance Timer Border ===== */

/*
 * Instant appear / clockwise wipe-off, driven by JS custom properties.
 *
 * --timer-color : current performance-zone color (blue→green→orange→red)
 * --wipe-angle  : 0deg = full ring visible, 360deg = fully wiped away
 *
 * Appear: ring fades in quickly (0.3s)
 * Steady: full ring, color shifts with elapsed time
 * Death:  JS drives --wipe-angle 0→360 (clockwise erase), then cleanup
 */

/* Reserve border space so there's no layout shift on activation */
#mc-options-grid {
    border: 2px solid transparent;
    border-radius: 0.75rem;
}
#review-session-modal.workspace-mode #mc-options-grid {
    padding: 0.75rem;
}

#mc-options-grid.mc-timer-active {
    position: relative;
}

#mc-options-grid.mc-timer-active::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 0.75rem;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        transparent var(--wipe-angle, 0deg),
        var(--timer-color, #3b82f6) var(--wipe-angle, 0deg),
        var(--timer-color, #3b82f6) 360deg
    );
    opacity: 0.7;
    filter: blur(4px);
    z-index: 10;
    pointer-events: none;
    animation: mc-timer-fadein 0.3s ease forwards;

    /* Mask: show only a ring, cut out the interior */
    -webkit-mask:
        linear-gradient(#fff, #fff) content-box,
        linear-gradient(#fff, #fff);
    -webkit-mask-composite: xor;
    mask:
        linear-gradient(#fff, #fff) content-box,
        linear-gradient(#fff, #fff);
    mask-composite: exclude;
    padding: 8px;
}

@keyframes mc-timer-fadein {
    from { opacity: 0; }
    to   { opacity: 0.7; }
}

/* Gentle pulse when in Again zone (>20s) */
@keyframes mc-timer-border-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.4; }
}
#mc-options-grid.mc-timer-again::before {
    animation: mc-timer-border-pulse 1.5s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    #mc-options-grid.mc-timer-active::before { filter: none; opacity: 0.3; animation: none; }
    #mc-options-grid.mc-timer-again::before { animation: none; }
    .card-perf-badge,
    .card-perf-badge #card-perf-value {
        transition: none !important;
    }
    .card-perf-badge.perf-counting .perf-hand { animation: none !important; }
}

/* ===== Card Performance Badge — per-card timer pill ===== */

.card-perf-badge {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    min-width: 80px;
    justify-content: center;
}

/* Zero state + counting: text always softly blurred until reveal */
.card-perf-badge #card-perf-value {
    filter: blur(3px);
    opacity: 0.35;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

/* Post-answer: text snaps into focus */
.card-perf-badge.perf-revealed #card-perf-value {
    filter: none;
    opacity: 1;
    transition: filter 0.15s ease, opacity 0.15s ease;
}

.card-perf-badge.perf-easy  { border-color: #3b82f6; box-shadow: 0 0 12px rgba(59, 130, 246, 0.25); }
.card-perf-badge.perf-good  { border-color: #22c55e; box-shadow: 0 0 12px rgba(34, 197, 94, 0.25); }
.card-perf-badge.perf-hard  { border-color: #f59e0b; box-shadow: 0 0 12px rgba(245, 158, 11, 0.25); }
.card-perf-badge.perf-again { border-color: #ef4444; box-shadow: 0 0 12px rgba(239, 68, 68, 0.25); }

/* Stopwatch hand animation — spins while counting, stops on reveal */
.card-perf-badge .perf-hand { transform-origin: 12px 13px; }
.card-perf-badge.perf-counting .perf-hand {
    animation: perf-spin 3s linear infinite;
}
.card-perf-badge.perf-revealed .perf-hand { animation: none; }
@keyframes perf-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ===== ETA Analog Clock ===== */

.eta-clock-icon { opacity: 0.35; transition: opacity 0.4s ease; }
.eta-clock-icon.eta-active { opacity: 1; }

.eta-clock-icon .eta-hour-hand,
.eta-clock-icon .eta-minute-hand {
    transform-origin: 12px 12px;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.eta-clock-icon.no-transition .eta-hour-hand,
.eta-clock-icon.no-transition .eta-minute-hand {
    transition: none;
}

@media (prefers-reduced-motion: reduce) {
    .eta-clock-icon,
    .eta-clock-icon .eta-hour-hand,
    .eta-clock-icon .eta-minute-hand {
        transition: none !important;
    }
}

/* Threshold tooltip — rendered as fixed via JS to escape overflow clipping */
.card-perf-tooltip {
    display: none;
    position: fixed;
    min-width: 200px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(10, 10, 14, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.6875rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
}

/* Arrow pointing up */
.card-perf-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.card-perf-tooltip.tt-visible {
    display: block;
}

.card-perf-tooltip .tt-row {
    display: flex;
    justify-content: space-between;
    gap: 24px;
}

.card-perf-tooltip .tt-label { opacity: 0.5; text-transform: uppercase; letter-spacing: 0.05em; }
.card-perf-tooltip .tt-val { font-weight: 600; }
.card-perf-tooltip .tt-val.tt-easy   { color: #3b82f6; }
.card-perf-tooltip .tt-val.tt-good   { color: #22c55e; }
.card-perf-tooltip .tt-val.tt-hard   { color: #f59e0b; }
.card-perf-tooltip .tt-val.tt-again  { color: #ef4444; }
.card-perf-tooltip .tt-actual { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.08); }
.card-perf-tooltip .tt-note { margin-bottom: 6px; font-size: 0.6rem; opacity: 0.35; font-style: italic; text-align: center; }

/* Review details card - KanjiOS style */
.review-details-card {
    max-width: 28rem;
    margin: 0 auto;
    text-align: left;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
}

.review-details-header {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.5625rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-secondary, #9ca3af);
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.review-details-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.375rem 1rem;
    font-size: 0.8125rem;
}

.review-details-label {
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--color-text-secondary, #9ca3af);
    text-transform: uppercase;
}

.review-details-value {
    color: var(--color-text, #e5e7eb);
    font-weight: 500;
}

/* Review examples section */
.review-examples-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

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

/* Scrollable examples - shows 3 items before scrolling */
.review-examples-scrollable {
    max-height: calc(3 * 2.75rem + 2 * 0.5rem); /* 3 items (~44px each) + 2 gaps */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.review-examples-scrollable::-webkit-scrollbar {
    width: 4px;
}

.review-examples-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.review-examples-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.review-examples-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.review-example-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.625rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    font-size: 0.875rem;
    min-height: 2.5rem;
}

.review-example-text {
    flex: 1;
    display: block;
    min-width: 0;
    color: var(--color-text, #e5e7eb);
    line-height: 1.5;
}

.review-example-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.375rem;
    flex-shrink: 0;
}

/* Smart markdown pills within examples */
.review-example-text .smart-pill {
    font-size: 0.8125rem;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    cursor: pointer;
}

.review-example-text .smart-pill:hover {
    text-decoration: underline;
}

.review-example-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 4px;
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.08);
    border: 1px solid rgba(var(--kos-accent-rgb, 34, 197, 94), 0.2);
    color: var(--kos-accent, #22c55e);
    transition: all 0.15s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.review-example-play:hover {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.15);
    border-color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.35);
}

/* Review associations section */
.review-associations {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* 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 {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    padding: 1.5rem 2.5rem !important; /* Restore padding for answers, extra horizontal breathing room */
    margin-bottom: 0 !important;
    width: 100% !important;
}

/* 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 — constrained by vw AND vh to avoid
   wrapping on narrow/short viewports (1080p etc.) */
#review-session-modal.workspace-mode .rw-main .hero-glyph {
    font-size: min(
        calc(var(--dynamic-font-size, 1em) * 1.3),
        clamp(2rem, min(8vw, 12vh), 8rem)
    ) !important;
    line-height: 1.05 !important;
    margin-bottom: 0.25rem !important;
}

/* Typing/production hero — same boost as MC hero glyph */
#review-session-modal.workspace-mode .rw-main .typing-hero-glyph {
    font-size: min(
        calc(var(--dynamic-font-size, 1em) * 1.3),
        clamp(3rem, min(10vw, 14vh), 9rem)
    ) !important;
    line-height: 1.05 !important;
}

#review-session-modal.workspace-mode .rw-main .production-hero-meaning {
    font-size: min(
        calc(var(--dynamic-font-size, 1em) * 1.2),
        clamp(1.5rem, min(6vw, 8vh), 4rem)
    ) !important;
    line-height: 1.15 !important;
}

/* Clickable hero glyph after answer - visual feedback */
#review-session-modal .hero-glyph[style*="cursor: pointer"] {
    transition: opacity 0.15s ease, transform 0.15s ease;
}

#review-session-modal .hero-glyph[style*="cursor: pointer"]:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

#review-session-modal .hero-glyph[role="button"]:focus-visible {
    outline: 2px solid var(--color-accent, #22c55e);
    outline-offset: 4px;
    border-radius: 4px;
}

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

/* 2b. Controls Bar — fixed in the footer, holds Replay / Volume / A-/A+ / Peek + hint */
#review-controls-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}
#review-controls-bar.hidden { display: none; }

/* Override the 6px border-radius from #review-session-modal .pressable-pill
   so that replay / peek buttons in the controls bar stay fully rounded */
#review-controls-bar .pressable-pill,
#review-session-modal .footer-actions-row > .pressable-pill { border-radius: 9999px; }

.review-controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.review-controls-hint {
    font-size: 0.7rem;
    color: var(--text-muted, #71717a);
    opacity: 0.55;
    text-align: center;
    line-height: 1.2;
}

#review-session-modal.workspace-mode #review-controls-bar {
    padding: 0.5rem 1.5rem 0.375rem;
    margin: 0 0.75rem;
    border-radius: 8px 8px 0 0;
    border: 1px solid rgba(34, 197, 94, 0.08);
    border-bottom: none;
    background: linear-gradient(180deg, rgba(15, 15, 17, 0.7) 0%, rgba(10, 10, 12, 0.75) 100%);
}

#review-session-modal:not(.workspace-mode) #review-controls-bar {
    padding: 0.375rem 1rem 0.25rem;
    background: transparent;
}

/* Footer compact mode — triggered when the row wraps */
.label-compact { display: none; }
.footer-compact .label-full { display: none; }
.footer-compact .label-compact { display: inline; }
.footer-compact .typing-action-btn { padding: 0 0.625rem; }
.footer-compact .review-vol-pill { width: 3rem; }
.footer-compact .review-vol-vertical { width: 2.5rem; }

/* Collapse the actions box when empty (controls bar already shows hint) */
#review-session-modal #review-actions:empty {
    display: none !important;
}

/* Volume slider pill — horizontal, compact */
.review-vol-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    height: 2rem;
    border-radius: 9999px;
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    background: var(--bg-tertiary, #27272a);
    opacity: 0.8;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.review-vol-pill:hover { opacity: 1; }

.review-vol-vertical {
    width: 3.5rem;
    height: 0.375rem;
    cursor: pointer;
    accent-color: var(--accent, #3b82f6);
    margin: 0;
    padding: 0;
}

/* 3. Footer Section - KanjiOS Command Bar */
#review-session-modal.workspace-mode #review-actions {
    padding: 0.625rem 1.5rem !important;
    margin: 0 0.75rem 0.5rem 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: 3rem;
    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);
}

/* Note: MC Answer States (bg-success/bg-danger) are now consolidated above in lines ~1845-1893 */

/* 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;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   WORKSPACE TOGGLE BUTTON - Clean pill toggle
   ═══════════════════════════════════════════════════════════════════════════════ */

.workspace-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

/* Simple mode state (showing "Full" button to expand) */
.workspace-toggle-btn.is-simple-mode {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.08);
    border-color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.25);
    color: var(--kos-accent, #22c55e);
}

.workspace-toggle-btn.is-simple-mode:hover {
    background: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.15);
    border-color: rgba(var(--kos-accent-rgb, 34, 197, 94), 0.4);
    box-shadow: 0 0 12px rgba(var(--kos-accent-rgb, 34, 197, 94), 0.2);
}

/* Full mode state (showing "Simple" button to collapse) - more subdued */
.workspace-toggle-btn.is-full-mode {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.55);
}

.workspace-toggle-btn.is-full-mode:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.75);
}

.workspace-toggle-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--kos-accent-rgb, 34, 197, 94), 0.3);
}

.workspace-toggle-btn:active {
    transform: scale(0.97);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   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-press 0.35s ease-out;
}

@keyframes explain-attention-press {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
    }
    30% {
        transform: scale(0.94);
        box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.6);
    }
    60% {
        transform: scale(1.03);
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.7), 0 0 15px rgba(59, 130, 246, 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
    }
}

/* 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 - MC subtab */
#review-session-modal.workspace-mode .rw-ai-subtab.has-cache:not(:disabled, .rw-ai-subtab-ge) {
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.3);
}

/* Cache indicator - grammar example subtab (amber) */
#review-session-modal.workspace-mode .rw-ai-subtab.has-cache.rw-ai-subtab-ge:not(:disabled) {
    border-color: rgba(250, 204, 21, 0.6);
    box-shadow: 0 0 6px rgba(250, 204, 21, 0.2);
}

/* 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); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   AI Explain Button - TypeWriter Animation
   Smooth haiku typing animation on the button itself
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Icon base state - visible with transition */
.btn-ai-explain .btn-ai-icon {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Fade out icon across all loading states (haiku takes its place) */
.btn-ai-explain.loading .btn-ai-icon,
.btn-ai-explain.loading-slow .btn-ai-icon,
.btn-ai-explain.loading-critical .btn-ai-icon {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Button label styling for TypeWriter */
.btn-ai-explain .btn-ai-label {
    display: inline-block;
    font-family: "Hiragino Sans", "Hiragino Kaku Gothic Pro", "Yu Gothic", "Meiryo", system-ui, sans-serif;
    max-width: 80%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Brighter text when loading (match Item Detail) */
.btn-ai-explain.loading .btn-ai-label {
    color: #93c5fd;
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

/* State-based button color transitions */
.btn-ai-explain.loading-slow {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.1);
}

.btn-ai-explain.loading-slow .btn-ai-label {
    color: #fcd34d;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.btn-ai-explain.loading-critical {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
}

.btn-ai-explain.loading-critical .btn-ai-label {
    color: #fca5a5;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.btn-ai-explain.success {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.15);
}

.btn-ai-explain.success .btn-ai-label {
    color: #86efac;
    text-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

/* Smooth transitions for all button states */
.btn-ai-explain {
    transition: border-color 0.4s ease, background 0.4s ease, opacity 0.3s ease;
}

.btn-ai-explain .btn-ai-label {
    transition: color 0.4s ease, text-shadow 0.4s ease;
}

/* 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;
}

/* Let the intro rainbow spotlight own the hero edge treatment while it is active. */
#review-session-modal.workspace-mode .hero-spotlight:not(.spotlight-done) .hero-glyph.hero-scanning::before,
#review-session-modal.workspace-mode .hero-spotlight:not(.spotlight-done) .hero-glyph.hero-scanning::after {
    display: none;
}

#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);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Grammar Example Scanner Animation
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Base scanning state */
.review-example-item.ge-scanning {
    position: relative;
    align-items: flex-start;
    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);
    overflow: hidden;
}

/* Hide action buttons while scanning */
.review-example-item.ge-scanning .review-example-actions {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Corner reticles */
.review-example-item.ge-scanning::before,
.review-example-item.ge-scanning::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    pointer-events: none;
    opacity: 0.4;
    z-index: 1;
}

.review-example-item.ge-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;
}

.review-example-item.ge-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;
}

/* ── Yellow (Slow) ── */
.review-example-item.ge-scanning.ge-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-example-item.ge-scanning.ge-scanning-slow::before {
    border-top-color: #f59e0b;
    border-left-color: #f59e0b;
}
.review-example-item.ge-scanning.ge-scanning-slow::after {
    border-bottom-color: #f59e0b;
    border-right-color: #f59e0b;
}
.review-example-item.ge-scanning.ge-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);
}

/* ── Red (Critical) ── */
.review-example-item.ge-scanning.ge-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-example-item.ge-scanning.ge-scanning-critical::before {
    border-top-color: #ef4444;
    border-left-color: #ef4444;
}
.review-example-item.ge-scanning.ge-scanning-critical::after {
    border-bottom-color: #ef4444;
    border-right-color: #ef4444;
}
.review-example-item.ge-scanning.ge-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);
}

/* ── Green (Success) ── */
.review-example-item.ge-scanning.ge-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-example-item.ge-scanning.ge-scanning-success::before {
    border-top-color: #22c55e;
    border-left-color: #22c55e;
}
.review-example-item.ge-scanning.ge-scanning-success::after {
    border-bottom-color: #22c55e;
    border-right-color: #22c55e;
}
.review-example-item.ge-scanning.ge-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);
}

/* Reduced motion: disable grammar example scanner animations */
@media (prefers-reduced-motion: reduce) {
    .review-example-item.ge-scanning::before,
    .review-example-item.ge-scanning::after {
        animation: none;
    }
    .review-example-item.ge-scanning .mc-scan-line::after {
        animation: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   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;
}

/* 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
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Shared desktop AI scanner shell for explanation + JP definition */
#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;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   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: #93c5fd;
    font-size: 0.9375rem;
    padding: 0.75rem;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.explain-scanning-text::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(147, 197, 253, 0.3);
    border-top-color: #93c5fd;
    border-radius: 50%;
    animation: explain-spinner 0.8s linear infinite;
    flex-shrink: 0;
}

@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: #fcd34d;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

#detail-explain-display.explain-scanning.explain-scanning-slow .explain-scanning-text::before {
    border-color: rgba(252, 211, 77, 0.3);
    border-top-color: #fcd34d;
}

/* 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: #fca5a5;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

#detail-explain-display.explain-scanning.explain-scanning-critical .explain-scanning-text::before {
    border-color: rgba(252, 165, 165, 0.3);
    border-top-color: #fca5a5;
}

/* 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);
}

/* ─────────────────────────────────────────────────────────────────────────────
   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: text;
    cursor: text;
}

.jpdef-actions {
    display: flex;
    flex-wrap: wrap;
    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); }
}

/* Audio button styling - includes hotkey label */
#detail-jpdef-audio-btn {
    gap: 0.25rem;
}

#detail-jpdef-audio-btn .jpdef-audio-hotkey {
    font-size: 9px;
    opacity: 0.65;
    font-weight: 500;
    margin-left: 1px;
}

/* Explanation scanning visuals reuse the shared desktop AI scanner above. */

/* ═══════════════════════════════════════════════════════════════════════════════
   AI Error Retry State - Used across all AI generation components
   Shows vague apology + auto-countdown for transient failures
   ═══════════════════════════════════════════════════════════════════════════════ */

.ai-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem 1rem;
    min-height: 80px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ai-error-state:hover {
    background-color: rgba(239, 68, 68, 0.05);
}

.ai-error-state:focus-visible {
    outline: 2px solid rgba(239, 68, 68, 0.5);
    outline-offset: 2px;
    background-color: rgba(239, 68, 68, 0.05);
}

.ai-error-message {
    font-size: 0.875rem;
    color: #fca5a5;
    opacity: 0.9;
    text-align: center;
}

.ai-error-retry {
    font-size: 0.75rem;
    color: #f87171;
    opacity: 0.7;
    text-align: center;
}

.ai-error-retry .countdown {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 1ch;
    display: inline-block;
}

/* Subtle pulse animation during countdown */
.ai-error-state.counting .ai-error-retry {
    animation: ai-error-pulse 1s ease-in-out infinite;
}

@keyframes ai-error-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .ai-error-state.counting .ai-error-retry {
        animation: none;
    }
}

/* Error state border styling for containers */
.ai-error-container {
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.5rem;
    background: rgba(239, 68, 68, 0.03);
}

/* Manual retry state (after auto-retry failed) */
.ai-error-state.manual-only .ai-error-retry {
    opacity: 0.5;
}

.ai-error-state.manual-only:hover .ai-error-retry {
    opacity: 0.9;
}

/* 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/Regenerate button - blue */
.explain-actions .explain-retry,
.explain-actions .explain-retry-hold {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

.explain-actions .explain-retry:hover,
.explain-actions .explain-retry-hold:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.6);
}

/* Clear hold button - subtle red */
.explain-actions .explain-clear-hold {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
    color: var(--text-muted, #a1a1aa);
}

.explain-actions .explain-clear-hold:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

/* Clear hold button - subtle red */
.explain-actions .explain-clear-hold {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
    color: var(--text-muted, #a1a1aa);
}

.explain-actions .explain-clear-hold:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

/* 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 */
.explain-content {
    color: var(--text-primary, #fafafa);
    line-height: 1.5;
    font-size: 0.9375rem;
    counter-reset: section;
}

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

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

.explain-content code {
    background: var(--bg-tertiary, #3f3f46);
    color: var(--text-primary, #fafafa);
    padding: 0.125rem 0.3rem;
    border-radius: 3px;
    font-size: 0.875em;
}

/* Top-level ordered list - numbered sections */
.explain-content > ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

.explain-content > ol > li {
    counter-increment: section;
    margin: 0;
    padding: 0.5rem 0 0.625rem;
    border-bottom: 1px solid rgba(63, 63, 70, 0.35);
}

.explain-content > ol > li:first-child {
    padding-top: 0;
}

.explain-content > ol > li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Section number styling */
.explain-content > ol > li::before {
    content: counter(section) ".";
    font-size: 0.75rem;
    font-weight: 600;
    color: #818cf8;
    margin-right: 0.375rem;
    opacity: 0.9;
}

/* Nested bullet lists under sections */
.explain-content > ol > li > ul {
    list-style: none;
    padding: 0;
    margin: 0.3rem 0 0 0;
}

.explain-content > ol > li > ul > li {
    position: relative;
    padding-left: 0.875rem;
    margin: 0.25rem 0;
    color: var(--text-primary, #e4e4e7);
    line-height: 1.5;
}

.explain-content > ol > li > ul > li:first-child {
    margin-top: 0.25rem;
}

.explain-content > ol > li > ul > li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 3px;
    height: 3px;
    background: #52525b;
    border-radius: 50%;
}

/* English translations - secondary styling */
.explain-content p {
    margin: 0.2rem 0 0.35rem;
    color: #6b7280;
    font-size: 0.8125rem;
    line-height: 1.45;
    font-style: italic;
}

.explain-content p:first-child {
    margin-top: 0;
}

/* Translations after bullet points */
.explain-content > ol > li > ul > li + p,
.explain-content > ol > li > p:not(:first-child) {
    margin-left: 0.875rem;
    padding-left: 0.625rem;
    border-left: 1.5px solid #3f3f46;
}

/* Generic list items (fallback) */
.explain-content li {
    color: var(--text-primary, #e4e4e7);
}

/* Deeply nested lists */
.explain-content > ol > li > ul > li ul,
.explain-content > ol > li > ul > li ol {
    padding-left: 0.875rem;
    margin: 0.2rem 0;
}

.explain-content > ol > li > ul > li ul li::before,
.explain-content > ol > li > ul > li ol li::before {
    width: 2px;
    height: 2px;
    background: #3f3f46;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Detail Modal Explanation Content - Flat structure (ol and ul are siblings)
   ═══════════════════════════════════════════════════════════════════════════════ */

#detail-explain-display .explain-content {
    color: var(--text-primary, #fafafa);
    line-height: 1.5;
    font-size: 0.9375rem;
    counter-reset: section;
}

#detail-explain-display .explain-content strong {
    color: var(--accent, #a78bfa);
    font-weight: 600;
}

#detail-explain-display .explain-content code {
    background: var(--bg-tertiary, #3f3f46);
    color: var(--text-primary, #fafafa);
    padding: 0.125rem 0.3rem;
    border-radius: 3px;
    font-size: 0.875em;
}

/* Numbered sections (section headers) - flat ol elements */
#detail-explain-display .explain-content ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

#detail-explain-display .explain-content ol li {
    counter-increment: section;
    position: relative;
    font-weight: 500;
    color: var(--text-primary, #fafafa);
    padding: 0.5rem 0 0.25rem 1.5rem;
    margin: 0;
}

#detail-explain-display .explain-content ol li::before {
    content: counter(section) ".";
    position: absolute;
    left: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #818cf8;
}

/* First ol after content start - no top padding */
#detail-explain-display .explain-content > div > ol:first-child li {
    padding-top: 0;
}

/* Section divider: ol that follows a ul (new section) */
#detail-explain-display .explain-content ul + ol li {
    padding-top: 0.625rem;
    margin-top: 0.375rem;
    border-top: 1px solid rgba(63, 63, 70, 0.35);
}

/* Bullet lists (content under sections) - flat ul elements */
#detail-explain-display .explain-content ul {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0 0;
}

#detail-explain-display .explain-content ul li {
    position: relative;
    padding-left: 0.875rem;
    margin: 0.25rem 0;
    color: var(--text-primary, #e4e4e7);
    line-height: 1.5;
    font-weight: 400;
}

#detail-explain-display .explain-content ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 3px;
    height: 3px;
    background: #52525b;
    border-radius: 50%;
}

/* Paragraphs (subtitles & English translations) - secondary styling */
#detail-explain-display .explain-content p {
    margin: 0.125rem 0 0.2rem;
    color: #6b7280;
    font-size: 0.8125rem;
    line-height: 1.4;
    font-style: italic;
    padding-left: 0.875rem;
}

#detail-explain-display .explain-content p:first-child {
    margin-top: 0;
    padding-left: 0;
}

/* Translations that follow bullet lists get left border */
#detail-explain-display .explain-content ul + p {
    padding-left: 0.625rem;
    margin-left: 0.875rem;
    border-left: 1.5px solid #3f3f46;
}

/* Spacer divs */
#detail-explain-display .explain-content .h-2 {
    height: 0.25rem;
}

/* ===============================================
   Mnemonic Section - Content Styling
   Centered, poetic presentation
   =============================================== */

.mnemonic-content {
    text-align: center;
    font-style: italic;
    font-size: 0.9375rem;
    line-height: 1.8;
    color: var(--text-primary, #fafafa);
    padding: 0.5rem 1rem;
    letter-spacing: 0.01em;
}

.mnemonic-ref {
    display: inline;
    color: #f6d365;
    font-weight: 700;
    font-style: inherit;
    text-decoration-line: underline;
    text-decoration-color: rgba(245, 158, 11, 0.72);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    border-radius: 4px;
    padding: 0 0.04em;
    background: linear-gradient(180deg, transparent 68%, rgba(245, 158, 11, 0.1) 68%);
    cursor: help;
    transition: color 0.15s ease, background-color 0.15s ease, text-decoration-color 0.15s ease;
}

.mnemonic-ref:hover,
.mnemonic-ref:focus-visible {
    color: #ffe08a;
    background-color: rgba(245, 158, 11, 0.08);
    text-decoration-color: rgba(251, 191, 36, 0.9);
}

.mnemonic-ref:focus-visible {
    outline: 2px solid rgba(245, 158, 11, 0.65);
    outline-offset: 2px;
}

.mnemonic-target-kanji {
    display: inline-block;
    position: relative;
    margin-left: 0.14em;
    padding: 0 0.04em;
    vertical-align: -0.22em;
    color: #fef3c7;
    font-family: 'Noto Sans JP', 'Noto Sans CJK JP', 'Hiragino Kaku Gothic Pro', system-ui, sans-serif;
    font-size: 1.78em;
    font-style: normal;
    font-weight: 700;
    line-height: 0.9;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.2), 0 1px 0 rgba(255, 255, 255, 0.14);
    transform: translateZ(0) scale(1);
    transform-origin: center 65%;
    transition: transform 0.18s ease, color 0.18s ease, text-shadow 0.18s ease;
}

.mnemonic-target-kanji:hover,
.mnemonic-target-kanji:focus-visible {
    color: #fff4cf;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.24), 0 1px 0 rgba(255, 255, 255, 0.16);
    transform: translateY(-0.03em) scale(1.13);
}

.mnemonic-target-kanji::after {
    content: '';
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: -0.12em;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.75), transparent);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.16);
    transition: opacity 0.18s ease, box-shadow 0.18s ease;
}

.mnemonic-target-kanji:hover::after,
.mnemonic-target-kanji:focus-visible::after {
    box-shadow: 0 0 7px rgba(245, 158, 11, 0.2);
}

@media (prefers-reduced-motion: reduce) {
    .mnemonic-target-kanji {
        transition: color 0.18s ease, text-shadow 0.18s ease;
    }

    .mnemonic-target-kanji:hover,
    .mnemonic-target-kanji:focus-visible {
        transform: translateZ(0) scale(1);
    }
}

.mnemonic-ref-tip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 88px;
    text-align: center;
}

.mnemonic-ref-tip-char {
    font-family: 'Noto Sans JP', 'Noto Sans CJK JP', 'Hiragino Kaku Gothic Pro', system-ui, sans-serif;
    font-size: 2rem;
    font-weight: 500;
    line-height: 1;
    color: #fef3c7;
}

.mnemonic-ref-tip-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: rgba(251, 191, 36, 0.92);
    text-transform: uppercase;
}

.mnemonic-ref-tip-row {
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.86);
}

.mnemonic-ref-tip-muted {
    color: rgba(255, 255, 255, 0.58);
}


/* ===============================================
   Mnemonic Section - AI Scanning States
   Uses amber/yellow as base color (like the mnemonic gradient)
   =============================================== */

/* Base scanning state for mnemonic display - amber glow */
#detail-mnemonic-display.mnemonic-scanning {
    position: relative;
    outline: 1px solid rgba(245, 158, 11, 0.4);
    outline-offset: -1px;
    box-shadow:
        0 0 12px rgba(245, 158, 11, 0.15),
        inset 0 0 20px rgba(245, 158, 11, 0.03);
    overflow: hidden;
}

/* Corner reticles for mnemonic scanning state */
#detail-mnemonic-display.mnemonic-scanning::before,
#detail-mnemonic-display.mnemonic-scanning::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 0 solid transparent;
    pointer-events: none;
    z-index: 2;
}

/* Top-left reticle - amber */
#detail-mnemonic-display.mnemonic-scanning::before {
    top: 6px;
    left: 6px;
    border-top: 2px solid #f59e0b;
    border-left: 2px solid #f59e0b;
    border-top-left-radius: 2px;
}

/* Bottom-right reticle - amber */
#detail-mnemonic-display.mnemonic-scanning::after {
    bottom: 6px;
    right: 6px;
    border-bottom: 2px solid #f59e0b;
    border-right: 2px solid #f59e0b;
    border-bottom-right-radius: 2px;
}

/* Mnemonic scan line (reuses the shared desktop AI scanner line with amber colors) */
#detail-mnemonic-display .mnemonic-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
    border-radius: inherit;
}

#detail-mnemonic-display .mnemonic-scan-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(245, 158, 11, 0.4) 30%,
        rgba(251, 191, 36, 0.8) 50%,
        rgba(245, 158, 11, 0.4) 70%,
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    animation: mnemonic-scan-sweep 2s ease-in-out infinite;
}

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

/* Mnemonic scanning text - amber theme */
.mnemonic-scanning-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    color: #fcd34d;
    font-size: 0.875rem;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.mnemonic-scanning-text::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(252, 211, 77, 0.3);
    border-top-color: #fcd34d;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Slow state (after ~3s) - transitions to blue */
#detail-mnemonic-display.mnemonic-scanning.mnemonic-scanning-slow {
    outline-color: rgba(59, 130, 246, 0.5);
    box-shadow:
        0 0 12px rgba(59, 130, 246, 0.2),
        inset 0 0 20px rgba(59, 130, 246, 0.03);
}

#detail-mnemonic-display.mnemonic-scanning.mnemonic-scanning-slow::before {
    border-top-color: #3b82f6;
    border-left-color: #3b82f6;
}

#detail-mnemonic-display.mnemonic-scanning.mnemonic-scanning-slow::after {
    border-bottom-color: #3b82f6;
    border-right-color: #3b82f6;
}

#detail-mnemonic-display.mnemonic-scanning.mnemonic-scanning-slow .mnemonic-scan-line::after {
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(59, 130, 246, 0.4) 30%,
        rgba(96, 165, 250, 0.8) 50%,
        rgba(59, 130, 246, 0.4) 70%,
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

#detail-mnemonic-display.mnemonic-scanning.mnemonic-scanning-slow .mnemonic-scanning-text {
    color: #93c5fd;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

#detail-mnemonic-display.mnemonic-scanning.mnemonic-scanning-slow .mnemonic-scanning-text::before {
    border-color: rgba(147, 197, 253, 0.3);
    border-top-color: #93c5fd;
}

/* Critical state (after ~10s) - transitions to red */
#detail-mnemonic-display.mnemonic-scanning.mnemonic-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-mnemonic-display.mnemonic-scanning.mnemonic-scanning-critical::before {
    border-top-color: #ef4444;
    border-left-color: #ef4444;
}

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

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

#detail-mnemonic-display.mnemonic-scanning.mnemonic-scanning-critical .mnemonic-scanning-text {
    color: #fca5a5;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

#detail-mnemonic-display.mnemonic-scanning.mnemonic-scanning-critical .mnemonic-scanning-text::before {
    border-color: rgba(252, 165, 165, 0.3);
    border-top-color: #fca5a5;
}

/* Success state - green flash */
#detail-mnemonic-display.mnemonic-scanning.mnemonic-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-mnemonic-display.mnemonic-scanning.mnemonic-scanning-success::before {
    border-top-color: #22c55e;
    border-left-color: #22c55e;
    opacity: 0.8;
}

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

#detail-mnemonic-display.mnemonic-scanning.mnemonic-scanning-success .mnemonic-scan-line::after {
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(34, 197, 94, 0.5) 30%,
        rgba(74, 222, 128, 0.9) 50%,
        rgba(34, 197, 94, 0.5) 70%,
        transparent 100%
    );
}

/* Error state - red flash */
#detail-mnemonic-display.mnemonic-scanning.mnemonic-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);
}

/* Mnemonic timer text - subtle positioning */
.mnemonic-scanning-time {
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 0.6875rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    color: var(--text-muted, #71717a);
    opacity: 0.7;
    letter-spacing: 0.02em;
}

/* Mnemonic editing state */
#detail-mnemonic-display.mnemonic-editing {
    outline: 2px solid rgba(245, 158, 11, 0.5);
    box-shadow:
        0 0 16px rgba(245, 158, 11, 0.15),
        inset 0 0 20px rgba(245, 158, 11, 0.03);
}

.mnemonic-edit-textarea {
    font-size: 0.9375rem;
    line-height: 1.6;
    min-height: 60px;
    font-family: inherit;
}

.mnemonic-edit-textarea:focus {
    outline: none;
}

#detail-mnemonic-display.mnemonic-save-success {
    outline: 2px solid 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;
}

/* ===============================================
   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--feather {
    background: rgba(45, 212, 191, 0.15);
    border-color: rgba(45, 212, 191, 0.4);
}
.unified-srs-tool-btn:hover .unified-tool-icon--spread {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
}
.unified-srs-tool-btn:hover .unified-tool-icon--reset {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
}
.unified-srs-tool-btn:hover .unified-tool-icon--suspend {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
}

.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;
}

/* Default icon colors */
.unified-tool-icon--feather {
    color: #2dd4bf;
    border-color: rgba(45, 212, 191, 0.25);
}
.unified-tool-icon--spread {
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.25);
}
.unified-tool-icon--reset {
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.25);
}
.unified-tool-icon--suspend {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.25);
}

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

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

.unified-tool-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.35;
}

.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); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   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;
    }
    
}

/* ═══════════════════════════════════════════════════════════════════════════════
   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.hidden {
    display: none;
}

.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
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════════
   SIDEBAR PROFILE HEADER - User identity section
   Dark themed to match the overall aesthetic, but more subdued than HUD elements
   ═══════════════════════════════════════════════════════════════════════════════ */

.sidebar-profile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(39, 39, 42, 0.6);
    border: 1px solid rgba(63, 63, 70, 0.5);
    border-radius: 8px;
}

.sidebar-profile-header .profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

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

.sidebar-profile-header .profile-avatar-initials {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
}

.sidebar-profile-header .profile-info {
    flex: 1;
    min-width: 0;
}

.sidebar-profile-header .profile-name {
    font-size: 13px;
    font-weight: 600;
    color: #fafafa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sidebar-profile-header .profile-email {
    font-size: 11px;
    color: #a1a1aa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-profile-header .tier-badge {
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ATTEMPTS HUD - Hacker tool style counter
   Replaces the old streak display with a cyberpunk-inspired total attempts counter
   ═══════════════════════════════════════════════════════════════════════════════ */

.attempts-hud {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(6, 78, 59, 0.10) 100%);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.attempts-hud:hover {
    border-color: rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(6, 78, 59, 0.15) 100%);
}

/* Scanline overlay effect */
.attempts-hud::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(16, 185, 129, 0.02) 2px,
        rgba(16, 185, 129, 0.02) 4px
    );
    pointer-events: none;
}

/* Subtle glow effect */
.attempts-hud-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.12) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.attempts-hud:hover .attempts-hud-glow {
    opacity: 1;
}

/* Left side: dot + label */
.attempts-hud-left {
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1;
}

.attempts-hud-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: rgba(16, 185, 129, 0.7);
    text-transform: uppercase;
}

/* Blinking status dot */
.attempts-hud-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.5; box-shadow: 0 0 4px rgba(16, 185, 129, 0.5); }
    50% { opacity: 1; box-shadow: 0 0 8px rgba(16, 185, 129, 1); }
}

/* Main counter value - monospace hacker style, right-aligned */
.attempts-hud-value {
    font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 16px;
    font-weight: 600;
    color: #10b981;
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
    letter-spacing: 0.02em;
    z-index: 1;
}

/* Counter increment animation */
@keyframes countUp {
    0% { transform: translateY(4px); opacity: 0.5; }
    50% { transform: translateY(-2px); }
    100% { transform: translateY(0); opacity: 1; }
}

.attempts-hud-value.updating {
    animation: countUp 0.3s ease-out;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MOBILE ATTEMPTS HUD - Compact version for account sheet
   ═══════════════════════════════════════════════════════════════════════════════ */

.mobile-attempts-hud {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(6, 78, 59, 0.15) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    flex-shrink: 0;
}

.mobile-attempts-dot {
    width: 5px;
    height: 5px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.8);
    animation: dotPulse 2s ease-in-out infinite;
}

.mobile-attempts-value {
    font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    font-size: 14px;
    font-weight: 700;
    color: #10b981;
    text-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
    letter-spacing: 0.03em;
}

.mobile-attempts-hud.active .mobile-attempts-value {
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SYNC HUD - Cloud sync status indicator (matches attempts HUD aesthetic)
   Uses cyan/blue tones to differentiate from green attempts counter
   ═══════════════════════════════════════════════════════════════════════════════ */

.sync-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px 8px 12px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.05) 0%, rgba(14, 116, 144, 0.08) 100%);
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sync-hud:hover {
    border-color: rgba(56, 189, 248, 0.3);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.08) 0%, rgba(14, 116, 144, 0.12) 100%);
}

.sync-hud-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-hud-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: rgba(56, 189, 248, 0.7);
    text-transform: uppercase;
}

/* Active sync (Pro) - cyan dot */
.sync-hud--active .sync-hud-dot {
    width: 6px;
    height: 6px;
    background: #38bdf8;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.8);
    animation: syncPulse 3s ease-in-out infinite;
}

@keyframes syncPulse {
    0%, 100% { opacity: 0.5; box-shadow: 0 0 4px rgba(56, 189, 248, 0.4); }
    50% { opacity: 1; box-shadow: 0 0 8px rgba(56, 189, 248, 0.9); }
}

/* Offline/local only - dimmed amber dot */
.sync-hud--offline {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.04) 0%, rgba(120, 53, 15, 0.06) 100%);
    border-color: rgba(251, 191, 36, 0.12);
}

.sync-hud--offline:hover {
    border-color: rgba(251, 191, 36, 0.25);
}

.sync-hud--offline .sync-hud-dot {
    width: 6px;
    height: 6px;
    background: rgba(251, 191, 36, 0.5);
    border-radius: 50%;
    box-shadow: none;
}

.sync-hud--offline .sync-hud-label {
    color: rgba(251, 191, 36, 0.5);
}

/* Sync status display (replaces button - shows current state) */
.sync-hud-status {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: 6px;
    color: #38bdf8;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Sync button (kept for manual sync if needed) */
.sync-hud-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 6px;
    color: #38bdf8;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sync-hud-btn:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.sync-hud-btn:active {
    transform: scale(0.97);
}

.sync-hud-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sync-hud-btn-icon {
    transition: transform 0.3s ease;
}

/* Spinning animation when syncing */
.sync-hud-btn.syncing .sync-hud-btn-icon {
    animation: spin 1s linear infinite;
}

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

/* ═══════════════════════════════════════════════════════════════════════════════
   TIER BADGES - Premium subscription status indicators
   PRO: Electric purple with lightning bolt
   LIFETIME: Golden with star and radiant glow
   ═══════════════════════════════════════════════════════════════════════════════ */

.tier-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    overflow: hidden;
    flex-shrink: 0;
}

.tier-badge-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.tier-badge-text {
    position: relative;
    z-index: 1;
}

/* ─────────────────────────────────────────────────────────────────────────────
   PRO BADGE - Electric purple with shimmer effect
   ───────────────────────────────────────────────────────────────────────────── */

.tier-badge--pro {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 50%, #6d28d9 100%);
    border: 1px solid rgba(167, 139, 250, 0.4);
    color: #fff;
    box-shadow:
        0 0 12px rgba(139, 92, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.tier-badge--pro .tier-badge-icon {
    color: #fbbf24;
    filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.6));
}

/* Animated shimmer effect */
.tier-badge-shimmer {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 100%
    );
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { left: -100%; }
    50% { left: 100%; }
}

.tier-badge--pro:hover {
    box-shadow:
        0 0 20px rgba(139, 92, 246, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* ─────────────────────────────────────────────────────────────────────────────
   LIFETIME BADGE - Premium gold with radiant glow
   ───────────────────────────────────────────────────────────────────────────── */

.tier-badge--lifetime {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 40%, #f59e0b 70%, #d97706 100%);
    border: 1px solid rgba(251, 191, 36, 0.5);
    color: #1c1917;
    box-shadow:
        0 0 15px rgba(251, 191, 36, 0.4),
        0 0 30px rgba(251, 191, 36, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.tier-badge--lifetime .tier-badge-icon {
    color: #1c1917;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.5));
    animation: starPulse 2s ease-in-out infinite;
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Radiant glow effect */
.tier-badge-glow {
    position: absolute;
    inset: -2px;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 70%
    );
    animation: glowRotate 4s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.tier-badge--lifetime:hover .tier-badge-glow {
    opacity: 1;
}

.tier-badge--lifetime:hover {
    box-shadow:
        0 0 20px rgba(251, 191, 36, 0.6),
        0 0 40px rgba(251, 191, 36, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   EMAIL PREFERENCES ICONS - HUD style icon containers
   Each type has its own accent color matching the semantic meaning
   ═══════════════════════════════════════════════════════════════════════════════ */

.email-pref-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

/* Come Back Nudges - Soft blue (friendly, welcoming) */
.email-pref-icon--nudge {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(37, 99, 235, 0.2) 100%);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #60a5fa;
}

/* Achievements - Gold/amber (celebratory, rewarding) */
.email-pref-icon--achievement {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.12) 0%, rgba(245, 158, 11, 0.18) 100%);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: #fbbf24;
}

/* Product Updates - Purple (brand, innovation) */
.email-pref-icon--updates {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(124, 58, 237, 0.18) 100%);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: #a78bfa;
}

/* Tips & Content - Green (learning, growth) */
.email-pref-icon--tips {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.18) 100%);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
}

/* Hover states */
.email-pref-row:hover .email-pref-icon--nudge {
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.4);
}

.email-pref-row:hover .email-pref-icon--achievement {
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
    border-color: rgba(251, 191, 36, 0.4);
}

.email-pref-row:hover .email-pref-icon--updates {
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.4);
}

.email-pref-row:hover .email-pref-icon--tips {
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
    border-color: rgba(16, 185, 129, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ACCOUNT SETTINGS MODAL - Clean, organized settings interface
   Follows the HUD aesthetic with subtle accents
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Info rows - display account details */
.settings-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.04) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.settings-info-row:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.06) 100%);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Info icon container */
.settings-info-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(99, 102, 241, 0.15) 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.settings-info-icon--tier {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.12) 0%, rgba(245, 158, 11, 0.15) 100%);
    border-color: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.settings-info-row:hover .settings-info-icon {
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.35);
}

.settings-info-row:hover .settings-info-icon--tier {
    box-shadow: 0 0 16px rgba(251, 191, 36, 0.25);
    border-color: rgba(251, 191, 36, 0.35);
}

/* Action buttons - clickable settings options */
.settings-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-action-btn:last-child {
    margin-bottom: 0;
}

.settings-action-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(99, 102, 241, 0.1) 100%);
    border-color: rgba(139, 92, 246, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.15);
}

.settings-action-btn:active {
    transform: translateY(0);
}

/* Action icon variants */
.settings-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.settings-action-icon--email {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(168, 85, 247, 0.2) 100%);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: #c4b5fd;
}

.settings-action-btn:hover .settings-action-icon--email {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
    border-color: rgba(139, 92, 246, 0.5);
    color: #ddd6fe;
}

.settings-action-icon--password {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(129, 140, 248, 0.2) 100%);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
}

.settings-action-btn:hover .settings-action-icon--password {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
    border-color: rgba(99, 102, 241, 0.5);
    color: #c7d2fe;
}

/* Danger buttons - destructive actions */
.settings-danger-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.06) 0%, rgba(220, 38, 38, 0.08) 100%);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-danger-btn:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(220, 38, 38, 0.15) 100%);
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow:
        0 0 20px rgba(239, 68, 68, 0.15),
        inset 0 0 30px rgba(239, 68, 68, 0.05);
}

.settings-danger-btn:active {
    transform: scale(0.995);
}

/* Danger icon */
.settings-danger-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.2) 100%);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.settings-danger-btn:hover .settings-danger-icon {
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

/* Warning buttons - cautionary actions (amber variant) */
.settings-warning-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.06) 0%, rgba(217, 119, 6, 0.08) 100%);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-warning-btn:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(217, 119, 6, 0.15) 100%);
    border-color: rgba(245, 158, 11, 0.35);
    box-shadow:
        0 0 20px rgba(245, 158, 11, 0.15),
        inset 0 0 30px rgba(245, 158, 11, 0.05);
}

.settings-warning-btn:active {
    transform: scale(0.995);
}

/* Warning icon */
.settings-warning-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.2) 100%);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #fbbf24;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.settings-warning-btn:hover .settings-warning-icon {
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
    border-color: rgba(245, 158, 11, 0.5);
    color: #fcd34d;
}

/* Subscription row variant */
.settings-info-row--subscription {
    flex-direction: row;
    align-items: center;
}

/* Editable row variant (e.g., display name) */
.settings-info-row--editable {
    flex-direction: row;
    align-items: center;
}

/* Display name view mode */
.display-name-view {
    display: flex;
    align-items: center;
}

.display-name-value {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Edit button - positioned on far right of row */
.display-name-edit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.display-name-edit-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.25);
    color: #a78bfa;
}

.display-name-edit-btn:active {
    transform: scale(0.95);
}

/* Hide edit button when in edit mode */
.settings-info-row--editable:has(.display-name-edit:not(.hidden)) .display-name-edit-btn {
    display: none;
}

/* Edit mode container */
.display-name-edit {
    margin-top: 6px;
}

/* Input group with inline action buttons */
.display-name-input-group {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.display-name-input-group:focus-within {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.display-name-input {
    flex: 1;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    min-width: 0;
}

.display-name-input::placeholder {
    color: var(--text-muted);
}

/* Inline action buttons container */
.display-name-input-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}

/* Action buttons (save/cancel) */
.display-name-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.display-name-action-btn--save {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.display-name-action-btn--save:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.25);
    color: #86efac;
}

.display-name-action-btn--cancel {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.display-name-action-btn--cancel:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.display-name-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.display-name-action-btn:active:not(:disabled) {
    transform: scale(0.92);
}

/* Footer with counter and error */
.display-name-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    padding: 0 4px;
    min-height: 16px;
}

/* Character counter */
.display-name-counter {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.display-name-counter--warning {
    color: #f59e0b;
}

.display-name-counter--error {
    color: #ef4444;
}

/* Error message - inline in footer */
.display-name-error {
    font-size: 0.7rem;
    color: #f87171;
}

.display-name-error.hidden {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SUBSCRIPTION DETAILS - Clean, informative subscription display
   Shows tier, status, billing dates in a sober, professional format
   ═══════════════════════════════════════════════════════════════════════════════ */

.subscription-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.subscription-tier-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.subscription-tier-icon {
    flex-shrink: 0;
}

.subscription-tier-icon--pro {
    color: #a78bfa;
}

.subscription-tier-icon--lifetime {
    color: #fbbf24;
}

.subscription-tier-label {
    font-size: 14px;
    font-weight: 600;
}

.subscription-tier-label--free {
    color: var(--text-secondary, #a0a0a0);
}

.subscription-tier-label--pro {
    color: #c4b5fd;
}

.subscription-tier-label--lifetime {
    color: #fcd34d;
}

.subscription-tier-state {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.subscription-tier-state--confirmed {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.28);
}

.subscription-meta {
    font-size: 11px;
    color: var(--text-muted, #666);
    line-height: 1.4;
}

.subscription-meta--warning {
    color: #f59e0b;
}

.subscription-manage-btn {
    margin-left: auto;
    background: transparent;
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    color: #a78bfa;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    transition: all 0.2s ease;
}

.subscription-manage-btn:hover {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.5);
}

.subscription-manage-btn svg {
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.subscription-manage-btn:hover svg {
    opacity: 1;
}

.subscription-manage-btn.open svg {
    transform: rotate(90deg);
}

/* Subscription dropdown menu wrapper */
.subscription-menu-wrapper {
    position: relative;
    margin-left: auto;
}

/* Subscription dropdown menu */
.subscription-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    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.96);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 6px;
    overflow: hidden;
}

.subscription-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Dropdown items */
.subscription-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s ease;
    text-align: left;
}

.subscription-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.subscription-dropdown-item svg {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.5);
}

.subscription-dropdown-item:hover svg {
    color: rgba(255, 255, 255, 0.7);
}

/* Upgrade option has accent color */
.subscription-dropdown-item[data-action="upgrade-plan"] svg {
    color: #a78bfa;
}

.subscription-dropdown-item[data-action="upgrade-plan"]:hover svg {
    color: #c4b5fd;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   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="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;
    --color-variant: #2dd4bf;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   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: 10px;
    padding: 0.625rem 1rem;
    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.375rem;
}

.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.125rem;
    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: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.375rem;
    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.375rem;
    font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

/* Status color classes */
.match-exact { --scanner-color: var(--color-success); }
.match-variant { --scanner-color: var(--color-variant); }
.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;
    text-align: center;
    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);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Item Context Bar
   Compact SRS metadata strip shown above every review card.
   ═══════════════════════════════════════════════════════════════════════════════ */

.item-context-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.4rem 0.75rem;
    margin: -0.5rem 0 0.5rem;
    border-bottom: 1px solid rgba(var(--kos-accent-rgb, 59, 130, 246), 0.1);
    background: rgba(var(--kos-accent-rgb, 59, 130, 246), 0.03);
    font-size: 0.7rem;
    line-height: 1.3;
    color: var(--kos-text-secondary, #94a3b8);
    letter-spacing: 0.01em;
    opacity: 0;
    animation: context-bar-fade-in 0.3s 0.1s ease-out forwards;
}

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

@media (prefers-reduced-motion: reduce) {
    .item-context-bar {
        animation: none;
        opacity: 1;
    }
}

/* Mode badge: AUTO · TYPE EN (auto-mode) or just MC (manual) */
.item-context-bar-mode {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(var(--kos-accent-rgb, 59, 130, 246), 0.85);
    padding: 0.15rem 0.5rem;
    background: rgba(var(--kos-accent-rgb, 59, 130, 246), 0.12);
    border-radius: 0.25rem;
    white-space: nowrap;
}

/* Dot separator inside the badge */
.item-context-bar-mode-sep {
    opacity: 0.4;
}

.item-context-bar-stats {
    font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.65rem;
    color: var(--kos-text-muted, #64748b);
}

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

.typing-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-weight: 500;
    font-size: 0.8125rem;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    border-radius: 9999px;
    height: 2rem;
    padding: 0 0.875rem;
}

.typing-action-primary {
    background: rgba(var(--kos-accent-rgb, 59, 130, 246), 0.8);
    color: white;
    border-color: rgba(var(--kos-accent-rgb, 59, 130, 246), 0.5);
}

.typing-action-primary:hover {
    background: rgba(var(--kos-accent-rgb, 59, 130, 246), 1);
}

.typing-action-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.25);
}

.typing-action-secondary:hover {
    background: rgba(245, 158, 11, 0.15);
}

.typing-action-tertiary {
    background: transparent;
    color: var(--kos-text-secondary, #94a3b8);
    border-color: rgba(255, 255, 255, 0.08);
}

.typing-action-tertiary:hover {
    background: rgba(255, 255, 255, 0.06);
}

.typing-action-charge-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: rgba(245, 158, 11, 0.3);
    border-radius: inherit;
    pointer-events: none;
}

.typing-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.0625rem 0.3rem;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.625rem;
    font-weight: 600;
    min-width: 1rem;
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Grading Buttons - HUD Style
   ═══════════════════════════════════════════════════════════════════════════════ */

.grade-buttons-hud {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

/* In the footer, collapse the top margin — footer padding is enough */
.rw-panel-footer .grade-buttons-hud {
    margin-top: 0;
    margin-bottom: 0;
}

.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;
}

/* Disabled state — Easy button blocked when card was downgraded */
.grade-btn-disabled {
    opacity: 0.3;
    pointer-events: none;
    cursor: not-allowed;
}

/* 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);
}

/* Confirmation animation - brief pulse before advancing */
.grade-btn-hud.grade-btn-confirming {
    animation: grade-confirm-pulse 0.12s ease-out;
}

@keyframes grade-confirm-pulse {
    0% { transform: scale(1.05); }
    50% { transform: scale(1.12); opacity: 0.9; }
    100% { transform: scale(1.05); opacity: 0.7; }
}

/* Confirm-key badge — tiny ↵ after the grade buttons */
.grade-confirm-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    padding: 0.125rem 0.35rem;
    margin-left: 0.125rem;
}

/* Grading suggestion hint — inline in the button row */
.grade-suggestion-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    letter-spacing: 0.02em;
    margin-left: 0.25rem;
    white-space: nowrap;
}

.grade-suggestion-hint #suggested-grade-label,
.grade-suggestion-hint #preview-grade-label {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Answer Box Styling
   ═══════════════════════════════════════════════════════════════════════════════ */

.answer-box {
    text-align: center;
}

.typing-alias-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 2.25rem;
    margin: 0.75rem auto 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.875rem;
}

.typing-alias-btn,
.typing-alias-undo {
    appearance: none;
    border: 1px solid rgba(59, 130, 246, 0.42);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.12);
    color: #93c5fd;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.typing-alias-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: min(100%, 34rem);
    min-height: 2.25rem;
    padding: 0.45rem 0.75rem;
    text-align: left;
}

.typing-alias-btn strong,
.typing-alias-saved-label strong {
    color: #fff;
    font-weight: 700;
}

.typing-alias-btn:hover,
.typing-alias-btn:focus-visible,
.typing-alias-undo:hover,
.typing-alias-undo:focus-visible {
    border-color: rgba(96, 165, 250, 0.75);
    background: rgba(59, 130, 246, 0.2);
    color: #bfdbfe;
    outline: none;
}

.typing-alias-btn:disabled,
.typing-alias-undo:disabled {
    cursor: wait;
    opacity: 0.55;
}

.typing-alias-icon {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
}

.typing-alias-cta--saved {
    color: rgba(187, 247, 208, 0.9);
}

.typing-alias-saved-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.typing-alias-undo {
    padding: 0.3rem 0.55rem;
    font-size: 0.8125rem;
}

/* 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.5rem 0.75rem;
    }
    
    .match-scanner-score {
        font-size: 1rem;
    }
    
    .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 0.625rem;
        font-size: 0.75rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Self-Reference Pill Click Feedback
   "You're already here!" glow effect when clicking a pill for the current item
   ═══════════════════════════════════════════════════════════════════════════════ */

@keyframes detail-modal-self-ref-glow {
    0% { 
        box-shadow: 
            0 0 0 0 rgba(var(--accent-rgb, 245, 158, 11), 0.6),
            0 25px 50px -12px rgba(0, 0, 0, 0.25);
    }
    40% { 
        box-shadow: 
            0 0 40px 12px rgba(var(--accent-rgb, 245, 158, 11), 0.4),
            0 25px 50px -12px rgba(0, 0, 0, 0.25);
    }
    100% { 
        box-shadow: 
            0 0 0 0 rgba(var(--accent-rgb, 245, 158, 11), 0),
            0 25px 50px -12px rgba(0, 0, 0, 0.25);
    }
}

.detail-modal-container.self-reference-glow {
    animation: detail-modal-self-ref-glow 0.5s ease-out;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Adaptive JP Toggle - Live Text Transition Animation
   Smooth fade when toggling between definition complexity levels
   ═══════════════════════════════════════════════════════════════════════════════ */

.adaptive-text-fade-out {
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.adaptive-text-fade-in {
    animation: adaptive-text-reveal 0.2s ease-out;
}

@keyframes adaptive-text-reveal {
    0% {
        opacity: 0;
        transform: translateY(2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Mnemonic Pill - Association Tab Integration
   Amber/yellow theme matching detail modal mnemonic section
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Base pill styling */
.mnemonic-pill {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(234, 179, 8, 0.04) 100%);
    border-color: rgba(245, 158, 11, 0.25);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.mnemonic-pill:hover:not(.mnemonic-pill-blurred):not(.mnemonic-pill-scanning) {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.1);
}

/* Type chip styling */
.mnemonic-type-chip {
    background: rgba(245, 158, 11, 0.15);
    color: rgba(251, 191, 36, 0.9);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Blurred state (pre-answer) - blur content only, keep border visible */
.mnemonic-pill-blurred {
    pointer-events: none;
}

.mnemonic-pill-blurred > * {
    filter: blur(6px);
    opacity: 0.4;
    transition: filter 0.4s ease, opacity 0.4s ease;
}

/* Keep component drawer visible pre-answer — chips don't reveal the answer */
.mnemonic-pill-blurred > .mnemonic-component-drawer {
    filter: none;
    opacity: 1;
}

.mnemonic-pill-revealed > *,
.mnemonic-pill:not(.mnemonic-pill-blurred) > * {
    filter: none;
    opacity: 1;
}

.mnemonic-pill-revealed {
    pointer-events: auto;
}

.mnemonic-pill-revealed > * {
    animation: mnemonic-reveal 0.4s ease-out;
}

@keyframes mnemonic-reveal {
    0% {
        filter: blur(6px);
        opacity: 0.4;
    }
    100% {
        filter: blur(0);
        opacity: 1;
    }
}

/* Preview text truncation */
.mnemonic-pill-preview {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    /* Non-WebKit fallback */
    max-height: 3em; /* 2 lines at line-height 1.5 */
    overflow-wrap: anywhere;
}

/* Expanded state - border emphasis on pill container */
.mnemonic-pill-expanded-state {
    border-color: rgba(245, 158, 11, 0.4);
}

/* Expanded content animation - applied to inner div */
.mnemonic-pill-expand-content {
    animation: mnemonic-expand 0.2s ease-out;
}

@keyframes mnemonic-expand {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scanning state */
.mnemonic-pill-scanning {
    position: relative;
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
    overflow: hidden;
    cursor: default;
}

.mnemonic-pill-scan-container {
    position: relative;
    min-height: 48px;
}

.mnemonic-pill-scanning .mnemonic-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.mnemonic-pill-scanning .mnemonic-scan-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(245, 158, 11, 0.4) 30%,
        rgba(251, 191, 36, 0.8) 50%,
        rgba(245, 158, 11, 0.4) 70%,
        transparent 100%
    );
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    animation: mnemonic-pill-scan-sweep 2s ease-in-out infinite;
}

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

/* Scanning text animation */
.mnemonic-pill-scanning-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    color: #fcd34d;
    font-size: 0.8rem;
    min-height: 2rem;
}

.mnemonic-pill-scanning-text::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(252, 211, 77, 0.3);
    border-top-color: #fcd34d;
    border-radius: 50%;
    animation: mnemonic-pill-spin 0.8s linear infinite;
}

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

/* Editing state */
.mnemonic-pill-editing {
    border-color: rgba(245, 158, 11, 0.5);
}

.mnemonic-pill-editing .mnemonic-edit-textarea {
    font-family: inherit;
    line-height: 1.6;
}

.mnemonic-pill-editing .mnemonic-edit-textarea:focus {
    outline: none;
}

/* Success flash */
.mnemonic-pill-success {
    border-color: rgba(34, 197, 94, 0.6) !important;
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.2);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Error flash */
.mnemonic-pill-error {
    border-color: rgba(239, 68, 68, 0.6) !important;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.2);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .mnemonic-pill-revealed > * {
        animation: none;
    }

    .mnemonic-pill-expand-content {
        animation: none;
    }

    .mnemonic-pill-scanning .mnemonic-scan-line::after {
        animation: none;
        opacity: 0.6;
        top: 50%;
    }

    .mnemonic-pill-scanning-text::before {
        animation: none;
        border-top-color: rgba(252, 211, 77, 0.6);
    }

    .mnemonic-pill-blurred > * {
        transition: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MNEMONIC COMPONENT DRAWER
   Expandable drawer for custom component selection in mnemonic generation
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Drawer container - CSS grid for smooth expand/collapse */
.mnemonic-component-drawer {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease-out;
}
.mnemonic-component-drawer.open {
    grid-template-rows: 1fr;
}
.mnemonic-drawer-inner {
    overflow: hidden;
}
.mnemonic-drawer-content {
    padding-top: 6px;
    margin-top: 4px;
    border-top: 1px solid rgba(245, 158, 11, 0.1);
}

/* Component chips container */
.mnemonic-comp-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Individual component chip */
.mnemonic-comp-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.08);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
    user-select: none;
    min-width: 40px;
}
.mnemonic-comp-chip.selected {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.12);
}
.mnemonic-comp-chip:not(.selected) {
    border-style: dashed;
    background: transparent;
    border-color: rgba(245, 158, 11, 0.18);
}
.mnemonic-comp-chip:hover {
    border-color: rgba(245, 158, 11, 0.7);
}
.mnemonic-comp-chip:not(.selected):hover {
    border-color: rgba(245, 158, 11, 0.38);
    background: rgba(245, 158, 11, 0.04);
}
.mnemonic-comp-chip:focus-visible {
    outline: 2px solid rgba(245, 158, 11, 0.7);
    outline-offset: 2px;
}

.mnemonic-comp-expandable-pill {
    display: inline-flex;
    align-items: stretch;
    border-radius: 6px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.mnemonic-comp-expandable-pill .mnemonic-comp-chip {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    min-width: 40px;
}

.mnemonic-comp-expandable-pill .mnemonic-comp-chip:not(.selected) {
    opacity: 1;
}

.mnemonic-comp-expandable-pill[data-source="manual"].selected .mnemonic-comp-chip,
.mnemonic-comp-expandable-pill[data-source="manual"].selected .mnemonic-comp-chip-toggle {
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.08);
}

.mnemonic-comp-expand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(245, 158, 11, 0.32);
    border-radius: 6px;
    background: rgba(245, 158, 11, 0.08);
    color: rgba(253, 230, 138, 0.88);
    font-family: ui-monospace, 'SF Mono', Monaco, monospace;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.mnemonic-comp-expand:hover {
    border-color: rgba(245, 158, 11, 0.58);
    background: rgba(245, 158, 11, 0.14);
    color: rgba(254, 243, 199, 0.96);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.12);
}

.mnemonic-comp-expand:focus-visible {
    outline: 2px solid rgba(245, 158, 11, 0.7);
    outline-offset: 2px;
}

.mnemonic-comp-expand-chevron {
    width: 7px;
    height: 7px;
    border-right: 2px solid currentcolor;
    border-bottom: 2px solid currentcolor;
    transform: translateY(-1px) rotate(45deg);
    transition: transform 0.18s ease;
    opacity: 0.9;
}

.mnemonic-comp-expand.is-expanded .mnemonic-comp-expand-chevron {
    transform: translateY(1px) rotate(225deg);
}

.mnemonic-comp-chip-toggle {
    width: 24px;
    min-width: 24px;
    height: auto;
    align-self: stretch;
    padding: 0;
    border-left: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    font-size: 0;
    letter-spacing: 0;
}

.mnemonic-comp-chip-toggle .mnemonic-comp-expand-chevron {
    width: 7px;
    height: 7px;
}

.mnemonic-comp-expandable-pill:not(.selected) .mnemonic-comp-chip-toggle {
    opacity: 1;
    border-style: dashed;
    background: transparent;
}

.mnemonic-comp-expandable-pill:hover .mnemonic-comp-chip.selected,
.mnemonic-comp-expandable-pill.selected:hover .mnemonic-comp-chip-toggle {
    border-color: rgba(245, 158, 11, 0.7);
}

.mnemonic-comp-expandable-pill:not(.selected):hover .mnemonic-comp-chip-toggle {
    border-color: rgba(245, 158, 11, 0.38);
    background: rgba(245, 158, 11, 0.04);
    color: rgba(253, 230, 138, 0.88);
    box-shadow: none;
}

.mnemonic-comp-expandable-pill .mnemonic-comp-chip:focus-visible,
.mnemonic-comp-expandable-pill .mnemonic-comp-chip-toggle:focus-visible {
    position: relative;
    z-index: 1;
}

/* Manual association chips get a subtle purple tint */
.mnemonic-comp-chip[data-source="manual"].selected {
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(139, 92, 246, 0.08);
}

/* Chip character */
.mnemonic-comp-chip .comp-char {
    font-size: 15px;
    line-height: 1.2;
    color: var(--text-primary, #e2e8f0);
}
.mnemonic-comp-chip:not(.selected) .comp-char {
    color: var(--text-muted, #94a3b8);
    opacity: 0.45;
}
.mnemonic-comp-chip:not(.selected):hover .comp-char,
.mnemonic-comp-chip:not(.selected):focus-visible .comp-char,
.mnemonic-comp-expandable-pill:not(.selected):hover .comp-char,
.mnemonic-comp-expandable-pill:focus-within .mnemonic-comp-chip:not(.selected) .comp-char {
    opacity: 0.78;
}

/* Chip meaning label */
.mnemonic-comp-chip .comp-meaning {
    font-size: 8px;
    line-height: 1.1;
    color: var(--text-muted, #94a3b8);
    max-width: 52px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* Component chip tooltip - rich hover card */
.comp-chip-tooltip {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: linear-gradient(135deg, rgba(20, 20, 24, 0.98), rgba(12, 12, 16, 0.98));
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
    pointer-events: none;
    white-space: nowrap;
    z-index: 99999;
    top: -9999px;
    left: -9999px;
    transform: translateY(4px);
}
.mnemonic-comp-chip:hover .comp-chip-tooltip,
.mnemonic-comp-chip:focus-visible .comp-chip-tooltip,
.mnemonic-comp-chip:focus-within .comp-chip-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.comp-chip-tooltip-meaning {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
}
.comp-chip-tooltip-reading {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.55);
    text-align: center;
}
.comp-chip-tooltip-variants {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin-top: 2px;
}
.comp-chip-tooltip-variants-label {
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(245, 158, 11, 0.45);
}
.comp-chip-tooltip-variants-row {
    display: flex;
    gap: 4px;
}
.comp-chip-variant-pill {
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.08);
    color: var(--text-primary, #e2e8f0);
}
/* Arrow pointing down (tooltip above chip) */
.comp-chip-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(20, 20, 24, 0.98);
}
/* Arrow flipped when tooltip is below */
.comp-chip-tooltip.tooltip-below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: rgba(20, 20, 24, 0.98);
}

/* Status line below chips */
.mnemonic-drawer-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

/* Regen button text flash animation (NEW ↔ REGENERATE state change) */
@keyframes mnemonic-btn-flash {
    0% { color: rgba(251, 191, 36, 0.9); transform: scale(1.15); }
    100% { color: inherit; transform: scale(1); }
}
.mnemonic-btn-flash {
    animation: mnemonic-btn-flash 0.35s ease-out;
}

/* Subtle pulse when same text re-confirmed (chip toggled but state unchanged) */
@keyframes mnemonic-btn-pulse {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}
.mnemonic-btn-pulse {
    animation: mnemonic-btn-pulse 0.25s ease-out;
}

/* Detail panel: always-visible component chips */
.detail-mnemonic-inline-drawer .mnemonic-comp-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

/* Copy-on-click pulse when tapping a chip during edit mode */
@keyframes mnemonic-chip-copied {
    0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.5); }
    50% { box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.2); }
    100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}
.mnemonic-chip-copied {
    animation: mnemonic-chip-copied 0.4s ease-out;
}

/* Nudge pulse on the edit box when user re-clicks TYPE MANUALLY */
@keyframes mnemonic-nudge {
    0%, 100% { border-color: rgba(245, 158, 11, 0.3); }
    25% { border-color: rgba(245, 158, 11, 0.8); }
    50% { border-color: rgba(245, 158, 11, 0.4); }
    75% { border-color: rgba(245, 158, 11, 0.7); }
}
.mnemonic-nudge {
    animation: mnemonic-nudge 0.5s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .mnemonic-component-drawer {
        transition: none;
    }
    .mnemonic-comp-chip {
        transition: none;
    }
    .mnemonic-comp-chip:hover {
        transform: none;
    }
    .mnemonic-btn-flash {
        animation: none;
    }
    .mnemonic-chip-copied {
        animation: none;
    }
    .mnemonic-nudge {
        animation: none;
    }
    .mnemonic-btn-pulse {
        animation: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   REDIRECT UI - Mixed up cards flow
   Calmer, explanatory design for when user types a different word from their queue
   ═══════════════════════════════════════════════════════════════════════════════ */

.redirect-header-container {
    perspective: 1000px;
}

.redirect-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0.06) 100%);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 10px 10px 0 0;
    font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.redirect-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #FBBF24;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.redirect-subtitle {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    letter-spacing: 0.05em;
}

/* Explanation text below header */
.redirect-explanation {
    padding: 0.5rem 1rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    background: rgba(245, 158, 11, 0.04);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-top: none;
    border-radius: 0 0 10px 10px;
    text-align: center;
}

/* Comparison cards */
.redirect-comparison {
    gap: 1rem;
}

.redirect-card {
    text-align: center;
}

/* Card inner styling with transition for hover effects */
.redirect-card-inner {
    position: relative;
    transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

/* Softer amber for the "you typed" card */
.redirect-yours .redirect-card-inner {
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.08);
}

/* Red/danger for the "expected" card - this is what user should have typed */
.redirect-expected .redirect-card-inner {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.08);
}

/* Dimmed state when the other card is highlighted */
.redirect-card-inner.redirect-dimmed {
    opacity: 0.4;
    transform: scale(0.98);
}

/* Simple fade out for the typed card */
.redirect-yours.redirect-fading {
    animation: redirect-simple-fade 0.4s ease forwards;
}

@keyframes redirect-simple-fade {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0.15;
    }
}

/* Highlight card when grading it */
.redirect-card-inner.redirect-grading-this {
    animation: redirect-grading-pulse 0.4s ease forwards;
}

/* Typed card (amber) when being graded */
.redirect-yours .redirect-card-inner.redirect-grading-this {
    animation: redirect-grading-pulse-amber 0.4s ease forwards;
}

@keyframes redirect-grading-pulse-amber {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.03);
        box-shadow: 0 0 25px rgba(251, 191, 36, 0.5), 0 0 50px rgba(251, 191, 36, 0.25);
    }
}

/* Expected card (red) when being graded */
.redirect-expected .redirect-card-inner.redirect-grading-this {
    animation: redirect-grading-pulse-red 0.4s ease forwards;
}

@keyframes redirect-grading-pulse-red {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.03);
        box-shadow: 0 0 25px rgba(239, 68, 68, 0.5), 0 0 50px rgba(239, 68, 68, 0.25);
    }
}

/* Grading label above buttons */
.redirect-grading-label {
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

.redirect-grading-label strong {
    color: var(--color-text-main);
    font-weight: 600;
}

/* Highlighted state with animated circulating border */
.redirect-card-inner.redirect-highlighted {
    transform: scale(1.02);
}

.redirect-yours .redirect-card-inner.redirect-highlighted {
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4), 0 0 40px rgba(251, 191, 36, 0.2);
    animation: redirect-glow-amber 1.5s ease-in-out infinite;
}

.redirect-expected .redirect-card-inner.redirect-highlighted {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4), 0 0 40px rgba(239, 68, 68, 0.2);
    animation: redirect-glow-red 1.5s ease-in-out infinite;
}

/* Circulating border effect using pseudo-element */
.redirect-card-inner.redirect-highlighted::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 10px;
    padding: 2px;
    background: conic-gradient(
        from var(--redirect-angle, 0deg),
        transparent 0deg,
        var(--redirect-glow-color) 60deg,
        transparent 120deg
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: redirect-border-rotate 2s linear infinite;
    pointer-events: none;
}

.redirect-yours .redirect-card-inner.redirect-highlighted {
    --redirect-glow-color: rgba(251, 191, 36, 0.8);
}

.redirect-expected .redirect-card-inner.redirect-highlighted {
    --redirect-glow-color: rgba(239, 68, 68, 0.8);
}

@keyframes redirect-border-rotate {
    0% { --redirect-angle: 0deg; }
    100% { --redirect-angle: 360deg; }
}

/* Fallback for browsers that don't support @property */
@supports not (background: conic-gradient(from 0deg, red, blue)) {
    .redirect-card-inner.redirect-highlighted::before {
        display: none;
    }
}

/* Pulsing glow animation */
@keyframes redirect-glow-amber {
    0%, 100% { box-shadow: 0 0 20px rgba(251, 191, 36, 0.4), 0 0 40px rgba(251, 191, 36, 0.2); }
    50% { box-shadow: 0 0 25px rgba(251, 191, 36, 0.6), 0 0 50px rgba(251, 191, 36, 0.3); }
}

@keyframes redirect-glow-red {
    0%, 100% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.4), 0 0 40px rgba(239, 68, 68, 0.2); }
    50% { box-shadow: 0 0 25px rgba(239, 68, 68, 0.6), 0 0 50px rgba(239, 68, 68, 0.3); }
}

/* CSS custom property for rotation (for browsers that support it) */
@property --redirect-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* Queue badge - simpler "also in queue" indicator */
.redirect-queue-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    letter-spacing: 0.03em;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   REDIRECT UI v2 - Seamless compact flow
   Inline notice with immediate grading buttons
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Compact inline notice */
.redirect-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.5rem 1rem;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
}

.redirect-notice-badge {
    font-size: 0.625rem;
    font-weight: 700;
    color: #FBBF24;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.redirect-notice-text {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

/* Compact side-by-side comparison */
.redirect-comparison-compact {
    gap: 0.75rem;
}

.redirect-card-compact {
    padding: 0.75rem;
    background: var(--color-bg-secondary);
    border-radius: 8px;
    text-align: center;
}

.redirect-yours-compact {
    border: 1px solid rgba(251, 191, 36, 0.4);
}

.redirect-expected-compact {
    border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Auto-credit checkbox option */
.redirect-credit-option {
    display: flex;
    justify-content: center;
}

.redirect-credit-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.redirect-credit-label:hover {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.3);
}

.redirect-credit-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: #FBBF24;
    cursor: pointer;
}

.redirect-credit-label strong {
    color: #FBBF24;
    font-weight: 600;
}

/* Fade transitions for CTA → grading buttons */
.redirect-actions-wrapper {
    min-height: 60px; /* Prevent layout shift */
}

.redirect-fade-out {
    animation: redirect-fade-out 0.2s ease forwards;
}

.redirect-fade-in {
    animation: redirect-fade-in 0.25s ease forwards;
}

@keyframes redirect-fade-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

@keyframes redirect-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Action buttons container - horizontal inline layout */
.redirect-actions-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Separator dot between actions */
.redirect-action-separator {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    user-select: none;
}

/* Action button style - proper buttons with backgrounds */
.redirect-action-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Ignore mix-up - red/coral button */
.redirect-action-ignore {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.redirect-action-ignore:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
}

/* Grade typed first - amber/gold button */
.redirect-action-credit {
    color: #fcd34d;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.redirect-action-credit:hover {
    color: #fff;
    background: rgba(251, 191, 36, 0.25);
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.2);
}

.redirect-action-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.4);
    outline-offset: 2px;
}

.redirect-action-link:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Keyboard shortcut hints */
.redirect-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: inherit;
    opacity: 0.8;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.redirect-action-link:hover .redirect-kbd {
    opacity: 1;
    background: rgba(0, 0, 0, 0.4);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .redirect-header {
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.5rem 1rem;
    }
    
    .redirect-actions-container {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .redirect-action-separator {
        display: none;
    }
    
    .redirect-action-link {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem;
    }
}
