/* ==========================================================================
   HIRAGANA MASTER - Modern Japanese Aesthetics Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700;900&family=Outfit:wght@300;400;500;600;700;800&family=Zen+Kaku+Gothic+New:wght@500;700;900&display=swap');

:root {
    /* Color Palette - Dark Sumi & Sakura */
    --bg-main: #0c0e14;
    --bg-surface: #141722;
    --bg-surface-elevated: #1c2130;
    --bg-surface-translucent: rgba(20, 23, 34, 0.75);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-active: rgba(255, 107, 139, 0.5);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-sakura: #ff6584;
    --accent-sakura-glow: rgba(255, 101, 132, 0.35);
    --accent-torii: #e63946;
    --accent-gold: #f59e0b;
    --accent-jade: #10b981;
    --accent-jade-glow: rgba(16, 185, 129, 0.3);
    --accent-indigo: #6366f1;
    
    --calligraphy-grid: rgba(255, 101, 132, 0.15);
    --calligraphy-bg: #10131d;
    
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(255, 101, 132, 0.25);
    --shadow-card: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-xl: 32px;
    --radius-full: 9999px;
    
    --font-ui: 'Outfit', sans-serif;
    --font-jp: 'Zen Kaku Gothic New', 'Noto Sans JP', sans-serif;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
    --bg-main: #f5f2eb;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #faf7f2;
    --bg-surface-translucent: rgba(255, 255, 255, 0.85);
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-active: rgba(214, 51, 80, 0.4);
    
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent-sakura: #e11d48;
    --accent-sakura-glow: rgba(225, 29, 72, 0.2);
    --accent-torii: #be123c;
    --accent-gold: #d97706;
    --accent-jade: #059669;
    --accent-jade-glow: rgba(5, 150, 105, 0.2);
    --accent-indigo: #4f46e5;
    
    --calligraphy-grid: rgba(225, 29, 72, 0.12);
    --calligraphy-bg: #fffbf5;
    
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 25px rgba(225, 29, 72, 0.15);
    --shadow-card: 0 20px 40px -15px rgba(100, 80, 60, 0.12);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font-ui);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

button, select, input, .kana-tile, .ctrl-btn, .action-pill-btn, .nav-tab-btn {
    touch-action: manipulation;
}

body {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Canvas background for cherry blossom petals */
#sakura-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.85;
}

/* Subtle background glowing ambient orbs */
.ambient-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 101, 132, 0.08) 0%, transparent 70%);
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 0;
    filter: blur(60px);
}

.app-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 1rem 1.5rem 2.5rem;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 1.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.hanko-seal {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-torii), var(--accent-sakura));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-jp);
    font-weight: 900;
    font-size: 1.45rem;
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.4);
    position: relative;
    user-select: none;
    letter-spacing: -1px;
}

.brand-titles h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-titles h1 .jp-title {
    font-family: var(--font-jp);
    color: var(--accent-sakura);
    font-weight: 700;
    font-size: 1.2rem;
}

.brand-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.nav-tabs {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 4px;
    border-radius: var(--radius-full);
    gap: 4px;
}

.nav-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.nav-tab-btn:hover {
    color: var(--text-primary);
}

.nav-tab-btn.active {
    background: var(--accent-sakura);
    color: #ffffff;
    box-shadow: 0 2px 12px var(--accent-sakura-glow);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.ctrl-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1.1rem;
}

.ctrl-btn:hover {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.ctrl-btn.active {
    color: var(--accent-sakura);
    border-color: var(--accent-sakura);
    background: rgba(255, 101, 132, 0.1);
}

#btn-admin-panel {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.15), rgba(99, 102, 241, 0.15));
    border-color: rgba(236, 72, 153, 0.35);
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.15);
}

#btn-admin-panel:hover {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.3), rgba(99, 102, 241, 0.3));
    border-color: var(--accent-sakura);
    box-shadow: 0 0 16px rgba(236, 72, 153, 0.3);
    transform: translateY(-2px);
}

/* ==========================================================================
   Filters & Session Bar
   ========================================================================== */
.session-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface-translucent);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.75rem;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-soft);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.45rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: var(--transition-fast);
    font-family: inherit;
}

.filter-select:focus {
    border-color: var(--accent-sakura);
    box-shadow: 0 0 0 3px var(--accent-sakura-glow);
}

.order-toggle-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition-fast);
}

.order-toggle-btn:hover {
    color: var(--text-primary);
}

.smart-mode-btn {
    border-color: rgba(168, 85, 247, 0.3);
    color: var(--text-secondary);
}

.smart-mode-btn:hover {
    border-color: rgba(168, 85, 247, 0.6);
    color: var(--text-primary);
}

.smart-mode-btn.active {
    background: rgba(168, 85, 247, 0.15);
    border-color: #a855f7;
    color: #e9d5ff;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.25);
}

.session-stats {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.stat-item .stat-icon {
    font-size: 1.1rem;
}

.stat-item .stat-val {
    color: var(--text-primary);
}

.stat-item.streak .stat-val {
    color: var(--accent-gold);
}

.stat-item.accuracy .stat-val {
    color: var(--accent-jade);
}

.stat-item.mastered .stat-val {
    color: var(--accent-sakura);
}

.stat-item.timer {
    cursor: pointer;
    user-select: none;
    transition: var(--transition-fast);
}

.stat-item.timer:hover {
    transform: translateY(-1px);
    filter: brightness(1.15);
}

.stat-item.timer .stat-val {
    color: #38bdf8;
    font-variant-numeric: tabular-nums;
    font-family: monospace, inherit;
    letter-spacing: 0.5px;
}

.stat-item.timer.paused .stat-val {
    color: var(--text-muted);
    animation: timerPulse 1s infinite alternate;
}

@keyframes timerPulse {
    0% { opacity: 1; }
    100% { opacity: 0.35; }
}

/* ==========================================================================
   Main Training / Quiz Card
   ========================================================================== */
.quiz-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.practice-card-container {
    width: 100%;
    max-width: 580px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2rem 2.25rem;
    box-shadow: var(--shadow-card);
    position: relative;
    backdrop-filter: blur(16px);
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.practice-card-container.correct-pulse {
    border-color: var(--accent-jade);
    box-shadow: 0 0 35px var(--accent-jade-glow);
    animation: correctCelebration 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

.practice-card-container.incorrect-shake {
    border-color: var(--accent-torii);
    animation: shakeCard 0.45s ease-in-out;
}

@keyframes shakeCard {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-12px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(4px); }
}

@keyframes correctCelebration {
    0% { transform: scale(1); }
    50% { transform: scale(1.025); }
    100% { transform: scale(1); }
}

/* Progress bar inside card */
.card-progress-wrapper {
    margin-bottom: 1.5rem;
}

.card-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.progress-track {
    width: 100%;
    height: 6px;
    background: var(--bg-surface-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-sakura), var(--accent-gold));
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
    width: 0%;
}

/* Card Top Badges */
.card-badges {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.badge-tag.group-tag {
    color: var(--accent-sakura);
    background: rgba(255, 101, 132, 0.08);
    border-color: rgba(255, 101, 132, 0.2);
}

.badge-tag.strokes-tag {
    color: var(--accent-gold);
}

.badge-tag.katakana-tag {
    color: var(--accent-indigo);
}

.badge-tag.repeat-tag {
    color: #d8b4fe;
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.4);
    font-weight: 700;
}

/* Character Dual Display Stage (Stroke Animation + Digital Font) */
.character-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.75rem;
    position: relative;
    width: 100%;
}

.character-dual-display {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 1.25rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

/* Wycentrowana pojedyncza karta na scenie (gdy brak pełnego GIF-a) */
.character-dual-display.single-card {
    justify-content: center;
}

.character-dual-display.single-card .char-display-card,
.character-dual-display.modal-dual-display.single-card .char-display-card {
    max-width: 185px !important;
    width: 185px;
}

.char-display-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.char-display-header {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 0.45rem;
    width: 100%;
}

.char-display-label {
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.35px;
    color: var(--text-secondary);
    white-space: nowrap;
    line-height: 1.1;
}

.calligraphy-box {
    width: 185px;
    height: 185px;
    background-color: #ffffff;
    border: 3px solid rgba(255, 101, 132, 0.4);
    border-radius: var(--radius-lg);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), inset 0 0 15px rgba(0, 0, 0, 0.04);
    transition: var(--transition-fast);
}

.calligraphy-box.pulse-restart {
    box-shadow: 0 0 25px var(--accent-sakura-glow), 0 12px 30px rgba(0, 0, 0, 0.35);
    border-color: var(--accent-sakura);
    transform: scale(1.02);
}

/* Digital Computer Font Box */
.digital-font-box {
    width: 185px;
    height: 185px;
    background-color: #ffffff;
    border: 3px solid rgba(99, 102, 241, 0.4);
    border-radius: var(--radius-lg);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), inset 0 0 15px rgba(0, 0, 0, 0.04);
    transition: var(--transition-fast);
}

.digital-char-glyph {
    font-family: 'Zen Kaku Gothic New', 'Noto Sans JP', sans-serif;
    font-size: 6.2rem;
    font-weight: 900;
    color: #111827;
    line-height: 1;
    user-select: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    white-space: nowrap !important;
    transition: transform var(--transition-fast);
}

/* Skalowanie dla 2-znakowych dźwięków łączonych Yōon (np. みょ, きゃ, しゅ) */
.digital-char-glyph.yoon {
    font-size: 3.75rem !important;
    letter-spacing: -3px;
}

.calligraphy-box.small,
.digital-font-box.small {
    width: 145px;
    height: 145px;
}

.digital-font-box.small .digital-char-glyph {
    font-size: 5rem;
}

.digital-font-box.small .digital-char-glyph.yoon {
    font-size: 3rem !important;
    letter-spacing: -2px;
}

.calligraphy-box.small .stroke-gif-img {
    width: 135px;
    height: 135px;
}

/* Traditional 9-box calligraphy guidelines (cross & diagonals) in authentic red vermilion */
.calligraphy-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    border-left: 1.5px dashed rgba(230, 57, 70, 0.3);
    pointer-events: none;
    z-index: 1;
}

.calligraphy-box::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    border-top: 1.5px dashed rgba(230, 57, 70, 0.3);
    pointer-events: none;
    z-index: 1;
}

.diagonal-guide {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.diagonal-guide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 141.4%;
    height: 1px;
    border-top: 1px dotted rgba(230, 57, 70, 0.2);
    transform: rotate(45deg);
    transform-origin: top left;
}

.diagonal-guide::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 141.4%;
    height: 1px;
    border-top: 1px dotted rgba(230, 57, 70, 0.2);
    transform: rotate(-45deg);
    transform-origin: top right;
}

/* The stroke order GIF image */
.stroke-gif-img {
    width: 165px;
    height: 165px;
    object-fit: contain;
    position: relative;
    z-index: 2;
    border-radius: var(--radius-sm);
    transition: transform var(--transition-fast);
}

/* Static fallback character if GIF is loading */
.character-static-char {
    position: absolute;
    font-family: var(--font-jp);
    font-size: 7.5rem;
    font-weight: 700;
    color: #111827;
    z-index: 1;
    user-select: none;
    opacity: 0.12;
    pointer-events: none;
    white-space: nowrap !important;
}

.character-static-char.yoon {
    font-size: 4.5rem !important;
    letter-spacing: -4px;
}

.calligraphy-box.small .character-static-char.yoon {
    font-size: 3.2rem !important;
}

/* Stage Action Buttons (Audio & Replay) */
.stage-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.action-pill-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
}

.action-pill-btn:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.action-pill-btn.audio-btn {
    color: var(--accent-sakura);
    border-color: rgba(255, 101, 132, 0.3);
}

.action-pill-btn.audio-btn:hover {
    background: rgba(255, 101, 132, 0.15);
    box-shadow: 0 0 15px var(--accent-sakura-glow);
}

.action-pill-btn.audio-btn.speaking {
    animation: soundPulse 1s infinite alternate;
    background: var(--accent-sakura);
    color: #fff;
}

@keyframes soundPulse {
    0% { transform: scale(1); box-shadow: 0 0 5px var(--accent-sakura-glow); }
    100% { transform: scale(1.05); box-shadow: 0 0 20px var(--accent-sakura); }
}

/* ==========================================================================
   Romaji Input Section
   ========================================================================== */
.input-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
}

.input-wrapper {
    position: relative;
    width: 100%;
    max-width: 320px;
}

