/* Nihon Tokuei - Custom Design Based on User Requirements */

/* Import custom fonts */
@import url('./fonts.css');

/* ===== RESET & BASE ===== */
.nt-app {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: #333333;
    background: #f8f9fa;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.nt-app * {
    box-sizing: border-box;
}

/* ===== FULL WIDTH OVERRIDE ===== */
.nt-app {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    overflow: hidden;
}

/* ===== HEADER ===== */
.nt-header {
    background: #ffffff;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1000;
}

.nt-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.nt-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-primary);
    margin: 0;
}

.nt-header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nt-header-level-filter {
    min-width: 200px;
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #374151;
}

.nt-header-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
    max-width: 240px;
}

/* ===== HAMBURGER MENU ===== */
.nt-hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.nt-hamburger-btn:hover {
    background-color: #f3f4f6;
}

.nt-hamburger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #374151;
    margin: 2px 0;
    transition: all 0.3s ease;
    border-radius: 1px;
}

.nt-hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nt-hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.nt-hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.nt-header-icon {
    font-size: 32px;
    filter: drop-shadow(0 2px 4px rgba(139, 92, 246, 0.3));
}

.nt-header-logo {
    width: auto;
    height: 60px;
    max-width: 240px;
    border-radius: 8px;
    object-fit: contain;
    border: none;
}

/* Header Navigation (Integrated Sidebar) */
.nt-header-nav {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 15px 30px;
}

.nt-header-nav-row {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.nt-header-nav-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nt-header-nav-label {
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.nt-header-lessons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.nt-header-lesson-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    text-decoration: none;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nt-header-lesson-link:hover,
.nt-header-lesson-link.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    text-decoration: none;
}

.nt-header-level-filter {
    min-width: 200px;
}

/* ===== MAIN LAYOUT ===== */
.nt-main-layout {
    display: flex;
    height: calc(100vh - 80px);
    overflow: hidden;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

.nt-content-area {
    width: 100%;
    background: #ffffff;
    margin: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow-y: auto;
    position: relative;
}

.nt-content-area::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
    background: linear-gradient(to bottom, #f97316 0%, #ea580c 50%, #f97316 100%);
    border-radius: 0 0 0 12px;
    z-index: 1;
}

.nt-content-inner {
    padding: 30px;
    margin-left: 4px;
}

/* ===== SIDEBAR ===== */
.nt-sidebar {
    width: 350px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 80px;
    right: -350px;
    height: calc(100vh - 80px);
    z-index: 2000;
    overflow: hidden;
    transition: right 0.3s ease;
}

.nt-sidebar.open {
    right: 20px;
}

/* Overlay backdrop */
.nt-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.nt-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Desktop: sidebar always visible */
@media (min-width: 1024px) {
    .nt-sidebar {
        position: relative;
        right: 0;
        top: 0;
        height: auto;
        margin: 20px 20px 20px 0;
        transition: none;
        order: 2;
    }

    .nt-sidebar.open {
        right: 0;
    }

    .nt-main-layout {
        display: flex;
        flex-direction: row;
    }

    .nt-content-area {
        width: auto;
        flex: 1;
        margin: 20px 0 20px 20px;
        order: 1;
    }

    .nt-sidebar-overlay {
        display: none;
    }

    .nt-hamburger-btn {
        display: none;
    }
}

.nt-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, #f97316, #ea580c, #1e40af);
    border-radius: 0 12px 12px 0;
}

.nt-sidebar-header {
    padding: 25px 25px 20px 25px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    position: relative;
}

.nt-sidebar-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, #10b981, #059669, #047857);
}

.nt-sidebar-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 15px;
}

.nt-sidebar-filter {
    margin-top: 15px;
}

.nt-sidebar-filter select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #374151;
    outline: none;
}

/* ===== LEVEL DROPDOWN ===== */
.nt-level-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nt-level-select:hover {
    border-color: #eab308;
}

.nt-level-select:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

/* ===== LESSONS LIST ===== */
.nt-lessons-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px 25px 25px;
}

.nt-lessons-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nt-lesson-item {
    margin-bottom: 8px;
}

.nt-lesson-link {
    display: block;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    color: #475569;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.nt-lesson-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(to bottom, #10b981, #059669);
    transition: width 0.2s ease;
}

.nt-lesson-link:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
    transform: translateX(4px);
}

.nt-lesson-link:hover .nt-lesson-title {
    color: #0f172a; /* Darker on hover */
}

.nt-lesson-link:hover .nt-lesson-topic {
    color: #047857; /* Darker green on hover */
}

.nt-lesson-link:hover::before {
    width: 4px;
}

.nt-lesson-link.active {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #10b981;
    color: #047857;
    font-weight: 500;
}

.nt-lesson-link.active .nt-lesson-title {
    color: #065f46; /* Darker green for active title */
    font-weight: 600;
}

.nt-lesson-link.active .nt-lesson-topic {
    color: #047857; /* Consistent green for active topic */
    font-weight: 600;
}

.nt-lesson-link.active::before {
    width: 4px;
}

.nt-lesson-title {
    font-weight: 500;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    color: #1e293b; /* Dark slate for better contrast */
}

.nt-lesson-topic {
    font-size: 12px;
    color: #059669; /* Green color for lesson count */
    position: relative;
    z-index: 1;
    font-weight: 500;
}

