/* ===== ROOT VARIABLES - ZEN GARDEN EDUCATION THEME ===== */
:root {
    /* Core Accent Colors - Vibrant & Readable */
    --primary: #e63946;
    --primary-dark: #d62828;
    --secondary: #457b9d;
    --accent-gold: #f77f00;
    --accent-teal: #06a77d;
    --success: #06a77d;
    --warning: #fb8500;
    --danger: #e63946;

    /* Light Mode - Warm Paper with HIGH CONTRAST (WCAG AA+) */
    --bg-primary: #fefcfb;
    --bg-secondary: #f5f1ed;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #525252;
    --border: #d4d4d8;
    --shadow: rgba(0, 0, 0, 0.1);

    /* Beautiful Readable Gradients */
    --gradient-1: linear-gradient(135deg, #e63946 0%, #457b9d 100%);
    --gradient-2: linear-gradient(135deg, #f77f00 0%, #e63946 100%);
    --gradient-3: linear-gradient(135deg, #457b9d 0%, #1d3557 100%);
    --gradient-cherry: linear-gradient(135deg, #fff5f0 0%, #ffe8e0 100%);
    --gradient-warm: linear-gradient(135deg, #fffbf5 0%, #fff0e5 100%);

    /* Animation Variables */
    --bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode - Deep Navy with Warm Cream Text (Easy on Eyes) */
[data-theme="dark"] {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-card: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border: #4b5563;
    --shadow: rgba(0, 0, 0, 0.4);
    --gradient-1: linear-gradient(135deg, #ef4444 0%, #3b82f6 100%);
    --gradient-2: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --gradient-cherry: linear-gradient(135deg, #374151 0%, #1f2937 100%);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    transition: background 0.3s var(--smooth), color 0.3s ease;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden {
    display: none !important;
}

/* ===== HEADER ===== */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px var(--shadow);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.home-icon-btn {
    font-size: 1.5rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-secondary);
    transition: all 0.3s ease;
}

.home-icon-btn:hover {
    background: var(--gradient-1);
    transform: scale(1.05);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px var(--shadow);
}

/* ===== MAIN LAYOUT ===== */
.main-container {
    display: flex;
    min-height: calc(100vh - 80px);
    position: relative;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 200;
    width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 0;
    overflow: hidden;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.03);
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    min-height: 70px;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 1.5rem 0.5rem;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease, width 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-header h2 {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

.sidebar-toggle {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
}

.sidebar.collapsed .sidebar-toggle {
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
}

.toggle-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}

.sidebar.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.sidebar-close {
    display: none;
}

.chapter-nav {
    padding: 1rem 0;
    overflow-y: auto;
    height: calc(100vh - 70px);
}

.chapter-nav::-webkit-scrollbar {
    width: 6px;
}

.chapter-nav::-webkit-scrollbar-track {
    background: transparent;
}

.chapter-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.chapter-item {
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.sidebar.collapsed .chapter-item {
    padding: 1rem 0;
    justify-content: center;
    gap: 0;
}

.chapter-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gradient-1);
    transform: scaleY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chapter-item:hover::before,
.chapter-item.active::before {
    transform: scaleY(1);
}

.chapter-item:hover {
    background: linear-gradient(90deg, var(--bg-secondary) 0%, transparent 100%);
}

.chapter-item.active {
    background: linear-gradient(90deg, rgba(255, 107, 157, 0.08) 0%, transparent 100%);
    color: var(--primary);
}

.chapter-item.completed .chapter-icon::after {
    content: '✓';
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: var(--success);
    color: white;
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
}

.chapter-icon {
    font-size: 2rem;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chapter-item:hover .chapter-icon {
    transform: scale(1.15) rotate(5deg);
}

.sidebar.collapsed .chapter-icon {
    width: auto;
    height: auto;
}

.chapter-info {
    flex: 1;
    min-width: 0;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .chapter-info {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.chapter-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-status {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .chapter-item {
    position: relative;
}

.sidebar.collapsed .chapter-item::after {
    content: attr(data-title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    margin-left: 1rem;
    box-shadow: 0 8px 20px var(--shadow);
    border: 1px solid var(--border);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.85rem;
    font-weight: 600;
}

.sidebar.collapsed .chapter-item:hover::after {
    opacity: 1;
    margin-left: 0.5rem;
}

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    z-index: 99;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.mobile-menu-btn:hover {
    background: var(--bg-secondary);
}

.mobile-menu-btn span {
    width: 24px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* ===== CONTENT AREA ===== */
.content {
    flex: 1;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
    margin-left: 280px;
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .content {
    margin-left: 80px;
}

/* ===== WELCOME SCREEN ===== */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    animation: fadeIn 0.6s ease;
}

.welcome-card {
    background: var(--bg-card);
    border-radius: 30px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 20px 60px var(--shadow), 0 0 0 1px rgba(255, 107, 157, 0.1);
    max-width: 700px;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.8s var(--bounce);
    border: 2px solid var(--border);
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 107, 157, 0.05),
        transparent
    );
    animation: shimmer 3s infinite;
}

.welcome-title {
    font-size: 4rem;
    margin-bottom: 1rem;
    background: var(--gradient-1);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 3s ease infinite, float 3s ease-in-out infinite;
    font-weight: 700;
    letter-spacing: -2px;
    position: relative;
    z-index: 1;
}

.welcome-subtitle {
    font-size: 1.85rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    animation: fadeInUp 0.8s var(--bounce) 0.2s backwards;
}

.welcome-text {
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    font-size: 1.15rem;
    line-height: 1.8;
    animation: fadeInUp 0.8s var(--bounce) 0.3s backwards;
}

.welcome-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 640px) {
    .welcome-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

.welcome-stat {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    padding: 2rem 1.5rem;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    border: 2px solid var(--border);
    box-shadow: 0 8px 20px var(--shadow);
    transition: all 0.4s var(--bounce);
    animation: fadeInUp 0.6s var(--bounce) backwards;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.welcome-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-1);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.welcome-stat:hover::before {
    opacity: 0.1;
}

.welcome-stat:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 30px var(--shadow);
    border-color: var(--primary);
}

.welcome-stat:nth-child(1) { animation-delay: 0.5s; }
.welcome-stat:nth-child(2) { animation-delay: 0.6s; }
.welcome-stat:nth-child(3) { animation-delay: 0.7s; }
.welcome-stat:nth-child(4) { animation-delay: 0.8s; }

.welcome-stat:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 8px 25px var(--shadow);
    border-color: var(--primary);
}

.stat-icon {
    font-size: 3rem;
    animation: bounce 2s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

.stat-info {
    position: relative;
    z-index: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
}

.stat-name {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
    position: relative;
    z-index: 1;
}

.start-btn {
    background: var(--gradient-1);
    background-size: 200% 200%;
    color: white;
    border: none;
    padding: 1.25rem 3.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.4s var(--bounce);
    box-shadow: 0 8px 25px rgba(255, 107, 157, 0.4);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.8s var(--bounce) 0.4s backwards, pulse 2s ease-in-out infinite;
    z-index: 1;
}

.start-btn::before {
    content: '✨';
    position: absolute;
    left: 20px;
    font-size: 1.5rem;
    animation: sparkle 2s ease-in-out infinite;
}

.start-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.start-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 35px rgba(255, 107, 157, 0.6);
    animation: gradient-shift 2s ease infinite, wiggle 0.5s ease;
}

.start-btn:hover::after {
    width: 300px;
    height: 300px;
}

.start-btn:active {
    transform: translateY(-2px) scale(1.02);
}

/* ===== CHAPTER CONTENT ===== */
.chapter-content {
    animation: fadeInUp 0.6s ease;
}

.chapter-header {
    text-align: center;
    margin-bottom: 3rem;
}

.chapter-number {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.chapter-heading {
    font-size: 2.5rem;
    margin: 0.5rem 0 1rem;
    font-weight: 700;
}

.chapter-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Lesson Card */
.lesson-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px var(--shadow);
}

.lesson-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vocabulary-grid {
    display: grid;
    gap: 1rem;
}

.vocab-item {
    background: var(--bg-card);
    padding: 1.75rem;
    border-radius: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.4s var(--bounce);
    border: 2px solid var(--border);
    box-shadow: 0 4px 15px var(--shadow);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.vocab-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-1);
    transform: scaleY(0);
    transition: transform 0.3s var(--bounce);
}

.vocab-item:hover {
    transform: translateX(8px) scale(1.02);
    box-shadow: 0 8px 25px var(--shadow);
    border-color: var(--primary);
}

.vocab-item:hover::before {
    transform: scaleY(1);
}

.vocab-japanese {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'Noto Sans JP', sans-serif;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.vocab-item:hover .vocab-japanese {
    transform: scale(1.1);
}

.vocab-romaji {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

.vocab-english {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 1.05rem;
}

.play-audio {
    background: var(--gradient-1);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.4s var(--bounce);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
    position: relative;
}

.play-audio::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--primary);
    opacity: 0;
    animation: pulse 2s ease-out infinite;
}

.play-audio:hover {
    transform: scale(1.15) rotate(10deg);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.5);
    animation: bounce 0.5s ease;
}

.play-audio:active {
    transform: scale(0.95);
}

/* Example Box */
.example-box {
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary);
    padding: 1.5rem;
    margin: 1rem 0;
    border-radius: 8px;
}

.example-japanese {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-family: 'Noto Sans JP', sans-serif;
}

.example-romaji {
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.example-english {
    color: var(--text-secondary);
}

/* Grammar Table */
.grammar-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.grammar-table th,
.grammar-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.grammar-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--primary);
}

.grammar-table tr:hover {
    background: var(--bg-secondary);
}

/* Quiz Section */
.quiz-section {
    background: var(--bg-secondary);
    border-radius: 25px;
    padding: 3rem;
    margin-top: 3rem;
    border: 2px solid var(--border);
    box-shadow: 0 10px 30px var(--shadow);
    position: relative;
    overflow: hidden;
}

.quiz-section::before {
    content: '🌸';
    position: absolute;
    font-size: 8rem;
    opacity: 0.05;
    top: -20px;
    right: -20px;
    animation: rotate 20s linear infinite;
    pointer-events: none;
}

.quiz-section::after {
    content: '🎌';
    position: absolute;
    font-size: 6rem;
    opacity: 0.05;
    bottom: -10px;
    left: -10px;
    animation: float 4s ease-in-out infinite;
    pointer-events: none;
}

.quiz-header {
    text-align: center;
    margin-bottom: 2rem;
}

.quiz-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.quiz-progress {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.quiz-question {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.question-text {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.quiz-options {
    display: grid;
    gap: 1rem;
}

.quiz-option {
    background: var(--bg-card);
    border: 3px solid var(--border);
    padding: 1.25rem 1.75rem;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.4s var(--bounce);
    text-align: left;
    font-size: 1.05rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.quiz-option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: var(--gradient-1);
    opacity: 0.1;
    transition: width 0.3s ease;
}

.quiz-option:hover {
    border-color: var(--primary);
    transform: translateX(8px) scale(1.02);
    box-shadow: 0 6px 20px var(--shadow);
}

.quiz-option:hover::before {
    width: 100%;
}

.quiz-option.selected {
    border-color: var(--primary);
    background: rgba(255, 107, 157, 0.15);
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.3);
}

.quiz-option.correct {
    border-color: var(--success);
    background: rgba(126, 201, 86, 0.15);
    animation: bounce 0.6s ease;
}

.quiz-option.correct::before {
    content: '✓';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: var(--success);
    animation: slideInRight 0.5s var(--bounce);
}

.quiz-option.incorrect {
    border-color: var(--danger);
    background: rgba(255, 107, 107, 0.15);
    animation: wiggle 0.5s ease;
}

.quiz-option.incorrect::before {
    content: '✗';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: var(--danger);
    animation: slideInRight 0.5s var(--bounce);
}

.quiz-feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 500;
}

.quiz-feedback.correct {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.quiz-feedback.incorrect {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.quiz-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.quiz-btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn {
    background: var(--primary);
    color: white;
}

.submit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.next-question-btn {
    background: var(--success);
    color: white;
}

.next-question-btn:hover {
    transform: translateY(-2px);
}

/* Quiz Results */
.quiz-results {
    text-align: center;
    padding: 3rem;
    position: relative;
}

.results-emoji {
    font-size: 5rem;
    animation: bounce 1s ease infinite;
    margin-bottom: 1rem;
}

.results-score {
    font-size: 5rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    animation: fadeInUp 0.6s var(--bounce), pulse 2s ease-in-out infinite;
}

.results-message {
    font-size: 1.75rem;
    margin-bottom: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    animation: fadeInUp 0.6s var(--bounce) 0.2s backwards;
}

.results-details {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.result-stat {
    text-align: center;
}

.result-stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.result-stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== NAVIGATION BUTTONS ===== */
.content-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    gap: 1rem;
}

.nav-btn {
    padding: 1rem 2rem;
    border: 2px solid var(--primary);
    background: transparent;
    color: var(--primary);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.nav-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.next-btn {
    background: var(--primary);
    color: white;
}

/* ===== MAGICAL ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

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

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* ===== MODE TOGGLE ===== */
.mode-toggle-container {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInUp 0.5s var(--bounce);
}

.mode-toggle {
    display: inline-flex;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 25px;
    padding: 0.5rem;
    gap: 0.5rem;
    box-shadow: 0 4px 15px var(--shadow);
}

.mode-btn {
    padding: 0.75rem 2rem;
    border: none;
    background: transparent;
    border-radius: 20px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    color: var(--text-secondary);
}

.mode-btn:hover {
    transform: translateY(-2px);
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
}

/* ===== FLASHCARD MODE ===== */
.flashcard-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.flashcard-nav-btn {
    width: 60px;
    height: 60px;
    background: var(--gradient-1);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
}

.flashcard-nav-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.6);
}

.flashcard-nav-btn:active {
    transform: scale(0.95);
}

.flashcard-counter {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 100px;
    text-align: center;
}

.flashcard-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    margin-bottom: 2rem;
}

.flashcard {
    perspective: 1000px;
    cursor: pointer;
    width: 100%;
    max-width: 600px;
    height: 350px;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    box-shadow: 0 15px 50px var(--shadow);
    border: 3px solid var(--border);
}

.flashcard-front {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
}

.flashcard-back {
    background: var(--gradient-cherry);
    transform: rotateY(180deg);
}

.flashcard-japanese {
    font-size: 4rem;
    font-weight: 900;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    font-family: 'Noto Sans JP', sans-serif;
    animation: pulse 2s ease-in-out infinite;
}

.flashcard-romaji {
    font-size: 1.5rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 2rem;
}

.flashcard-english {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.flashcard-hint {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-style: italic;
    margin-top: 2rem;
}

.flashcard-progress {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.flashcard-progress-bar {
    height: 100%;
    background: var(--gradient-1);
    transition: width 0.5s var(--bounce);
}

/* ===== FLIP CARD STYLES ===== */
.vocab-flip-card {
    perspective: 1000px;
    cursor: pointer;
    height: 200px;
    margin-bottom: 1.5rem;
}

.vocab-flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.vocab-flip-card.flipped .vocab-flip-card-inner {
    transform: rotateY(180deg);
}

.vocab-flip-card-front,
.vocab-flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    box-shadow: 0 8px 25px var(--shadow);
    border: 3px solid var(--border);
}

.vocab-flip-card-front {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
}

.vocab-flip-card-back {
    background: var(--gradient-cherry);
    transform: rotateY(180deg);
}

.flip-card-japanese {
    font-size: 3rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.flip-card-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 1rem;
}

.flip-card-english {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.flip-card-romaji {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* ===== CONFETTI & CELEBRATION ===== */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: var(--primary);
    position: absolute;
    animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* ===== PROGRESS STREAK ===== */
.streak-counter {
    background: var(--gradient-2);
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 175, 204, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

.streak-counter .fire-icon {
    font-size: 1.5rem;
    animation: bounce 1s ease infinite;
}

/* ===== ACHIEVEMENT BADGE ===== */
.achievement-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px var(--shadow);
    border: 2px solid var(--accent-gold);
    z-index: 1000;
    animation: slideInRight 0.5s var(--bounce);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.achievement-icon {
    font-size: 3rem;
    animation: bounce 1s ease infinite;
}

.achievement-text {
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== STUDY MODE TOGGLE ===== */
.study-mode-toggle {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 25px;
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.study-mode-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s var(--bounce);
    color: var(--text-secondary);
}

.study-mode-btn.active {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
}

/* ===== PROGRESS BAR ===== */
.lesson-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0;
}

.lesson-progress-fill {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 10px;
    transition: width 0.5s var(--bounce);
    animation: shimmer 2s infinite;
}

/* ===== KEYBOARD SHORTCUT HINT ===== */
.keyboard-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 15px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 999;
}

.keyboard-hint.show {
    opacity: 1;
}

.kbd {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 5px;
    font-weight: 700;
    margin: 0 0.25rem;
}

/* ===== HEADER ENHANCEMENTS ===== */
.header {
    background: var(--bg-card);
    border-bottom: 2px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px var(--shadow);
}

.logo {
    font-size: 1.75rem;
    font-weight: 800;
    background: var(--gradient-1);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 3s ease infinite;
    letter-spacing: -1px;
}

/* ===== CHAPTER NAVIGATION ENHANCEMENTS ===== */
.chapter-item {
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    border-left: 4px solid transparent;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-radius: 0 15px 15px 0;
    margin: 0.5rem 0;
}

.chapter-item:hover {
    background: var(--bg-secondary);
    border-left-color: var(--primary);
    transform: translateX(8px);
}

.chapter-item.active {
    background: linear-gradient(90deg, rgba(255, 107, 157, 0.15) 0%, transparent 100%);
    border-left-color: var(--primary);
    color: var(--primary);
}

.chapter-item.completed::after {
    content: '✨';
    animation: sparkle 2s ease-in-out infinite;
}

/* ===== LESSON CARD ENHANCEMENTS ===== */
.lesson-card {
    background: var(--bg-card);
    border-radius: 25px;
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 8px 30px var(--shadow);
    border: 2px solid var(--border);
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s var(--bounce);
}

.lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px var(--shadow);
}

.lesson-title {
    font-size: 1.75rem;
    margin-bottom: 2rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 800;
}

/* ===== DAILY CHALLENGE NOTIFICATION ===== */
.daily-challenge-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border: 3px solid var(--accent-gold);
    border-radius: 30px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(212, 175, 55, 0.4);
    z-index: 10001;
    animation: fadeInUp 0.6s var(--bounce);
    max-width: 450px;
    width: 90%;
}

.daily-challenge-notification::before {
    content: '✨';
    position: absolute;
    top: -20px;
    left: 20px;
    font-size: 3rem;
    animation: sparkle 2s ease-in-out infinite;
}

.daily-challenge-notification::after {
    content: '🌟';
    position: absolute;
    top: -20px;
    right: 20px;
    font-size: 3rem;
    animation: sparkle 2s ease-in-out infinite 0.5s;
}

/* ===== FLOATING STUDY BUDDY ===== */
.study-buddy {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9998;
    cursor: pointer;
    animation: float 3s ease-in-out infinite;
}

.buddy-avatar {
    width: 80px;
    height: 80px;
    background: var(--gradient-1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    box-shadow: 0 8px 30px rgba(255, 107, 157, 0.4);
    transition: all 0.3s var(--bounce);
    border: 4px solid var(--bg-card);
}

.buddy-avatar:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 12px 40px rgba(255, 107, 157, 0.6);
}

.buddy-message {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: var(--bg-card);
    border: 3px solid var(--border);
    border-radius: 20px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 15px;
    box-shadow: 0 10px 30px var(--shadow);
    min-width: 280px;
    max-width: 320px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s var(--bounce);
    transform: translateY(10px);
}

.study-buddy:hover .buddy-message {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.buddy-message::after {
    content: '';
    position: absolute;
    bottom: -12px;
    right: 30px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid var(--border);
}

.buddy-message p {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
    font-weight: 500;
}

/* ===== SLIDING INFO PANEL ===== */
.info-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100vh;
    background: var(--bg-card);
    border-left: 3px solid var(--border);
    box-shadow: -5px 0 30px var(--shadow);
    z-index: 9999;
    transition: right 0.4s var(--bounce);
    overflow-y: auto;
    padding: 2rem;
}

.info-panel.open {
    right: 0;
}

.panel-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    color: var(--text-primary);
}

.panel-close:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg);
}

.panel-content {
    margin-top: 50px;
}

.panel-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 20px;
    border: 2px solid var(--border);
    animation: fadeInUp 0.5s var(--bounce);
}

.panel-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.panel-section p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.panel-tip {
    background: var(--gradient-cherry);
    padding: 1rem 1.5rem;
    border-radius: 15px;
    margin: 1rem 0;
    border-left: 4px solid var(--primary);
}

.panel-tip strong {
    color: var(--primary);
    font-weight: 700;
}

/* ===== KEYBOARD SHORTCUTS PANEL ===== */
.keyboard-shortcuts-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 60px var(--shadow);
    z-index: 10000;
    max-width: 400px;
    width: 90%;
    animation: fadeInUp 0.3s var(--bounce);
}

.shortcuts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.shortcuts-header h3 {
    font-size: 1.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.close-shortcuts {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.close-shortcuts:hover {
    color: var(--danger);
    transform: rotate(90deg);
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.shortcut-item:hover {
    transform: translateX(5px);
    background: var(--bg-primary);
}

.shortcut-item kbd {
    background: var(--bg-card);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-weight: 700;
    border: 2px solid var(--border);
    min-width: 40px;
    text-align: center;
    font-family: monospace;
    box-shadow: 0 2px 5px var(--shadow);
}

.shortcut-item span {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header .container {
        padding: 0 15px;
    }

    .header-left {
        gap: 0.5rem;
    }

    .logo {
        font-size: 1.1rem;
    }

    .home-icon-btn {
        width: 38px;
        height: 38px;
        font-size: 1.3rem;
    }

    /* Hide stat on mobile - not needed */
    .stat {
        display: none;
    }

    /* Hide the Day Streak badge on mobile */
    .streak-counter {
        display: none;
    }

    .theme-toggle {
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
    }

    .header-stats {
        gap: 0.6rem;
    }

    .content {
        padding: 1rem;
    }
    
    .welcome-card {
        padding: 2rem 1.5rem;
    }
    
    .welcome-title {
        font-size: 2.5rem;
    }
    
    .welcome-subtitle {
        font-size: 1.35rem;
    }
    
    .welcome-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .welcome-stat {
        flex-direction: row;
        justify-content: center;
        padding: 1rem;
    }
    
    .chapter-heading {
        font-size: 2rem;
    }
    
    .lesson-card {
        padding: 1.5rem;
    }
    
    .vocab-item {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .results-details {
        grid-template-columns: 1fr;
    }
    
    .content-nav {
        flex-direction: column;
    }
    
    .quiz-options {
        gap: 0.75rem;
    }
    
    .grammar-table {
        font-size: 0.9rem;
    }
    
    .grammar-table th,
    .grammar-table td {
        padding: 0.75rem;
    }

    /* Fix overlap between study buddy and mobile menu button */
    .study-buddy {
        bottom: 100px;
        right: 20px;
    }

    .buddy-avatar {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .sidebar-close {
        display: block;
    }

    /* Hide desktop sidebar toggle on mobile */
    .sidebar-toggle {
        display: none;
    }

    /* Sidebar stays as slide-out on mobile */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        padding: 2rem 0;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: 280px;
    }

    .sidebar.collapsed ~ .content {
        margin-left: 0;
    }

    /* Remove left margin on mobile */
    .content {
        margin-left: 0;
    }

    .sidebar-header {
        padding: 0 1.5rem 1.5rem;
        background: none;
        min-height: auto;
    }

    .chapter-item {
        padding: 1rem 1.5rem;
    }

    .sidebar.collapsed .chapter-item {
        padding: 1rem 1.5rem;
        justify-content: flex-start;
    }

    .sidebar.collapsed .chapter-info {
        opacity: 1;
        position: relative;
    }

    .sidebar.collapsed .sidebar-header h2 {
        opacity: 1;
    }

    /* Mobile menu button styling when in header */
    .mobile-menu-btn {
        display: flex;
        width: 40px;
        height: 40px;
        padding: 8px;
        margin-right: 0.5rem;
    }

    .mobile-menu-btn span {
        width: 20px;
        height: 2px;
    }

    /* Make chapter titles smaller in sidebar on mobile */
    .chapter-title {
        font-size: 0.85rem;
    }

    .chapter-subtitle {
        font-size: 0.7rem;
    }

    .chapter-item {
        padding: 0.8rem 1rem;
    }
}

@media (max-width: 480px) {
    .welcome-title {
        font-size: 2rem;
    }

    .welcome-subtitle {
        font-size: 1.1rem;
    }

    .chapter-heading {
        font-size: 1.75rem;
    }

    .vocab-japanese {
        font-size: 1.25rem;
    }
}

/* ===== HIRAGANA LEARNING SECTION ===== */

/* Hiragana Container */
.hiragana-container {
    animation: fadeInUp 0.6s var(--bounce);
}

/* Progress Card */
.hiragana-progress-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 20px;
    margin-top: 1.5rem;
    border: 2px solid var(--border);
    box-shadow: 0 4px 15px var(--shadow);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-weight: 600;
}

.progress-number {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    font-size: 1.15rem;
}

.hiragana-progress-bar {
    width: 100%;
    height: 12px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
}

.hiragana-progress-fill {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 10px;
    transition: width 0.5s var(--bounce);
    animation: shimmer 2s infinite;
}

/* Mode Selector Inner Elements */
.mode-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.75rem;
    animation: bounce 2s ease-in-out infinite;
}

.mode-name {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.mode-desc {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Learning Tips */
.hiragana-tips {
    background: var(--gradient-cherry);
    border-radius: 25px;
    padding: 2.5rem;
    margin-top: 3rem;
    border: 2px solid var(--border);
}

.hiragana-tips h3 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.tip-card {
    background: var(--bg-card);
    padding: 1.25rem 1.5rem;
    border-radius: 15px;
    border-left: 4px solid var(--primary);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow);
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.6;
}

.tip-card:hover {
    transform: translateX(8px);
    box-shadow: 0 6px 20px var(--shadow);
}

/* Flashcards Mode */
.hiragana-flashcards {
    padding: 1rem 0;
}

.group-selector {
    margin-bottom: 3rem;
}

.group-selector h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.group-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
}

.group-btn {
    background: var(--bg-card);
    border: 3px solid var(--border);
    border-radius: 20px;
    padding: 1.75rem 1.25rem;
    cursor: pointer;
    transition: all 0.4s var(--bounce);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow);
}

.group-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 107, 157, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.5s ease;
}

.group-btn:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgba(255, 107, 157, 0.3);
}

.group-btn:hover::before {
    left: 100%;
}

.group-btn.active {
    border-width: 4px;
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(255, 107, 157, 0.4);
}

.group-emoji {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.75rem;
}

.group-name {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.group-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Character Cards Grid */
.character-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

/* Individual Hiragana Card (3D Flip) */
.hiragana-card {
    perspective: 1000px;
    cursor: pointer;
    height: 450px;
    position: relative;
}

.hiragana-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.7s;
    transform-style: preserve-3d;
}

.hiragana-card.flipped .hiragana-card-inner {
    transform: rotateY(180deg);
}

.hiragana-card-front,
.hiragana-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 25px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 30px var(--shadow);
    border: 3px solid var(--border);
}