.romaji-input {
    width: 100%;
    background: var(--bg-surface-elevated);
    border: 2px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    outline: none;
    letter-spacing: 1px;
    transition: var(--transition-fast);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.romaji-input::placeholder {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0;
}

.romaji-input:focus {
    border-color: var(--accent-sakura);
    box-shadow: 0 0 0 4px var(--accent-sakura-glow);
    background: var(--bg-surface);
}

.submit-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent-sakura);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition-fast);
    box-shadow: 0 2px 10px var(--accent-sakura-glow);
}

.submit-btn:hover {
    transform: translateY(-50%) scale(1.05);
}

/* Feedback Alert Banner */
.feedback-banner {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    transition: var(--transition-fast);
}

.feedback-msg {
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(6px);
    transition: var(--transition-fast);
}

.feedback-msg.show {
    opacity: 1;
    transform: translateY(0);
}

.feedback-msg.correct {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: var(--accent-jade);
}

.feedback-msg.incorrect {
    background: rgba(230, 57, 70, 0.15);
    border: 1px solid rgba(230, 57, 70, 0.4);
    color: var(--accent-torii);
}

.feedback-msg.revealed {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: var(--accent-gold);
}

.feedback-msg.smart-requeue {
    background: rgba(168, 85, 247, 0.16);
    border: 1px solid rgba(168, 85, 247, 0.45);
    color: #e9d5ff;
}

.smart-hint-note {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: #d8b4fe;
    font-weight: 500;
}

/* Card Auxiliary Controls */
.card-bottom-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-subtle);
    width: 100%;
    gap: 0.75rem;
}

.text-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.text-action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
}

.text-action-btn.hint-btn:hover {
    color: var(--accent-gold);
}

.text-action-btn.skip-btn:hover {
    color: var(--accent-sakura);
}

/* Example Vocabulary Card (Reveals on answer) */
.vocab-hint-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.vocab-word {
    font-family: var(--font-jp);
    font-weight: 700;
    color: var(--accent-sakura);
}

.vocab-meaning {
    color: var(--text-secondary);
}

/* Mnemonic Hint Card (Skojarzenie wizualne) */
.mnemonic-hint-card {
    background: linear-gradient(135deg, rgba(255, 101, 132, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
    border: 1.5px solid rgba(255, 101, 132, 0.35);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-top: 1rem;
    width: 100%;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35), 0 0 15px rgba(255, 101, 132, 0.12);
    animation: slideUpFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: var(--transition-fast);
}

.mnemonic-hint-card.in-modal {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.mnemonic-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.mnemonic-badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-sakura);
    background: rgba(255, 101, 132, 0.18);
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
}

.mnemonic-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.mnemonic-body {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.mnemonic-img-wrapper {
    position: relative;
    flex-shrink: 0;
    width: 130px;
    height: 95px;
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: zoom-in;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.mnemonic-img-wrapper:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), 0 0 12px rgba(56, 189, 248, 0.25);
}

.mnemonic-img-wrapper::after {
    content: "🔍";
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.mnemonic-img-wrapper:hover::after {
    opacity: 1;
    transform: scale(1);
}

.mnemonic-img-wrapper:empty,
.mnemonic-img-wrapper[style*="display: none"],
.mnemonic-img-wrapper:has(img[style*="display: none"]),
.mnemonic-img-wrapper:has(img:not([src])),
.mnemonic-img-wrapper:has(img[src=""]) {
    display: none !important;
}

.mnemonic-img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: calc(var(--radius-md) - 4px);
    transition: transform var(--transition-fast);
}

.mnemonic-img:hover {
    transform: scale(1.05);
}

.mnemonic-desc {
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--text-secondary);
    margin: 0;
}

.mnemonic-header-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.mnemonic-part-pills {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.mnemonic-part-pill {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.mnemonic-part-pill:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    border-color: rgba(255, 101, 132, 0.4);
    transform: translateY(-1px);
}

.mnemonic-part-pill.active {
    background: rgba(255, 101, 132, 0.25);
    border-color: var(--accent-sakura);
    color: var(--accent-sakura);
    box-shadow: 0 0 12px rgba(255, 101, 132, 0.35);
}

.mnemonic-media-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.mnemonic-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 32px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 5;
    user-select: none;
    padding: 0;
    line-height: 1;
}

.mnemonic-nav-arrow.prev {
    left: 4px;
}

.mnemonic-nav-arrow.next {
    right: 4px;
}

.mnemonic-nav-arrow:hover {
    background: var(--accent-sakura);
    border-color: var(--accent-sakura);
    transform: translateY(-50%) scale(1.12);
    box-shadow: 0 0 12px rgba(255, 101, 132, 0.6);
}

.mnemonic-slide-indicator {
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.03em;
    text-align: center;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.mnemonic-content-col {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1;
}

.mnemonic-component-hint {
    padding: 0.45rem 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border-left: 3px solid var(--accent-sakura);
    border-radius: 6px;
    font-size: 0.82rem;
    color: #e2e8f0;
    line-height: 1.4;
    animation: fadeInView 0.2s ease-out;
}

.comp-hint-badge {
    font-weight: 700;
    color: var(--accent-sakura);
    margin-right: 0.35rem;
}

.mnemonic-tts-chip.active-component {
    border-color: var(--accent-sakura) !important;
    background: rgba(255, 101, 132, 0.28) !important;
    box-shadow: 0 0 12px rgba(255, 101, 132, 0.5);
    transform: scale(1.06);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 600px) {
    .mnemonic-body {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    .mnemonic-img-wrapper {
        width: 100%;
        max-width: 180px;
        height: 110px;
        margin: 0 auto;
    }
}

/* ==========================================================================
   Gojūon Table / Matrix View (Tablica Hiragany)
   ========================================================================== */
.table-view {
    display: none;
    flex-direction: column;
    width: 100%;
    animation: fadeIn 0.3s ease;
}

.table-view.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.matrix-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.matrix-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.4rem;
}

.matrix-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Wyszukiwarka w Tablicy Gojūon */
.matrix-search-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    margin-top: 1.25rem;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.matrix-search-box {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.matrix-search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    user-select: none;
}

.matrix-search-input {
    width: 100%;
    background: var(--bg-surface-elevated);
    border: 1.5px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.65rem 2.6rem 0.65rem 2.6rem;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition-fast);
}

.matrix-search-input:focus {
    border-color: var(--accent-sakura);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--accent-sakura-glow);
}

.matrix-search-clear {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.matrix-search-clear:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

.matrix-search-badge {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-unmastered-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 0.5rem 0.95rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: var(--transition-fast);
}

.filter-unmastered-btn:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--accent-sakura);
}

.filter-unmastered-btn.active {
    background: rgba(255, 101, 132, 0.18);
    color: var(--accent-sakura);
    border-color: var(--accent-sakura);
    box-shadow: 0 0 12px var(--accent-sakura-glow);
}

.calligraphy-box.small .character-static-char {
    font-size: 5.4rem;
}

/* Klasy filtracji kafelków */
.kana-tile.search-dimmed {
    opacity: 0.18;
    transform: scale(0.96);
    filter: grayscale(0.8);
    pointer-events: none;
}

.kana-tile.search-highlight {
    border-color: var(--accent-sakura);
    box-shadow: 0 0 16px var(--accent-sakura-glow);
    transform: translateY(-4px) scale(1.05);
    background: var(--bg-surface);
    z-index: 2;
}

.gojuon-row-group.search-hidden {
    display: none;
}

.matrix-no-results {
    text-align: center;
    padding: 2.5rem 1rem;
    background: var(--bg-surface);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 1rem;
}

.gojuon-grid-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.gojuon-row-group {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-soft);
}

.row-group-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-sakura);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kana-tiles-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.85rem;
    max-width: 580px;
    margin: 0 auto;
}

.kana-tile {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    user-select: none;
}

.kana-tile:hover {
    transform: translateY(-4px);
    border-color: var(--accent-sakura);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 15px var(--accent-sakura-glow);
    background: var(--bg-surface);
}

.kana-tile-char {
    font-family: var(--font-jp);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 0.2rem;
}

.kana-tile-romaji {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-sakura);
}

.kana-tile-strokes {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.kana-tile.mastered {
    border-color: rgba(16, 185, 129, 0.4);
}

.kana-tile.mastered::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.7rem;
    color: var(--accent-jade);
    font-weight: 800;
}

/* ==========================================================================
   Character Inspector Modal
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.inspector-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 460px;
    padding: 2rem;
    box-shadow: var(--shadow-card);
    position: relative;
    transform: scale(0.94);
    transition: transform var(--transition-smooth);
}

.modal-overlay.active .inspector-modal {
    transform: scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition-fast);
}

.modal-close-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-sakura);
}

.inspector-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.inspector-header h3 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.inspector-stage {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.inspector-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.meta-box {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.5rem;
    text-align: center;
}

.meta-box .meta-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.meta-box .meta-val {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.15rem;
}

.meta-box .meta-val.highlight {
    color: var(--accent-sakura);
}

.inspector-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.inspector-actions .inspector-btn.full-width {
    grid-column: span 2;
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--accent-jade);
}

.inspector-actions .inspector-btn.full-width:hover {
    background: var(--accent-jade);
    color: #ffffff;
    box-shadow: 0 4px 15px var(--accent-jade-glow);
}

.inspector-btn {
    flex: 1;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
}

.inspector-btn:hover {
    border-color: var(--accent-sakura);
    background: var(--bg-surface);
}

.inspector-btn.primary {
    background: var(--accent-sakura);
    border-color: var(--accent-sakura);
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-sakura-glow);
}

/* ==========================================================================
   Settings Modal
   ========================================================================== */
.settings-modal {
    max-width: 480px;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.setting-text {
    flex: 1;
    min-width: 0;
}

.setting-select {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.42rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: var(--transition-fast);
    font-family: inherit;
    width: auto;
    max-width: 135px;
    flex-shrink: 0;
    height: 38px;
}

.setting-select:focus {
    border-color: var(--accent-sakura);
    box-shadow: 0 0 0 3px var(--accent-sakura-glow);
}

.setting-row-danger {
    padding-top: 1.1rem;
    margin-top: 0.4rem;
    border-top: 1px solid var(--border-subtle);
}

.setting-danger-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.52rem 1.15rem;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    min-height: 38px;
}

.setting-danger-btn:hover,
.setting-danger-btn:active {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.35);
    transform: scale(0.98);
}

.setting-text h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.setting-text p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    transition: .3s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--accent-sakura);
    border-color: var(--accent-sakura);
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
    background-color: #ffffff;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    padding-bottom: 1rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.footer-hotkeys {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.hotkey-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

kbd {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
/* (Zunifikowane reguły responsywne przeniesione do głównej sekcji KOMPLEKSOWA RESPONSYWNOŚĆ MOBILNA) */

/* Bardzo małe ekrany (np. iPhone SE 1st gen, małe smartfony < 360px) */
@media (max-width: 360px) {
    .app-wrapper {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .brand-titles h1 {
        font-size: 1.05rem;
    }

    .ctrl-btn {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }

    .character-dual-display {
        flex-direction: column;
        gap: 0.75rem;
    }

    .calligraphy-box,
    .digital-font-box {
        width: 140px;
        height: 140px;
    }

    .stroke-gif-img {
        width: 125px;
        height: 125px;
    }

    .kana-tile-char {
        font-size: 1.35rem;
    }
}

/* ==========================================================================
   QR Code Modal (Otwórz na smartfonie)
   ========================================================================== */
.qr-modal {
    max-width: 460px;
    text-align: center;
}

.qr-ctrl-btn {
    position: relative;
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(99, 102, 241, 0.08);
}

.qr-ctrl-btn:hover {
    border-color: var(--accent-indigo);
    background: rgba(99, 102, 241, 0.2);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.35);
    transform: scale(1.05);
}

.qr-code-stage {
    display: flex;
    justify-content: center;
    margin: 1.25rem 0 1rem;
}

.qr-code-card {
    background: #ffffff;
    padding: 16px;
    border-radius: var(--radius-lg);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
}

.qr-code-card:hover {
    transform: scale(1.02);
}

.qrcode-canvas-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    min-height: 200px;
}

.qrcode-canvas-wrapper img,
.qrcode-canvas-wrapper canvas {
    display: block;
    border-radius: var(--radius-sm);
}

.qr-url-box {
    margin: 0.75rem 0 1.25rem;
    width: 100%;
}

.qr-url-input-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.35rem 0.5rem;
    gap: 0.5rem;
}

.qr-url-prefix {
    font-size: 1.1rem;
    padding-left: 0.3rem;
}

.qr-url-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.95rem;
    flex: 1;
    outline: none;
}

.qr-copy-btn {
    background: var(--accent-sakura);
    color: #fff;
    border: none;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.qr-copy-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 10px var(--accent-sakura-glow);
}