/* ===== SECTION STYLES ===== */
.nt-section-group {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nt-section-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.nt-section-title {
    color: #1e293b;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid #3b82f6;
    display: inline-block;
}

.nt-section-description {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.nt-topic-group {
    margin-bottom: 32px;
}

.nt-topic-title {
    color: #0f172a;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.nt-topic-description {
    color: #475569;
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.nt-lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.nt-lesson-card {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    transition: background-color 0.2s ease;
}

.nt-lesson-card:hover {
    background: #f1f5f9;
}

.nt-lesson-card .nt-lesson-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #334155;
}

.nt-no-lessons, .nt-no-sections {
    color: #64748b;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* ===== CONTENT STYLES ===== */
.nt-content-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f1f5f9;
    position: relative;
}

.nt-content-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(to right, #8b5cf6, #a855f7);
}

.nt-content-title-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 24px;
    gap: 8px;
}

.nt-content-title {
    font-size: 48px;
    font-weight: 900;
    margin: 0;
    background: linear-gradient(135deg, #1e40af 0%, #7c3aed 50%, #4338ca 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
    letter-spacing: 0.5px;
    position: relative;
}

.nt-content-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #dc2626, #fbbf24, #dc2626);
    border-radius: 2px;
}

.nt-content-subtitle {
    font-size: 18px;
    color: #6b7280;
    font-weight: 500;
    margin: 16px 0 0 0;
    padding-left: 4px;
    border-left: 4px solid #1e40af;
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.05) 0%, transparent 100%);
    padding: 8px 0 8px 16px;
    border-radius: 0 6px 6px 0;
}

/* ===== PROBLEM TITLES ===== */
/* Target h3 elements containing problem titles (問題1:, 問題2:, etc.) */
h3[style*="color: #047857"] {
    font-family: var(--font-japanese) !important;
}

.nt-paragraph {
    margin-bottom: 32px;
}

.nt-paragraph:last-child {
    margin-bottom: 0;
}

/* ===== TEXT CONTENT TYPES ===== */
.nt-japanese-text .nt-text-content {
    background: linear-gradient(135deg, #f5f5f5 0%, #fbfbfb 100%);
    border-left: 4px solid #a855f7;
    padding: 26px 20px 20px 20px;
    border-radius: 8px;
    font-family: var(--font-japanese);
    line-height: 2.2;
    color: #1e293b;
    text-indent: 0;
    text-align: justify;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Font size will be controlled by unified system below */
}

.nt-hints .nt-text-content {
    background: linear-gradient(135deg, #f5f5f5 0%, #fbfbfb 100%);
    border-left: 4px solid #f59e0b;
    padding: 16px;
    border-radius: 6px;
    color: #92400e;
    font-style: italic;
    font-size: 15px;
    line-height: 1.6;
    text-align: justify;
    margin-bottom: 16px;
}

.nt-vietnamese {
    background: #f0fdf4;
    border-left: 4px solid #22c55e;
    padding: 16px;
    border-radius: 6px;
    color: #15803d;
    line-height: 1.7;
    text-indent: 0;
    text-align: justify;
    margin-bottom: 16px;
    /* Font size will be controlled by unified system below */
}

/* ===== CONTROL PANEL ===== */
.nt-control-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.nt-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nt-control-label {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
    margin-right: 4px;
}

.nt-control-btn {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nt-control-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.nt-control-btn.active,
.nt-control-btn[data-active="true"] {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: #10b981;
    color: white;
}

.nt-control-icon {
    font-size: 12px;
}

.nt-control-text {
    font-size: 12px;
}

/* ===== UNIFIED FONT SIZE SYSTEM ===== */
/* This system provides clean, conflict-free font sizing with 3 main sizes */

/* Default font size when no font class is applied */
#nt-lesson-content .nt-japanese-text .nt-text-content,
#nt-lesson-content .nt-japanese-question,
#nt-lesson-content .nt-japanese-answer,
#nt-lesson-content .nt-vietnamese {
    font-size: 22px; /* Default medium size */
    text-indent: 1em; /* Add text indentation for all content */
}

/* Base font sizes applied to #nt-lesson-content with classes */
#nt-lesson-content.font-small,
#nt-lesson-content.font-small .nt-japanese-text .nt-text-content,
#nt-lesson-content.font-small .nt-japanese-question,
#nt-lesson-content.font-small .nt-japanese-answer,
#nt-lesson-content.font-small .nt-vietnamese {
    font-size: 18px !important;
    text-indent: 1em !important;
}

#nt-lesson-content.font-medium,
#nt-lesson-content.font-medium .nt-japanese-text .nt-text-content,
#nt-lesson-content.font-medium .nt-japanese-question,
#nt-lesson-content.font-medium .nt-japanese-answer,
#nt-lesson-content.font-medium .nt-vietnamese {
    font-size: 22px !important;
    text-indent: 1em !important;
}

#nt-lesson-content.font-large,
#nt-lesson-content.font-large .nt-japanese-text .nt-text-content,
#nt-lesson-content.font-large .nt-japanese-question,
#nt-lesson-content.font-large .nt-japanese-answer,
#nt-lesson-content.font-large .nt-vietnamese {
    font-size: 24px !important;
    text-indent: 1em !important;
}

/* ===== RUBY TEXT SYSTEM ===== */
/* Ruby base element (kanji) inherits main text size */
#nt-lesson-content ruby {
    line-height: 2.2;
    font-size: inherit; /* Inherits from parent font size */
    color: inherit !important; /* Force inherit parent color, override external CSS */
}

/* Default ruby text size when no font class is applied */
#nt-lesson-content ruby rt {
    font-size: 11px; /* 50% of default 22px */
    color: #ea580c;
    font-weight: 400;
}

/* Ruby text (rt) is always 50% of main text size */
#nt-lesson-content.font-small ruby rt {
    font-size: 9px !important; /* 50% of 18px */
    color: #ea580c;
    font-weight: 400;
}

#nt-lesson-content.font-medium ruby rt {
    font-size: 11px !important; /* 50% of 22px */
    color: #ea580c;
    font-weight: 400;
}

#nt-lesson-content.font-large ruby rt {
    font-size: 12px !important; /* 50% of 24px */
    color: #ea580c;
    font-weight: 400;
}