.hiragana-card-front {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
}

.hiragana-card-back {
    background: var(--gradient-cherry);
    transform: rotateY(180deg);
}

.hiragana-large {
    font-size: 6rem;
    font-weight: 900;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Noto Sans JP', sans-serif;
    margin-bottom: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

.hiragana-romaji {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.hiragana-sound {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
}

.card-audio-btn {
    background: var(--gradient-1);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
    margin-bottom: 1rem;
}

.card-audio-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.5);
}

.flip-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 1rem;
}

.mnemonic-emoji {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.mnemonic-text {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: center;
    margin-bottom: 1.5rem;
}

.stroke-info {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.stroke-info strong {
    color: var(--text-primary);
}

.examples {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.examples strong {
    color: var(--text-primary);
}

.mark-learned-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.mark-learned-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Matching Game */
.matching-game {
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 25px;
    border: 2px solid var(--border);
}

.game-header {
    text-align: center;
    margin-bottom: 2rem;
}

.game-header h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-header p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.game-stats .stat {
    background: var(--bg-card);
    padding: 0.75rem 1.5rem;
    border-radius: 15px;
    border: 2px solid var(--border);
    box-shadow: 0 4px 12px var(--shadow);
}

.game-stats .stat strong {
    color: var(--primary);
    font-size: 1.25rem;
}

.matching-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.reset-game-btn {
    background: var(--gradient-1);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 15px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.3);
    display: block;
    margin: 0 auto;
}

.reset-game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.5);
}