.qr-copy-feedback {
    color: var(--accent-jade);
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 0.45rem;
    animation: fadeIn 0.2s ease;
}

.qr-instructions {
    text-align: left;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-size: 0.86rem;
    color: var(--text-secondary);
}

.qr-step {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    line-height: 1.4;
}

.qr-step .step-num {
    background: rgba(255, 101, 132, 0.2);
    color: var(--accent-sakura);
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.qr-advanced-details {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: left;
}

.qr-advanced-details summary {
    cursor: pointer;
    user-select: none;
    margin-bottom: 0.5rem;
    outline: none;
    transition: color var(--transition-fast);
}

.qr-advanced-details summary:hover {
    color: var(--text-secondary);
}

.qr-ip-switcher {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-top: 0.4rem;
}

.qr-ip-select {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

/* ==========================================================================
   Victory Celebration Modal (46/46 Mastered)
   ========================================================================== */
.victory-modal {
    max-width: 500px;
    text-align: center;
    border: 1.5px solid rgba(255, 215, 0, 0.45);
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.25), var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.victory-modal::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.09) 0%, transparent 65%);
    pointer-events: none;
    animation: rotateVictoryGlow 22s linear infinite;
}

@keyframes rotateVictoryGlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.victory-header {
    position: relative;
    z-index: 1;
    margin-bottom: 1.5rem;
}

.victory-badge-crown {
    font-size: 2.8rem;
    margin-bottom: 0.25rem;
    animation: bounceCrown 1.6s ease-in-out infinite alternate;
}

@keyframes bounceCrown {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-7px) scale(1.08); }
}

.victory-seal {
    display: inline-block;
    border: 2px solid #e63946;
    color: #e63946;
    font-family: 'Hiragino Mincho Pro', 'Yu Mincho', serif;
    font-weight: 900;
    font-size: 1.05rem;
    padding: 0.2rem 0.85rem;
    border-radius: var(--radius-sm);
    letter-spacing: 3px;
    margin-bottom: 0.75rem;
    box-shadow: 0 0 12px rgba(230, 57, 70, 0.3);
    background: rgba(230, 57, 70, 0.05);
}

.victory-header h3 {
    font-size: 1.7rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffd700, #ff758c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.victory-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.victory-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
}

.victory-stat-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-align: left;
    transition: var(--transition-fast);
}

.victory-stat-card:hover {
    border-color: rgba(255, 215, 0, 0.4);
    transform: translateY(-2px);
}

.victory-stat-card .v-stat-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.victory-stat-card .v-stat-info {
    display: flex;
    flex-direction: column;
}

.victory-stat-card .v-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.victory-stat-card .v-stat-val {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.victory-mastery-banner {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.12), rgba(255, 117, 140, 0.12));
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.victory-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    position: relative;
    z-index: 1;
}

.victory-btn-reset {
    background: linear-gradient(135deg, #ffd700, #f59e0b) !important;
    color: #1a1a2e !important;
    font-weight: 800 !important;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    border: none !important;
    padding: 0.85rem 1.25rem;
}

.victory-btn-reset:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

.victory-btn-table {
    padding: 0.75rem 1.25rem;
}

.victory-btn-dismiss {
    margin-top: 0.25rem;
    align-self: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.victory-btn-dismiss:hover {
    color: var(--text-primary);
}

/* ==========================================================================
   Drawing Mode (Tryb rysowania znaków - Duolingo Style)
   ========================================================================== */
.draw-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.draw-card-container {
    width: 100%;
    max-width: 580px;
}

.draw-prompt-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.draw-prompt-label {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.draw-target-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.draw-target-romaji-box {
    background: linear-gradient(135deg, rgba(255, 101, 132, 0.12), rgba(99, 102, 241, 0.12));
    border: 1.5px solid rgba(255, 101, 132, 0.35);
    border-radius: var(--radius-md);
    padding: 0.25rem 2rem;
    box-shadow: 0 4px 15px rgba(255, 101, 132, 0.15);
}

.draw-romaji-target {
    font-size: 3rem;
    font-weight: 900;
    color: var(--accent-sakura);
    letter-spacing: -0.5px;
    line-height: 1.1;
    text-shadow: 0 2px 12px var(--accent-sakura-glow);
}

.draw-example-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.draw-ex-lbl {
    color: var(--text-muted);
}

.draw-example-subtitle strong {
    color: var(--text-primary);
}

.draw-canvas-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.25rem;
    width: 100%;
}

.draw-canvas-box {
    width: 290px;
    height: 290px;
    background-color: #ffffff;
    border: 3px solid rgba(255, 101, 132, 0.45);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35), inset 0 0 15px rgba(0, 0, 0, 0.04);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.draw-canvas-box:hover {
    border-color: var(--accent-sakura);
}

.draw-canvas-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    border-left: 1.5px dashed rgba(230, 57, 70, 0.28);
    pointer-events: none;
    z-index: 1;
}

.draw-canvas-box::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    border-top: 1.5px dashed rgba(230, 57, 70, 0.28);
    pointer-events: none;
    z-index: 1;
}

.draw-watermark-glyph {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Zen Kaku Gothic New', 'Noto Sans JP', sans-serif;
    font-size: 11.5rem;
    font-weight: 700;
    color: rgba(148, 163, 184, 0.32);
    line-height: 1;
    pointer-events: none;
    z-index: 2;
    user-select: none;
    transition: opacity 0.25s ease;
}

.draw-watermark-glyph.hidden {
    opacity: 0;
}

.draw-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    cursor: crosshair;
    touch-action: none;
}

.draw-stroke-pill {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 4;
    background: rgba(15, 23, 42, 0.78);
    color: #f8fafc;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    pointer-events: none;
}

.draw-tools-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-top: 0.85rem;
    width: 100%;
}

.draw-tool-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: var(--transition-fast);
}

.draw-tool-btn:hover:not(:disabled) {
    color: var(--text-primary);
    border-color: rgba(255, 101, 132, 0.4);
    transform: translateY(-1px);
}

.draw-tool-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.draw-tool-btn.active {
    color: var(--accent-sakura);
    border-color: rgba(255, 101, 132, 0.5);
    background: rgba(255, 101, 132, 0.1);
}

.draw-feedback-section {
    width: 100%;
    margin-bottom: 1rem;
    min-height: 28px;
}

.draw-solution-card {
    background: var(--bg-surface-elevated);
    border: 1px solid rgba(255, 101, 132, 0.3);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    animation: fadeInSlideUp 0.3s ease;
}

@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.draw-solution-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-sakura);
    margin-bottom: 0.75rem;
}

.solution-header-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.solution-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.solution-close-btn:hover {
    color: var(--text-primary);
}

.draw-solution-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.solution-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.solution-char-large {
    font-family: 'Zen Kaku Gothic New', 'Noto Sans JP', sans-serif;
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
}

.solution-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.solution-meta strong {
    color: var(--text-primary);
}

.draw-bottom-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.5rem;
}

.draw-submit-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--accent-sakura), #ec4899);
    color: #ffffff;
    font-weight: 800;
    font-size: 1.05rem;
    padding: 0.85rem 1.5rem;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: 0 4px 18px var(--accent-sakura-glow);
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.draw-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px var(--accent-sakura-glow);
}

.draw-submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.draw-submit-btn.success-mode {
    background: linear-gradient(135deg, var(--accent-jade), #059669);
    box-shadow: 0 4px 18px var(--accent-jade-glow);
}

/* Etykiety responsywne dla zakładek nawigacji */
.tab-text-mobile {
    display: none;
}
.tab-text-full {
    display: inline;
}

/* Rząd przycisków losowości i trybu inteligentnego w pasku filtrów */
.filter-actions-row {
    display: contents;
}

/* ==========================================================================
   Globalny Przełącznik Alfabetu (Hiragana ⇄ Katakana)
   ========================================================================== */
.alphabet-switcher {
    display: inline-flex;
    align-items: center;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    padding: 3px;
    border-radius: var(--radius-full);
    gap: 3px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    user-select: none;
}

.alpha-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-fast);
}

.alpha-toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.alpha-toggle-btn.active {
    color: #ffffff;
}

