* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.app-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    gap: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    min-height: 90vh;
    position: relative;
}

/* Hamburger Menu */
.hamburger-menu {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.hamburger-btn {
    display: flex;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    gap: 6px;
    padding: 8px;
}

.hamburger-btn span {
    width: 25px;
    height: 3px;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger-btn.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Hamburger Dropdown Menu */
.hamburger-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    overflow: hidden;
}

.hamburger-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: white;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    transition: background 0.2s ease;
    text-align: left;
}

.menu-item:hover {
    background: #f8f9fa;
}

.menu-item.active {
    background: #e7f0ff;
    color: #667eea;
}

.menu-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.menu-text {
    flex: 1;
}

/* Settings Overlay */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.3s ease;
}

.settings-overlay.active {
    display: flex;
}

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

.settings-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideInUp 0.3s ease;
}

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

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
}

.settings-header h2 {
    margin: 0;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #333;
}

.settings-content {
    padding: 20px;
}

.settings-content h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #333;
}

.settings-description {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
}

/* Language Buttons */
.language-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.lang-btn {
    padding: 8px 5px;
    border: 2px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: #555;
    flex: 1;
    min-width: 80px;
}

.lang-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.lang-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Theme Buttons */
.theme-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.theme-btn {
    padding: 8px 16px;
    border: 2px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: #555;
    flex: 1;
    min-width: 80px;
}

.theme-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.theme-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: #f8f9fa;
    padding: 30px 20px;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
}

.sidebar h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
}

.belt-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 30px;
}

.belt-btn {
    padding: 12px 16px;
    border: 3px solid;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: #333;
    text-align: left;
}

/* Individual belt colors */
.belt-btn[data-kyu="5_kyu_gelb"] {
    border-color: #ffd700;
}

.belt-btn[data-kyu="5_kyu_gelb"]:hover:not(.active) {
    background: rgba(255, 215, 0, 0.1);
}

.belt-btn[data-kyu="5_kyu_gelb"].active {
    background: #ffd700;
    color: #333;
}

.belt-btn[data-kyu="4_kyu_orange"] {
    border-color: #ff8c00;
}

.belt-btn[data-kyu="4_kyu_orange"]:hover:not(.active) {
    background: rgba(255, 140, 0, 0.1);
}

.belt-btn[data-kyu="4_kyu_orange"].active {
    background: #ff8c00;
    color: white;
}

.belt-btn[data-kyu="3_kyu_gruen"] {
    border-color: #228b22;
}

.belt-btn[data-kyu="3_kyu_gruen"]:hover:not(.active) {
    background: rgba(34, 139, 34, 0.1);
}

.belt-btn[data-kyu="3_kyu_gruen"].active {
    background: #228b22;
    color: white;
}

.belt-btn[data-kyu="2_kyu_blau"] {
    border-color: #4169e1;
}

.belt-btn[data-kyu="2_kyu_blau"]:hover:not(.active) {
    background: rgba(65, 105, 225, 0.1);
}

.belt-btn[data-kyu="2_kyu_blau"].active {
    background: #4169e1;
    color: white;
}

.belt-btn[data-kyu="1_kyu_braun"] {
    border-color: #8b4513;
}

.belt-btn[data-kyu="1_kyu_braun"]:hover:not(.active) {
    background: rgba(139, 69, 19, 0.1);
}

.belt-btn[data-kyu="1_kyu_braun"].active {
    background: #8b4513;
    color: white;
}

/* Category Groups */
.category-group {
    margin-bottom: 20px;
}

.category-group-title {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    padding-left: 4px;
}

.category-filters {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.category-btn {
    padding: 10px 14px;
    border: 2px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #555;
    text-align: left;
}

.category-btn:hover:not(.active) {
    border-color: #667eea;
    background: #f0f4ff;
}

.category-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.stats {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.stats h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: #333;
}

.stats p {
    font-size: 13px;
    color: #555;
    margin-bottom: 8px;
}

#reset-stats {
    width: 100%;
    padding: 8px;
    margin-top: 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s ease;
}

#reset-stats:hover {
    background: #c82333;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 40px;
}

/* Compendium Content */
.compendium-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 40px;
}

.compendium-container {
    flex: 1;
    display: block;
    text-align: left;
}

.compendium-container h1 {
    font-size: 36px;
    color: #333;
    margin-bottom: 20px;
}

.compendium-container p {
    font-size: 18px;
    color: #666;
}


.card-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
}