/* Speed Quiz */
.speed-quiz {
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 25px;
    border: 2px solid var(--border);
}

.quiz-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.quiz-header h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quiz-header p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.quiz-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.quiz-stats .stat {
    background: var(--bg-card);
    padding: 0.75rem 1.5rem;
    border-radius: 15px;
    border: 2px solid var(--border);
    box-shadow: 0 4px 12px var(--shadow);
}

.quiz-stats .stat strong {
    color: var(--primary);
    font-size: 1.25rem;
}

.quiz-question {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 8px 25px var(--shadow);
    border: 3px solid var(--border);
}

.quiz-character {
    font-size: 8rem;
    font-weight: 900;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Noto Sans JP', sans-serif;
    margin-bottom: 2rem;
    animation: float 2s ease-in-out infinite;
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-top: 2rem;
}

.quiz-option-btn {
    background: var(--bg-card);
    border: 3px solid var(--border);
    padding: 1.5rem;
    border-radius: 15px;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    color: var(--text-primary);
}

.quiz-option-btn:hover:not(:disabled) {
    background: var(--gradient-cherry);
    border-color: var(--primary);
    transform: scale(1.05);
}

.quiz-option-btn.correct {
    background: var(--success);
    border-color: var(--success);
    color: white;
    animation: bounce 0.5s ease;
}

