/* ============================================
   RANKUP EPP — FULLY RESPONSIVE
   ============================================ */

/* ---- CSS VARIABLES ---- */
:root {
    --primary: #1e3a5f;
    --primary-light: #2563eb;
    --primary-dark: #0f172a;
    --accent: #3b82f6;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.2s ease;
}

/* ---- RESET & BASE ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   LOGIN PAGE — RESPONSIVE
   ============================================ */
.login-page {
    background: var(--primary-dark);
    min-height: 100vh;
}

.login-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.login-left {
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    color: var(--white);
}

.brand {
    margin-bottom: 40px;
}

.logo {
    width: fit-content;
    min-width: 64px;
    height: 64px;
    padding: 0 22px;
    background: var(--accent);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 20px;
}

.brand h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.brand p {
    font-size: 1.1rem;
    color: var(--gray-300);
}

.features {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 40px;
}

.feature {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.feature-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius);
}

.feature h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.feature p {
    color: var(--gray-400);
    font-size: 0.9rem;
}

.category-info {
    margin-top: auto;
    padding-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.category-info h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
    margin-bottom: 12px;
}

.cat-item {
    font-size: 0.8rem;
    color: var(--gray-300);
    padding: 4px 0;
}

.cat-item strong {
    color: var(--accent);
}

.login-right {
    width: 460px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-box {
    width: 100%;
    max-width: 380px;
}

.login-box h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.login-subtitle {
    color: var(--gray-500);
    margin-bottom: 28px;
    font-size: 0.95rem;
}

/* ---- FORM ELEMENTS (TOUCH-FRIENDLY) ---- */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    color: var(--gray-900);
    background: var(--gray-50);
    transition: var(--transition);
    min-height: 48px;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-group select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* ---- BUTTONS ---- */
.btn-login,
.btn-nav,
.btn-modal,
.btn-newquiz {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}

.btn-login {
    width: 100%;
    background: var(--accent);
    color: var(--white);
    margin-top: 8px;
}

.btn-login:hover,
.btn-login:active {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-login:active {
    transform: translateY(0);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.85rem;
}

/* ============================================
   QUIZ PAGE — RESPONSIVE
   ============================================ */
.quiz-page {
    background: var(--gray-50);
    padding-bottom: 80px;
}

.quiz-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.quiz-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.quiz-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.meta-item {
    font-size: 0.75rem;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.meta-item:first-child {
    color: var(--primary);
    background: #eff6ff;
    font-weight: 500;
}

.quiz-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--danger);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.timer-icon {
    font-size: 1rem;
}

.quiz-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-logout {
    padding: 8px 18px;
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger);
    border: 1.5px solid rgba(220, 38, 38, 0.3);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-logout:hover {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-logout::before {
    content: "🚪";
    font-size: 0.9rem;
}

/* Scope Banner */
.scope-banner {
    background: var(--primary);
    color: var(--white);
    padding: 10px 16px;
    font-size: 0.85rem;
}

.scope-inner {
    max-width: 1200px;
    margin: 0 auto;
    line-height: 1.5;
}

.scope-inner strong {
    color: #93c5fd;
}

/* Progress Track */
.progress-track {
    height: 4px;
    background: var(--gray-200);
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

/* Main Content */
.quiz-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 16px;
}

.question-page {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

.page-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
}

.page-range {
    font-size: 0.8rem;
    color: var(--gray-500);
    background: var(--white);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--gray-200);
}

.questions-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.question-block {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.question-block:active {
    box-shadow: var(--shadow);
}

.q-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.q-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.q-topic {
    font-size: 0.7rem;
    color: var(--accent);
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.q-status {
    font-size: 0.7rem;
    color: var(--gray-400);
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: auto;
}

.q-status.answered-status {
    color: var(--success);
    background: #f0fdf4;
}

.q-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 16px;
    line-height: 1.6;
}

/* Options */
.q-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.q-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    background: var(--gray-50);
    min-height: 56px;
    -webkit-tap-highlight-color: transparent;
}

.q-option:hover,
.q-option:active {
    border-color: var(--accent);
    background: #eff6ff;
}

.q-option input[type="radio"] {
    display: none;
}

.opt-letter {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--gray-200);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: var(--transition);
}

.q-option input:checked + .opt-letter {
    background: var(--success);
    color: var(--white);
}

.q-option input:checked ~ .opt-text {
    color: var(--success);
    font-weight: 600;
}

.q-option:has(input:checked) {
    border-color: var(--success);
    background: #f0fdf4;
}

.opt-text {
    font-size: 0.95rem;
    color: var(--gray-700);
    line-height: 1.4;
}

/* Page Navigation */
.page-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
    gap: 12px;
}