/* Ruby parentheses (rp) always hidden */
#nt-lesson-content ruby rp {
    display: none !important;
}

/* Ruby toggle functionality - hides ruby when .hide-ruby class is applied */
#nt-lesson-content.hide-ruby ruby rt,
#nt-lesson-content.hide-ruby ruby rp {
    display: none !important;
}




.nt-image-container {
    text-align: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #fbfbfb 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.nt-content-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}


.nt-image-caption {
    text-align: center;
    font-size: 14px;
    color: #64748b;
    font-style: italic;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 8px 16px;
    border-radius: 6px;
    border-left: 3px solid #94a3b8;
}

/* ===== QUESTION STYLES ===== */
.nt-question-content {
    margin-bottom: 24px;
}

.nt-answers {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease;
}

.nt-answers:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}


.nt-japanese-question {
    background: linear-gradient(135deg, #f5f5f5 0%, #fbfbfb 100%);
    padding: 26px 20px 20px 20px;
    border-radius: 8px;
    font-family: var(--font-japanese);
    margin-bottom: 16px;
    border-left: 4px solid #1e40af;
    color: #1e293b;
    line-height: 2.2;
    font-weight: 500;
    position: relative;
    text-indent: 0;
    text-align: justify;
    /* Font size will be controlled by unified system below */
}


.nt-vietnamese-question,
.nt-vietnamese-answer-external {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left: 4px solid #f59e0b;
    padding: 8px 12px;
    margin: 8px 24px;
    border-radius: 4px;
    color: #92400e;
    font-size: 1.1rem;
    font-style: italic;
    line-height: 1.4;
    text-align: justify;
}

.nt-answers .nt-answer-list {
    padding: 24px;
}

/* 2x2 Grid layout for short answers */
.nt-answer-list.nt-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 16px;
    align-items: stretch;
}

.nt-answer-list.nt-grid-2x2 .nt-answer-option {
    margin-bottom: 0; /* Remove default margin in grid */
    height: auto;
    min-height: 60px; /* Ensure consistent height */
    display: flex;
    align-items: center;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    text-indent: 0 !important;
}

.nt-answer-list.nt-grid-2x2 .nt-answer-content {
    width: 100%;
    overflow: hidden;
}

.nt-answer-list.nt-grid-2x2 .nt-japanese-answer {
    word-break: break-all;
    overflow-wrap: anywhere;
    hyphens: auto;
}

.nt-answer-option {
    margin-bottom: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    transition: all 0.3s ease;
    overflow: visible;
    cursor: pointer;
    background: #fafafa;
    position: relative;
    padding: 18px 16px 16px 16px;
    line-height: normal !important;
    text-indent: 0 !important;
}

.nt-answer-option:hover {
    border-color: #f59e0b;
    background: #fffbeb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.nt-answer-option.selected {
    background-color: #e0f2fe;
    border-color: #0369a1;
}

.nt-answer-option.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.nt-answer-letter {
    background: #f59e0b;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: bold;
    font-size: 0.9rem;
    position: absolute;
    top: -14px;
    left: -14px;
    z-index: 10;
    margin: 0;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.nt-answer-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0; /* Allow content to shrink */
    text-indent: 0 !important;
}

.nt-japanese-answer {
    font-weight: 500;
    color: #1e293b;
    font-family: var(--font-japanese);
    line-height: 2.2;
    text-align: justify;
    /* Font size will be controlled by unified system below */
}

.nt-vietnamese-answer {
    color: #64748b;
    font-size: 1.1rem;
    font-style: italic;
    line-height: 1.4;
}


.nt-answer-option.nt-correct-answer {
    background: #ecfdf5;
    border-color: #22c55e;
    animation: nt-highlight 0.5s ease;
}

.nt-answer-option.nt-correct-answer .nt-answer-letter {
    background: #22c55e;
}

.nt-answer-option.nt-wrong-answer {
    background: #fef2f2;
    border-color: #ef4444;
}

.nt-answer-option.nt-wrong-answer .nt-answer-letter {
    background: #ef4444;
}

.nt-answer-option.nt-selected {
    border-color: #f59e0b;
    background: #fffbeb;
}

.nt-answer-option.nt-selected .nt-answer-letter {
    background: #d97706;
}

.nt-question-actions {
    text-align: center;
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}


.nt-question-result {
    padding: 16px 20px;
    border-radius: 6px;
    margin: 16px 20px;
    font-weight: 500;
    display: none;
}