.quiz-option-btn.incorrect {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
    animation: wiggle 0.5s ease;
}

.quiz-option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.start-quiz-btn {
    background: var(--gradient-1);
    color: white;
    border: none;
    padding: 1.25rem 3rem;
    border-radius: 15px;
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.3);
    display: block;
    margin: 0 auto;
}

.start-quiz-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.5);
}

/* Write Practice */
.write-practice {
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 25px;
    border: 2px solid var(--border);
}

.write-practice h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.write-practice > p {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.practice-chars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.practice-char-btn {
    background: var(--bg-card);
    border: 2px solid var(--border);
    padding: 1rem 0.75rem;
    border-radius: 12px;
    font-size: 2rem;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--text-primary);
}

.practice-char-btn small {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.practice-char-btn:hover {
    background: var(--gradient-cherry);
    border-color: var(--primary);
    transform: scale(1.1);
}

.writing-area {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 3px solid var(--border);
    box-shadow: 0 8px 25px var(--shadow);
}

.char-display {
    text-align: center;
    margin-bottom: 1.5rem;
}

#practiceCharLarge {
    font-size: 5rem;
    font-weight: 900;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Noto Sans JP', sans-serif;
    animation: pulse 2s ease-in-out infinite;
}

#practiceRomaji {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.stroke-guide {
    background: var(--gradient-cherry);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    text-align: center;
    border-left: 4px solid var(--primary);
}

