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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    color: #2D4059;
}

/* ============================================
   LOADING SCREEN
============================================ */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #FF6B35, #E85D2C);
    z-index: 1000;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.loading-screen.hidden {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 24px;
    max-width: 400px;
    width: 100%;
}

.app-icon {
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    animation: float 2.5s ease-in-out infinite;
}

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

.app-name {
    font-size: 36px;
    font-weight: 700;
    color: white;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.tagline {
    font-size: 14px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 3px;
    margin-bottom: 48px;
}

.loading-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loading-text {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 12px;
    min-height: 24px;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: white;
    border-radius: 10px;
    transition: width 0.4s ease;
    width: 0%;
}

.progress-percentage {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   MAIN APP
============================================ */
.main-app {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px 20px 100px;
    animation: fadeIn 0.6s ease;
}

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

/* ============================================
   HEADER
============================================ */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0 16px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.header-title {
    font-size: 22px;
    font-weight: 700;
    color: #FF6B35;
    letter-spacing: 0.5px;
}

.header-subtitle {
    font-size: 12px;
    color: #999;
    font-weight: 400;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.subject-count {
    font-size: 12px;
    color: #999;
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 20px;
}

.sync-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.2s;
}

.sync-btn:hover {
    transform: rotate(180deg);
    color: #FF6B35;
}

.sync-btn.spinning {
    animation: spin 1s linear infinite;
}

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

/* ============================================
   WELCOME SECTION
============================================ */
.welcome-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 20px;
}

.welcome-title {
    font-size: 22px;
    font-weight: 600;
    color: #2D4059;
}

.welcome-subtitle {
    font-size: 14px;
    color: #999;
}

.offline-badge {
    display: none;
    font-size: 12px;
    color: #16a34a;
    background: #dcfce7;
    padding: 4px 12px;
    border-radius: 20px;
}

.offline-badge.show {
    display: inline-block;
}

/* ============================================
   SEARCH BAR
============================================ */
.search-container {
    margin-bottom: 20px;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    padding: 0 16px;
    transition: box-shadow 0.2s;
}

.search-wrapper:focus-within {
    box-shadow: 0 4px 20px rgba(255,107,53,0.15);
}

.search-icon {
    font-size: 18px;
    color: #999;
    margin-right: 12px;
}

.search-input {
    flex: 1;
    padding: 14px 0;
    border: none;
    font-size: 15px;
    font-family: 'Poppins', sans-serif;
    background: transparent;
    color: #2D4059;
    outline: none;
}

.search-input::placeholder {
    color: #ccc;
}

.clear-search-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
}

.search-hint {
    display: block;
    font-size: 11px;
    color: #aaa;
    padding: 6px 4px 0;
}

/* ============================================
   SUBJECTS SECTION
============================================ */
.subjects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.subjects-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2D4059;
}

.shelf-count {
    font-size: 13px;
    color: #FF6B35;
    font-weight: 500;
}