.nt-question-result.nt-correct {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.nt-question-result.nt-incorrect {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.nt-question-result.nt-correct:before {
    content: '✅ ';
    margin-right: 8px;
}

.nt-question-result.nt-incorrect:before {
    content: '❌ ';
    margin-right: 8px;
}

/* ===== EMPTY STATES ===== */
.nt-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.nt-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.nt-empty-title {
    font-size: 20px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.nt-empty-description {
    color: #64748b;
    max-width: 400px;
    margin: 0 auto;
}

/* ===== SCROLLBAR STYLING ===== */
.nt-content-area::-webkit-scrollbar,
.nt-lessons-container::-webkit-scrollbar {
    width: 6px;
}

.nt-content-area::-webkit-scrollbar-track,
.nt-lessons-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.nt-content-area::-webkit-scrollbar-thumb,
.nt-lessons-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.nt-content-area::-webkit-scrollbar-thumb:hover,
.nt-lessons-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .nt-header-nav {
        padding: 15px 20px;
    }

    .nt-header-nav-row {
        gap: 20px;
    }

    .nt-header-top {
        padding: 15px 20px;
    }

    .nt-header-title {
        font-size: 20px;
    }
}

@media (max-width: 1023px) {
    .nt-main-layout {
        height: calc(100vh - 80px);
        padding: 0 10px;
    }

    .nt-sidebar {
        width: calc(100vw - 40px);
        right: calc(-100vw + 20px);
        top: 80px;
        height: calc(100vh - 80px);
        border-radius: 0;
    }

    .nt-sidebar.open {
        right: 20px;
    }

    .nt-content-area {
        margin: 10px;
        border-radius: 8px;
    }

    .nt-content-inner {
        padding: 15px;
    }

    .nt-header {
        padding: 0 15px;
    }

    .nt-hamburger-btn {
        width: 35px;
        height: 35px;
    }

    .nt-hamburger-btn span {
        width: 18px;
    }
}

    /* Mobile-specific content styling - moved to proper 768px media query */

    .nt-answer-option:hover,
    .nt-answer-option:focus-within {
        border-color: #3b82f6;
        background: #eff6ff;
    }

    .nt-answer-letter {
        width: 35px;
        height: 35px;
        font-size: 16px;
        font-weight: 600;
        position: absolute;
        top: -17.5px;
        left: -17.5px;
        z-index: 10;
    }


    /* Level and lesson styling */
    .nt-level-title {
        font-size: 16px;
        padding: 12px 15px;
    }

    .nt-lesson-item {
        margin-bottom: 8px;
    }

    .nt-lesson-link {
        padding: 12px 15px;
        border-radius: 6px;
    }

    .nt-lesson-title {
        font-size: 14px;
    }

    .nt-lesson-topic {
        font-size: 12px;
    }

    /* Improve mobile tap targets and spacing */
    .nt-scroll-top {
        bottom: 80px;
        right: 15px;
        width: 55px;
        height: 55px;
        font-size: 24px;
    }

    /* Mobile-friendly notifications */
    .nt-notification {
        bottom: 20px;
        left: 15px;
        right: 15px;
        width: auto;
        max-width: none;
        padding: 15px 20px;
        border-radius: 8px;
    }

    /* Better mobile form controls */
    #nt-level-filter {
        width: 100%;
        padding: 12px 15px;
        border: 2px solid #e2e8f0;
        border-radius: 8px;
        background: white;
    }

    /* Mobile paragraph styling */
    .nt-paragraph {
        margin-bottom: 20px;
    }

    .nt-question-content {
        margin-bottom: 20px;
    }

    /* Mobile image improvements */
    .nt-image-container {
        margin: 15px 0;
        text-align: center;
    }

    .nt-content-image {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }

    .nt-content-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* Content title and subtitle font-size moved to proper mobile media query */

    /* All font-sizes moved to proper 768px mobile media query */

    .nt-header {
        height: 70px;
        padding: 0 15px;
    }

    .nt-header-logo {
        height: 50px;
        max-width: 200px;
    }

    .nt-main-layout {
        height: calc(100vh - 70px);
    }
}

/* ===== LOADING STATES ===== */
.nt-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #64748b;
}

.nt-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: nt-spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes nt-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== HIGHLIGHT & EMPHASIS ===== */
.nt-text-content strong,
.nt-text-content b {
    color: #1e293b;
    font-weight: 600;
}

.nt-text-content em,
.nt-text-content i {
    color: #475569;
    font-style: italic;
}