.stroke-guide strong {
    color: var(--text-primary);
}

#strokeGuide {
    color: var(--text-secondary);
    font-weight: 600;
}

#writingCanvas {
    display: block;
    width: 100%;
    max-width: 400px;
    height: 400px;
    margin: 0 auto 1.5rem;
    border: 3px solid var(--border);
    border-radius: 15px;
    background: white;
    cursor: crosshair;
    touch-action: none;
}

.clear-canvas-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
    display: block;
    margin: 0 auto;
}

.clear-canvas-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(230, 57, 70, 0.5);
}

.practice-tips {
    background: var(--gradient-cherry);
    border-radius: 15px;
    padding: 1.5rem 2rem;
    border-left: 4px solid var(--accent-gold);
}

.practice-tips h4 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.practice-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.practice-tips li {
    color: var(--text-primary);
    padding: 0.5rem 0;
    font-weight: 600;
}

/* ===== ALL CHARACTERS CHART VIEW ===== */
.hiragana-chart {
    padding: 1rem 0;
}

.chart-title {
    font-size: 2.25rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.75rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chart-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 3rem;
    font-weight: 600;
}

.chart-group {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2.5rem;
    border-left: 6px solid var(--primary);
    box-shadow: 0 8px 30px var(--shadow);
    border: 3px solid var(--border);
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s var(--bounce) backwards;
}

.chart-group:nth-child(1) { animation-delay: 0.1s; }
.chart-group:nth-child(2) { animation-delay: 0.2s; }
.chart-group:nth-child(3) { animation-delay: 0.3s; }
.chart-group:nth-child(4) { animation-delay: 0.4s; }
.chart-group:nth-child(5) { animation-delay: 0.5s; }

.chart-group:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px var(--shadow);
}

.chart-group-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.chart-group-emoji {
    font-size: 2.5rem;
}

.chart-group-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}

.chart-group-badge {
    background: var(--gradient-1);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.chart-group-desc {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.chart-characters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.25rem;
}

.chart-char-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
    border: 3px solid var(--border);
    border-radius: 18px;
    padding: 1.75rem 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s var(--bounce);
    position: relative;
    overflow: hidden;
}

.chart-char-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 107, 157, 0.15), transparent);
    transform: rotate(45deg);
    transition: all 0.5s ease;
}

.chart-char-card:hover {
    transform: translateY(-8px) scale(1.05);
    border-color: var(--primary);
    box-shadow: 0 12px 35px rgba(255, 107, 157, 0.4);
}

.chart-char-card:hover::before {
    left: 100%;
}

.chart-char-card.learned {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, var(--bg-card) 100%);
}

.chart-char-main {
    font-size: 3.5rem;
    font-weight: 900;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Noto Sans JP', sans-serif;
    margin-bottom: 0.5rem;
    position: relative;
}

