@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Serif+JP:wght@400;600;700;900&family=Outfit:wght@300;400;500;600;700;800&family=Sawarabi+Mincho&display=swap');

:root {
    --bg-primary: #0a0b10;
    --bg-secondary: #12131e;
    --bg-card: rgba(20, 22, 39, 0.65);
    --bg-card-hover: rgba(28, 30, 54, 0.85);
    --bg-input: rgba(13, 14, 24, 0.8);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(255, 107, 139, 0.15);
    
    --color-primary: #ff6b8b;      /* Sakura Pink */
    --color-primary-rgb: 255, 107, 139;
    --color-secondary: #ffd700;    /* Gold */
    --color-accent: #6c5ce7;       /* Kyoto Indigo */
    --color-accent-rgb: 108, 92, 231;
    --color-success: #10b981;
    --color-danger: #ef4444;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #1f2937;
    
    --font-ui: 'Outfit', 'Inter', sans-serif;
    --font-jp: 'Noto Serif JP', 'Sawarabi Mincho', serif;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 15px 40px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 20px rgba(255, 107, 139, 0.25);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 107, 139, 0.3) rgba(0, 0, 0, 0.2);
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

*::-webkit-scrollbar-thumb {
    background-color: rgba(255, 107, 139, 0.3);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 107, 139, 0.5);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-ui);
    overflow-x: hidden;
    min-height: 100vh;
    background-image: 
        radial-gradient(at 0% 0%, rgba(108, 92, 231, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(255, 107, 139, 0.12) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(20, 22, 39, 0.4) 0px, transparent 100%);
    background-attachment: fixed;
}

/* Background Artwork */
.bg-art {
    position: fixed;
    top: 5%;
    right: 5%;
    width: 30vw;
    height: 30vw;
    background-image: radial-gradient(circle, rgba(255, 107, 139, 0.03) 0%, transparent 70%);
    border: 1px solid rgba(255, 107, 139, 0.05);
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-jp);
    font-size: 15vw;
    font-weight: 900;
    color: rgba(255, 107, 139, 0.02);
    user-select: none;
}

/* Header */
header {
    background: rgba(10, 11, 16, 0.8);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-icon {
    font-family: var(--font-jp);
    font-size: 2.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-glow);
    animation: pulseGlow 4s infinite alternate;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-family: var(--font-ui);
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: 1px;
    color: var(--text-main);
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.35rem;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.tab-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.6rem 1.25rem;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    background: var(--color-primary);
    color: var(--bg-primary);
    box-shadow: 0 4px 15px rgba(255, 107, 139, 0.4);
    font-weight: 700;
}

/* Settings trigger in nav */
.settings-nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.settings-nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
    border-color: var(--color-secondary);
    color: var(--color-secondary);
}

/* Layout container */
main {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    min-height: calc(100vh - 180px);
}

.page-section {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.page-section.active {
    display: block;
}

/* Dictionary Section */
.search-bar-container {
    margin-bottom: 2.5rem;
    display: flex;
    gap: 1rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.search-input-wrapper {
    position: relative;
    flex-grow: 1;
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 1.1rem 1.25rem 1.1rem 3.2rem;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 1.1rem;
    outline: none;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 15px rgba(255, 107, 139, 0.15), var(--shadow-sm);
}

.filter-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 0 1.5rem;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-ui);
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:focus {
    border-color: var(--color-primary);
}

/* Kanji Grid */
.kanji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.kanji-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.kanji-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    opacity: 0;
    transition: var(--transition);
}

.kanji-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-5px);
    border-color: rgba(255, 107, 139, 0.3);
    box-shadow: var(--shadow-md), 0 5px 20px rgba(255, 107, 139, 0.1);
}

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

.card-glyph {
    font-family: var(--font-jp);
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    transition: var(--transition);
}

.kanji-card:hover .card-glyph {
    color: var(--color-primary);
    text-shadow: 0 0 10px rgba(255, 107, 139, 0.3);
}

.card-meaning {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
    text-transform: capitalize;
}

.card-readings {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.card-level {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--color-secondary);
}