.btn-prev {
    background: var(--white);
    color: var(--gray-600);
    border: 2px solid var(--gray-200);
    padding: 12px 20px;
}

.btn-prev:hover,
.btn-prev:active {
    border-color: var(--gray-400);
    background: var(--gray-50);
}

.btn-next {
    background: var(--accent);
    color: var(--white);
    padding: 12px 24px;
}

.btn-next:hover,
.btn-next:active {
    background: var(--primary-light);
    box-shadow: var(--shadow-lg);
}

.btn-submit {
    background: var(--success);
    color: var(--white);
    padding: 14px 28px;
    font-size: 1.05rem;
}

.btn-submit:hover,
.btn-submit:active {
    background: #15803d;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

/* Desktop Sidebar */
.quiz-sidebar {
    position: fixed;
    right: 0;
    top: 120px;
    width: 260px;
    height: calc(100vh - 120px);
    background: var(--white);
    border-left: 1px solid var(--gray-200);
    padding: 20px;
    overflow-y: auto;
    z-index: 50;
}

.sidebar-box h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 16px;
}

.nav-btn {
    aspect-ratio: 1;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition);
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.nav-btn:hover,
.nav-btn:active {
    border-color: var(--accent);
    color: var(--accent);
}

.nav-btn.nav-answered {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}

.nav-btn.current-page {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.nav-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.nav-legend span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--white);
    border: 1.5px solid var(--gray-200);
}

.legend-dot.answered {
    background: var(--success);
    border-color: var(--success);
}

.legend-dot.current {
    background: var(--accent);
    border-color: var(--accent);
}