.nt-text-content mark {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Color-specific highlight styles */
.nt-text-content mark.nt-highlight-yellow {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.nt-text-content mark.nt-highlight-green {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.nt-text-content mark.nt-highlight-blue {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

.nt-text-content mark.nt-highlight-red {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.nt-text-content mark.nt-highlight-purple {
    background: linear-gradient(135deg, #e9d5ff 0%, #ddd6fe 100%);
    color: #7c2d12;
}

.nt-text-content mark.nt-highlight-orange {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    color: #c2410c;
}

.nt-text-content u {
    text-decoration: underline;
    text-decoration-color: #8b5cf6;
}

/* Normal text content styling */
.nt-text-content,
.nt-japanese-question,
.nt-japanese-answer,
.nt-vietnamese-answer {
    white-space: normal;
}

.nt-text-content p {
    margin: 0.5em 0;
    line-height: inherit;
}

/* ===== BREADCRUMB ===== */
.nt-breadcrumb {
    margin-bottom: 20px;
    padding: 10px 0;
    font-size: 14px;
    color: #64748b;
}

.nt-breadcrumb a {
    color: #8b5cf6;
    text-decoration: none;
}

.nt-breadcrumb a:hover {
    text-decoration: underline;
}

.nt-separator {
    margin: 0 8px;
    color: #cbd5e1;
}

/* ===== IMAGE CONTENT STYLES ===== */
.nt-image-content {
    margin: 24px 0;
    max-width: 100%;
    overflow: hidden;
}

.nt-image-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.6);
}


.nt-content-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.3s ease;
}


.nt-image-caption {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 12px 16px;
    font-size: 14px;
    color: #64748b;
    text-align: center;
    font-style: italic;
    border-top: 1px solid rgba(226, 232, 240, 0.6);
}

/* Image Alignment Styles */
.nt-align-left {
    text-align: left;
}

.nt-align-left .nt-image-container {
    max-width: 70%;
    margin-left: 0;
    margin-right: auto;
}

.nt-align-center {
    text-align: center;
}

.nt-align-center .nt-image-container {
    max-width: 90%;
    margin: 0 auto;
}

.nt-align-right {
    text-align: right;
}

.nt-align-right .nt-image-container {
    max-width: 70%;
    margin-left: auto;
    margin-right: 0;
}

/* Tablet responsive layout */
@media (max-width: 1024px) and (min-width: 769px) {
    .nt-answer-letter {
        width: 26px;
        height: 26px;
        font-size: 13px;
        position: absolute;
        top: -13px;
        left: -13px;
        z-index: 10;
    }
}

/* Image Lazy Loading Styles */
.nt-lazy {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    background-color: #f8f9fa;
    background-image: linear-gradient(90deg, #f8f9fa 0px, #e9ecef 40px, #f8f9fa 80px);
    background-size: 300px;
    animation: loading-placeholder 1.5s ease-in-out infinite;
}

.nt-loaded {
    opacity: 1;
    animation: none;
    background: none;
}

@keyframes loading-placeholder {
    0% {
        background-position: -300px 0;
    }
    100% {
        background-position: 300px 0;
    }
}

/* Prevent layout shift during image loading */
.nt-image-container {
    position: relative;
    overflow: hidden;
}

.nt-image-container .nt-lazy::before {
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #e9ecef;
    border-top-color: #007cba;
    border-radius: 50%;
    animation: nt-spin 1s linear infinite;
}

@keyframes nt-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Image Styles */
@media (max-width: 768px) {
    /* Header and navigation */
    .nt-header-title {
        font-size: 20px;
    }

    /* Content titles */
    .nt-content-title {
        font-size: 28px;
    }

    .nt-content-subtitle {
        font-size: 14px;
    }

    /* Lesson titles */
    .nt-lesson-section h3 {
        font-size: 20px !important;
    }

    .nt-lesson-title {
        font-size: 14px;
    }

    .nt-lesson-topic {
        font-size: 12px;
    }

    /* Mobile responsive font sizes - respecting existing font size system */

    /* Default mobile sizes (no class) */
    #nt-lesson-content .nt-japanese-text .nt-text-content,
    #nt-lesson-content .nt-japanese-question,
    #nt-lesson-content .nt-japanese-answer,
    #nt-lesson-content .nt-vietnamese {
        font-size: 18px !important; /* Smaller than desktop 22px */
    }

    /* Small font mode on mobile */
    #nt-lesson-content.font-small .nt-japanese-text .nt-text-content,
    #nt-lesson-content.font-small .nt-japanese-question,
    #nt-lesson-content.font-small .nt-japanese-answer,
    #nt-lesson-content.font-small .nt-vietnamese {
        font-size: 16px !important; /* Smaller than desktop 18px */
    }

    /* Medium font mode on mobile */
    #nt-lesson-content.font-medium .nt-japanese-text .nt-text-content,
    #nt-lesson-content.font-medium .nt-japanese-question,
    #nt-lesson-content.font-medium .nt-japanese-answer,
    #nt-lesson-content.font-medium .nt-vietnamese {
        font-size: 18px !important; /* Smaller than desktop 22px */
    }

    /* Large font mode on mobile */
    #nt-lesson-content.font-large .nt-japanese-text .nt-text-content,
    #nt-lesson-content.font-large .nt-japanese-question,
    #nt-lesson-content.font-large .nt-japanese-answer,
    #nt-lesson-content.font-large .nt-vietnamese {
        font-size: 20px !important; /* Smaller than desktop 24px */
    }

    /* Vietnamese specific adjustments */
    #nt-lesson-content .nt-vietnamese-question {
        font-size: 14px !important;
        line-height: 1.4;
    }

    #nt-lesson-content.font-small .nt-vietnamese-question {
        font-size: 13px !important;
    }

    #nt-lesson-content.font-large .nt-vietnamese-question {
        font-size: 16px !important;
    }

    #nt-lesson-content .nt-vietnamese-answer {
        font-size: 13px !important;
        color: #6b7280;
        font-style: italic;
    }

    #nt-lesson-content.font-small .nt-vietnamese-answer {
        font-size: 12px !important;
    }

    #nt-lesson-content.font-large .nt-vietnamese-answer {
        font-size: 15px !important;
    }

    /* Ruby text responsive sizes for mobile */
    #nt-lesson-content ruby rt {
        font-size: 9px !important; /* 50% of default mobile 18px */
    }

    #nt-lesson-content.font-small ruby rt {
        font-size: 8px !important; /* 50% of mobile small 16px */
    }

    #nt-lesson-content.font-medium ruby rt {
        font-size: 9px !important; /* 50% of mobile medium 18px */
    }

    #nt-lesson-content.font-large ruby rt {
        font-size: 10px !important; /* 50% of mobile large 20px */
    }

    /* Answer options layout */
    .nt-answer-option {
        margin-bottom: 12px;
        padding: 12px;
        border-radius: 8px;
    }

    /* 2x2 Grid responsive adjustments */
    .nt-answer-list.nt-grid-2x2 {
        gap: 12px; /* Smaller gap on mobile */
    }

    .nt-answer-list.nt-grid-2x2 .nt-answer-option {
        min-height: 50px; /* Smaller height on mobile */
        padding: 10px;
    }

    /* Safety: Force fallback to 1x4 on mobile if content is too wide */
    @media (max-width: 768px) {
        .nt-answer-list.nt-grid-2x2 .nt-answer-option .nt-japanese-answer {
            font-size: 16px !important; /* Ensure we're using mobile font size */
        }

        /* If any answer is longer than mobile threshold, force vertical layout */
        .nt-answer-list.nt-grid-2x2:has(.nt-japanese-answer[data-length-warning]) {
            display: block !important;
        }

        .nt-answer-list.nt-grid-2x2:has(.nt-japanese-answer[data-length-warning]) .nt-answer-option {
            margin-bottom: 12px;
        }
    }

    .nt-answer-letter {
        width: 24px;
        height: 24px;
        font-size: 12px;
        position: absolute;
        top: -12px;
        left: -12px;
        z-index: 10;
    }

    .nt-answer-content {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Images */
    .nt-image-content {
        margin: 20px 0;
    }

    .nt-align-left .nt-image-container,
    .nt-align-right .nt-image-container {
        max-width: 100%;
        margin: 0 auto;
    }

    .nt-align-left,
    .nt-align-right {
        text-align: center;
    }

    .nt-image-caption {
        padding: 10px 12px;
        font-size: 13px;
    }

    /* Alignment adjustments */
    .nt-align-justify {
        text-align: left; /* Fallback to left alignment on mobile for readability */
    }

    /* Exam results and Modal */
    .nt-score-summary {
        flex-direction: column;
        gap: 20px;
    }

    .nt-score-circle {
        width: 120px;
        height: 120px;
        font-size: 24px;
    }

    .nt-score-details {
        text-align: center;
    }

    .nt-exam-results h3 {
        font-size: 24px;
    }

    .nt-score-number {
        font-size: 30px;
    }

    .nt-score-status {
        font-size: 12px;
    }

    /* Modal specific */
    .nt-results-content {
        width: 95%;
        margin: 20px;
        max-height: calc(100vh - 40px);
    }

    .nt-results-header {
        padding: 20px 25px 10px;
    }

    .nt-results-header h2 {
        font-size: 24px;
        padding-right: 40px;
    }

    .nt-results-body {
        padding: 15px 25px;
    }

    .nt-results-actions {
        padding: 0 25px 25px;
        flex-direction: column;
    }

    .nt-action-btn {
        padding: 12px 15px;
        font-size: 14px;
    }
}