/* ============================================
   SUBJECT GRID
============================================ */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* Subject Card */
.subject-card {
    background: white;
    border-radius: 16px;
    padding: 16px 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.subject-card:active {
    transform: scale(0.96);
}

.subject-card .subject-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.subject-card .subject-name {
    font-size: 13px;
    font-weight: 500;
    color: #2D4059;
    line-height: 1.3;
    word-break: break-word;
}

.subject-card .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.subject-card .remove-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Card Colors */
.subject-card.color-1 { background: linear-gradient(135deg, #fff5f0, #ffe8e0); }
.subject-card.color-2 { background: linear-gradient(135deg, #f0f7ff, #e0edff); }
.subject-card.color-3 { background: linear-gradient(135deg, #f0fdf4, #dcfce7); }
.subject-card.color-4 { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.subject-card.color-5 { background: linear-gradient(135deg, #fae8ff, #f3d4ff); }
.subject-card.color-6 { background: linear-gradient(135deg, #fce7f3, #fbcfe8); }

/* ============================================
   EMPTY STATE
============================================ */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: #2D4059;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: #999;
}

.empty-state .empty-hint {
    font-size: 12px;
    color: #FF6B35;
    margin-top: 8px;
}

/* ============================================
   GRID LOADING
============================================ */
.grid-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #FF6B35;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

.grid-loading p {
    font-size: 14px;
    color: #999;
}

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 480px) {
    .app-header {
        padding: 4px 0 12px;
    }
    
    .header-title {
        font-size: 18px;
    }
    
    .welcome-title {
        font-size: 18px;
    }
    
    .subject-grid {
        gap: 10px;
    }
    
    .subject-card {
        padding: 12px 6px;
        min-height: 70px;
    }
    
    .subject-card .subject-icon {
        font-size: 22px;
    }
    
    .subject-card .subject-name {
        font-size: 11px;
    }
    
    .search-input {
        font-size: 14px;
        padding: 12px 0;
    }
}

@media (max-width: 380px) {
    .subject-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .subject-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
/* ============================================
   TOPICS SCREEN
============================================ */
.topics-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f7fa;
    z-index: 100;
    overflow-y: auto;
    padding: 16px 20px 100px;
    animation: slideIn 0.3s ease;
}

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

/* Topics Header */
.topics-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0 16px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.back-btn {
    background: none;
    border: none;
    color: #2D4059;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.back-btn:active {
    transform: scale(0.9);
}

.topics-title {
    font-size: 18px;
    font-weight: 600;
    color: #2D4059;
}

.topics-subtitle {
    font-size: 12px;
    color: #999;
}

/* Topics Grid */
.topics-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.topics-header-row h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2D4059;
}

.topic-count {
    font-size: 13px;
    color: #FF6B35;
    font-weight: 500;
}

.topics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

/* Topic Card */
.topic-card {
    background: white;
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.topic-card:active {
    transform: scale(0.98);
}

.topic-card .topic-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topic-card .topic-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    background: #f0f7ff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topic-card .topic-name {
    font-size: 15px;
    font-weight: 500;
    color: #2D4059;
}

.topic-card .topic-arrow {
    color: #ccc;
    font-size: 18px;
}

/* Topic Card Colors */
.topic-card.color-1 .topic-icon { background: #fff5f0; }
.topic-card.color-2 .topic-icon { background: #f0f7ff; }
.topic-card.color-3 .topic-icon { background: #f0fdf4; }
.topic-card.color-4 .topic-icon { background: #fef3c7; }
.topic-card.color-5 .topic-icon { background: #fae8ff; }
.topic-card.color-6 .topic-icon { background: #fce7f3; }

/* Topics Empty State */
.topics-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.topics-empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.topics-empty-state h3 {
    font-size: 18px;
    color: #2D4059;
    margin-bottom: 8px;
}

.topics-empty-state p {
    font-size: 14px;
    color: #999;
}

/* ============================================
   TOPICS RESPONSIVE
============================================ */
@media (max-width: 480px) {
    .topics-screen {
        padding: 12px 16px 100px;
    }
    
    .topics-title {
        font-size: 16px;
    }
    
    .topic-card {
        padding: 12px 14px;
    }
    
    .topic-card .topic-name {
        font-size: 14px;
    }
}

@media (min-width: 768px) {
    .topics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.update-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.2s, color 0.2s;
}

.update-btn:hover {
    color: #FF6B35;
    transform: rotate(180deg);
}

.update-btn.spinning {
    animation: spin 1s linear infinite;
    color: #FF6B35;
}

.update-btn.has-update {
    color: #FF6B35;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* ============================================
   QUIZ LIST SCREEN
============================================ */
.quiz-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f7fa;
    z-index: 100;
    overflow-y: auto;
    padding: 16px 20px 100px;
    animation: slideIn 0.3s ease;
}

.quiz-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0 16px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.quiz-title {
    font-size: 18px;
    font-weight: 600;
    color: #2D4059;
}

.quiz-subtitle {
    font-size: 12px;
    color: #999;
}

.quiz-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.quiz-header-row h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2D4059;
}

.quiz-count {
    font-size: 13px;
    color: #FF6B35;
    font-weight: 500;
}

.quiz-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

/* Quiz Card */
.quiz-card {
    background: white;
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.quiz-card:active {
    transform: scale(0.98);
}

.quiz-card .quiz-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.quiz-card .quiz-icon {
    font-size: 20px;
    width: 40px;
    height: 40px;
    background: #f0f7ff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-card .quiz-info {
    display: flex;
    flex-direction: column;
}

.quiz-card .quiz-name {
    font-size: 15px;
    font-weight: 500;
    color: #2D4059;
}

.quiz-card .quiz-meta {
    font-size: 12px;
    color: #999;
}

.quiz-card .quiz-score {
    font-size: 13px;
    font-weight: 600;
    color: #16a34a;
    background: #dcfce7;
    padding: 4px 12px;
    border-radius: 20px;
}

.quiz-card .quiz-score.not-started {
    color: #999;
    background: #f0f0f0;
}

.quiz-card .quiz-arrow {
    color: #ccc;
    font-size: 18px;
}

/* Quiz Card Colors */
.quiz-card.color-1 .quiz-icon { background: #fff5f0; }
.quiz-card.color-2 .quiz-icon { background: #f0f7ff; }
.quiz-card.color-3 .quiz-icon { background: #f0fdf4; }
.quiz-card.color-4 .quiz-icon { background: #fef3c7; }
.quiz-card.color-5 .quiz-icon { background: #fae8ff; }
.quiz-card.color-6 .quiz-icon { background: #fce7f3; }

/* ============================================
   QUIZ MODAL
============================================ */
.quiz-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 24px;
    padding: 32px 28px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #f0f0f0;
}

.modal-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 12px;
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    color: #2D4059;
    text-align: center;
}

.modal-subtitle {
    font-size: 14px;
    color: #999;
    text-align: center;
    margin-bottom: 24px;
}

.modal-settings {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-label {
    font-size: 14px;
    font-weight: 600;
    color: #2D4059;
}

.timer-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.timer-option {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Poppins', sans-serif;
}

.timer-option:hover {
    border-color: #FF6B35;
    color: #FF6B35;
}

.timer-option.active {
    border-color: #FF6B35;
    background: #fff5f0;
    color: #FF6B35;
}

.begin-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #FF6B35, #E85D2C);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'Poppins', sans-serif;
}

.begin-btn:active {
    transform: scale(0.97);
}

.begin-btn:hover {
    box-shadow: 0 8px 30px rgba(255,107,53,0.3);
}

/* ============================================
   QUIZ PLAY SCREEN
============================================ */
.quiz-play-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f7fa;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 16px 20px 20px;
    animation: slideIn 0.3s ease;
}

.quiz-play-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.quiz-play-title-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.quiz-play-title {
    font-size: 16px;
    font-weight: 600;
    color: #2D4059;
}

.quiz-play-timer {
    font-size: 14px;
    font-weight: 600;
    color: #FF6B35;
    font-variant-numeric: tabular-nums;
}

.quiz-play-actions {
    display: flex;
    gap: 8px;
}

.nav-toggle-btn,
.diagram-toggle-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

.nav-toggle-btn:hover,
.diagram-toggle-btn:hover {
    background: #f0f0f0;
    color: #FF6B35;
}

/* ============================================
   QUESTION NAVIGATOR
============================================ */
.question-navigator {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    padding: 16px;
    margin: 12px 0;
    flex-shrink: 0;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.navigator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #2D4059;
}

.close-nav-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
}

.navigator-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.nav-box {
    aspect-ratio: 1;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-box:hover {
    transform: scale(1.05);
}

.nav-box.current {
    border-color: #FF6B35;
    box-shadow: 0 0 0 2px rgba(255,107,53,0.2);
}

.nav-box.correct {
    background: #dcfce7;
    border-color: #16a34a;
    color: #16a34a;
}

.nav-box.wrong {
    background: #fee2e2;
    border-color: #ef4444;
    color: #ef4444;
}

.nav-box.unanswered {
    background: white;
    border-color: #e0e0e0;
    color: #999;
}

.navigator-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    font-size: 11px;
    color: #666;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
    border: 1px solid #ddd;
}

.legend-dot.green { background: #16a34a; }
.legend-dot.red { background: #ef4444; }
.legend-dot.white { background: white; }

/* ============================================
   DIAGRAM MODAL
============================================ */
.diagram-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.diagram-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    animation: fadeIn 0.3s ease;
}

.diagram-content {
    position: relative;
    background: white;
    border-radius: 24px;
    padding: 32px 28px;
    max-width: 500px;
    width: 100%;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}

.diagram-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
}

.diagram-content h3 {
    margin-bottom: 16px;
    color: #2D4059;
}

.diagram-placeholder {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #ddd;
}

.diagram-text {
    color: #999;
    font-size: 14px;
    margin-top: 12px;
}

/* ============================================
   QUESTION CARD
============================================ */
.question-card-container {
    flex: 1;
    background: white;
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin: 12px 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.question-number {
    font-size: 13px;
    font-weight: 500;
    color: #999;
    margin-bottom: 12px;
}

.question-text {
    font-size: 18px;
    font-weight: 500;
    color: #2D4059;
    line-height: 1.6;
    margin-bottom: 20px;
}

.question-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    color: #2D4059;
}

.option-item:hover:not(.disabled) {
    border-color: #FF6B35;
    background: #fff5f0;
}

.option-item .option-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #666;
    flex-shrink: 0;
    transition: all 0.2s;
}

.option-item.selected {
    border-color: #FF6B35;
    background: #fff5f0;
}

.option-item.selected .option-letter {
    background: #FF6B35;
    color: white;
}

.option-item.correct {
    border-color: #16a34a;
    background: #dcfce7;
}

.option-item.correct .option-letter {
    background: #16a34a;
    color: white;
}

.option-item.wrong {
    border-color: #ef4444;
    background: #fee2e2;
}

.option-item.wrong .option-letter {
    background: #ef4444;
    color: white;
}

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

.option-item.disabled:hover {
    border-color: #e8e8e8;
    background: transparent;
}

.option-item.disabled.selected:hover {
    border-color: #FF6B35;
    background: #fff5f0;
}

/* ============================================
   QUIZ NAVIGATION BUTTONS
============================================ */
.quiz-nav-buttons {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    padding-top: 8px;
}

.nav-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Poppins', sans-serif;
}

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

.prev-btn {
    background: #f0f0f0;
    color: #666;
}

.prev-btn:hover {
    background: #e0e0e0;
}

.next-btn {
    background: linear-gradient(135deg, #FF6B35, #E85D2C);
    color: white;
}

.next-btn:hover {
    box-shadow: 0 4px 16px rgba(255,107,53,0.3);
}

/* ============================================
   ANSWER FEEDBACK MODAL
============================================ */
.answer-feedback-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.feedback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

.feedback-content {
    position: relative;
    background: white;
    border-radius: 24px;
    padding: 32px 28px;
    max-width: 400px;
    width: 100%;
    animation: slideUp 0.3s ease;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.feedback-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
}

.feedback-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.feedback-title {
    font-size: 22px;
    font-weight: 700;
    color: #2D4059;
    margin-bottom: 4px;
}

.feedback-message {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.feedback-explanation {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 10px;
    text-align: left;
    font-size: 14px;
    color: #444;
    line-height: 1.5;
    margin-bottom: 16px;
}

.feedback-continue-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #FF6B35, #E85D2C);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
}

.feedback-continue-btn:active {
    transform: scale(0.97);
}

/* ============================================
   RESULTS SCREEN
============================================ */
.results-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f7fa;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.5s ease;
}

.results-content {
    background: white;
    border-radius: 24px;
    padding: 40px 32px;
    max-width: 440px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    text-align: center;
}

.results-icon {
    font-size: 64px;
    margin-bottom: 8px;
}

.results-title {
    font-size: 28px;
    font-weight: 700;
    color: #2D4059;
}

.results-subtitle {
    font-size: 14px;
    color: #999;
    margin-bottom: 20px;
}

.results-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.stat-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 10px;
}

.stat-item .stat-label {
    display: block;
    font-size: 12px;
    color: #999;
    font-weight: 500;
}

.stat-item .stat-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #2D4059;
}

.stat-item.correct-stat .stat-value { color: #16a34a; }
.stat-item.wrong-stat .stat-value { color: #ef4444; }
.stat-item.unanswered-stat .stat-value { color: #f59e0b; }

.results-grade {
    font-size: 48px;
    font-weight: 800;
    color: #FF6B35;
    margin: 8px 0;
}

.results-remark {
    font-size: 16px;
    color: #444;
    margin-bottom: 12px;
    line-height: 1.5;
}

.results-warning {
    background: #fef3c7;
    color: #d97706;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
    text-align: left;
}

.results-ok-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #FF6B35, #E85D2C);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: transform 0.2s;
}

.results-ok-btn:active {
    transform: scale(0.97);
}

/* ============================================
   SUBJECT PROGRESS
============================================ */
.subject-progress {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
}

.subject-progress .completed {
    color: #16a34a;
    font-weight: 600;
}

.subject-card .progress-container {
    width: 100%;
    height: 3px;
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
    margin-top: 6px;
    overflow: hidden;
}

.subject-card .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF6B35, #E85D2C);
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 480px) {
    .quiz-screen {
        padding: 12px 16px 100px;
    }
    
    .quiz-title {
        font-size: 16px;
    }
    
    .quiz-card {
        padding: 12px 14px;
    }
    
    .quiz-card .quiz-name {
        font-size: 14px;
    }
    
    .modal-content {
        padding: 24px 20px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .timer-option {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .quiz-play-screen {
        padding: 12px 14px 16px;
    }
    
    .quiz-play-title {
        font-size: 14px;
    }
    
    .question-text {
        font-size: 16px;
    }
    
    .option-item {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .navigator-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 4px;
    }
    
    .nav-box {
        font-size: 10px;
    }
    
    .results-content {
        padding: 28px 20px;
    }
    
    .results-title {
        font-size: 22px;
    }
    
    .results-stats {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .stat-item .stat-value {
        font-size: 18px;
    }
    
    .results-grade {
        font-size: 36px;
    }
}

@media (max-width: 380px) {
    .navigator-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (min-width: 768px) {
    .quiz-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   SEARCH SCREEN
============================================ */
.search-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f7fa;
    z-index: 200;
    display: flex;
    flex-direction: column;
    padding: 16px 20px 20px;
    animation: slideIn 0.3s ease;
}

.search-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.search-header-title h2 {
    font-size: 18px;
    font-weight: 600;
    color: #2D4059;
}

.search-header-title p {
    font-size: 12px;
    color: #999;
}

.search-screen-bar {
    padding: 12px 0 8px;
    flex-shrink: 0;
}

.search-screen-bar .search-wrapper {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    padding: 0 16px;
    display: flex;
    align-items: center;
}

.search-screen-bar .search-wrapper:focus-within {
    box-shadow: 0 4px 20px rgba(255,107,53,0.15);
}

.search-screen-bar .search-input {
    flex: 1;
    padding: 14px 0;
    border: none;
    font-size: 15px;
    font-family: 'Poppins', sans-serif;
    background: transparent;
    color: #2D4059;
    outline: none;
}

.search-screen-bar .search-hint {
    display: block;
    font-size: 11px;
    color: #aaa;
    padding: 6px 4px 0;
}

/* ============================================
   PREVIEW SECTION
============================================ */
.preview-section {
    background: white;
    border-radius: 16px;
    padding: 12px 16px;
    margin: 8px 0 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    flex-shrink: 0;
    animation: slideDown 0.3s ease;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.preview-title {
    font-size: 13px;
    font-weight: 600;
    color: #2D4059;
}

.clear-preview-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
}

.preview-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 8px;
    scrollbar-width: thin;
}

.preview-container::-webkit-scrollbar {
    height: 4px;
}

.preview-container::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}

.preview-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fff5f0;
    border: 1px solid #FF6B35;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #2D4059;
    white-space: nowrap;
    animation: fadeIn 0.2s ease;
}

.preview-chip .remove-chip {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
}

.preview-chip .remove-chip:hover {
    color: #ef4444;
}

/* ============================================
   ADD SUBJECTS BUTTON
============================================ */
.add-subjects-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #FF6B35, #E85D2C);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Poppins', sans-serif;
    flex-shrink: 0;
    margin: 8px 0 12px;
}

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

.add-subjects-btn:not(:disabled):active {
    transform: scale(0.97);
}

.add-subjects-btn:not(:disabled):hover {
    box-shadow: 0 8px 30px rgba(255,107,53,0.3);
}

/* ============================================
   SEARCH RESULTS GRID
============================================ */
.search-results-section {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 8px;
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* Search Result Card */
.result-card {
    background: white;
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.result-card:active {
    transform: scale(0.96);
}

.result-card .result-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.result-card .result-name {
    font-size: 12px;
    font-weight: 500;
    color: #2D4059;
    line-height: 1.3;
}

.result-card .add-result-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    color: #ccc;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 50%;
    transition: all 0.2s;
}

.result-card .add-result-btn:hover {
    color: #FF6B35;
    background: #fff5f0;
}

.result-card .add-result-btn.added {
    color: #16a34a;
}

.result-card .result-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 10px;
    color: #16a34a;
    background: #dcfce7;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Result Card Colors */
.result-card.color-1 { background: linear-gradient(135deg, #fff5f0, #ffe8e0); }
.result-card.color-2 { background: linear-gradient(135deg, #f0f7ff, #e0edff); }
.result-card.color-3 { background: linear-gradient(135deg, #f0fdf4, #dcfce7); }
.result-card.color-4 { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.result-card.color-5 { background: linear-gradient(135deg, #fae8ff, #f3d4ff); }
.result-card.color-6 { background: linear-gradient(135deg, #fce7f3, #fbcfe8); }

/* ============================================
   SEARCH SCREEN RESPONSIVE
============================================ */
@media (max-width: 480px) {
    .search-screen {
        padding: 12px 14px 16px;
    }
    
    .search-results-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .result-card {
        padding: 10px 6px;
        min-height: 60px;
    }
    
    .result-card .result-icon {
        font-size: 20px;
    }
    
    .result-card .result-name {
        font-size: 11px;
    }
}

@media (max-width: 380px) {
    .search-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}