.alpha-toggle-btn[data-alpha="hiragana"].active {
    background: linear-gradient(135deg, #e11d48, #f43f5e);
    border-color: rgba(244, 63, 94, 0.6);
    box-shadow: 0 2px 12px var(--accent-sakura-glow);
}

.alpha-toggle-btn[data-alpha="katakana"].active {
    background: linear-gradient(135deg, #4f46e5, #0284c7);
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.45);
}

.alpha-toggle-btn[data-alpha="both"].active {
    background: linear-gradient(135deg, #e11d48, #8b5cf6, #0284c7);
    border-color: rgba(139, 92, 246, 0.7);
    box-shadow: 0 2px 14px rgba(139, 92, 246, 0.45);
}

.alpha-icon {
    font-family: var(--font-jp);
    font-weight: 900;
    font-size: 0.95rem;
    line-height: 1;
}

.alpha-text-mobile {
    display: none;
}
.alpha-text-full {
    display: inline;
}

/* Katakana Mode Styling & Accents */
[data-alphabet="katakana"] .hanko-seal {
    background: linear-gradient(135deg, #4f46e5, #06b6d4) !important;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.45) !important;
}

[data-alphabet="katakana"] .brand-titles h1 .jp-title {
    color: #38bdf8 !important;
}

[data-alphabet="katakana"] .badge-tag.group-badge {
    background: rgba(99, 102, 241, 0.15) !important;
    color: #818cf8 !important;
    border-color: rgba(99, 102, 241, 0.35) !important;
}

/* Mixed (Both Hiragana + Katakana) Mode Styling & Accents */
[data-alphabet="both"] .hanko-seal {
    background: linear-gradient(135deg, #e11d48, #8b5cf6, #0284c7) !important;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.5) !important;
}

[data-alphabet="both"] .brand-titles h1 .jp-title {
    background: linear-gradient(135deg, #fb7185, #c084fc, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge-tag.script-tag {
    font-weight: 800;
    letter-spacing: 0.3px;
}
.badge-tag.script-tag.hiragana {
    background: rgba(225, 29, 72, 0.15) !important;
    color: #fb7185 !important;
    border-color: rgba(225, 29, 72, 0.4) !important;
}
.badge-tag.script-tag.katakana {
    background: rgba(2, 132, 199, 0.15) !important;
    color: #38bdf8 !important;
    border-color: rgba(2, 132, 199, 0.4) !important;
}

.draw-alpha-highlight {
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
}
.draw-alpha-highlight.hiragana {
    background: rgba(225, 29, 72, 0.18);
    color: #fb7185;
}
.draw-alpha-highlight.katakana {
    background: rgba(2, 132, 199, 0.18);
    color: #38bdf8;
}

/* ==========================================================================
   KOMPLEKSOWA RESPONSYWNOŚĆ MOBILNA (MOBILE-FIRST POLISH)
   ========================================================================== */

@media (max-width: 768px) {
    /* 1. Globalne marginesy, układ i obsługa iPhone Notch & Safe Areas */
    .app-wrapper {
        padding: max(0.4rem, env(safe-area-inset-top, 0px)) max(0.65rem, env(safe-area-inset-right, 0px)) max(1.25rem, env(safe-area-inset-bottom, 0px)) max(0.65rem, env(safe-area-inset-left, 0px));
        width: 100%;
        max-width: 100vw;
        min-height: 100dvh;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    /* 2. Nagłówek - 3-poziomowy perfekcyjny mobilny układ:
       Rząd 1: Brand (lewa) + Narzędzia/Controls (prawa)
       Rząd 2: Wybór alfabetu (Hira, Kata, Oba, Kanji) - 4 równe kolumny
       Rząd 3: Nawigacja trybów (Quiz, Rysuj, Tablica, Kanji) - 4 równe kolumny */
    .site-header {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
        row-gap: 0.5rem;
        column-gap: 0.4rem;
        align-items: center;
        padding: 0.25rem 0 0.65rem;
        margin-bottom: 0.65rem;
        width: 100%;
    }

    .brand-section {
        grid-column: 1;
        grid-row: 1;
        display: flex;
        align-items: center;
        gap: 0.45rem;
        min-width: 0;
    }

    .hanko-seal {
        width: 34px;
        height: 34px;
        font-size: 1.15rem;
        flex-shrink: 0;
    }

    .brand-titles h1 {
        font-size: 1.05rem;
        gap: 0.25rem;
        white-space: nowrap;
        letter-spacing: -0.3px;
    }

    .brand-titles h1 .jp-title {
        font-size: 0.95rem;
    }

    .brand-subtitle {
        display: none;
    }

    .header-controls {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        gap: 0.25rem;
        margin-left: auto;
        align-items: center;
    }

    .ctrl-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        border-radius: var(--radius-sm);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    /* Wybór alfabetu: 4 równe kolumny na całą szerokość ekranu iPhone'a */
    .alphabet-switcher {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        padding: 2.5px;
        gap: 3px;
        background: var(--bg-surface-elevated);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-full);
        box-sizing: border-box;
    }

    .alpha-toggle-btn {
        flex: 1;
        justify-content: center;
        padding: 0.4rem 0.15rem;
        font-size: 0.76rem;
        font-weight: 700;
        gap: 0.2rem;
        min-height: 34px;
        border-radius: var(--radius-full);
        white-space: nowrap;
    }

    .alpha-text-full {
        display: none;
    }
    .alpha-text-mobile {
        display: inline;
    }

    /* Pełnowymiarowy mobilny Segmented Control dla 4 zakładek w JEDNYM rzędzie */
    .nav-tabs {
        grid-column: 1 / -1;
        grid-row: 3;
        width: 100%;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        padding: 2.5px;
        gap: 3px;
        background: var(--bg-surface-elevated);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-full);
        box-sizing: border-box;
        margin-top: 0;
    }

    .nav-tab-btn {
        padding: 0.45rem 0.15rem;
        font-size: 0.76rem;
        font-weight: 700;
        justify-content: center;
        text-align: center;
        gap: 0.25rem;
        min-height: 36px;
        border-radius: var(--radius-full);
        white-space: nowrap;
    }

    .nav-tab-btn span {
        font-size: 0.9rem;
    }

    .tab-text-mobile {
        display: inline;
    }
    .tab-text-full {
        display: none;
    }

    /* 3. Pasek filtrów i statystyk */
    .session-bar {
        padding: 0.55rem 0.7rem;
        border-radius: var(--radius-md);
        margin-bottom: 0.75rem;
        gap: 0.45rem;
    }

    .filter-group {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }

    .filter-label {
        display: none;
    }

    .filter-select {
        width: 100%;
        padding: 0.45rem 0.75rem;
        font-size: 0.84rem;
        height: 38px;
        border-radius: var(--radius-sm);
    }

    .setting-select {
        width: auto !important;
        max-width: 125px;
        flex-shrink: 0;
        padding: 0.38rem 0.6rem;
        font-size: 0.8rem;
        height: 36px;
    }

    .filter-actions-row {
        display: flex;
        gap: 0.4rem;
        width: 100%;
    }

    .order-toggle-btn {
        flex: 1;
        justify-content: center;
        padding: 0.4rem 0.45rem;
        font-size: 0.75rem;
        white-space: nowrap;
        text-align: center;
        min-height: 34px;
        border-radius: var(--radius-sm);
    }

    /* Statystyki jako 4-kolumnowy mobilny panel */
    .session-stats {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0.2rem;
        padding-top: 0.45rem;
        border-top: 1px solid var(--border-subtle);
    }

    .stat-item {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1px;
        font-size: 0.7rem;
        text-align: center;
    }

    .stat-item .stat-icon {
        font-size: 1.05rem;
    }

    .stat-item .stat-val {
        font-size: 0.78rem;
        font-weight: 700;
    }

    /* 4. Karta Quizu / Treningu */
    .practice-card-container {
        padding: 0.9rem 0.75rem 1rem;
        border-radius: var(--radius-lg);
    }

    .card-progress-wrapper {
        margin-bottom: 0.65rem;
    }

    .card-badges {
        flex-wrap: wrap;
        gap: 0.3rem;
        justify-content: center;
        margin-bottom: 0.65rem;
    }

    .badge-tag {
        padding: 0.2rem 0.5rem;
        font-size: 0.72rem;
    }

    /* DUAL DISPLAY NA TELEFONIE - IDEALNE DOPASOWANIE PROPORCJI */
    .character-dual-display {
        gap: 0.5rem;
        width: 100%;
        justify-content: center;
        align-items: flex-start;
    }

    .char-display-card {
        flex: 1;
        max-width: 142px;
        min-width: 0;
    }

    .character-dual-display.single-card .char-display-card,
    .character-dual-display.modal-dual-display.single-card .char-display-card {
        max-width: 175px !important;
        width: 175px;
    }

    .char-display-header {
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        margin-bottom: 0.35rem;
        width: 100%;
    }

    .char-display-label {
        font-size: 0.68rem;
        letter-spacing: 0.1px;
        white-space: nowrap;
        line-height: 1.1;
    }

    .calligraphy-box,
    .digital-font-box {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        max-width: 142px;
        border-width: 2px;
        border-radius: var(--radius-md);
    }

    .stroke-gif-img {
        width: 88%;
        height: 88%;
        max-width: 122px;
        max-height: 122px;
    }

    .digital-char-glyph {
        font-size: 4rem;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        margin: 0;
        padding: 0;
    }

    .character-static-char {
        font-size: 4.4rem;
    }

    .stage-actions {
        width: 100%;
        gap: 0.45rem;
        margin-top: 0.55rem;
    }

    .action-pill-btn {
        flex: 1;
        justify-content: center;
        padding: 0.4rem 0.5rem;
        font-size: 0.76rem;
        min-height: 36px;
    }

    /* Formularz wprowadzania Romaji */
    .input-section {
        margin-top: 0.75rem;
    }

    .input-wrapper {
        margin-bottom: 0.55rem;
        width: 100%;
        max-width: 320px;
    }

    .romaji-input {
        height: 48px;
        font-size: 1.15rem; /* >= 16px to prevent iOS Safari auto-zoom */
        padding: 0.45rem 3.2rem 0.45rem 1rem;
        border-radius: var(--radius-full);
        -webkit-appearance: none;
    }

    .submit-btn {
        width: 40px;
        height: 40px;
        right: 4px;
        font-size: 1.1rem;
    }

    .card-footer-actions {
        padding-top: 0.45rem;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .ghost-action-btn {
        font-size: 0.78rem;
        padding: 0.35rem 0.45rem;
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
    }

    /* 5. Widok Rysowania (Nauka pisania) */
    .draw-card-container {
        padding: 0.9rem 0.75rem 1rem;
        border-radius: var(--radius-lg);
    }

    .draw-prompt-header {
        margin-bottom: 0.45rem;
    }

    .draw-prompt-label {
        font-size: 0.72rem;
    }

    .draw-target-row {
        gap: 0.45rem;
        margin-bottom: 0.2rem;
    }

    .draw-target-romaji-box {
        padding: 0.1rem 0.9rem;
    }

    .draw-romaji-target {
        font-size: 2rem;
    }

    .draw-canvas-box {
        width: 250px;
        height: 250px;
        max-width: 76vw;
        max-height: 76vw;
        border-width: 2px;
        touch-action: none;
    }

    #draw-canvas {
        touch-action: none;
    }

    .draw-watermark-glyph {
        font-size: 8.5rem;
    }

    .draw-tools-toolbar {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 3px;
        width: 100%;
        max-width: 320px;
        margin-top: 0.5rem;
    }

    .draw-tool-btn {
        padding: 0.35rem 0.1rem;
        font-size: 0.68rem;
        flex-direction: column;
        gap: 1px;
        text-align: center;
        justify-content: center;
        border-radius: var(--radius-sm);
        min-height: 42px;
    }

    .draw-tool-btn span:first-child {
        font-size: 0.95rem;
    }

    .draw-bottom-actions {
        gap: 0.45rem;
        margin-top: 0.55rem;
    }

    .draw-submit-btn {
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
        height: 44px;
    }

    /* 6. Tablica Gojūon */
    .matrix-header {
        margin-bottom: 0.85rem;
    }

    .matrix-header h2 {
        font-size: 1.15rem;
        margin-bottom: 0.2rem;
    }

    .matrix-header p {
        font-size: 0.8rem;
    }

    .matrix-category-pills {
        display: flex !important;
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none;
        gap: 0.35rem;
        padding: 0.2rem 0.35rem 0.45rem !important;
        margin-bottom: 0.65rem;
        width: 100%;
        scroll-padding-left: 0.35rem;
    }

    .matrix-category-pills::-webkit-scrollbar {
        display: none;
    }

    .matrix-category-pill {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
        font-size: 0.76rem !important;
        padding: 0.35rem 0.7rem !important;
    }

    .matrix-search-wrapper {
        flex-direction: column;
        gap: 0.4rem;
        width: 100%;
        margin-bottom: 0.65rem;
    }

    .matrix-search-box {
        width: 100%;
    }

    .matrix-search-input {
        font-size: 0.88rem;
        padding: 0.45rem 2.2rem;
        height: 40px;
    }

    .filter-unmastered-btn,
    .matrix-search-badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.65rem;
    }

    .gojuon-row-group {
        padding: 0.65rem 0.35rem;
        border-radius: var(--radius-md);
        margin-bottom: 0.65rem;
    }

    .row-group-title {
        font-size: 0.76rem;
        margin-bottom: 0.4rem;
    }

    .kana-tiles-row {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.25rem;
        width: 100%;
    }

    .kana-tile {
        padding: 0.35rem 0.1rem;
        min-height: 56px;
        border-radius: var(--radius-sm);
    }

    .kana-tile-char {
        font-size: 1.5rem;
        margin-bottom: 0.05rem;
    }

    .kana-tile-romaji {
        font-size: 0.7rem;
    }

    .kana-tile-strokes {
        font-size: 0.58rem;
    }

    /* 7. Modale na telefonie (Inspector, Settings, Analytics, Victory) */
    .modal-overlay {
        padding: max(0.5rem, env(safe-area-inset-top, 0px)) max(0.5rem, env(safe-area-inset-right, 0px)) max(0.75rem, env(safe-area-inset-bottom, 0px)) max(0.5rem, env(safe-area-inset-left, 0px)) !important;
    }

    .inspector-modal {
        max-width: 96vw !important;
        width: 96vw !important;
        max-height: calc(100dvh - 35px) !important;
        max-height: calc(100vh - 35px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 1.15rem 0.85rem calc(1.5rem + env(safe-area-inset-bottom, 0px)) !important;
        border-radius: var(--radius-xl) !important;
    }

    .modal-close-btn {
        width: 36px;
        height: 36px;
        top: 0.6rem;
        right: 0.6rem;
        font-size: 1.15rem;
    }

    .modal-dual-display {
        gap: 0.45rem;
    }

    .modal-dual-display .char-display-label {
        font-size: 0.64rem !important;
        letter-spacing: 0 !important;
        white-space: nowrap !important;
    }

    .calligraphy-box.small,
    .digital-font-box.small {
        width: 105px;
        height: 105px;
    }

    .calligraphy-box.small .stroke-gif-img {
        width: 88px;
        height: 88px;
    }

    .digital-font-box.small .digital-char-glyph {
        font-size: 3.4rem;
    }

    .inspector-actions {
        flex-direction: column;
        gap: 0.4rem;
    }

    .inspector-btn {
        width: 100% !important;
        padding: 0.6rem 0.85rem !important;
        font-size: 0.82rem !important;
        min-height: 42px;
    }

    @media (max-width: 360px) {
        .setting-row-danger {
            flex-direction: column;
            align-items: stretch;
            gap: 0.6rem;
        }
        .setting-row-danger .setting-danger-btn {
            width: 100%;
        }
    }

    .victory-modal {
        max-width: 96vw !important;
        padding: 1.15rem 0.75rem !important;
    }

    .victory-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }

    .victory-stat-card {
        padding: 0.5rem 0.6rem;
        gap: 0.4rem;
    }

    .victory-stat-card .v-stat-icon {
        font-size: 1.1rem;
    }

    .victory-stat-card .v-stat-val {
        font-size: 0.88rem;
    }

    .settings-modal {
        max-width: 96vw !important;
        width: 96vw !important;
        padding: 1.15rem 0.85rem !important;
        max-height: calc(100dvh - 30px) !important;
    }
}

/* 8. Dodatkowa optymalizacja dla wąskich ekranów (np. iPhone SE 320-375px) */
@media (max-width: 380px) {
    .brand-subtitle {
        display: none;
    }

    .hanko-seal {
        width: 34px;
        height: 34px;
        font-size: 1.1rem;
    }

    .brand-titles h1 {
        font-size: 1.05rem;
    }

    .ctrl-btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .char-display-card {
        max-width: 130px;
    }

    .digital-char-glyph {
        font-size: 3.8rem;
    }

    .draw-canvas-box {
        width: 240px;
        height: 240px;
    }

    .draw-watermark-glyph {
        font-size: 8.5rem;
    }

    .kana-tiles-row {
        gap: 0.2rem;
    }

    .kana-tile {
        padding: 0.35rem 0.1rem;
        min-height: 54px;
    }

    .kana-tile-char {
        font-size: 1.35rem;
    }

    .alpha-toggle-btn {
        padding: 0.28rem 0.42rem;
        font-size: 0.72rem;
    }
}

/* ==========================================================================
   Mnemonic Lightbox Modal (Powiększenie zdjęcia mnemotechniki)
   ========================================================================== */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 15, 29, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.lightbox-overlay.active {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.lightbox-modal {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    width: min(92vw, 680px);
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.75), 0 0 35px rgba(56, 189, 248, 0.18);
    transform: scale(0.92);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.lightbox-overlay.active .lightbox-modal {
    transform: scale(1);
    opacity: 1;
}

.lightbox-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 15;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: var(--transition-fast);
    backdrop-filter: blur(8px);
}

.lightbox-close-btn:hover {
    background: var(--accent-sakura);
    border-color: var(--accent-sakura);
    color: #ffffff;
    transform: scale(1.08) rotate(90deg);
    box-shadow: 0 0 15px var(--accent-sakura-glow);
}

.lightbox-content {
    display: flex;
    flex-direction: column;
}

.lightbox-img-box {
    position: relative;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.75rem;
    max-height: 52vh;
    min-height: 220px;
    overflow: hidden;
    border-top-left-radius: calc(var(--radius-xl) - 1px);
    border-top-right-radius: calc(var(--radius-xl) - 1px);
    border-bottom: 1px solid var(--border-subtle);
}

.lightbox-img {
    max-width: 100%;
    max-height: 48vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.08));
    user-select: none;
    -webkit-user-select: none;
}

.lightbox-info {
    padding: 1.4rem 1.75rem 1.65rem;
    background: var(--bg-surface);
}

.lightbox-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.lightbox-hint-label {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.lightbox-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.3px;
}

.lightbox-desc {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

@media (max-width: 600px) {
    .lightbox-modal {
        width: 95vw;
        max-height: 92vh;
        border-radius: var(--radius-lg);
    }

    .lightbox-close-btn {
        top: 0.65rem;
        right: 0.65rem;
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }

    .lightbox-img-box {
        padding: 1rem;
        min-height: 180px;
        max-height: 40vh;
        border-top-left-radius: calc(var(--radius-lg) - 1px);
        border-top-right-radius: calc(var(--radius-lg) - 1px);
    }

    .lightbox-img {
        max-height: 36vh;
    }

    .lightbox-info {
        padding: 1rem 1.15rem 1.25rem;
    }

    .lightbox-title {
        font-size: 1.2rem;
    }

    .lightbox-desc {
        font-size: 0.88rem;
        line-height: 1.45;
    }

    .lightbox-hint-label {
        display: none;
    }
}

/* ==========================================================================
   TABLICA PORÓWNAWCZA: HIRAGANA + KATAKANA OBOK SIEBIE
   ========================================================================== */

.matrix-view-mode-tabs {
    display: inline-flex;
    align-items: center;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 3px;
    gap: 4px;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    user-select: none;
}

.matrix-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-fast);
}