/* Kanji Detail Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 5, 8, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.3s forwards;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 107, 139, 0.2);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(255, 107, 139, 0.15);
    width: 100%;
    max-width: 900px;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    max-height: 90vh;
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modal-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: rotate(90deg);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.modal-left {
    background: rgba(10, 11, 16, 0.8);
    border-right: 1px solid var(--border-color);
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.modal-glyph {
    font-family: var(--font-jp);
    font-size: 9rem;
    font-weight: 900;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 30px rgba(255, 107, 139, 0.2);
    cursor: pointer;
    transition: var(--transition);
}

.modal-glyph:hover {
    transform: scale(1.05);
    color: var(--color-primary);
}

.modal-audio-btn {
    background: rgba(255, 107, 139, 0.1);
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    margin-bottom: 1rem;
}

.modal-audio-btn:hover {
    background: var(--color-primary);
    color: var(--bg-primary);
    box-shadow: 0 4px 15px rgba(255, 107, 139, 0.3);
}

.modal-meta-row {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.modal-meta-badge {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.modal-meta-badge span {
    color: var(--color-secondary);
    font-weight: 600;
}

.modal-right {
    padding: 3rem 2.5rem;
    overflow-y: auto;
}

.modal-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--text-main), #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.info-section {
    margin-bottom: 1.5rem;
}

.info-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--color-primary);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.info-value {
    font-size: 1.1rem;
    color: var(--text-main);
    line-height: 1.5;
}

.readings-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    background: rgba(0, 0, 0, 0.15);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.reading-col h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.reading-kana {
    font-family: var(--font-jp);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-main);
}

.reading-romaji {
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

.example-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.example-jp {
    display: flex;
    flex-direction: column;
}

.example-kanji {
    font-family: var(--font-jp);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
}

.example-kana {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.example-en {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-secondary);
}

/* Practice Canvas Section */
.canvas-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.canvas-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: var(--shadow-md);
}

.canvas-wrapper {
    position: relative;
    width: 360px;
    height: 360px;
    background: #ffffff;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
    border: 4px solid var(--bg-secondary);
}

#drawing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    cursor: crosshair;
}

.canvas-background-guideline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    stroke: rgba(0, 0, 0, 0.05);
    stroke-dasharray: 4;
    stroke-width: 1;
}

.canvas-kanji-guide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-jp);
    font-size: 200px;
    color: rgba(0, 0, 0, 0.08);
    user-select: none;
    transition: var(--transition);
}

.canvas-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    width: 100%;
}

.btn {
    flex: 1;
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    outline: none;
}

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

.btn-primary:hover {
    box-shadow: 0 4px 15px rgba(255, 107, 139, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.canvas-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.canvas-kanji-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.selector-glyph {
    font-family: var(--font-jp);
    font-size: 1.5rem;
    height: 45px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.selector-glyph:hover, .selector-glyph.active {
    background: var(--color-accent);
    color: var(--text-main);
    border-color: var(--color-accent);
}

/* Chat Section */
.chat-container {
    max-width: 900px;
    margin: 0 auto;
    height: calc(100vh - 240px);
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
}

.chat-header {
    background: rgba(10, 11, 16, 0.6);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tutor-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tutor-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-jp);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    box-shadow: var(--shadow-glow);
    position: relative;
}

.tutor-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: var(--color-success);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.tutor-details h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.tutor-details p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-messages {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: rgba(10, 11, 16, 0.2);
}

.message {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    animation: messageSlideIn 0.3s ease-out;
}

.message.tutor {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
}

.message-bubble {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    line-height: 1.5;
    font-size: 1rem;
}

.message.tutor .message-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-top-left-radius: 4px;
}

.message.user .message-bubble {
    background: var(--color-accent);
    color: var(--text-main);
    border-top-right-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    padding: 0 0.25rem;
}

.message.tutor .message-time {
    align-self: flex-start;
}

.message.user .message-time {
    align-self: flex-end;
}

.typing-indicator {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-md);
    border-top-left-radius: 4px;
    display: none;
    align-items: center;
    gap: 0.35rem;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

.chat-input-area {
    padding: 1.25rem 1.5rem;
    background: rgba(10, 11, 16, 0.6);
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
}

.chat-input {
    flex-grow: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.chat-input:focus {
    border-color: var(--color-accent);
}

.chat-send-btn {
    background: var(--color-accent);
    color: var(--text-main);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.chat-send-btn:hover {
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
    transform: translateY(-2px);
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Quiz Section */
.quiz-container {
    max-width: 700px;
    margin: 2rem auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    position: relative;
}

.quiz-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.quiz-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    width: 0%;
    transition: var(--transition);
}

.quiz-score-badge {
    position: absolute;
    top: 2.5rem;
    right: 2.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-secondary);
}

.quiz-question-box {
    margin-bottom: 2.5rem;
}

.quiz-glyph {
    font-family: var(--font-jp);
    font-size: 7.5rem;
    font-weight: 900;
    color: var(--text-main);
    text-shadow: 0 0 25px rgba(255, 107, 139, 0.2);
    margin-bottom: 1rem;
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quiz-prompt {
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--text-muted);
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.option-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.option-btn.correct {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: var(--color-success) !important;
    color: var(--color-success) !important;
}

.option-btn.wrong {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: var(--color-danger) !important;
    color: var(--color-danger) !important;
}

.quiz-result-view {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.quiz-trophy {
    font-size: 5rem;
    margin-bottom: 1rem;
}

/* Settings Modal */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 5, 8, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.3s forwards;
}

.settings-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.settings-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 2rem;
    color: var(--text-main);
}

.settings-group {
    margin-bottom: 1.75rem;
}

.settings-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.settings-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.settings-input:focus {
    border-color: var(--color-primary);
}

.settings-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    line-height: 1.4;
}

.settings-desc a {
    color: var(--color-primary);
    text-decoration: none;
}

.settings-desc a:hover {
    text-decoration: underline;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-main);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--color-primary);
}