/* Simple image styles - let browser handle lazy loading natively */
.nt-content-image {
    opacity: 1;
}

/* Image with custom dimensions */
.nt-image-container.has-dimensions {
    display: inline-block;
    vertical-align: top;
}

/* Image Zoom Effect for Large Screens */
@media (min-width: 1024px) {
    .nt-image-container {
        cursor: zoom-in;
    }

    .nt-image-container.zoomed {
        cursor: zoom-out;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(1.5);
        z-index: 9999;
        max-width: 90vw;
        max-height: 90vh;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    }

    .nt-image-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.8);
        z-index: 9998;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .nt-image-overlay.active {
        opacity: 1;
    }
}

/* ===== ALIGNMENT CLASSES ===== */
.nt-align-left {
    display: inline-block;
    width: 100%;
    text-align: left;
    margin: 0 !important;
    padding: 0 !important;
    line-height: inherit;
}

.nt-align-center {
    display: inline-block;
    width: 100%;
    text-align: center;
    margin: 0 !important;
    padding: 0 !important;
    line-height: inherit;
}

.nt-align-right {
    display: inline-block;
    width: 100%;
    text-align: right;
    margin: 0 !important;
    padding: 0 !important;
    line-height: inherit;
}

.nt-align-justify {
    display: inline-block;
    width: 100%;
    text-align: justify;
    text-justify: inter-word;
    margin: 0 !important;
    padding: 0 !important;
    line-height: inherit;
}

/* Responsive alignment adjustments - moved to main mobile media query */

/* No text indentation - disable auto indentation on parent containers */
.nt-japanese-text .nt-text-content:has(.nt-no-indent),
.nt-japanese-question:has(.nt-no-indent),
.nt-japanese-answer:has(.nt-no-indent),
.nt-vietnamese:has(.nt-no-indent) {
    text-indent: 0 !important; /* Override auto indentation for containers with no-indent content */
}

/* Fallback for browsers that don't support :has() */
.nt-text-content.no-indent-parent,
.nt-japanese-question.no-indent-parent,
.nt-japanese-answer.no-indent-parent,
.nt-vietnamese.no-indent-parent {
    text-indent: 0 !important;
}

/* Make the span itself invisible wrapper */
.nt-no-indent {
    display: inline;
    text-indent: inherit; /* Inherit from parent (which should be 0) */
    margin: 0 !important;
    padding: 0 !important;
}

/* ===== CONTROL PANEL FUNCTIONALITY ===== */
/* Font size controls are handled by the unified system above */

/* Control button active state */
.nt-control-btn.active {
    background-color: #007cba !important;
    color: white !important;
    border-color: #005a87 !important;
}

/* Vietnamese text and hints - initially hidden */
.nt-vietnamese,
.nt-hint-text,
.nt-explanation {
    display: none;
}

/* OVERRIDE: Clean, simple answer selection styles - highest specificity */

/* Reset all conflicting states */
.nt-answer-option.nt-selected,
.nt-answer-option.nt-correct-answer,
.nt-answer-option.nt-wrong-answer {
    background: none !important;
    border-color: #e2e8f0 !important;
    animation: none !important;
}

.nt-answer-option.nt-selected .nt-answer-letter,
.nt-answer-option.nt-correct-answer .nt-answer-letter,
.nt-answer-option.nt-wrong-answer .nt-answer-letter {
    background: #f59e0b !important;
    color: white !important;
}

/* Only use .selected class for selection */
.nt-answer-option.selected {
    background-color: #e8f5e8 !important;
    border-color: #10b981 !important;
}

.nt-answer-option.selected .nt-answer-letter {
    background-color: #10b981 !important;
    color: white !important;
}

/* Show when toggled */
.nt-show-vietnamese .nt-vietnamese,
.nt-show-hints .nt-hint-text,
.nt-show-hints .nt-explanation {
    display: block;
}

/* Vietnamese text styling - moved to unified section */

/* Hints styling */
.nt-hint-text,
.nt-explanation {
    color: #555;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
}

.nt-hint-text:before {
    content: "💡 ";
    font-weight: bold;
}

.nt-explanation:before {
    content: "📝 Giải thích: ";
    font-weight: bold;
    color: #007cba;
}

/* ===== EXAM MODE STYLES ===== */

/* Exam submit button */
.nt-exam-submit-container {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
    border-top: 2px solid #007cba;
}

.nt-exam-submit-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.nt-exam-submit-btn:hover {
    background-color: #c82333;
}

.nt-exam-submit-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}