.learned-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--success);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    animation: bounce 0.6s ease infinite;
}

.chart-char-romaji {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.chart-char-sound {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Character Detail Modal */
.char-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    padding: 1rem;
}

.char-modal.hidden {
    display: none;
}

.char-modal-content {
    background: var(--bg-card);
    border-radius: 30px;
    padding: 3rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    border: 3px solid var(--border);
    animation: fadeInUp 0.4s var(--bounce);
}

.char-modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--danger);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 1.75rem;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.4);
}

.char-modal-close:hover {
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 25px rgba(230, 57, 70, 0.6);
}

.char-detail-hero {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: var(--gradient-cherry);
    border-radius: 20px;
    border: 2px solid var(--border);
}

.char-detail-large {
    font-size: 8rem;
    font-weight: 900;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Noto Sans JP', sans-serif;
    margin-bottom: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

.char-detail-romaji {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.char-detail-sound {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-style: italic;
}

.char-detail-audio {
    width: 100%;
    background: var(--gradient-1);
    color: white;
    border: none;
    padding: 1.25rem;
    border-radius: 15px;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.4);
    margin-bottom: 2rem;
}

.char-detail-audio:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 25px rgba(255, 107, 157, 0.6);
}

.char-detail-mnemonic {
    background: var(--gradient-cherry);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary);
}

.mnemonic-emoji-large {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.mnemonic-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.mnemonic-text-large {
    font-size: 1.15rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.7;
}

.char-detail-stroke {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.char-detail-stroke strong {
    color: var(--text-primary);
    font-size: 1.15rem;
}

.char-detail-examples {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    text-align: center;
}

.char-detail-examples strong {
    color: var(--text-primary);
    font-size: 1.15rem;
}

.example-item {
    background: var(--bg-card);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin: 0.75rem 0;
    color: var(--text-primary);
    font-weight: 600;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.example-item:hover {
    transform: translateX(5px);
    border-color: var(--primary);
}

.char-detail-mark {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1.25rem;
    border-radius: 15px;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.4);
}

.char-detail-mark:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 25px rgba(230, 57, 70, 0.6);
}

.char-detail-mark.learned {
    background: var(--success);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.char-detail-mark.learned:hover {
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.6);
}

/* ===== TABLE VIEW (Traditional Chart) ===== */
.hiragana-table-view {
    padding: 1rem 0;
}

.table-view-title {
    font-size: 2.25rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.75rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.table-view-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
    font-weight: 600;
}

.hiragana-table-container {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 8px 30px var(--shadow);
    border: 3px solid var(--border);
    overflow-x: auto;
}

.hiragana-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0.5rem;
    margin-bottom: 2rem;
}

.hiragana-table thead th {
    background: var(--gradient-1);
    color: white;
    padding: 1rem;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
}

.table-vowel-header {
    min-width: 100px;
}

.table-row-label {
    background: var(--gradient-2);
    color: white;
    padding: 1rem;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(69, 123, 157, 0.3);
    min-width: 60px;
}

.hiragana-table tbody .table-row-label {
    background: var(--gradient-2);
}

.table-cell {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
    border: 3px solid var(--border);
    border-radius: 15px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s var(--bounce);
    position: relative;
    min-width: 100px;
    min-height: 100px;
}

.table-cell:not(.empty):hover {
    transform: scale(1.1);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(255, 107, 157, 0.4);
    background: var(--gradient-cherry);
    z-index: 10;
}

.table-cell.learned {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, var(--bg-card) 100%);
}

.table-cell.empty {
    background: transparent;
    border: 2px dashed rgba(128, 128, 128, 0.2);
    cursor: default;
}

.table-char {
    font-size: 2.75rem;
    font-weight: 900;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Noto Sans JP', sans-serif;
    margin-bottom: 0.5rem;
}

.table-romaji {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.table-learned-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--success);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    animation: bounce 0.6s ease infinite;
}

/* Special Character (ん) */
.table-special-char {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--gradient-cherry);
    border-radius: 15px;
    border: 2px solid var(--border);
}

.special-char-label {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.special-char-cell {
    background: var(--bg-card);
    border: 3px solid var(--border);
    border-radius: 15px;
    padding: 1.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s var(--bounce);
    position: relative;
    min-width: 120px;
}

.special-char-cell:hover {
    transform: scale(1.1);
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(255, 107, 157, 0.4);
}

.special-char-cell.learned {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, var(--bg-card) 100%);
}

/* Legend */
.table-legend {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legend-sample {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.legend-sample.learned {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, var(--bg-card) 100%);
    position: relative;
}

.legend-sample.learned::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--success);
    font-weight: 700;
    font-size: 1.25rem;
}

.legend-item span {
    font-weight: 600;
    color: var(--text-primary);
}

/* Dakuten Section */
.dakuten-table-title {
    font-size: 1.75rem;
    font-weight: 800;
    text-align: center;
    margin: 3rem 0 0.75rem;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dakuten-table-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 2rem;
    font-weight: 600;
}

.dakuten-table {
    margin-top: 2rem;
}

/* Hiragana Header */
.hiragana-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--gradient-cherry);
    border-radius: 25px;
    border: 2px solid var(--border);
    position: relative;
    overflow: hidden;
}

.hiragana-header::before {
    content: '🌸';
    position: absolute;
    font-size: 10rem;
    opacity: 0.05;
    top: -30px;
    right: -30px;
    animation: rotate 20s linear infinite;
}

.hiragana-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.hiragana-subtitle {
    color: var(--text-secondary);
    font-size: 1.15rem;
    margin-bottom: 1.5rem;
}

.hiragana-progress-info {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 4px 15px var(--shadow);
    border: 2px solid var(--border);
}

.hiragana-progress-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hiragana Mode Selector */
.hiragana-mode-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
    animation: fadeInUp 0.6s var(--bounce) 0.2s backwards;
}

.hiragana-mode-btn {
    background: var(--bg-card);
    border: 3px solid var(--border);
    padding: 2rem 1.5rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.4s var(--bounce);
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow);
}

.hiragana-mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hiragana-mode-btn:hover {
    transform: translateY(-8px) scale(1.05);
    border-color: var(--primary);
    box-shadow: 0 8px 30px rgba(255, 107, 157, 0.4);
}

.hiragana-mode-btn:hover::before {
    opacity: 0.1;
}

.hiragana-mode-btn.active {
    background: var(--gradient-1);
    color: white;
    border-color: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(255, 107, 157, 0.5);
}

.hiragana-mode-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    animation: bounce 2s ease-in-out infinite;
}

/* Group Selector */
.hiragana-group-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.hiragana-group-card {
    background: var(--bg-card);
    border: 3px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.4s var(--bounce);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow);
}

.hiragana-group-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 107, 157, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.5s ease;
}

.hiragana-group-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 12px 40px rgba(255, 107, 157, 0.3);
}

.hiragana-group-card:hover::before {
    left: 100%;
}