.matrix-view-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.matrix-view-btn.active {
    background: linear-gradient(135deg, #e11d48, #8b5cf6, #0284c7);
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Pigułki wyboru kategorii znaków w tablicy */
.matrix-category-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.35rem auto 1.35rem;
    user-select: none;
    max-width: 800px;
}

.matrix-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.95rem;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-fast);
}

.matrix-cat-pill:hover {
    color: var(--text-primary);
    border-color: var(--accent-sakura);
    background: var(--bg-surface);
    transform: translateY(-1px);
}

.matrix-cat-pill.active {
    background: linear-gradient(135deg, #e11d48, #be185d);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 14px var(--accent-sakura-glow);
}

.matrix-cat-pill .cat-pill-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 800;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
}

.matrix-cat-pill.active .cat-pill-count {
    background: rgba(255, 255, 255, 0.28);
}

/* Nagłówki sekcji kategorii w tablicy (gdy wybrane 'Wszystkie') */
.matrix-section-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.15rem;
    margin: 1rem 0 0.25rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-left: 4px solid var(--accent-sakura);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.matrix-section-divider.dakuon {
    border-left-color: #f59e0b;
}

.matrix-section-divider.yoon {
    border-left-color: #8b5cf6;
}

.matrix-section-title {
    font-size: 0.96rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.matrix-section-badge {
    font-size: 0.74rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

/* Siatka 3 kolumn dla wierszy Yōon (zmiękczeń) */
.kana-tiles-row.yoon-row {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    max-width: 380px !important;
    margin: 0 auto !important;
}

.kana-tiles-row.compare-tiles-row.yoon-row {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    max-width: 440px !important;
    margin: 0 auto !important;
}

/* Dwu-znakowe litery Yōon (きゃ, ぴょ itp.) skalowane proporcjonalnie */
.kana-tile.yoon .kana-tile-char {
    font-size: 1.65rem;
    letter-spacing: -1px;
}

.compare-sub-char.yoon {
    font-size: 1.35rem;
    letter-spacing: -1px;
}

/* Wiersz siatki porównawczej: 5 kolumn z większą przestrzenią na dwa znaki */
.kana-tiles-row.compare-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.85rem;
    max-width: 680px;
    margin: 0 auto;
}

/* Kafel porównawczy: Hiragana obok Katakany */
.kana-tile.compare-tile {
    padding: 0.65rem 0.55rem 0.55rem;
    min-width: 0;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.35rem;
    position: relative;
    transition: var(--transition-fast);
    cursor: pointer;
    user-select: none;
}

.kana-tile.compare-tile:hover {
    transform: translateY(-4px);
    border-color: rgba(139, 92, 246, 0.7);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 18px rgba(139, 92, 246, 0.3);
    background: var(--bg-surface);
}

.compare-tile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.compare-romaji {
    font-size: 0.92rem;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 0.5px;
}

.compare-tile-audio-btn {
    background: transparent;
    border: none;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0.75;
    transition: var(--transition-fast);
}

.compare-tile-audio-btn:hover {
    opacity: 1;
    transform: scale(1.25);
}

.compare-split-chars {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
    padding: 0.15rem 0;
}

.compare-sub-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.2rem;
    transition: var(--transition-fast);
}

.compare-sub-col.hira-sub {
    background: rgba(225, 29, 72, 0.08);
    border: 1px solid rgba(225, 29, 72, 0.22);
}

.compare-sub-col.kata-sub {
    background: rgba(2, 132, 199, 0.08);
    border: 1px solid rgba(2, 132, 199, 0.22);
}

.compare-sub-col:hover {
    background: rgba(255, 255, 255, 0.08);
}

.compare-sub-tag {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.05rem;
}

.compare-sub-col.hira-sub .compare-sub-tag {
    color: #fb7185;
}

.compare-sub-col.kata-sub .compare-sub-tag {
    color: #38bdf8;
}

.compare-sub-char {
    font-family: var(--font-jp);
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}

.compare-sub-strokes {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.compare-divider {
    width: 1px;
    height: 70%;
    background: var(--border-subtle);
    opacity: 0.5;
}

.compare-tile-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.compare-inspect-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}

.kana-tile.compare-tile.mastered-both {
    border-color: rgba(16, 185, 129, 0.45);
}

.kana-tile.compare-tile.mastered-both::after {
    content: '⭐';
    position: absolute;
    top: 3px;
    right: 5px;
    font-size: 0.65rem;
}

/* ==========================================================================
   MODAL INSPEKTORA: SCRIPT TABS & DUAL STAGE
   ========================================================================== */

.inspector-script-tabs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 3px;
    gap: 3px;
    margin: 0.5rem auto 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    user-select: none;
}

.insp-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.insp-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.insp-tab-btn.active {
    color: #ffffff;
}

.insp-tab-btn[data-tab="hira"].active {
    background: linear-gradient(135deg, #e11d48, #f43f5e);
    border-color: rgba(244, 63, 94, 0.6);
    box-shadow: 0 2px 10px var(--accent-sakura-glow);
}

.insp-tab-btn[data-tab="kata"].active {
    background: linear-gradient(135deg, #4f46e5, #0284c7);
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.45);
}

.insp-tab-btn[data-tab="dual"].active {
    background: linear-gradient(135deg, #e11d48, #8b5cf6, #0284c7);
    border-color: rgba(139, 92, 246, 0.7);
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.45);
}

/* Widok podwójny obok siebie w inspektorze */
.inspector-dual-stage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.dual-side-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.dual-side-card.hira-side {
    border-color: rgba(225, 29, 72, 0.3);
}

.dual-side-card.kata-side {
    border-color: rgba(2, 132, 199, 0.3);
}

.dual-side-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.dual-side-tag {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
}

.dual-side-tag.hira {
    background: rgba(225, 29, 72, 0.15);
    color: #fb7185;
}

.dual-side-tag.kata {
    background: rgba(2, 132, 199, 0.15);
    color: #38bdf8;
}

.dual-side-strokes {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.dual-side-char {
    font-family: var(--font-jp);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.dual-side-card .calligraphy-box[style*="display: none"] ~ .dual-side-char {
    font-size: 3.2rem;
    padding: 1.4rem 0;
}

/* Podwójne karty mnemotechnik w modalu */
.inspector-dual-mnemonics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.dual-mnemonic-box {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dual-mnemonic-box.hira {
    border-color: rgba(225, 29, 72, 0.25);
}

.dual-mnemonic-box.kata {
    border-color: rgba(2, 132, 199, 0.25);
}

.mnemonic-badge.hira {
    background: rgba(225, 29, 72, 0.15);
    color: #fb7185;
}

.mnemonic-badge.kata {
    background: rgba(2, 132, 199, 0.15);
    color: #38bdf8;
}

.mnemonic-body.compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.mnemonic-body.compact .mnemonic-img-wrapper {
    max-width: 140px;
    max-height: 120px;
}

.mnemonic-body.compact .mnemonic-desc {
    font-size: 0.78rem;
    line-height: 1.35;
    text-align: center;
}

/* ==========================================================================
   RESPONSYWNOŚĆ MOBILNA DLA TABLICY PORÓWNAWCZEJ
   ========================================================================== */

@media (max-width: 680px) {
    .kana-tiles-row.compare-row {
        gap: 0.45rem;
        max-width: 100%;
    }

    .matrix-view-mode-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .matrix-view-btn {
        padding: 0.4rem 0.35rem;
        font-size: 0.76rem;
        justify-content: center;
        text-align: center;
    }

    .kana-tile.compare-tile {
        padding: 0.45rem 0.3rem 0.4rem;
        gap: 0.25rem;
    }

    .compare-romaji {
        font-size: 0.8rem;
    }

    .compare-sub-char {
        font-size: 1.35rem;
    }

    .compare-sub-tag {
        font-size: 0.56rem;
    }

    .compare-sub-strokes {
        font-size: 0.56rem;
    }

    .compare-inspect-hint {
        display: none;
    }

    .inspector-script-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .insp-tab-btn {
        padding: 0.35rem 0.2rem;
        font-size: 0.72rem;
        justify-content: center;
    }

    .inspector-dual-stage {
        gap: 0.5rem;
    }

    .dual-side-card {
        padding: 0.5rem 0.35rem;
    }

    .dual-side-char {
        font-size: 1.6rem;
    }

    .inspector-dual-mnemonics {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }
}

/* ==========================================================================
   KANJI MASTER STYLES (GRADE 1-6 ARCHITECTURE)
   ========================================================================== */

.kanji-view {
    display: flex;
    flex-direction: column;
    width: 100%;
    animation: fadeIn 0.25s ease-out;
}

/* Floating Toast Notification */
.app-floating-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background: rgba(24, 24, 37, 0.95);
    border: 1.5px solid var(--accent-sakura);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55), 0 0 18px var(--accent-sakura-glow);
    backdrop-filter: blur(10px);
    color: #ffffff;
    padding: 0.8rem 1.4rem;
    border-radius: var(--radius-full);
    font-size: 0.92rem;
    font-weight: 600;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    max-width: 90vw;
    text-align: center;
}

.app-floating-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.app-floating-toast .toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.kanji-matrix-section {
    width: 100%;
}

/* 1. Selektor poziomów klas (Grade 1 - Grade 6) */
.kanji-grade-selector-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 1.15rem 0 1.25rem;
    padding: 0.9rem 1.1rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
}

.kanji-grade-lbl {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.kanji-grade-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    width: 100%;
}

.kanji-grade-pill {
    flex: 1 1 calc(16.666% - 0.55rem);
    min-width: 110px;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    transition: all var(--transition-fast);
    text-align: center;
    position: relative;
    user-select: none;
}

.kanji-grade-pill:hover:not(.disabled) {
    border-color: var(--accent-sakura);
    background: rgba(255, 101, 132, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-sakura-glow);
}

.kanji-grade-pill.active {
    background: linear-gradient(135deg, rgba(255, 101, 132, 0.22), rgba(99, 102, 241, 0.2));
    border-color: var(--accent-sakura);
    box-shadow: 0 4px 16px var(--accent-sakura-glow);
}

.kanji-grade-pill .grade-badge {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.kanji-grade-pill.active .grade-badge {
    color: var(--accent-sakura);
}

.kanji-grade-pill .grade-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.kanji-grade-pill.disabled {
    opacity: 0.55;
    background: rgba(15, 23, 42, 0.35);
    border-style: dashed;
    cursor: pointer;
}

.kanji-grade-pill.disabled:hover {
    border-color: rgba(255, 215, 0, 0.5);
    background: rgba(255, 215, 0, 0.05);
    opacity: 0.8;
}

/* 2. Pasek statystyk i podtrybów */
.kanji-stats-subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-bottom: 1.15rem;
    padding: 0.65rem 1rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.kanji-stat-box {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.kanji-stat-box strong {
    color: #ffd700;
    font-weight: 800;
    font-size: 1.05rem;
}

.kanji-submode-tabs {
    display: inline-flex;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 0.25rem;
    gap: 0.25rem;
}

.kanji-sub-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.45rem 0.95rem;
    border-radius: var(--radius-full);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--transition-fast);
}

.kanji-sub-btn:hover {
    color: var(--text-primary);
}

.kanji-sub-btn.active {
    background: var(--accent-sakura);
    color: #ffffff;
    box-shadow: 0 2px 10px var(--accent-sakura-glow);
}

/* 3. Filtry kategorii i toolbar */
.kanji-filter-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.35rem;
}