/* Exam results styling */
.nt-exam-results {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.nt-exam-results h3 {
    margin: 0 0 20px 0;
    font-size: 28px;
    font-weight: bold;
}

.nt-score-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.nt-score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: white;
    color: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.nt-score-details {
    text-align: left;
}

.nt-score-details p {
    margin: 10px 0;
    font-size: 18px;
}

/* Answer highlighting in exam results */
.nt-selected-answer {
    background-color: #ffeb3b !important;
    border-color: #ffc107 !important;
}

.nt-correct-answer.nt-selected-answer {
    background-color: #4caf50 !important;
    border-color: #388e3c !important;
    color: white !important;
}

/* Responsive exam results - moved to main mobile media query */

/* Results Modal Styles */
.nt-results-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.nt-results-modal.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.nt-results-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}

.nt-results-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.nt-results-modal.show .nt-results-content {
    transform: translate(-50%, -50%) scale(1);
}

.nt-results-header {
    padding: 25px 30px 15px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.nt-results-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
}

.nt-close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.nt-close-modal:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.nt-results-body {
    padding: 20px 30px;
}

.nt-score-display {
    text-align: center;
    margin-bottom: 30px;
}

.nt-score-circle {
    width: 140px;
    height: 140px;
    border: 6px solid;
    border-radius: 50%;
    margin: 0 auto 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    position: relative;
    transition: all 0.3s ease;
}

.nt-score-number {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
}

.nt-score-status {
    font-size: 14px;
    font-weight: 600;
    margin-top: 5px;
    opacity: 0.8;
}

.nt-score-details {
    background: #f9fafb;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
}

.nt-detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.nt-detail-item:last-child {
    border-bottom: none;
}

.nt-detail-icon {
    font-size: 20px;
    margin-right: 12px;
}

.nt-detail-label {
    font-weight: 600;
    color: #374151;
    flex: 1;
}

.nt-detail-value {
    font-weight: 700;
    font-size: 18px;
}

.nt-results-actions {
    padding: 0 30px 30px;
    display: flex;
    gap: 15px;
}

.nt-action-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    color: white;
}

.nt-retry-btn {
    background-color: #6366f1;
}

.nt-retry-btn:hover {
    background-color: #5856eb;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
}

.nt-explanation-btn {
    background-color: #64748b;
}

.nt-explanation-btn:hover {
    background-color: #475569;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(100, 116, 139, 0.4);
}

/* Mobile responsiveness for modal - moved to main mobile media query */

/* Extra small mobile devices */
@media (max-width: 480px) {
    .nt-answer-option {
        padding: 10px;
        margin-bottom: 10px;
    }

    .nt-answer-letter {
        width: 20px;
        height: 20px;
        font-size: 11px;
        position: absolute;
        top: -10px;
        left: -10px;
        z-index: 10;
    }

    .nt-answer-content {
        font-size: 13px;
    }

    .nt-vietnamese-answer {
        font-size: 11px;
    }

    /* Extra small mobile - 2x2 Grid adjustments */
    .nt-answer-list.nt-grid-2x2 {
        gap: 10px; /* Even smaller gap on very small screens */
    }

    .nt-answer-list.nt-grid-2x2 .nt-answer-option {
        min-height: 45px; /* Smaller height on extra small mobile */
        padding: 8px;
    }

    /* Extra small mobile font sizes - respecting font size system */

    /* Default extra small mobile sizes (no class) */
    #nt-lesson-content .nt-japanese-text .nt-text-content,
    #nt-lesson-content .nt-japanese-question,
    #nt-lesson-content .nt-japanese-answer,
    #nt-lesson-content .nt-vietnamese {
        font-size: 16px !important; /* Smaller than mobile 18px */
    }

    /* Small font mode on extra small mobile */
    #nt-lesson-content.font-small .nt-japanese-text .nt-text-content,
    #nt-lesson-content.font-small .nt-japanese-question,
    #nt-lesson-content.font-small .nt-japanese-answer,
    #nt-lesson-content.font-small .nt-vietnamese {
        font-size: 14px !important; /* Smaller than mobile 16px */
    }

    /* Medium font mode on extra small mobile */
    #nt-lesson-content.font-medium .nt-japanese-text .nt-text-content,
    #nt-lesson-content.font-medium .nt-japanese-question,
    #nt-lesson-content.font-medium .nt-japanese-answer,
    #nt-lesson-content.font-medium .nt-vietnamese {
        font-size: 16px !important; /* Same as default */
    }

    /* Large font mode on extra small mobile */
    #nt-lesson-content.font-large .nt-japanese-text .nt-text-content,
    #nt-lesson-content.font-large .nt-japanese-question,
    #nt-lesson-content.font-large .nt-japanese-answer,
    #nt-lesson-content.font-large .nt-vietnamese {
        font-size: 18px !important; /* Smaller than mobile 20px */
    }

    /* Vietnamese specific adjustments for extra small mobile */
    #nt-lesson-content .nt-vietnamese-question {
        font-size: 13px !important;
        line-height: 1.4;
    }

    #nt-lesson-content.font-small .nt-vietnamese-question {
        font-size: 12px !important;
    }

    #nt-lesson-content.font-large .nt-vietnamese-question {
        font-size: 15px !important;
    }

    #nt-lesson-content .nt-vietnamese-answer {
        font-size: 11px !important;
    }

    #nt-lesson-content.font-small .nt-vietnamese-answer {
        font-size: 10px !important;
    }

    #nt-lesson-content.font-large .nt-vietnamese-answer {
        font-size: 13px !important;
    }

    /* Ruby text responsive sizes for extra small mobile */
    #nt-lesson-content ruby rt {
        font-size: 8px !important; /* 50% of default extra small mobile 16px */
    }

    #nt-lesson-content.font-small ruby rt {
        font-size: 7px !important; /* 50% of extra small mobile small 14px */
    }

    #nt-lesson-content.font-medium ruby rt {
        font-size: 8px !important; /* 50% of extra small mobile medium 16px */
    }

    #nt-lesson-content.font-large ruby rt {
        font-size: 9px !important; /* 50% of extra small mobile large 18px */
    }

    .nt-content-title {
        font-size: 24px;
    }

    .nt-content-subtitle {
        font-size: 13px;
    }

    .nt-header-title {
        font-size: 18px;
    }

    /* Extra small mobile lesson title */
    .nt-lesson-section h3 {
        font-size: 18px !important;
    }

    /* Smaller body text for very small screens */
    body {
        font-size: 14px;
    }

    /* Reduce sidebar and navigation text */
    .nt-sidebar-title {
        font-size: 16px;
    }

    .nt-lesson-title {
        font-size: 13px;
    }

    .nt-lesson-topic {
        font-size: 11px;
    }

}