.hiragana-group-emoji {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.hiragana-group-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.hiragana-group-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.hiragana-group-count {
    display: inline-block;
    background: var(--gradient-1);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

/* Character Cards */
.hiragana-characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.hiragana-char-card {
    background: var(--bg-card);
    border: 3px solid var(--border);
    border-radius: 25px;
    padding: 2.5rem;
    transition: all 0.5s var(--bounce);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px var(--shadow);
    cursor: pointer;
    animation: fadeInUp 0.5s var(--bounce) backwards;
}

.hiragana-char-card:nth-child(1) { animation-delay: 0.1s; }
.hiragana-char-card:nth-child(2) { animation-delay: 0.2s; }
.hiragana-char-card:nth-child(3) { animation-delay: 0.3s; }
.hiragana-char-card:nth-child(4) { animation-delay: 0.4s; }
.hiragana-char-card:nth-child(5) { animation-delay: 0.5s; }

.hiragana-char-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 0%;
    background: var(--gradient-1);
    transition: height 0.4s ease;
}

.hiragana-char-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 15px 50px rgba(255, 107, 157, 0.4);
}

.hiragana-char-card:hover::before {
    height: 100%;
}

.hiragana-char-card.learned {
    border-color: var(--success);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.hiragana-char-main {
    text-align: center;
    margin-bottom: 1.5rem;
}

.hiragana-char-large {
    font-size: 5rem;
    font-weight: 900;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
    margin-bottom: 0.5rem;
    font-family: 'Noto Sans JP', sans-serif;
    animation: pulse 2s ease-in-out infinite;
}

.hiragana-char-romaji {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.hiragana-char-sound {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 1rem;
}

.hiragana-mnemonic {
    background: var(--gradient-cherry);
    padding: 1.5rem;
    border-radius: 15px;
    margin: 1.5rem 0;
    border-left: 4px solid var(--primary);
}

.hiragana-mnemonic-emoji {
    font-size: 2rem;
    margin-right: 0.5rem;
}

.hiragana-mnemonic-text {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.6;
}

.hiragana-stroke-order {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.hiragana-examples {
    margin-top: 1rem;
}

.hiragana-example-item {
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.hiragana-example-item:hover {
    background: var(--bg-primary);
    transform: translateX(5px);
}

.hiragana-tip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(247, 127, 0, 0.1);
    padding: 1rem;
    border-radius: 12px;
    margin-top: 1rem;
    border-left: 4px solid var(--accent-gold);
}

.hiragana-tip-icon {
    font-size: 1.5rem;
}

.hiragana-tip-text {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

/* Matching Game */
.matching-game-container {
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 25px;
    margin-bottom: 2rem;
}

.matching-game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.matching-game-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.matching-stat {
    text-align: center;
}

.matching-stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.matching-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.matching-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.matching-card {
    aspect-ratio: 1;
    background: var(--bg-card);
    border: 3px solid var(--border);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s var(--bounce);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow);
}

.matching-card::before {
    content: '?';
    position: absolute;
    font-size: 3rem;
    color: var(--text-secondary);
    opacity: 0.3;
}

.matching-card:hover {
    transform: scale(1.05) rotate(2deg);
    border-color: var(--primary);
}

.matching-card.flipped {
    background: var(--gradient-cherry);
    border-color: var(--primary);
}

.matching-card.flipped::before {
    display: none;
}

.matching-card.matched {
    background: var(--success);
    border-color: var(--success);
    color: white;
    animation: bounce 0.6s ease;
    pointer-events: none;
}

.matching-card.matched::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1.25rem;
    color: white;
    animation: fadeIn 0.3s ease;
}

/* Speed Quiz */
.speed-quiz-container {
    padding: 2.5rem;
    background: var(--bg-secondary);
    border-radius: 25px;
    margin-bottom: 2rem;
    border: 2px solid var(--border);
}

.speed-quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.speed-quiz-timer {
    font-size: 3rem;
    font-weight: 900;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 1s ease-in-out infinite;
}

.speed-quiz-timer.warning {
    animation: wiggle 0.5s ease infinite;
}

.speed-quiz-score {
    text-align: center;
}

.speed-quiz-score-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.speed-quiz-score-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.speed-quiz-question-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 8px 25px var(--shadow);
    border: 3px solid var(--border);
}

.speed-quiz-character {
    font-size: 7rem;
    font-weight: 900;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Noto Sans JP', sans-serif;
    margin-bottom: 1rem;
    animation: float 2s ease-in-out infinite;
}

.speed-quiz-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.speed-quiz-option {
    background: var(--bg-card);
    border: 3px solid var(--border);
    padding: 1.5rem;
    border-radius: 15px;
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    text-align: center;
}

.speed-quiz-option:hover {
    background: var(--gradient-cherry);
    border-color: var(--primary);
    transform: scale(1.05);
}

.speed-quiz-option.correct {
    background: var(--success);
    border-color: var(--success);
    color: white;
    animation: bounce 0.5s ease;
}

.speed-quiz-option.incorrect {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
    animation: wiggle 0.5s ease;
}

/* Writing Practice */
.writing-practice-container {
    padding: 2.5rem;
    background: var(--bg-secondary);
    border-radius: 25px;
    margin-bottom: 2rem;
    border: 2px solid var(--border);
}

.writing-canvas-wrapper {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: inset 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 3px solid var(--border);
    position: relative;
}

.writing-canvas {
    border: 2px dashed var(--border);
    border-radius: 15px;
    cursor: crosshair;
    touch-action: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 49px,
        rgba(0, 0, 0, 0.05) 49px,
        rgba(0, 0, 0, 0.05) 50px
    ),
    repeating-linear-gradient(
        90deg,
        transparent,
        transparent 49px,
        rgba(0, 0, 0, 0.05) 49px,
        rgba(0, 0, 0, 0.05) 50px
    );
}

.writing-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 15rem;
    opacity: 0.08;
    font-family: 'Noto Sans JP', sans-serif;
    pointer-events: none;
    color: var(--primary);
}

.writing-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.writing-btn {
    background: var(--gradient-1);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--bounce);
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.3);
}

.writing-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.5);
}

.writing-btn:active {
    transform: translateY(-1px);
}

.writing-btn.secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.writing-btn.secondary:hover {
    background: var(--bg-secondary);
}

/* Tips Section */
.hiragana-tips-section {
    background: var(--gradient-cherry);
    border-radius: 25px;
    padding: 2.5rem;
    margin-top: 3rem;
    border: 2px solid var(--border);
}

.hiragana-tips-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.hiragana-tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.hiragana-tip-card {
    background: var(--bg-card);
    padding: 1.25rem 1.5rem;
    border-radius: 15px;
    border-left: 4px solid var(--primary);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow);
}

.hiragana-tip-card:hover {
    transform: translateX(8px);
    box-shadow: 0 6px 20px var(--shadow);
}

.hiragana-tip-card-text {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.6;
}

/* Back to Groups Button */
.back-to-groups-btn {
    background: var(--bg-card);
    border: 2px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.back-to-groups-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateX(-5px);
}