.kanji-category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
}

.kanji-cat-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.kanji-cat-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255, 101, 132, 0.45);
    transform: translateY(-1px);
}

.kanji-cat-btn.active {
    background: linear-gradient(135deg, rgba(255, 101, 132, 0.2), rgba(99, 102, 241, 0.2));
    border-color: var(--accent-sakura);
    color: var(--accent-sakura);
    font-weight: 700;
}

/* 4. Siatka znaków Kanji */
.kanji-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.85rem;
    width: 100%;
    margin-bottom: 2rem;
}

.kanji-tile {
    background: var(--bg-surface-elevated);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.6rem 0.65rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    min-height: 165px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kanji-tile:hover {
    border-color: var(--accent-sakura);
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(255, 101, 132, 0.25);
    background: var(--bg-surface);
}

.kanji-tile:active {
    transform: scale(0.97);
}

.kanji-tile-top-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.kanji-tile-num {
    font-weight: 700;
    opacity: 0.7;
}

.kanji-tile-strokes {
    background: rgba(255, 255, 255, 0.06);
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm);
    font-size: 0.64rem;
}

.kanji-tile-char {
    font-family: 'Zen Kaku Gothic New', 'Noto Sans JP', 'Hiragino Sans', sans-serif;
    font-size: 2.85rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    margin: 0.15rem 0 0.3rem;
    transition: transform var(--transition-fast);
}

.kanji-tile:hover .kanji-tile-char {
    transform: scale(1.08);
    color: var(--accent-sakura);
}

.kanji-tile-meaning {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-bottom: 0.25rem;
}

.kanji-tile-readings {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 0.1rem;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.25;
}

.kanji-tile-on {
    color: #818cf8;
    font-weight: 600;
}

.kanji-tile-kun {
    color: #f472b6;
    font-weight: 500;
}

.kanji-tile-emoji {
    font-size: 1.25rem;
    line-height: 1;
    margin-top: 0.35rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
    transition: transform var(--transition-fast), filter var(--transition-fast);
    user-select: none;
}

.kanji-tile:hover .kanji-tile-emoji {
    transform: scale(1.22);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.kanji-tile.mastered::after {
    content: '⭐';
    position: absolute;
    top: 5px;
    right: 6px;
    font-size: 0.8rem;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.7));
}

.kanji-empty-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 1rem;
    background: var(--bg-surface-elevated);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-subtle);
}

/* 5. Modal Inspektora Kanji */
.kanji-inspector-modal {
    max-width: 540px;
}

.kanji-modal-header-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-bottom: 0.65rem;
}

.kanji-modal-header-badges .badge-tag {
    font-size: 0.72rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
}

.kanji-modal-header-badges .cat-tag {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.kanji-inspector-modal .inspector-header h3 {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.kanji-inspector-modal .inspector-header p {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent-sakura);
}

.kanji-modal-display {
    margin-bottom: 1.15rem;
}

.kanji-glyph {
    font-size: 5.5rem;
    font-weight: 700;
}

.kanji-modal-readings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.15rem;
}

.kanji-reading-box {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.kanji-reading-box.on-box {
    border-left: 3px solid #818cf8;
}

.kanji-reading-box.kun-box {
    border-left: 3px solid #f472b6;
}

.reading-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}

.reading-type-tag {
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
}

.reading-type-tag.on {
    color: #818cf8;
}

.reading-type-tag.kun {
    color: #f472b6;
}

.reading-hint {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.reading-items-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.reading-pill {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.reading-pill .pill-romaji {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 0.25rem;
}

.kanji-modal-examples-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
}

.examples-header {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.65rem;
}

.examples-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.example-item-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.45rem 0.6rem;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    gap: 0.65rem;
}

.example-word-group {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
}

.example-word-jp {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.example-reading-kana {
    font-size: 0.82rem;
    color: var(--accent-sakura);
}

.example-meaning-pl {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: right;
}

/* 6. Interaktywne tryby Kanji (Quiz & Rysowanie) */
.kanji-interactive-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.kanji-practice-card {
    max-width: 580px;
    width: 100%;
}

.kanji-quiz-display {
    margin-bottom: 1.15rem;
}

.kanji-quiz-question-prompt {
    font-size: 0.88rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 0.65rem;
}

.kanji-quiz-question-prompt em {
    color: var(--accent-sakura);
    font-style: normal;
    font-weight: 700;
}

.kanji-details-reveal-card {
    background: var(--bg-surface-elevated);
    border: 1.5px solid rgba(16, 185, 129, 0.45);
    border-radius: var(--radius-md);
    padding: 0.9rem 1.1rem;
    margin-top: 1rem;
    animation: fadeIn 0.25s ease-out;
}

.kanji-reveal-title {
    font-size: 1.15rem;
    margin-bottom: 0.45rem;
    color: var(--text-primary);
}

.kanji-reveal-title strong {
    font-size: 1.45rem;
    color: var(--accent-sakura);
}

.kanji-reveal-readings {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
}

.kanji-reveal-readings strong {
    color: var(--text-primary);
}

.kanji-reveal-examples {
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.kanji-target-text {
    font-size: 2rem !important;
}

/* ============================================================================
 * 6.1 NAWIGACJA PO PRZEROBIONYCH ZNAKACH KANJI (HISTORIA I COFANIE)
 * ============================================================================ */
.kanji-quiz-history-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.45rem 0.65rem;
    margin: 0.65rem 0 0.85rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.kanji-nav-arrow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 0.38rem 0.75rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
    user-select: none;
}

.kanji-nav-arrow-btn:hover:not(:disabled) {
    background: rgba(255, 117, 151, 0.15);
    border-color: var(--accent-sakura);
    color: #ff99b4;
    transform: translateY(-1px);
}

.kanji-nav-arrow-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.kanji-history-strip {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    flex: 1;
    padding: 0.2rem 0.1rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 117, 151, 0.3) transparent;
}

.kanji-history-strip::-webkit-scrollbar {
    height: 4px;
}

.kanji-history-strip::-webkit-scrollbar-track {
    background: transparent;
}

.kanji-history-strip::-webkit-scrollbar-thumb {
    background: rgba(255, 117, 151, 0.3);
    border-radius: 4px;
}

.kanji-history-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.6rem;
    background: rgba(0, 0, 0, 0.45);
    border: 1.5px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-jp);
    font-weight: 700;
    font-size: 1.05rem;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    user-select: none;
}

.kanji-history-chip:hover {
    background: rgba(255, 117, 151, 0.15);
    border-color: rgba(255, 117, 151, 0.5);
    transform: translateY(-2px);
}

.kanji-history-chip.active {
    background: linear-gradient(135deg, rgba(255, 117, 151, 0.25), rgba(236, 72, 153, 0.2));
    border-color: var(--accent-sakura);
    box-shadow: 0 0 12px var(--accent-sakura-glow);
    color: #ffffff;
    transform: scale(1.08);
}

.kanji-history-chip .chip-status {
    font-size: 0.75rem;
    line-height: 1;
}

.kanji-history-chip.status-mastered {
    border-color: rgba(16, 185, 129, 0.45);
}

.kanji-history-chip.status-mastered .chip-status {
    color: #34d399;
}

.kanji-history-chip.status-skipped {
    border-color: rgba(245, 158, 11, 0.45);
}

.kanji-history-chip.status-skipped .chip-status {
    color: #fbbf24;
}

.kanji-history-chip.status-current {
    border-color: var(--accent-sakura);
}

.kanji-history-chip.status-current .chip-status {
    color: var(--accent-sakura);
}

/* Baner trybu powtórki / przeglądu przerobionego znaku */
.kanji-review-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.95rem;
    color: #34d399;
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 0.75rem;
    animation: fadeIn 0.2s ease-out;
}

.review-status-info {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.kanji-retest-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    border-radius: 8px;
    padding: 0.3rem 0.65rem;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.kanji-retest-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: #ffffff;
}

/* Pasek odliczania do przejścia z możliwością zatrzymania */
.kanji-quiz-countdown-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: rgba(255, 117, 151, 0.12);
    border: 1px solid rgba(255, 117, 151, 0.35);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.95rem;
    color: #ff99b4;
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 0.75rem;
    animation: fadeIn 0.2s ease-out;
}

.countdown-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.countdown-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-sakura);
    box-shadow: 0 0 8px var(--accent-sakura);
    animation: pulse 1.2s infinite;
}

.countdown-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-countdown-pause, .btn-countdown-next {
    border-radius: 8px;
    padding: 0.3rem 0.65rem;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-countdown-pause {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.btn-countdown-pause:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-countdown-next {
    background: linear-gradient(135deg, var(--accent-sakura), #ec4899);
    border: none;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(236, 72, 153, 0.3);
}

.btn-countdown-next:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.5);
}

/* Przyciski akcji dolnych Kanji Quiz & Draw */
.kanji-action-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.15rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    width: 100%;
}

.kanji-action-buttons .action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    user-select: none;
}

.kanji-action-buttons .action-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.kanji-action-buttons .action-btn.nav-btn:hover:not(:disabled) {
    border-color: var(--accent-sakura);
    color: #ff99b4;
    background: rgba(255, 117, 151, 0.12);
}

.kanji-action-buttons .action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.kanji-draw-action-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    width: 100%;
}

.kanji-draw-action-buttons .draw-bottom-btn {
    flex: 1;
}

.text-action-btn.prev-btn:hover {
    color: var(--accent-sakura);
}

/* 7. Responsywność dla Kanji */
@media (max-width: 768px) {
    .kanji-grade-pills {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.35rem;
        -webkit-overflow-scrolling: touch;
    }

    .kanji-grade-pill {
        flex: 0 0 115px;
    }

    .kanji-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
        gap: 0.6rem;
    }

    .kanji-tile {
        padding: 0.55rem 0.4rem;
        min-height: 125px;
    }

    .kanji-tile-char {
        font-size: 2.25rem;
    }

    .kanji-tile-meaning {
        font-size: 0.8rem;
    }

    .kanji-modal-readings-grid {
        grid-template-columns: 1fr;
    }

    .example-item-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }

    .example-meaning-pl {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .kanji-stats-subbar {
        flex-direction: column;
        align-items: stretch;
    }

    .kanji-submode-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .kanji-sub-btn {
        padding: 0.4rem 0.2rem;
        font-size: 0.74rem;
        justify-content: center;
    }

    .kanji-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
        gap: 0.5rem;
    }

    .kanji-tile-char {
        font-size: 2rem;
    }
}

/* ============================================================================
   CENTRUM ANALIZY NAUKI & TELEMETRIA
   ============================================================================ */

.analytics-modal {
    max-width: 820px !important;
    width: 95% !important;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 1.5rem !important;
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.analytics-header {
    margin-bottom: 1.15rem;
}

.analytics-header-title {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}

.analytics-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.analytics-header-title h3 {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-primary);
}

.analytics-header-title p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0.2rem 0 0;
}

.analytics-scope-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    background: var(--bg-surface);
    padding: 0.3rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    width: fit-content;
}