/* ===== CONTACT SECTION ===== */
.nt-contact-section {
    margin-top: 24px;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: none;
}

.nt-contact-title {
    margin: 0 0 16px 0;
    font-size: 17px;
    font-weight: 700;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nt-contact-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}


.nt-contact-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    background: #059669;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.25);
}

.nt-contact-link:hover {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
    text-decoration: none;
    color: white;
}

.nt-contact-icon {
    font-size: 20px;
}

.nt-contact-number {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ===== EXAM RESULTS MODAL ===== */
.nt-results-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999 !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.nt-results-modal.show {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.nt-results-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
    z-index: 1;
}

.nt-results-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 380px;
    width: 90%;
    transition: transform 0.3s ease;
    z-index: 10;
}

.nt-results-modal.show .nt-results-content {
    transform: translate(-50%, -50%) scale(1);
}

.nt-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.nt-results-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.nt-close-modal {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.nt-close-modal:hover {
    background: #f3f4f6;
    color: #374151;
}

.nt-results-body {
    padding: 24px;
    text-align: center;
}

.nt-score-card {
    border: 3px solid;
    border-radius: 12px;
    padding: 24px 20px;
    margin-bottom: 24px;
    background: #fafafa;
}

.nt-score-main {
    margin-bottom: 12px;
}

.nt-score-big {
    display: block;
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
}

.nt-score-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
}

.nt-score-breakdown {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.nt-correct {
    font-size: 14px;
    font-weight: 500;
    color: #059669;
}

.nt-results-actions {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
}

.nt-retry-btn, .nt-explanation-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nt-retry-btn {
    background: #10b981;
    color: white;
}

.nt-retry-btn:hover {
    background: #059669;
}

.nt-explanation-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.nt-explanation-btn:hover {
    background: #e5e7eb;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .nt-results-content {
        max-width: 340px;
        width: 94%;
    }

    .nt-results-header {
        padding: 16px 20px 12px;
    }

    .nt-results-header h3 {
        font-size: 16px;
    }

    .nt-results-body {
        padding: 20px;
    }

    .nt-score-card {
        padding: 20px 16px;
        margin-bottom: 20px;
    }

    .nt-score-big {
        font-size: 40px;
    }

    .nt-score-label {
        font-size: 14px;
    }

    .nt-results-actions {
        padding: 0 20px 20px;
        flex-direction: column;
    }

    .nt-retry-btn, .nt-explanation-btn {
        padding: 14px 16px;
    }
}

/* ===== EXPLANATION STYLES ===== */
.nt-question-result {
    margin-top: 16px;
    padding: 16px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.nt-result-explanation {
    font-size: 14px;
}

.nt-result-status {
    font-weight: 600;
    margin-bottom: 8px;
}

.nt-result-status.correct {
    color: #059669;
}

.nt-result-status.incorrect {
    color: #dc2626;
}

.nt-correct-answer-info {
    color: #374151;
    margin-bottom: 8px;
    font-weight: 500;
}

.nt-explanation-text {
    color: #6b7280;
    font-style: italic;
    line-height: 1.5;
}

/* Answer highlighting */
.nt-answer-option.nt-correct-answer {
    background: #dcfce7 !important;
    border-color: #16a34a !important;
    color: #15803d !important;
}

.nt-answer-option.nt-wrong-answer {
    background: #fef2f2 !important;
    border-color: #dc2626 !important;
    color: #dc2626 !important;
}

/* Shuffle button styling */
.nt-shuffle-btn {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.nt-shuffle-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #374151;
    transform: translateY(-1px);
}

.nt-shuffle-btn:active {
    transform: translateY(0);
}

.nt-answer-controls {
    margin-bottom: 15px;
    text-align: right;
}

@media (max-width: 768px) {
    .nt-answer-controls {
        text-align: center;
        margin-bottom: 10px;
    }

    .nt-shuffle-btn {
        font-size: 11px;
        padding: 4px 8px;
    }
}

/* ===== FLOATING RUBY TOGGLE BUTTON ===== */
.nt-floating-ruby-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #ea580c 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(234, 88, 12, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-japanese);
    outline: none;
}

.nt-floating-ruby-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 24px rgba(234, 88, 12, 0.4);
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.nt-floating-ruby-btn:active {
    transform: translateY(0) scale(1);
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.3);
}

.nt-floating-ruby-btn.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.nt-floating-ruby-btn.active:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.nt-floating-ruby-btn.clicked {
    transform: scale(0.9);
}

.nt-ruby-icon {
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
}

/* Hide floating button when content panel is not loaded */
.nt-app:not(.has-content) .nt-floating-ruby-btn {
    display: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .nt-floating-ruby-btn {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }

    .nt-ruby-icon {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .nt-floating-ruby-btn {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
    }

    .nt-ruby-icon {
        font-size: 16px;
    }
}