input:checked + .slider:before {
    transform: translateX(24px);
    background-color: var(--bg-primary);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes popIn {
    0% { transform: scale(0.7); opacity: 0; }
    80% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

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

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 10px rgba(255, 107, 139, 0.2);
        border-color: rgba(255, 107, 139, 0.8);
    }
    100% {
        box-shadow: 0 0 25px rgba(255, 107, 139, 0.45);
        border-color: rgba(255, 107, 139, 1);
    }
}

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Footer */
footer {
    border-top: 1px solid var(--border-color);
    padding: 2.5rem 0;
    margin-top: 4rem;
    text-align: center;
    background: rgba(10, 11, 16, 0.6);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--color-primary);
}

.copyright {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Themes */
body.theme-kyoto {
    --bg-primary: #05060a;
    --bg-secondary: #0b0c14;
    --bg-card: rgba(13, 15, 28, 0.75);
    --bg-card-hover: rgba(20, 22, 38, 0.95);
    --bg-input: rgba(8, 9, 16, 0.9);
    --border-color: rgba(255, 255, 255, 0.05);
    --border-glow: rgba(108, 92, 231, 0.2);
    --color-primary: #ffd700;      /* Gold dominant */
    --color-primary-rgb: 255, 215, 0;
    --color-accent: #ff6b8b;       /* Sakura accent */
    --color-accent-rgb: 255, 107, 139;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --shadow-glow: 0 0 20px rgba(255, 215, 0, 0.15);
    background-image: 
        radial-gradient(at 0% 0%, rgba(108, 92, 231, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(255, 215, 0, 0.08) 0px, transparent 50%);
}

body.theme-minimal {
    --bg-primary: #f7f8fc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: #ffffff;
    --bg-input: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-glow: rgba(79, 70, 229, 0.08);
    --color-primary: #ff6b8b;      /* Sakura Pink */
    --color-primary-rgb: 255, 107, 139;
    --color-secondary: #b45309;    /* Dark Amber */
    --color-accent: #4f46e5;       /* Modern Indigo */
    --color-accent-rgb: 79, 70, 229;
    --color-success: #059669;
    --color-danger: #dc2626;
    --text-main: #1f2937;          /* Dark Text */
    --text-muted: #6b7280;
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 15px 32px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 15px rgba(255, 107, 139, 0.15);
    background-image: 
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(255, 107, 139, 0.05) 0px, transparent 50%);
}

body.theme-minimal .logo-icon {
    box-shadow: none;
    background: transparent;
    -webkit-text-fill-color: var(--color-primary);
}

body.theme-minimal .tab-btn.active {
    color: #ffffff;
}

body.theme-minimal .canvas-wrapper {
    border: 4px solid #e5e7eb;
}

body.theme-minimal .message.tutor .message-bubble {
    background: #f3f4f6;
    color: #1f2937;
    border-color: #e5e7eb;
}

body.theme-minimal .example-item {
    background: #f9fafb;
    border-color: #e5e7eb;
}

/* Responsive layout adjustments */
@media (max-width: 900px) {
    .modal-content {
        grid-template-columns: 1fr;
        max-height: 95vh;
        overflow-y: auto;
    }
    .modal-left {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 2rem;
    }
    .modal-right {
        padding: 2rem;
    }
    .canvas-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-tabs {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
    }
    
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        flex-shrink: 0;
    }
    
    .search-bar-container {
        flex-direction: column;
    }
    
    .canvas-wrapper {
        width: 290px;
        height: 290px;
    }
    
    .canvas-kanji-guide {
        font-size: 160px;
    }
    
    .quiz-options {
        grid-template-columns: 1fr;
    }
}