.analytics-scope-pill {
    padding: 0.32rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.analytics-scope-pill:hover {
    color: var(--text-primary);
}

.analytics-scope-pill.active {
    background: var(--accent-sakura);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--accent-sakura-glow);
}

/* Karty podsumowania ogólnego */
.analytics-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.15rem;
}

.analytics-stat-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 0.9rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.a-stat-icon {
    font-size: 1.35rem;
}

.a-stat-info {
    display: flex;
    flex-direction: column;
}

.a-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.a-stat-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Zakładki szczegółowe wewnątrz analityki */
.analytics-subtabs {
    display: flex;
    gap: 0.45rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.6rem;
    margin-bottom: 0.95rem;
    overflow-x: auto;
}

.analytics-subtab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.analytics-subtab:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

.analytics-subtab.active {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
    border-color: var(--border-subtle);
    border-bottom: 2px solid var(--accent-sakura);
}

/* Kontener przewijanej zawartości analityki */
.analytics-view-container {
    flex: 1;
    overflow-y: auto;
    max-height: 440px;
    padding-right: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

/* Wiersz pojedynczego znaku w analityce */
.analytics-char-card {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: var(--transition-fast);
}

.analytics-char-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.char-badge-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.35rem 0.25rem;
    min-width: 50px;
}

.char-badge-char {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-primary);
}

.char-badge-romaji {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.char-details-column {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.char-header-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.char-group-pill {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
}

.char-metrics-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.76rem;
}

.m-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.m-pill strong {
    color: var(--text-primary);
}

.m-pill.hesitation-critical {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

.m-pill.hesitation-hesitant {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

.m-pill.hesitation-fast {
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
}

/* Wskaźnik punktowy trudności Trouble Score */
.trouble-score-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-md);
    min-width: 68px;
    text-align: center;
}

.trouble-score-badge.critical {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

.trouble-score-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #f59e0b;
}

.trouble-score-badge.good {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #10b981;
}

.ts-val {
    font-size: 1.25rem;
    font-weight: 900;
    line-height: 1;
}

.ts-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.15rem;
}

/* Matryca pomyłek */
.confusion-tag-box {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.74rem;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(245, 158, 11, 0.3);
}

/* Pusty stan w analityce */
.analytics-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 2.8rem;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.analytics-empty-state h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.35rem;
}

.analytics-empty-state p {
    font-size: 0.85rem;
    max-width: 440px;
    margin: 0;
    line-height: 1.5;
}

/* Stopka analityki */
.analytics-footer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.15rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
}

.danger-outline {
    background: transparent !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
    color: #ef4444 !important;
}

.danger-outline:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: #ef4444 !important;
}

@media (max-width: 680px) {
    .analytics-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .analytics-char-card {
        grid-template-columns: 48px 1fr;
    }
    
    .trouble-score-badge {
        grid-column: 1 / -1;
        flex-direction: row;
        gap: 0.5rem;
        padding: 0.35rem 0.6rem;
    }

    .analytics-footer-actions {
        flex-direction: column;
        align-items: stretch;
    }
}






/* ============================================================================
 * INTERAKTYWNA SYNTEZA MOWY (TTS) DLA KANJI: ON'YOMI, KUN'YOMI, PRZYKŁADY
 * ============================================================================ */
.tts-clickable {
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

/* Interaktywne żetony wymowy TTS w opisach mnemotechnik */
.mnemonic-tts-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.12rem 0.52rem;
    margin: 0.1rem 0.22rem;
    border-radius: var(--radius-sm, 6px);
    background: rgba(255, 101, 132, 0.12);
    border: 1px solid rgba(255, 101, 132, 0.35);
    color: var(--text-primary, #f8fafc);
    font-family: inherit;
    font-size: 0.94em;
    line-height: 1.35;
    vertical-align: baseline;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.18s ease,
                border-color 0.18s ease,
                box-shadow 0.18s ease,
                color 0.18s ease;
}

.mnemonic-tts-chip .m-kana {
    font-family: 'Noto Sans JP', 'Zen Kaku Gothic New', sans-serif;
    font-weight: 700;
    color: var(--accent-sakura, #ff6584);
    font-size: 1.05em;
    letter-spacing: 0.02em;
}

.mnemonic-tts-chip .m-romaji {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.88em;
    margin-left: 0.05rem;
    transition: color 0.15s ease;
}

.mnemonic-tts-chip .speaker-mini-icon {
    font-size: 0.72rem;
    opacity: 0.68;
    margin-left: 0.15rem;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s ease;
}

.mnemonic-tts-chip:hover {
    background: rgba(255, 101, 132, 0.24);
    border-color: rgba(255, 101, 132, 0.85);
    transform: translateY(-1.5px) scale(1.02);
    box-shadow: 0 4px 12px rgba(255, 101, 132, 0.38);
}

.mnemonic-tts-chip:hover .m-romaji {
    color: #ffffff;
}

.mnemonic-tts-chip:hover .speaker-mini-icon {
    opacity: 1;
    transform: scale(1.25);
}

.mnemonic-tts-chip:active,
.mnemonic-tts-chip.tts-speaking {
    transform: scale(0.95);
    background: rgba(255, 101, 132, 0.42) !important;
    border-color: #ff6584 !important;
    box-shadow: 0 0 16px rgba(255, 101, 132, 0.7) !important;
}

.mnemonic-tts-chip.standalone {
    padding: 0.1rem 0.45rem;
}

.mnemonic-tts-chip:focus-visible {
    outline: 2px solid var(--accent-sakura, #ff6584);
    outline-offset: 2px;
}

.reading-clickable {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
    margin: 0.1rem 0.2rem;
    border-radius: var(--radius-sm, 6px);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: 600;
    color: var(--text-primary);
    vertical-align: middle;
}

.reading-clickable:hover {
    background: rgba(255, 107, 129, 0.2);
    border-color: rgba(255, 107, 129, 0.6);
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(255, 107, 129, 0.3);
}

.example-clickable-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.65rem;
    margin: 0.25rem 0.35rem 0.25rem 0;
    border-radius: var(--radius-sm, 6px);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    vertical-align: middle;
}

.example-clickable-chip:hover {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.55);
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.example-clickable-chip .ex-word {
    color: var(--accent-sakura, #ff6b81);
    font-size: 0.95rem;
    font-weight: 700;
}

.example-clickable-chip .ex-reading {
    color: var(--text-primary);
    font-weight: 600;
}

.example-clickable-chip .ex-sep {
    color: var(--text-muted);
    opacity: 0.55;
    margin: 0 0.1rem;
}

.example-clickable-chip .ex-meaning {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.speaker-mini-icon {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-left: 0.15rem;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.tts-clickable:hover .speaker-mini-icon {
    opacity: 1;
    transform: scale(1.2);
}

.tts-clickable:active,
.tts-clickable.tts-speaking {
    transform: scale(0.96);
    background: rgba(255, 107, 129, 0.35) !important;
    border-color: #ff6b81 !important;
    box-shadow: 0 0 12px rgba(255, 107, 129, 0.6) !important;
}

.reading-pill.tts-clickable {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.reading-pill.tts-clickable:hover {
    background: rgba(255, 107, 129, 0.2);
    border-color: rgba(255, 107, 129, 0.55);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 107, 129, 0.25);
}

.example-item-row.tts-clickable {
    cursor: pointer;
    transition: all 0.18s ease;
}

.example-item-row.tts-clickable:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 107, 129, 0.5);
    transform: translateX(3px);
}

#kanji-quiz-reveal-kanji.tts-clickable {
    display: inline-block;
    padding: 0 0.4rem;
    border-radius: var(--radius-sm, 6px);
}

#kanji-quiz-reveal-kanji.tts-clickable:hover {
    background: rgba(255, 107, 129, 0.18);
    transform: scale(1.08);
}

.feedback-msg strong.tts-clickable {
    display: inline-block;
    padding: 0 0.35rem;
    border-radius: 4px;
}

.feedback-msg strong.tts-clickable:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.08);
}

/* ==========================================================================
   WIDOK 5: TRENING SŁOWNICTWA I ZDAŃ (VOCABULARY & SENTENCES ENGINE)
   ========================================================================== */

.vocab-view {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 1rem 1.25rem 3rem;
    gap: 1.5rem;
    animation: fadeInView 0.35s ease-out;
}

@keyframes fadeInView {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 1. Nagłówek modułu słownictwa */
.vocab-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.vocab-title-group h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.vocab-title-group p {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.vocab-stats-pills {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.vocab-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.vocab-stat-pill strong {
    color: var(--accent-sakura);
    font-weight: 700;
}

/* 2. Pasek podzakładek trybów słownictwa */
.vocab-subtabs-bar {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-surface);
    padding: 0.35rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.vocab-subtabs-bar::-webkit-scrollbar {
    display: none;
}

.vocab-subtab-btn {
    flex: 1 0 auto;
    min-width: max-content;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.vocab-subtab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.vocab-subtab-btn.active {
    background: linear-gradient(135deg, rgba(255, 101, 132, 0.22), rgba(99, 102, 241, 0.25));
    border-color: rgba(255, 101, 132, 0.45);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(255, 101, 132, 0.18);
}

/* 3. Pasek filtrów słownictwa */
.vocab-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem;
    background: var(--bg-surface-elevated);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.vocab-filter-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.vocab-type-pills {
    display: flex;
    gap: 0.35rem;
}

.vocab-type-pill {
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.18s ease;
}

.vocab-type-pill:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
}

.vocab-type-pill.active {
    background: rgba(56, 189, 248, 0.18);
    border-color: rgba(56, 189, 248, 0.5);
    color: #38bdf8;
}

/* 4. Trening wpisywania (PL ➔ JAP oraz JAP ➔ PL) */
.vocab-practice-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.vocab-card-wrapper {
    width: 100%;
    max-width: 680px;
}

.vocab-drill-card {
    background: var(--bg-surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl, 24px);
    padding: 2.25rem 2rem;
    box-shadow: 0 20px 45px -15px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 101, 132, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    transition: border-color 0.25s ease;
}

.drill-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drill-meta-badges {
    display: flex;
    gap: 0.5rem;
}

.drill-badge-category {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.35);
}

.drill-badge-type {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
}

.drill-card-actions {
    display: flex;
    gap: 0.4rem;
}

.drill-action-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.18s ease;
}

.drill-action-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.drill-action-btn.active,
.fc-ctrl-btn.active {
    background: rgba(255, 101, 132, 0.24);
    border-color: var(--accent-sakura);
    color: #ffffff;
    box-shadow: 0 0 14px rgba(255, 101, 132, 0.45);
}

/* Prompt box */
.drill-prompt-box {
    text-align: center;
    padding: 1.5rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-lg);
    border: 1px dashed rgba(255, 255, 255, 0.08);
}

.drill-mode-badge {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.drill-prompt-text {
    font-size: 2.1rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.3;
    font-family: var(--font-primary, sans-serif);
}

.drill-prompt-text.jp-font {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 2.6rem;
    color: var(--accent-sakura);
}

/* Kontener dla promptu z ruby */
.ruby-prompt-container {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    gap: 0.1rem 0.28rem;
    padding-top: 0.6rem;
}

.ruby-prompt-container.dual-ruby {
    padding-top: 1.25rem;
    gap: 0.2rem 0.35rem;
}

.ruby-prompt-container .ruby-plain-text {
    display: inline-flex;
    align-items: flex-end;
    line-height: 1.15;
    padding: 0 0.08rem;
}

ruby.ruby-glyph {
    display: inline-flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: flex-end;
    line-height: 1.15;
    position: relative;
    padding: 0 0.08rem;
    vertical-align: bottom;
}

ruby.ruby-glyph .ruby-base {
    display: inline-block;
    line-height: 1.1;
}

ruby.ruby-glyph rt.ruby-romaji {
    font-family: var(--font-main, 'Plus Jakarta Sans', sans-serif);
    font-size: 0.38em;
    font-weight: 700;
    line-height: 1;
    color: #38bdf8;
    text-transform: lowercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.22rem;
    user-select: none;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    display: block;
    white-space: nowrap;
}

ruby.ruby-glyph.ruby-kanji {
    color: #ffffff;
    cursor: pointer;
    border-radius: 6px;
    padding: 0 0.15rem;
    transition: all 0.2s ease;
    border-bottom: 2px dashed rgba(255, 101, 132, 0.45);
}

ruby.ruby-glyph.ruby-kanji:hover {
    color: var(--accent-sakura);
    background: rgba(255, 101, 132, 0.15);
    transform: scale(1.06);
}

ruby.ruby-glyph.ruby-kanji rt.ruby-romaji {
    color: var(--accent-sakura);
}

ruby.ruby-glyph rt.ruby-furigana {
    font-family: var(--font-jp, 'Noto Sans JP', 'Hiragino Sans', sans-serif);
    font-size: 0.44em;
    font-weight: 600;
    line-height: 1;
    color: #c084fc;
    letter-spacing: 0.02em;
    margin-bottom: 0.22rem;
    user-select: none;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    display: block;
    white-space: nowrap;
}

ruby.ruby-glyph.ruby-kanji rt.ruby-furigana {
    color: #f472b6;
    text-shadow: 0 0 8px rgba(244, 114, 182, 0.4);
}

rt.ruby-furigana.ruby-spacer {
    visibility: hidden !important;
    pointer-events: none;
    user-select: none;
    opacity: 0;
}

#btn-vocab-card-furigana {
    font-family: var(--font-jp, 'Noto Sans JP', sans-serif);
    font-weight: 700;
    font-size: 1.15rem;
}