.image-section {
    text-align: center;
}

#technique-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.words-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    border: 2px solid #dee2e6;
}

.instruction {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.answer-placeholders {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
    min-height: 50px;
    align-items: center;
}

.answer-placeholder {
    width: 80px;
    height: 40px;
    border: 2px dotted #ccc;
    border-radius: 6px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #999;
    transition: all 0.3s ease;
}

.answer-placeholder.filled {
    border-color: #667eea;
    background: #e7f0ff;
}

.answer-placeholder.correct {
    border-color: #28a745;
    background: #d4edda;
    animation: pulse-correct 0.6s ease-out;
}

.answer-placeholder.incorrect {
    border-color: #dc3545;
    background: #f8d7da;
    animation: wiggle 0.4s ease-in-out;
}

@keyframes wiggle {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

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

.word-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    min-height: 45px;
}

.word-btn {
    padding: 10px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.word-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.word-btn.selected {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.5;
}


.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-submit {
    background: #28a745;
    color: white;
}

.btn-submit:hover {
    background: #218838;
}

.btn-skip {
    background: #ffc107;
    color: white;
}

.btn-skip:hover {
    background: #e0a800;
}

.btn-show {
    background: #17a2b8;
    color: white;
}

.btn-show:hover {
    background: #138496;
}

.feedback {
    text-align: center;
    min-height: 40px;
    padding: 15px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

.feedback.empty {
    border: none;
    color: transparent;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #dee2e6;
    border-radius: 4px;
    margin-top: auto;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #667eea;
    width: 0%;
    transition: width 0.3s ease;
}

/* Compendium Styling */
.compendium-content {
    display: flex;
    width: 100%;
    padding: 20px;
}

.compendium-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.compendium-header {
    margin-bottom: 20px;
}

.compendium-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.compendium-menu {
    min-width: 220px;
    max-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

body.theme-dark .compendium-menu {
    background: #2B2D30;
    border-color: #3a3f47;
}

/* ── Whole-menu collapse toggle ─────────────────────────────────────── */
.compendium-menu-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #667eea;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    gap: 8px;
    transition: background 0.2s ease;
}

.compendium-menu-toggle:hover {
    background: #5568d3;
}

body.theme-dark .compendium-menu-toggle {
    background: #2E436E;
}

body.theme-dark .compendium-menu-toggle:hover {
    background: #3a5489;
}

/* ── Collapsible items wrapper ──────────────────────────────────────── */
.compendium-menu-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.25s ease;
    padding-top: 0;
    padding-bottom: 0;
}

.compendium-menu-items.open {
    max-height: 600px;
    opacity: 1;
    pointer-events: auto;
    padding: 10px;
}

/* ── Chevron shared styles ──────────────────────────────────────────── */
.menu-chevron {
    flex-shrink: 0;
    align-self: center;
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-135deg); /* points up ∧ by default */
    transition: transform 0.25s ease;
    display: inline-block;
    margin-top: 3px; /* compensate for rotated box optical offset */
}

/* Whole-menu toggle: ∧ when open, ∨ when closed */
.compendium-menu-toggle[aria-expanded="true"]  .menu-chevron { transform: rotate(-135deg); } /* ∧ up   */
.compendium-menu-toggle[aria-expanded="false"] .menu-chevron { transform: rotate(45deg);   } /* ∨ down */

/* Parent item chevron: ∨ when collapsed, ∧ when open */
.compendium-menu-item.has-children {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.compendium-menu-item.has-children .menu-item-label {
    flex: 1;
    text-align: left;
}

.compendium-menu-item.has-children .menu-chevron { transform: rotate(45deg);   } /* ∨ collapsed */
.compendium-menu-item.has-children.submenu-open .menu-chevron { transform: rotate(-135deg); } /* ∧ expanded */

/* ── Menu items ─────────────────────────────────────────────────────── */
.compendium-menu-item {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: 2px solid transparent;
    background: transparent;
    color: #333;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.compendium-menu-item:hover {
    border-color: #667eea;
    background: #eef2ff;
}

.compendium-menu-item.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

body.theme-dark .compendium-menu-item {
    color: #fff;
}

body.theme-dark .compendium-menu-item:hover {
    background: #323742;
    border-color: #2E436E;
}

body.theme-dark .compendium-menu-item.active {
    background: #2E436E;
    border-color: #2E436E;
}

.compendium-menu-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.compendium-submenu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 2px solid #e0e0e0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.25s ease, opacity 0.25s ease;
}

body.theme-dark .compendium-submenu {
    border-left-color: #3a3f47;
}

.compendium-submenu.open {
    max-height: 500px;
    opacity: 1;
    pointer-events: auto;
}

.compendium-submenu-item {
    text-align: left;
    padding: 8px 10px;
    border: 2px solid transparent;
    background: transparent;
    color: #555;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
}

.compendium-submenu-item:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.compendium-submenu-item.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

body.theme-dark .compendium-submenu-item {
    color: #ccc;
}

body.theme-dark .compendium-submenu-item:hover {
    background: #323742;
    border-color: #2E436E;
}

body.theme-dark .compendium-submenu-item.active {
    background: #2E436E;
    border-color: #2E436E;
    color: #fff;
}

.compendium-content-area {
    flex: 1;
}

/* Technique Grid */
.compendium-techniques {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

@media (max-width: 768px) {
    .compendium-techniques {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .compendium-techniques {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Technique Card */
.technique-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.technique-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

body.theme-dark .technique-card {
    background: #3a3f47;
}

.technique-card-image {
    width: 100%;
    aspect-ratio: 1;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

body.theme-dark .technique-card-image {
    background: #2B2D30;
}

.technique-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.technique-card-name {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    background: white;
    word-break: break-word;
    line-height: 1.3;
}

body.theme-dark .technique-card-name {
    background: #3a3f47;
    color: #fff;
}

/* Technique Detail Overlay */
.technique-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.technique-detail-modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

body.theme-dark .technique-detail-modal {
    background: #3a3f47;
    color: #fff;
}

.technique-detail-modal .close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #333;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: background 0.2s ease;
}

body.theme-dark .technique-detail-modal .close-btn {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
}

.technique-detail-modal .close-btn:hover {
    background: rgba(255, 255, 255, 1);
}

.technique-detail-content {
    padding: 20px;
}

#detail-technique-image {
    width: 100%;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
    display: block;
}

.technique-detail-info {
    display: flex;
    flex-direction: column;
}

#detail-technique-name {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0 0 20px 0;
}

body.theme-dark #detail-technique-name {
    color: #fff;
}

.kanji-breakdown {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

body.theme-dark .kanji-breakdown {
    background: #2B2D30;
}

.kanji-item {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 14px;
}

.kanji-item:last-child {
    margin-bottom: 0;
}

.kanji-item strong {
    min-width: 60px;
    color: #667eea;
    font-weight: 600;
}

body.theme-dark .kanji-item strong {
    color: #7c9dff;
}

.kanji-item span {
    color: #666;
    flex: 1;
}

body.theme-dark .kanji-item span {
    color: #ccc;
}

.technique-description {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

body.theme-dark .technique-description {
    color: #ddd;
}

/* ── Extra info section ───────────────────────────────────────────────── */
.detail-extra {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

body.theme-dark .detail-extra {
    border-top-color: #444;
}

.detail-extra-title {
    /* inherits .detail-section-title styles, no data-i18n so no extra specificity needed */
}

.detail-extra-text {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    margin: 0 0 16px 0;
}

body.theme-dark .detail-extra-text {
    color: #ddd;
}

.detail-extra-images {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.extra-image-figure {
    margin: 0;
}

.extra-image {
    width: 100%;
    border-radius: 8px;
    display: block;
    object-fit: cover;
}

.extra-image-caption {
    font-size: 12px;
    color: #888;
    margin-top: 6px;
    font-style: italic;
    text-align: center;
}

body.theme-dark .extra-image-caption {
    color: #aaa;
}

.detail-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px 0;
}

body.theme-dark .detail-section-title {
    color: #fff;
}

/* Responsive adjustments */
@media (max-width: 800px) {
    .compendium-layout {
        flex-direction: column;
    }

    .compendium-menu {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 600px) {
    /* ...existing code... */
    #detail-technique-image {
        width: 100%;
    }
}

/* Responsive */
@media (max-width: 768px) {

    .app-container {
        flex-direction: column;
        padding-top: 60px;
    }

    /* Compendium sits inside app-container which already has 60px top padding
       for the hamburger — remove the extra top padding so the title sits high */
    .compendium-content {
        padding-top: 0;
    }

    .compendium-container h1 {
        position: absolute;
        top: 10px;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: none;
        padding: 20px;
        order: 2;
    }

    .main-content {
        padding: 20px;
        order: 1;
    }

    .belt-filters {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .belt-btn {
        flex: 1;
        min-width: 80px;
    }

    #technique-image {
        max-height: 250px;
    }

    .words-section {
        padding: 20px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .stats {
        margin-top: 20px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   DARK THEME  (IntelliJ / Chrome style)
   Palette:
     Body bg        : #1E1F22  (flat dark — IJ window bg)
     App container  : #2B2D30  (IJ editor bg)
     Elevated panels: #313438  (IJ tool-window bg)
     Input / inset  : #3C3F41  (IJ input / list bg)
     Border         : #4A4D52
     Accent blue    : #4E9FE5  (IJ active link / selection)
     Accent hover   : #3A7FCC
     Selected item  : #2D5A8E  (IJ list selection)
     Text primary   : #BCBEC4
     Text secondary : #8C8F96
     Text dim       : #6F737A
   ═══════════════════════════════════════════════════════════════════════════ */

/* Dark Theme */
body.theme-dark {
    background: #1E1F22;
}

body.theme-dark .app-container {
    background: #2B2D30;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

/* Hamburger lines */
body.theme-dark .hamburger-btn span {
    background: #BCBEC4;
}

body.theme-dark .compendium-container h1  {
    color: #666;
}

/* Dropdown menu */
body.theme-dark .hamburger-dropdown {
    background: #313438;
    border: 1px solid #4A4D52;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
body.theme-dark .menu-item {
    background: #313438;
    color: #BCBEC4;
}
body.theme-dark .menu-item:hover {
    background: #3C3F41;
}
body.theme-dark .menu-item.active {
    background: #2D3A4A;
    color: #4E9FE5;
}

/* Settings panel */
body.theme-dark .settings-panel {
    background: #2B2D30;
    border: 1px solid #4A4D52;
}
body.theme-dark .settings-header {
    background: #313438;
    border-bottom: 1px solid #4A4D52;
}
body.theme-dark .settings-header h2 {
    color: #BCBEC4;
}
body.theme-dark .settings-close {
    color: #8C8F96;
}
body.theme-dark .settings-close:hover {
    background: #3C3F41;
    color: #BCBEC4;
}
body.theme-dark .settings-section h3 {
    color: #BCBEC4;
}
body.theme-dark .settings-section p {
    color: #8C8F96;
}
body.theme-dark .settings-content h3 {
    color: #666;
}
body.theme-dark .settings-content .category-group-title {
    color: #666;
}
body.theme-dark .words-section {
    background: #3C3F41;
}

/* Belt / category / lang / theme buttons */
body.theme-dark .belt-btn,
body.theme-dark .category-btn,
body.theme-dark .lang-btn,
body.theme-dark .theme-btn {
    color: #BCBEC4;
    border-color: #4A4D52;
    background: #313438;
}
body.theme-dark .belt-btn:hover,
body.theme-dark .category-btn:hover,
body.theme-dark .lang-btn:hover,
body.theme-dark .theme-btn:hover {
    border-color: #4E9FE5;
}
body.theme-dark .category-btn.active,
body.theme-dark .lang-btn.active,
body.theme-dark .theme-btn.active {
    background: #2D5A8E;
    border-color: #4E9FE5;
    color: #FFFFFF;
}

/* Word buttons */
body.theme-dark .word-btn {
    background: #2E436E;
    color: #BCBEC4;
    border: 1px solid #3a5489;
}
body.theme-dark .word-btn:hover {
    background: #3a5489;
    color: #FFFFFF;
}
body.theme-dark .word-btn.selected {
    background: #3C3F41;
    color: #6F737A;
    border-color: #4A4D52;
}

/* Answer placeholders */
body.theme-dark .answer-placeholder {
    border-bottom-color: #4E9FE5;
    color: #BCBEC4;
}
body.theme-dark .answer-placeholder.filled {
    color: #4E9FE5;
}

/* Card / main content area */
body.theme-dark .card-container {
    background: #2B2D30;
}
body.theme-dark .instruction {
    color: #8C8F96;
}

/* Progress bar */
body.theme-dark .progress-bar {
    background: #3C3F41;
}
body.theme-dark .progress-fill {
    background: #4E9FE5;
}

/* Session stats */
body.theme-dark .stats {
    background: #313438;
    border: 1px solid #4A4D52;
    color: #BCBEC4;
}
body.theme-dark .stat-label {
    color: #8C8F96;
}
body.theme-dark .stat-value {
    color: #BCBEC4;
}
body.theme-dark .stats h3, body.theme-dark .stats p{
    color: #666;
}

body.theme-dark .sidebar{
    background: #3C3F41;
}

/* Technique image */
body.theme-dark #technique-image {
    border-radius: 8px;
}

/* ── Compendium ──────────────────────────────────────────────────────────── */
body.theme-dark .compendium-menu {
    background: #313438;
    border-color: #4A4D52;
}
body.theme-dark .compendium-menu-toggle {
    background: #2D5A8E;
    color: #FFFFFF;
}
body.theme-dark .compendium-menu-toggle:hover {
    background: #3A7FCC;
}
body.theme-dark .compendium-menu-item {
    color: #BCBEC4;
}
body.theme-dark .compendium-menu-item:hover {
    background: #3C3F41;
    border-color: #4E9FE5;
}
body.theme-dark .compendium-menu-item.active {
    background: #2D5A8E;
    border-color: #4E9FE5;
    color: #FFFFFF;
}
body.theme-dark .compendium-submenu {
    border-left-color: #4A4D52;
}
body.theme-dark .compendium-submenu-item {
    color: #8C8F96;
}
body.theme-dark .compendium-submenu-item:hover {
    background: #3C3F41;
    border-color: #4E9FE5;
    color: #BCBEC4;
}
body.theme-dark .compendium-submenu-item.active {
    background: #2D5A8E;
    border-color: #4E9FE5;
    color: #FFFFFF;
}

/* Technique cards */
body.theme-dark .technique-card {
    background: #313438;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
body.theme-dark .technique-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}
body.theme-dark .technique-card-image {
    background: #3C3F41;
}
body.theme-dark .technique-card-name {
    background: #313438;
    color: #BCBEC4;
}

/* Technique detail modal */
body.theme-dark .technique-detail-modal {
    background: #2B2D30;
    color: #BCBEC4;
    border: 1px solid #4A4D52;
}
body.theme-dark .technique-detail-modal .close-btn {
    background: #3C3F41;
    color: #BCBEC4;
}
body.theme-dark .technique-detail-modal .close-btn:hover {
    background: #4A4D52;
    color: #FFFFFF;
}
body.theme-dark #detail-technique-name {
    color: #BCBEC4;
}
body.theme-dark .kanji-breakdown {
    background: #313438;
    border: 1px solid #4A4D52;
}
body.theme-dark .kanji-item strong {
    color: #4E9FE5;
}
body.theme-dark .kanji-item span {
    color: #8C8F96;
}
body.theme-dark .technique-description {
    color: #BCBEC4;
}
body.theme-dark .detail-extra {
    border-top-color: #4A4D52;
}
body.theme-dark .detail-extra-text {
    color: #BCBEC4;
}
body.theme-dark .detail-section-title {
    color: #BCBEC4;
}
body.theme-dark .extra-image-caption {
    color: #6F737A;
}

/* ═══════════════════════════════════════════════════════════════════════════
   JAPANESE THEME
   Palette:
     Body bg      : deep ink-black → dark crimson  #1A0A0A → #2D0A0A
     App container: washi paper #F5ECD7
     Accent/primary: torii vermillion #C0392B
     Word buttons : vermillion #C0392B  (hover: #A93226)
     Text on light : ink #1A0A0A
     Text on dark  : washi #F5ECD7
   ═══════════════════════════════════════════════════════════════════════════ */

body.theme-japanese {
    background: linear-gradient(135deg, #1A0A0A 0%, #2D0A0A 100%);
}

/* App container — washi paper surface */
body.theme-japanese .app-container {
    background: #F5ECD7;
}

/* Hamburger lines */
body.theme-japanese .hamburger-btn span {
    background: #1A0A0A;
}

/* Dropdown menu */
body.theme-japanese .hamburger-dropdown {
    background: #F5ECD7;
}
body.theme-japanese .menu-item {
    background: #F5ECD7;
    color: #1A0A0A;
}
body.theme-japanese .menu-item:hover {
    background: #EDD9B0;
}
body.theme-japanese .menu-item.active {
    background: #fde8e6;
    color: #C0392B;
}

/* Settings overlay panel */
body.theme-japanese .settings-panel {
    background: #F5ECD7;
}
body.theme-japanese .settings-header {
    background: #C0392B;
    color: #F5ECD7;
}
body.theme-japanese .settings-header h2 {
    color: #F5ECD7;
}
body.theme-japanese .settings-close {
    color: #F5ECD7;
}
body.theme-japanese .settings-close:hover {
    background: rgba(255,255,255,0.2);
}

/* Belt / category / lang / theme buttons */
body.theme-japanese .belt-btn,
body.theme-japanese .category-btn,
body.theme-japanese .lang-btn,
body.theme-japanese .theme-btn {
    color: #1A0A0A;
}
body.theme-japanese .category-btn.active,
body.theme-japanese .lang-btn.active,
body.theme-japanese .theme-btn.active {
    background: #C0392B;
    border-color: #C0392B;
    color: #F5ECD7;
}

/* Word buttons */
body.theme-japanese .word-btn {
    background: #C0392B;
    color: #F5ECD7;
}
body.theme-japanese .word-btn:hover {
    background: #A93226;
}
body.theme-japanese .word-btn.selected {
    background: #8B7355;
    color: #F5ECD7;
}

/* Show answer button stays the same as default (no override needed) */

/* Card container / main content */
body.theme-japanese .card-container {
    background: #F5ECD7;
}

/* Answer placeholders */
body.theme-japanese .answer-placeholder {
    border-bottom-color: #C0392B;
    color: #1A0A0A;
}
body.theme-japanese .answer-placeholder.filled {
    color: #C0392B;
}

/* Correct / incorrect feedback */
body.theme-japanese .correct-feedback {
    color: #27AE60;
}

/* Progress bar */
body.theme-japanese .progress-fill {
    background: #C0392B;
}

/* Session stats */
body.theme-japanese .stats {
    background: #EDD9B0;
    border-color: #C0392B;
}

/* Instruction text */
body.theme-japanese .instruction {
    color: #2D0A0A;
}

/* Technique image border */
body.theme-japanese #technique-image {
    border: 2px solid #C0392B;
    border-radius: 8px;
}

/* ── Compendium ──────────────────────────────────────────────────────────── */
body.theme-japanese .compendium-menu {
    background: #EDD9B0;
    border-color: #C0392B;
}

body.theme-japanese .compendium-menu-toggle {
    background: #C0392B;
    color: #F5ECD7;
}
body.theme-japanese .compendium-menu-toggle:hover {
    background: #A93226;
}

body.theme-japanese .compendium-menu-item {
    color: #1A0A0A;
}
body.theme-japanese .compendium-menu-item:hover {
    border-color: #C0392B;
    background: #f9e8e5;
}
body.theme-japanese .compendium-menu-item.active {
    background: #C0392B;
    color: #F5ECD7;
    border-color: #C0392B;
}

body.theme-japanese .compendium-submenu {
    border-left-color: #C0392B;
}
body.theme-japanese .compendium-submenu-item {
    color: #4A1A1A;
}
body.theme-japanese .compendium-submenu-item:hover {
    border-color: #C0392B;
    background: #fde8e6;
}
body.theme-japanese .compendium-submenu-item.active {
    background: #C0392B;
    color: #F5ECD7;
    border-color: #C0392B;
}

/* Technique cards */
body.theme-japanese .technique-card {
    background: #F5ECD7;
    box-shadow: 0 2px 8px rgba(192, 57, 43, 0.15);
}
body.theme-japanese .technique-card-image {
    background: #EDD9B0;
}
body.theme-japanese .technique-card-name {
    background: #F5ECD7;
    color: #1A0A0A;
}

/* Technique detail modal */
body.theme-japanese .technique-detail-modal {
    background: #F5ECD7;
    color: #1A0A0A;
}
body.theme-japanese .technique-detail-modal .close-btn {
    background: rgba(192, 57, 43, 0.15);
    color: #1A0A0A;
}
body.theme-japanese .technique-detail-modal .close-btn:hover {
    background: rgba(192, 57, 43, 0.3);
}
body.theme-japanese #detail-technique-name {
    color: #2D0A0A;
}
body.theme-japanese .kanji-breakdown {
    background: #EDD9B0;
    border-left: 3px solid #C0392B;
}
body.theme-japanese .kanji-item strong {
    color: #C0392B;
}
body.theme-japanese .kanji-item span {
    color: #4A2A1A;
}
body.theme-japanese .technique-description {
    color: #2D0A0A;
}
body.theme-japanese .detail-extra {
    border-top-color: #C0392B;
}
body.theme-japanese .detail-extra-text {
    color: #2D0A0A;
}
body.theme-japanese .detail-section-title {
    color: #2D0A0A;
}
body.theme-japanese .extra-image-caption {
    color: #8B5E3C;
}