/* Mobile Elements - Hidden by default on desktop */
.mobile-nav-toggle,
.mobile-nav-overlay,
.mobile-nav-sheet {
    display: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal-box {
    background: var(--white);
    padding: 28px;
    border-radius: var(--radius-lg);
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.modal-box h3 {
    color: var(--danger);
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.modal-box p {
    color: var(--gray-500);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.btn-modal {
    background: var(--accent);
    color: var(--white);
    padding: 12px 32px;
}

/* ============================================
   RESULT PAGE
   ============================================ */
.result-page {
    background: var(--gray-50);
    padding: 24px 16px;
}

.result-container {
    max-width: 800px;
    margin: 0 auto;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.header-content {
    flex: 1;
}

.result-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.result-subtitle {
    color: var(--gray-500);
    font-size: 0.9rem;
}

.score-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
    margin-bottom: 24px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.score-ring {
    width: 160px;
    height: 160px;
    margin: 0 auto 20px;
    position: relative;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-ring .track {
    fill: none;
    stroke: var(--gray-200);
    stroke-width: 10;
}

.score-ring .fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dasharray 1s ease;
}

.score-ring.excellent .fill { stroke: var(--success); }
.score-ring.good .fill { stroke: var(--accent); }
.score-ring.average .fill { stroke: var(--warning); }
.score-ring.below-average .fill { stroke: #f97316; }
.score-ring.poor .fill { stroke: var(--danger); }

.score-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-percent {
    display: block;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
}

.score-grade {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-500);
    margin-top: 4px;
}

.score-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.score-item {
    padding: 14px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.score-label {
    display: block;
    font-size: 0.7rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.score-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-900);
}

.score-value.correct-val { color: var(--success); }
.score-value.incorrect-val { color: var(--danger); }

.feedback-text {
    font-size: 1.15rem;
    font-weight: 600;
}

.feedback-text.excellent { color: var(--success); }
.feedback-text.good { color: var(--accent); }
.feedback-text.average { color: var(--warning); }
.feedback-text.below-average { color: #f97316; }
.feedback-text.poor { color: var(--danger); }

.scope-reference {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
}

.scope-reference h4 {
    font-size: 0.8rem;
    color: #1e40af;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scope-reference p {
    color: var(--gray-700);
    font-size: 0.85rem;
    line-height: 1.6;
}

.review-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.review-section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 20px;
}

.review-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.review-item {
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    transition: var(--transition);
}

.review-item.correct {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.review-item.incorrect {
    border-color: #fecaca;
    background: #fef2f2;
}

.review-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.review-qnum {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
}

.review-topic {
    font-size: 0.7rem;
    color: var(--accent);
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.review-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    margin-left: auto;
}

.review-item.correct .review-badge {
    background: #bbf7d0;
    color: #166534;
}

.review-item.incorrect .review-badge {
    background: #fecaca;
    color: #991b1b;
}

.review-question {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 14px;
    line-height: 1.5;
}

.review-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.review-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    font-size: 0.85rem;
    min-height: 44px;
}

.review-opt.right {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.review-opt.wrong {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    text-decoration: line-through;
}

.opt-mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.review-opt.right .opt-mark {
    background: var(--success);
    color: var(--white);
}

.review-opt.wrong .opt-mark {
    background: var(--danger);
    color: var(--white);
}

.opt-txt {
    flex: 1;
    line-height: 1.4;
}

.opt-tag {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.opt-tag.your {
    background: #dbeafe;
    color: #1e40af;
}

.opt-tag.correct {
    background: #dcfce7;
    color: #166534;
}

.result-actions {
    text-align: center;
    padding-bottom: 20px;
}

.btn-newquiz {
    background: var(--accent);
    color: var(--white);
    padding: 14px 36px;
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 1rem;
    display: inline-flex;
}

.btn-newquiz:hover,
.btn-newquiz:active {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   TABLET (768px - 1023px)
   ============================================ */
@media (max-width: 1023px) {
    .login-left {
        padding: 40px;
    }
    
    .login-right {
        width: 400px;
        padding: 30px;
    }
    
    .quiz-sidebar {
        width: 220px;
    }
    
    .quiz-main {
        padding-right: 240px;
    }
}

/* ============================================
   MOBILE (< 768px) - MAIN BREAKPOINT
   ============================================ */
@media (max-width: 767px) {
    /* Login Page */
    .login-wrapper {
        flex-direction: column;
    }
    
    .login-left {
        padding: 30px 20px;
        min-height: auto;
        text-align: center;
    }
    
    .brand {
        margin-bottom: 24px;
    }
    
    .logo {
        min-width: 56px;
        height: 56px;
        padding: 0 18px;
        font-size: 22px;
        margin: 0 auto 16px;
    }
    
    .brand h1 {
        font-size: 1.75rem;
    }
    
    .features {
        display: none;
    }
    
    .category-info {
        display: none;
    }
    
    .login-right {
        width: 100%;
        padding: 24px 20px;
    }
    
    .login-box {
        max-width: 100%;
    }
    
    .login-box h2 {
        font-size: 1.5rem;
    }
    
    /* Quiz Page - Mobile */
    .quiz-page {
        padding-bottom: 100px;
    }
    
    .quiz-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
    }
    
    .header-inner {
        padding: 10px 12px;
    }
    
    .quiz-brand {
        font-size: 0.9rem;
    }
    
    .quiz-meta {
        display: none;
    }
    
    .quiz-timer {
        font-size: 1rem;
    }
    
    .scope-banner {
        margin-top: 50px;
        font-size: 0.75rem;
        padding: 8px 12px;
    }
    
    .quiz-main {
        padding: 16px 12px 100px;
    }
    
    .page-header {
        margin-bottom: 16px;
    }
    
    .page-header h2 {
        font-size: 0.9rem;
    }
    
    .question-block {
        padding: 16px;
    }
    
    .q-header {
        gap: 6px;
    }
    
    .q-text {
        font-size: 0.95rem;
        margin-bottom: 12px;
    }
    
    .q-options {
        gap: 8px;
    }
    
    .q-option {
        padding: 12px 14px;
        min-height: 52px;
    }
    
    .opt-letter {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .opt-text {
        font-size: 0.9rem;
    }
    
    /* Hide desktop sidebar on mobile */
    .quiz-sidebar {
        display: none !important;
    }
    
    /* Show mobile navigation elements */
    .mobile-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 80px;
        right: 16px;
        width: 56px;
        height: 56px;
        background: var(--accent);
        color: var(--white);
        border-radius: 50%;
        border: none;
        font-size: 1.25rem;
        box-shadow: var(--shadow-lg);
        z-index: 80;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    .mobile-nav-toggle:active {
        transform: scale(0.95);
    }
    
    .mobile-nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 90;
    }
    
    .mobile-nav-overlay.show {
        display: block;
    }
    
    .mobile-nav-sheet {
        display: none;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--white);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding: 20px;
        z-index: 95;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.15);
        max-height: 60vh;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    
    .mobile-nav-sheet.show {
        display: block;
        transform: translateY(0);
    }
    
    /* Fixed bottom navigation */
    .page-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--white);
        padding: 12px 16px;
        margin: 0;
        border-top: 1px solid var(--gray-200);
        z-index: 85;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
    }
    
    .btn-prev,
    .btn-next {
        flex: 1;
        justify-content: center;
        padding: 12px 16px;
        font-size: 0.95rem;
    }
    
    .btn-submit {
        flex: 1;
        justify-content: center;
        padding: 14px 20px;
        font-size: 1rem;
    }
    
    /* Results Page Mobile */
    .score-ring {
        width: 140px;
        height: 140px;
    }
    
    .score-percent {
        font-size: 1.8rem;
    }
    
    .score-details {
        gap: 8px;
    }
    
    .score-item {
        padding: 12px;
    }
    
    .score-value {
        font-size: 1.2rem;
    }
    
    .review-section {
        padding: 16px;
    }
    
    .review-opt {
        padding: 8px 10px;
        min-height: 40px;
    }
    
    .opt-tag {
        display: none;
    }
}

/* ============================================
   SMALL MOBILE (< 380px)
   ============================================ */
@media (max-width: 379px) {
    html {
        font-size: 14px;
    }
    
    .login-box h2 {
        font-size: 1.35rem;
    }
    
    .input-group input,
    .input-group select {
        padding: 12px 14px;
        min-height: 44px;
    }
    
    .btn-login {
        min-height: 44px;
    }
    
    .q-option {
        padding: 10px 12px;
        min-height: 48px;
    }
    
    .opt-letter {
        width: 28px;
        height: 28px;
    }
    
    .page-nav {
        padding: 10px 12px;
    }
    
    .btn-prev,
    .btn-next {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    .btn-submit {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
    
    .mobile-nav-toggle {
        width: 48px;
        height: 48px;
        bottom: 76px;
        right: 12px;
    }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .login-left {
        padding: 20px;
    }
    
    .features {
        display: none;
    }
    
    .quiz-header {
        position: relative;
    }
    
    .scope-banner {
        margin-top: 0;
    }
    
    .mobile-nav-toggle {
        bottom: 70px;
    }
}

/* ============================================
   LARGE DESKTOP (> 1200px)
   ============================================ */
@media (min-width: 1200px) {
    .quiz-main {
        padding-right: 300px;
    }

    .quiz-sidebar {
        width: 280px;
    }
}

/* ============================================
   ADMIN MOBILE MENU
   ============================================ */
.admin-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    gap: 5px;
    padding: 8px;
}

.admin-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.admin-hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.admin-hamburger.active span:nth-child(2) {
    opacity: 0;
}

.admin-hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.admin-nav-mobile {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: #0f172a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px;
    z-index: 99;
}

.admin-nav-mobile.show {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-nav-mobile a {
    color: #94a3b8;
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.05);
}

.admin-nav-mobile a:hover,
.admin-nav-mobile a.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 1023px) {
    .admin-hamburger {
        display: flex;
    }

    .admin-nav {
        display: none;
    }

    .admin-header-inner {
        padding: 12px 16px;
    }

    .admin-main {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .hide-mobile {
        display: none;
    }
}

@media (max-width: 767px) {
    .admin-header-inner {
        padding: 10px 14px;
    }

    .admin-brand {
        font-size: 1rem;
    }

    .admin-brand span {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .admin-user span {
        display: none;
    }

    .btn-admin-logout {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .admin-main {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-card .stat-value {
        font-size: 2rem;
    }

    .section-header {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
    }

    .section-header h3 {
        font-size: 1rem;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .dataTables_wrapper {
        padding: 12px;
    }

    .dataTables_filter input {
        width: 100%;
        margin: 8px 0 0 0;
    }

    .dataTables_length select {
        margin: 0;
    }

    .dataTables_info,
    .dataTables_paginate {
        font-size: 0.75rem;
    }

    .dataTables_paginate .paginate_button {
        padding: 4px 8px !important;
        font-size: 0.75rem !important;
    }

    .question-preview {
        max-width: 150px;
    }

    .modal-content {
        padding: 20px;
        max-height: 85vh;
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar input,
    .filter-bar select {
        width: 100%;
    }

    .filter-bar button {
        width: 100%;
    }
}