/* Karta wyjaśnienia znaczenia znaków Kanji */
.vocab-drill-kanji-breakdown,
.fc-kanji-breakdown {
    margin-top: 1.25rem;
    padding: 0.95rem 1.25rem;
    background: rgba(18, 22, 34, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 101, 132, 0.35);
    border-radius: var(--radius-md, 14px);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-align: left;
    animation: fadeInView 0.25s ease-out;
    box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 101, 132, 0.08);
}

.kanji-breakdown-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #a5b4fc;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kanji-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.kanji-breakdown-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.5rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm, 10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.kanji-breakdown-item.clickable {
    cursor: pointer;
}

.kanji-breakdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 101, 132, 0.5);
    transform: translateX(3px);
    box-shadow: 0 4px 14px rgba(255, 101, 132, 0.15);
}

.kanji-badge {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--accent-sakura);
    background: rgba(255, 101, 132, 0.16);
    border: 1px solid rgba(255, 101, 132, 0.35);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kanji-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
}

.kanji-meta-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
}

.kanji-meta-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.kanji-meaning-pl {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
}

.kanji-readings-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.kanji-hint-inspect {
    font-size: 0.72rem;
    color: #38bdf8;
    margin-left: auto;
    font-weight: 600;
}

.drill-reading-hint {
    margin-top: 0.5rem;
    font-size: 1.05rem;
    color: var(--accent-sakura);
    font-family: 'Noto Sans JP', sans-serif;
    animation: fadeInView 0.2s ease-out;
}

/* Formularz odpowiedzi WanaKana */
.vocab-answer-form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.vocab-input-wrap {
    display: flex;
    gap: 0.75rem;
    position: relative;
}

.vocab-answer-input {
    flex: 1;
    background: rgba(10, 12, 19, 0.85);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.95rem 1.25rem;
    font-size: 1.35rem;
    font-weight: 600;
    color: #ffffff;
    font-family: 'Noto Sans JP', sans-serif;
    outline: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.vocab-answer-input:focus {
    border-color: var(--accent-sakura);
    box-shadow: 0 0 0 4px rgba(255, 101, 132, 0.18), inset 0 2px 4px rgba(0, 0, 0, 0.4);
    background: rgba(15, 23, 42, 0.95);
}

.vocab-submit-btn {
    background: linear-gradient(135deg, var(--accent-sakura), #ff477e);
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    padding: 0 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 4px 16px rgba(255, 71, 126, 0.3);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.vocab-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(255, 71, 126, 0.45);
    filter: brightness(1.1);
}

.vocab-submit-btn:active {
    transform: translateY(0);
}

.wanakana-mode-pill {
    font-size: 0.78rem;
    color: var(--text-dim, #64748b);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.25rem;
}

.wanakana-mode-pill em {
    color: var(--accent-sakura);
    font-style: normal;
    font-weight: 600;
}

/* Feedback card */
.vocab-feedback-box {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeInView 0.25s ease-out;
}

.feedback-status-banner {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feedback-status-banner.correct {
    background: rgba(16, 185, 129, 0.18);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.feedback-status-banner.wrong {
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.vocab-feedback-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    padding: 0.5rem 0.25rem;
}

.feedback-ja-large {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.85rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
}

.feedback-reading {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1rem;
    color: var(--accent-sakura);
    font-weight: 500;
    margin-top: 0.2rem;
}

.feedback-romaji {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-style: italic;
}

.feedback-pl-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.feedback-pl-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-top: 0.2rem;
}

.vocab-feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.feedback-action-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.65rem 1.15rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}

.feedback-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.feedback-action-btn.primary {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.feedback-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

/* Bottom bar */
.drill-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.drill-skip-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.18s ease;
}

.drill-skip-btn:hover {
    color: var(--text-primary);
}

.drill-progress-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* 5. Fiszki 3D (Interactive 3D Flip Flashcards) */
.vocab-cards-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 1.5rem;
}

.flashcard-3d-scene {
    width: 100%;
    max-width: 520px;
    height: 320px;
    perspective: 1000px;
}

.flashcard-3d {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.flashcard-3d.flipped {
    transform: rotateY(180deg);
}

.flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: var(--radius-xl, 24px);
    border: 1px solid var(--border-subtle);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6), 0 0 25px rgba(255, 101, 132, 0.08);
}

.flashcard-front {
    background: radial-gradient(circle at 50% 20%, rgba(255, 101, 132, 0.12) 0%, rgba(18, 22, 34, 0.92) 80%);
    border-color: rgba(255, 101, 132, 0.35);
}

.flashcard-back {
    background: radial-gradient(circle at 50% 20%, rgba(99, 102, 241, 0.15) 0%, rgba(18, 22, 34, 0.92) 80%);
    border-color: rgba(99, 102, 241, 0.35);
    transform: rotateY(180deg);
}

.flashcard-corner-badge {
    align-self: flex-start;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.flashcard-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
}

.flashcard-glyph {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}

.flashcard-sub {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.25rem;
    color: var(--accent-sakura);
    font-weight: 600;
}

.flashcard-meaning {
    font-size: 2rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.3;
}

.flashcard-romaji {
    font-size: 1.1rem;
    color: #a5b4fc;
    font-style: italic;
}

.flashcard-hint-bottom {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.flashcard-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.fc-ctrl-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.35rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.fc-ctrl-btn:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.1);
}

.fc-ctrl-btn.primary {
    background: linear-gradient(135deg, var(--accent-sakura), #ff477e);
    border: none;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(255, 71, 126, 0.3);
}

/* 6. Słownik & Baza słownictwa */
.vocab-dict-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.dict-search-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.dict-search-box {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.dict-search-box .search-icon {
    position: absolute;
    left: 1rem;
    font-size: 1rem;
    color: var(--text-muted);
}

.dict-search-input {
    width: 100%;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease;
}

.dict-search-input:focus {
    border-color: var(--accent-sakura);
}

.dict-count-pill {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 0.45rem 0.95rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

.dict-words-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1rem;
}

.dict-word-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.85rem;
    transition: all 0.2s ease;
}

.dict-word-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 101, 132, 0.4);
    box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.5), 0 0 16px rgba(255, 101, 132, 0.1);
}

.dict-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.dict-card-ja {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
}

.dict-card-reading {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.92rem;
    color: var(--accent-sakura);
    font-weight: 500;
    margin-top: 0.15rem;
}

.dict-card-romaji {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-style: italic;
}

.dict-card-pl {
    font-size: 1.05rem;
    font-weight: 600;
    color: #f1f5f9;
    padding-top: 0.45rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.dict-card-tts-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.18s ease;
}

.dict-card-tts-btn:hover {
    background: rgba(255, 101, 132, 0.2);
    border-color: rgba(255, 101, 132, 0.5);
    transform: scale(1.08);
}

/* Responsywność */
@media (max-width: 640px) {
    .vocab-view {
        padding: 0.75rem 0.5rem 2.5rem;
    }
    
    /* 1. Podzakładki słownictwa na telefonie */
    .vocab-subtabs-bar {
        padding: 0.25rem;
        gap: 0.35rem;
        border-radius: var(--radius-md);
    }
    .vocab-subtab-btn {
        padding: 0.55rem 0.75rem;
        font-size: 0.82rem;
        gap: 0.35rem;
        border-radius: var(--radius-sm);
    }
    .vocab-subtab-hint {
        display: none;
    }

    /* 2. Karta ćwiczeń słownictwa */
    .vocab-drill-card {
        padding: 1.35rem 1rem;
        gap: 1.15rem;
        border-radius: var(--radius-lg, 18px);
    }
    .drill-card-top {
        flex-wrap: wrap;
        gap: 0.55rem;
        align-items: center;
        justify-content: space-between;
    }
    .drill-meta-badges {
        flex-wrap: wrap;
        gap: 0.35rem;
    }
    .drill-badge-category,
    .drill-badge-type {
        font-size: 0.7rem;
        padding: 0.2rem 0.55rem;
    }
    .drill-card-actions {
        gap: 0.35rem;
        flex-shrink: 0;
    }
    .drill-action-btn {
        width: 38px;
        height: 38px;
        font-size: 1.05rem;
    }
    #btn-vocab-card-furigana {
        font-size: 1.15rem;
    }

    /* 3. Prompt ze znakami i furiganą / romaji */
    .drill-prompt-box {
        padding: 1.15rem 0.65rem;
    }
    .drill-prompt-text {
        font-size: 1.55rem;
    }
    .drill-prompt-text.jp-font {
        font-size: 2.1rem;
    }
    .ruby-prompt-container {
        gap: 0.1rem 0.22rem;
    }
    .ruby-prompt-container.dual-ruby {
        padding-top: 1.35rem;
        gap: 0.15rem 0.25rem;
    }
    ruby.ruby-glyph {
        line-height: 1.2;
    }
    ruby.ruby-glyph rt.ruby-romaji {
        font-size: 0.38em;
        margin-bottom: 0.18rem;
    }
    ruby.ruby-glyph rt.ruby-furigana {
        font-size: 0.44em;
        margin-bottom: 0.18rem;
    }

    /* 4. Formularz wpisywania */
    .vocab-input-wrap {
        gap: 0.5rem;
    }
    .vocab-answer-input {
        font-size: 1.15rem;
        padding: 0.75rem 0.95rem;
    }
    .vocab-submit-btn {
        padding: 0 1.15rem;
        font-size: 0.92rem;
    }

    /* 5. Karta wyjaśnienia znaków Kanji */
    .vocab-drill-kanji-breakdown,
    .fc-kanji-breakdown {
        padding: 0.85rem 0.95rem;
        margin-top: 0.95rem;
        gap: 0.6rem;
    }
    .kanji-breakdown-title {
        font-size: 0.75rem;
    }
    .kanji-breakdown-item {
        padding: 0.5rem 0.65rem;
        gap: 0.65rem;
    }
    .kanji-badge {
        width: 38px;
        height: 38px;
        font-size: 1.45rem;
        border-radius: 6px;
    }
    .kanji-meta-top {
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    .kanji-meaning-pl {
        font-size: 0.92rem;
    }
    .kanji-readings-hint {
        font-size: 0.76rem;
        line-height: 1.35;
    }
    .kanji-hint-inspect {
        font-size: 0.7rem;
    }

    /* 6. Feedback card */
    .vocab-feedback-details {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .vocab-feedback-box {
        padding: 1.15rem 1rem;
    }

    /* 7. Fiszki 3D */
    .flashcard-3d-scene {
        height: 270px;
    }
    .flashcard-face {
        padding: 1.35rem 1.15rem;
    }
    .flashcard-glyph {
        font-size: 2.25rem;
    }
    .flashcard-meaning {
        font-size: 1.6rem;
    }
    .flashcard-sub {
        font-size: 1.15rem;
    }
    .flashcard-controls {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 0.45rem;
        width: 100%;
        max-width: 480px;
    }
    #btn-fc-prev { order: 1; }
    #btn-fc-flip { order: 2; }
    #btn-fc-next { order: 3; }
    #btn-fc-furigana { order: 4; }
    #btn-fc-romaji { order: 5; }
    #btn-fc-tts { order: 6; }
    .fc-ctrl-btn {
        padding: 0.65rem 0.35rem;
        font-size: 0.82rem;
        justify-content: center;
        white-space: nowrap;
    }

    /* 8. Pasek filtrów słownictwa */
    .vocab-filter-bar {
        padding: 0.65rem 0.85rem;
        gap: 0.6rem;
    }
    .vocab-filter-group {
        width: 100%;
        justify-content: space-between;
    }
    .vocab-type-pills {
        width: 100%;
        justify-content: space-between;
    }
    .vocab-type-pill {
        flex: 1;
        text-align: center;
        padding: 0.3rem 0.5rem;
        font-size: 0.76rem;
    }
}