/* Hiragana Flashcard Mode */
.hiragana-flashcard-mode {
    padding: 2rem 0;
}

.hiragana-flashcard-card {
    perspective: 1500px;
    cursor: pointer;
    width: 100%;
    max-width: 700px;
    height: 450px;
    margin: 0 auto 2rem;
}

.hiragana-flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.7s;
    transform-style: preserve-3d;
}

.hiragana-flashcard-card.flipped .hiragana-flashcard-inner {
    transform: rotateY(180deg);
}

.hiragana-flashcard-front,
.hiragana-flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    box-shadow: 0 20px 60px var(--shadow);
    border: 4px solid var(--border);
}

.hiragana-flashcard-front {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
}

.hiragana-flashcard-back {
    background: var(--gradient-cherry);
    transform: rotateY(180deg);
}

.hiragana-flashcard-char {
    font-size: 10rem;
    font-weight: 900;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Noto Sans JP', sans-serif;
    animation: pulse 2s ease-in-out infinite;
    margin-bottom: 1rem;
}

.hiragana-flashcard-romaji {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.hiragana-flashcard-sound {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Responsive Design for Hiragana */
@media (max-width: 768px) {
    .hiragana-mode-selector {
        grid-template-columns: 1fr;
    }

    .hiragana-group-selector {
        grid-template-columns: 1fr;
    }

    .hiragana-characters-grid {
        grid-template-columns: 1fr;
    }

    .matching-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .speed-quiz-character {
        font-size: 5rem;
    }

    .hiragana-flashcard-char {
        font-size: 7rem;
    }

    .writing-guide {
        font-size: 10rem;
    }

    .hiragana-tips-grid {
        grid-template-columns: 1fr;
    }

    /* Chart View Responsive */
    .chart-characters {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 1rem;
    }

    .chart-char-main {
        font-size: 2.75rem;
    }

    .char-detail-large {
        font-size: 6rem;
    }

    .char-modal-content {
        padding: 2rem;
    }

    /* Table View Responsive */
    .hiragana-table-container {
        padding: 1.5rem;
    }

    .table-char {
        font-size: 2.25rem;
    }

    .table-cell {
        min-width: 80px;
        min-height: 80px;
        padding: 1rem 0.5rem;
    }

    .hiragana-table thead th,
    .table-row-label {
        font-size: 1rem;
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .hiragana-char-large {
        font-size: 4rem;
    }

    .speed-quiz-character {
        font-size: 4rem;
    }

    .hiragana-flashcard-char {
        font-size: 5rem;
    }

    .matching-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .matching-card {
        font-size: 1.5rem;
    }

    /* Chart View Mobile */
    .chart-title {
        font-size: 1.75rem;
    }

    .chart-subtitle {
        font-size: 0.95rem;
    }

    .chart-characters {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 0.75rem;
    }

    .chart-char-card {
        padding: 1.25rem 0.75rem;
    }

    .chart-char-main {
        font-size: 2.25rem;
    }

    .chart-char-romaji {
        font-size: 1rem;
    }

    .chart-char-sound {
        font-size: 0.75rem;
    }

    .chart-group-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .chart-group-name {
        font-size: 1.25rem;
    }

    .char-detail-large {
        font-size: 5rem;
    }

    .char-detail-romaji {
        font-size: 2rem;
    }

    .char-modal-content {
        padding: 1.5rem;
    }

    .mnemonic-emoji-large {
        font-size: 3rem;
    }

    /* Table View Mobile */
    .table-view-title {
        font-size: 1.5rem;
    }

    .hiragana-table-container {
        padding: 1rem;
    }

    .table-char {
        font-size: 1.75rem;
    }

    .table-romaji {
        font-size: 0.85rem;
    }

    .table-cell {
        min-width: 65px;
        min-height: 65px;
        padding: 0.75rem 0.35rem;
    }

    .hiragana-table thead th,
    .table-row-label {
        font-size: 0.85rem;
        padding: 0.5rem;
        min-width: 50px;
    }

    .table-special-char {
        flex-direction: column;
        gap: 1rem;
    }

    .hiragana-table {
        border-spacing: 0.35rem;
    }

    .table-legend {
        gap: 1.5rem;
    }
}
/* ===== FOOTER ===== */
.app-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: 4rem;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.footer-content a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.footer-content a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

@media (max-width: 768px) {
    .app-footer {
        padding: 1rem 0;
        margin-top: 2rem;
    }

    .footer-content p {
        font-size: 0.85rem;
    }
}

/* ===== ENGAGEMENT SECTION ===== */
.engagement-section {
    max-width: 800px;
    margin: 40px auto 20px;
    padding: 24px;
    text-align: center;
}

.engagement-widget {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.engagement-stat {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s var(--smooth);
}

.engagement-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.engagement-stat.clickable {
    cursor: pointer;
}

.engagement-stat.liked {
    border: 1px solid rgba(255, 107, 157, 0.5);
    background: rgba(255, 107, 157, 0.1);
}

.stat-icon {
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.views {
    background: linear-gradient(135deg, #3b5998, #1b3984);
}

.stat-icon.likes {
    background: linear-gradient(135deg, #ff6b9d, #ff4d7d);
}

.stat-icon.comments {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.stat-icon svg {
    width: 16px;
    height: 16px;
    color: white;
}

.stat-number {
    color: var(--text-primary);
    font-weight: bold;
    font-size: 14px;
}

.stat-number.liked {
    color: #ff6b9d;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 12px;
    opacity: 0.6;
}

/* ===== COMMENTS SECTION ===== */
.comments-section {
    max-width: 800px;
    margin: 20px auto 40px;
    padding: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 4px 16px var(--shadow);
}

.comments-title {
    color: var(--text-primary);
    margin-bottom: 24px;
    font-size: 1.8rem;
    font-weight: 700;
}

.comment-form {
    margin-bottom: 32px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    display: block;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.form-label .required {
    color: var(--danger);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.comment-message {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: none;
}

.comment-message.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.comment-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.comment-message.show {
    display: block;
}

.submit-btn {
    background: var(--gradient-2);
    color: white;
    font-weight: 700;
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(255, 96, 48, 0.3);
    transition: transform 0.2s var(--smooth), box-shadow 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 96, 48, 0.4);
}

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

.form-note {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 12px;
    opacity: 0.7;
}

.comments-list {
    margin-top: 24px;
}

.comment-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.comment-content {
    display: flex;
    gap: 16px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
}

.comment-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.comment-author {
    color: var(--text-primary);
    font-weight: 600;
    margin: 0;
}

.comment-date {
    color: var(--text-secondary);
    font-size: 12px;
    opacity: 0.6;
}

.comment-text {
    color: var(--text-primary);
    margin: 0;
    line-height: 1.6;
}

.comments-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .engagement-section,
    .comments-section {
        margin-left: 16px;
        margin-right: 16px;
        padding: 20px;
    }

    .comments-title {
        font-size: 1.5rem;
    }
}
