:root {
    --header-bg: #002f55;
    --body-bg: #eef1f5;
    --white: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --blue-link: #007bff;
    --green-btn: #28a745;
    --red-btn: #dc3545;
    --orange-btn: #e0a800;
    --border-color: #dee2e6;
    --instruction-bg: #eef8ff;
    --instruction-border: #99c2ff;
    --font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    
    /* Dynamic Font Size Variable for Questions */
    --question-font-size: 16px; 
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
}

body {
    background-color: var(--body-bg);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 16px; 
    transition: background-color 0.3s, color 0.3s;
}

/* --- NOTE TOOLBAR STYLES --- */
.note-toolbar {
    background: #fff;
    border-bottom: 1px solid #ddd;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 99;
    flex-shrink: 0;
}
.note-toolbar.hidden { display: none; }

.nt-group { display: flex; align-items: center; gap: 8px; }
.nt-sep { width: 1px; height: 24px; background: #ddd; margin: 0 5px; }

.nt-btn {
    width: 36px; height: 36px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.nt-btn:hover { background: #f0f0f0; }
.nt-btn.active { background: #e3f2fd; border-color: var(--blue-link); }
.nt-btn svg { width: 20px; height: 20px; fill: #555; }
.nt-btn.active svg { fill: var(--blue-link); }

.nt-color {
    width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
    border: 2px solid transparent; transition: transform 0.2s;
}
.nt-color.selected { transform: scale(1.2); border-color: #fff; box-shadow: 0 0 0 1px #999; }

.nt-btn-text {
    background: #f8f9fa; border: 1px solid #ced4da;
    color: #333; padding: 5px 10px; font-size: 0.85rem; font-weight: bold;
    border-radius: 4px; cursor: pointer;
}
.nt-btn-close {
    margin-left: auto; background: transparent; border: none; font-size: 1.2rem; cursor: pointer; color: #777;
}
.nt-btn-close:hover { color: red; }

/* CANVAS STYLES */
.note-canvas {
    position: absolute; top: 0; left: 0;
    z-index: 10;
    /* pointer-events handled by JS */
    cursor: crosshair;
}

/* Cursor change when active */
body.note-mode-active .q-body, 
body.note-mode-active .split-left-pane {
    cursor: text; /* Fallback */
}
/* Highlight button when active */
.active-action { color: var(--blue-link) !important; }
.active-action svg { fill: var(--blue-link) !important; }

/* --- DARK MODE STYLES --- */
body.dark-mode {
    --header-bg: #000000;
    --body-bg: #121212;
    --white: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border-color: #444444;
    --instruction-bg: #2c2c2c;
    --instruction-border: #555555;
}

body.dark-mode .top-blue-bar { background-color: #000; }
body.dark-mode .bottom-white-bar { background-color: #1a1a1a; border-bottom: 1px solid #333; }
body.dark-mode .user-name-text { color: #fff; }
body.dark-mode .user-id-text { color: #aaa; }
body.dark-mode .timer-val { color: #fff; }
body.dark-mode .timer-text { color: #aaa; }
body.dark-mode .action-item { color: #aaa; }
body.dark-mode .action-item:hover { color: #fff; }
body.dark-mode .action-icon { fill: #aaa; }
body.dark-mode .action-item:hover .action-icon { fill: #fff; }
body.dark-mode .header-avatar-section { background-color: #333; border-color: #444; box-shadow: none; }
body.dark-mode .avatar-img { fill: #aaa; }

body.dark-mode .q-card { background-color: #1e1e1e; border-color: #333; }
body.dark-mode .q-number-big { color: #fff; }
body.dark-mode .q-text-content { color: #e0e0e0; }
body.dark-mode .opt-text-val { color: #e0e0e0; }
body.dark-mode .option-row:hover { background-color: #333; }
body.dark-mode .opt-letter-circle { border-color: #e0e0e0; color: #e0e0e0; }
body.dark-mode .option-row.selected .opt-letter-circle { background-color: #e0e0e0; color: #000; }

body.dark-mode .split-left-pane { background-color: #1a1a1a; border-right: 1px solid #333; color: #ddd; }
body.dark-mode .q-instruction { background-color: #263238; border-color: #37474f; color: #eceff1; }

body.dark-mode .nav-circle { background-color: #333; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }
body.dark-mode .nav-float:hover { color: #fff; }
body.dark-mode .nav-text { color: #aaa; }

/* Note Toolbar Dark Mode */
body.dark-mode .note-toolbar { background: #2c2c2c; border-color: #444; }
body.dark-mode .nt-btn svg { fill: #aaa; }
body.dark-mode .nt-btn.active { background: #333; border-color: #555; }
body.dark-mode .nt-btn.active svg { fill: #fff; }
body.dark-mode .nt-btn-text { background: #333; border-color: #555; color: #ddd; }


/* Dark Mode for Instructions */
body.dark-mode #view-instructions { background-color: #121212; }
body.dark-mode .inst-container { color: #ddd; }
body.dark-mode .inst-table { border-color: #444; }
body.dark-mode .inst-table th { background-color: #333; color: #fff; border-color: #444; }
body.dark-mode .inst-table td { color: #ddd; border-color: #444; }
body.dark-mode .inst-list { color: #ddd; }
body.dark-mode .inst-list li::before { color: #ddd; }
body.dark-mode .alert-yellow { background-color: #2a220a; color: #e0e0e0; border-color: #e0a800; }
body.dark-mode .alert-green { background-color: #0d2b10; color: #e0e0e0; border-color: #2e7d32; }
body.dark-mode .alert-green svg { fill: #66bb6a; }

body.dark-mode .modal-window { background-color: #1e1e1e; }
body.dark-mode .modal-top { border-bottom: 1px solid #333; }
body.dark-mode .modal-h-title { color: #fff; }
body.dark-mode .modal-body { background-color: #1e1e1e; color: #ddd; }
body.dark-mode .btn-close-red { background-color: #b71c1c; }
body.dark-mode .status-header { background-color: #333; color: #fff; border-color: #444; }
body.dark-mode .tbl-status th { background-color: #2c2c2c; color: #fff; border-color: #444; }
body.dark-mode .tbl-status td { border-color: #444; }
body.dark-mode .rev-btn { background-color: #333; color: #ddd; border-color: #444; }
body.dark-mode .rev-btn:hover { background-color: #444; }
body.dark-mode .rev-btn.active { background-color: #0277bd; border-color: #0277bd; }
body.dark-mode .rev-cell { border-color: #444; color: #ddd; }
body.dark-mode .rev-cell.answered { background-color: #eee; color: #000; border-color: #eee; }

body.dark-mode .settings-panel { background-color: #1e1e1e; box-shadow: -5px 0 15px rgba(0,0,0,0.5); }
body.dark-mode .st-title { color: #fff; }
body.dark-mode .st-label { color: #aaa; }
body.dark-mode .lang-opt { background-color: #333; color: #ddd; border-color: #444; }
body.dark-mode .lang-opt.selected { background-color: #2e7d32; border-color: #2e7d32; color: #fff; }
body.dark-mode .font-resize { border-color: #444; }
body.dark-mode .font-btn { background-color: #333; color: #fff; }
body.dark-mode .font-val { border-color: #444; color: #fff; }

body.dark-mode .login-card { background-color: #1e1e1e; }
body.dark-mode .form-label { color: #ddd; }
body.dark-mode .form-control { background-color: #333; border-color: #444; color: #fff; }
body.dark-mode .captcha-btn { background-color: #333; border-color: #444; color: #fff; }
body.dark-mode .captcha-display { background-color: #333; border-color: #444; color: #fff; }
body.dark-mode .btn-eye { background-color: #333; border-color: #444; color: #fff; }
body.dark-mode .btn-eye svg { fill: #fff !important; }

/* --- ICONS --- */
.icon { width: 24px; height: 24px; fill: currentColor; }
.icon-sm { width: 18px; height: 18px; fill: currentColor; }

/* --- NEW HEADER LAYOUT (Matching top part.png) --- */
#main-header-wrapper {
    display: none; /* Hidden on login */
    flex-direction: row;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 100;
    height: 105px; /* Total height of avatar box */
    flex-shrink: 0;
}

/* Left Avatar Section */
.header-avatar-section {
    width: 100px;
    background-color: #e9ecef;
    border-right: 1px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 4px solid #fff; /* White border effect inside */
    box-shadow: inset 0 0 0 1px #ccc; /* Inner border simulation */
}
.avatar-img {
    width: 70px;
    height: 70px;
    fill: #7d848a;
}

/* Right Content Column */
.header-content-col {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Top Blue Bar */
.top-blue-bar {
    background-color: var(--header-bg);
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    color: white;
}
.app-title { font-size: 1.1rem; font-weight: 600; }
.btn-settings {
    background-color: #00c853; /* Bright green from screenshot */
    color: white;
    border: none;
    padding: 5px 15px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 2px;
}
.btn-settings:hover { background-color: #009624; }

/* Bottom White Bar */
.bottom-white-bar {
    background-color: white;
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #dcdcdc;
    justify-content: space-between;
}

/* User Info Group */
.user-info-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-right: 40px;
}
.user-id-text { font-size: 0.85rem; color: #888; margin-bottom: 2px; }
.user-name-text { font-size: 1.1rem; font-weight: 700; color: #002f55; }

/* Actions Group */
.header-actions-group {
    display: flex;
    align-items: center;
    gap: 25px;
    flex: 1;
}
.action-item {
    display: flex; align-items: center; gap: 8px;
    color: #6c757d; font-weight: 500; font-size: 0.95rem;
    cursor: pointer;
}
.action-item:hover { color: #002f55; }
.action-icon { width: 20px; height: 20px; fill: #6c757d; }
.action-item:hover .action-icon { fill: #002f55; }

/* Timer Group */
.timer-group {
    display: flex;
    align-items: center;
    gap: 15px;
}
.timer-text { font-size: 1rem; color: #666; }
.timer-val { font-size: 1.6rem; font-weight: 700; color: #002f55; font-variant-numeric: tabular-nums; }
.btn-eye {
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 36px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #333;
    margin-left: 10px;
}

/* --- VIEWS --- */
#view-login {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--body-bg); z-index: 200;
    display: flex; flex-direction: column;
    overflow-y: auto; 
}
.login-hero {
    background-color: var(--header-bg); /* This restores the blue background */
    padding: 40px 0 80px 0;
    text-align: center;               /* This centers the text again */
    color: white;                     /* This makes the text white */
}
.login-hero h1 { font-size: 1.5rem; font-weight: 600; margin-bottom: 5px; }
.login-hero h2 { font-size: 1.1rem; font-weight: 400; opacity: 0.9; }

.login-card-container {
    flex: 1; display: flex; justify-content: center; margin-top: -50px;
    margin-bottom: 50px;
}
.login-card {
    background: white; padding: 30px; 
    width: 420px;       /* This restores the small card width */
    max-width: 90%;
    border-radius: 4px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); height: fit-content;
}
.form-label { display: block; margin-bottom: 8px; font-weight: 600; color: #495057; font-size: 0.9rem; }
.form-control {
    width: 100%; padding: 10px 12px; border: 1px solid #ced4da; border-radius: 4px;
    font-size: 1rem; color: #495057; margin-bottom: 20px;
}
.captcha-container {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 20px;
}
.captcha-btn {
    background: #e9ecef; border: 1px solid #ced4da; border-radius: 4px;
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #495057;
}
.captcha-display {
    background: #f8f9fa; border: 1px solid #ced4da;
    font-family: monospace; font-weight: bold; font-size: 1.4rem; letter-spacing: 3px;
    padding: 4px 15px; border-radius: 4px; flex: 1; text-align: center;
}
.btn-login {
    width: 100%; background-color: #17a2b8; color: white; border: none; padding: 12px;
    font-size: 1rem; font-weight: 600; border-radius: 4px; cursor: pointer; transition: background 0.2s;
}

/* --- INSTRUCTIONS SCREEN (Updated to match photo) --- */
#view-instructions {
    flex: 1;
    background: white; 
    display: none; 
    justify-content: center; 
    padding-top: 40px; 
    overflow-y: auto;
}
.inst-container { width: 900px; max-width: 95%; }

/* Yellow Box */
.alert-yellow {
    background-color: #fff8e1; /* Lighter yellow */
    color: #795548;
    border: 1px solid #ffe082;
    padding: 15px 20px;
    border-radius: 4px;
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 25px;
}
.btn-tut-start {
    background-color: #e0a800; color: white; border: none;
    padding: 8px 25px; font-weight: bold; border-radius: 4px; cursor: pointer;
    font-size: 0.9rem;
}

/* Green Box */
.alert-green {
    background-color: #dcedc8; /* Lighter green */
    color: #1b5e20;
    border: 1px solid #c5e1a5;
    border-left: 5px solid #2e7d32;
    padding: 20px;
    border-radius: 4px;
    display: flex; gap: 15px; align-items: flex-start;
    margin-bottom: 25px;
}
.alert-green svg { width: 24px; height: 24px; fill: #2e7d32; margin-top: 2px; flex-shrink: 0; }

/* List */
.inst-list { 
    list-style-type: none; 
    padding: 0; 
    margin-bottom: 30px; 
    color: #333; 
    font-size: 0.95rem;
}
.inst-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 12px;
    line-height: 1.6;
}
.inst-list li::before {
    content: "•";
    position: absolute; left: 0; top: 0;
    font-size: 1.2rem; line-height: 1.4rem;
    color: #333;
}

/* Table */
.inst-table { width: 100%; border-collapse: collapse; border: 1px solid #e0e0e0; }
.inst-table th, .inst-table td { border: 1px solid #e0e0e0; padding: 15px; text-align: center; }
.inst-table th { background-color: #f5f5f5; font-weight: 500; color: #555; }
.inst-table td { color: #333; }

/* EXAM VIEW - Updated for Page Scroll */
#view-exam {
    flex: 1; 
    display: none; 
    flex-direction: column; 
    align-items: center; 
    justify-content: flex-start; /* Align to top so it grows down */
    padding: 20px;
    overflow-y: auto; /* Scrollbar moves to this container */
}
.exam-area {
    display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
    gap: 20px; max-width: 1400px;
}
.nav-float {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    cursor: pointer; color: #6c757d; transition: color 0.2s; user-select: none;
}
.nav-float:hover { color: var(--header-bg); }
.nav-circle {
    width: 64px; height: 64px; border-radius: 50%; background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: center; transition: transform 0.1s;
}
.nav-circle:active { transform: scale(0.95); }
.nav-text { font-size: 0.8rem; font-weight: 600; text-align: center; line-height: 1.2; }
.nav-float.disabled { opacity: 0.3; pointer-events: none; }

.q-card {
    flex: 1; 
    /* Change height from auto to 100% so it fits the screen exactly */
    height: 100%; 
    background: white; border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); display: flex; 
    /* Change overflow from visible to hidden. This stops the whole card from growing */
    overflow: hidden; 
    position: relative; border: 1px solid #dee2e6;
}
.q-num-col {
    width: 80px; padding-top: 40px; display: flex; flex-direction: column; align-items: center; flex-shrink: 0;
}
.q-number-big { font-size: 2rem; font-weight: 700; color: #333; margin-bottom: 10px; }
.q-bookmark-icon { cursor: pointer; width: 32px; height: 40px; fill: none; stroke: #adb5bd; stroke-width: 2; }
.q-bookmark-icon.active { fill: var(--header-bg); stroke: var(--header-bg); }

.q-body {
    flex: 1; 
    padding: 40px 40px 40px 0; 
    /* Change overflow to auto to add scrollbar when needed */
    overflow-y: auto; 
    /* Force it to take full height so scrollbar appears correctly */
    height: 100%; 
    display: flex; flex-direction: column;
}
.q-instruction {
    background-color: var(--instruction-bg); border: 1px dashed var(--instruction-border); color: #004085;
    padding: 15px; border-radius: 4px; margin-bottom: 25px; font-size: 0.95rem; line-height: 1.5;
}

.q-text-content {
    font-size: var(--question-font-size);
    font-weight: 600; color: var(--header-bg); margin-bottom: 25px; line-height: 1.5;
}
.layout-split .split-left-pane p {
    font-size: var(--question-font-size);
    line-height: 1.6;
}
.opt-text-val {
    font-size: var(--question-font-size);
    color: #333;
}

.options-container { display: flex; flex-direction: column; gap: 12px; }
.option-row {
    display: flex; align-items: center; cursor: pointer; padding: 6px;
    border-radius: 4px; transition: background 0.1s; border: 1px solid transparent;
}
.option-row:hover { background: #f8f9fa; }
.opt-letter-circle {
    width: 36px; height: 36px; border: 2px solid var(--header-bg); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; color: var(--header-bg);
    margin-right: 15px; flex-shrink: 0; transition: all 0.2s;
}
.option-row.selected .opt-letter-circle { background-color: var(--header-bg); color: white; }

/* REVIEW MODE STYLES */
/* REVIEW MODE STYLES */
.option-row.correct { background-color: #d4edda; border-color: #c3e6cb; }
.option-row.correct .opt-letter-circle { background-color: #28a745; border-color: #28a745; color: white; }

.option-row.wrong { background-color: #f8d7da; border-color: #f5c6cb; }
.option-row.wrong .opt-letter-circle { background-color: #dc3545; border-color: #dc3545; color: white; }

/* --- DARK MODE VISIBILITY FIX --- */
/* Makes backgrounds dark green/red so the light text is visible */
body.dark-mode .option-row.correct { background-color: #1b4e26; border-color: #143a1d; }
body.dark-mode .option-row.wrong { background-color: #5a1a1a; border-color: #411111; }

/* Explanation Box */
.explanation-box {
    margin-top: 25px;
    padding: 20px;
    background: #f1f8f3;
    border-left: 4px solid #28a745;
    border-radius: 4px;
    font-size: 0.95rem;
    color: #2c3e50;
    display: none; 
}
.explanation-box.visible { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.layout-split { 
    display: flex; 
    flex-direction: row; 
    /* Change height to 100% to fill the card */
    height: 100%; 
    width: 100%; 
    /* Remove min-height to prevent forcing overflow */
    min-height: 0; 
}
.split-left-pane {
    flex: 1; padding: 30px; 
    background-color: #fcfcfc; border-right: 1px solid #dee2e6;
    /* Enable independent scrolling for the reading passage */
    overflow-y: auto; 
    color: #212529; 
    /* Ensure height is constrained */
    height: 100%;
}
.split-right-pane {
    flex: 1; padding: 30px; 
    /* Hide overflow here, because the .q-body inside it handles the scroll */
    overflow: hidden; 
    height: 100%;
    display: flex; flex-direction: column;
}

/* Dictionary Tooltip */
.dict-word {
    text-decoration: underline; text-decoration-style: dotted; text-decoration-color: var(--orange-btn);
    cursor: help; position: relative; font-weight: 500;
}
.dict-word:hover::after {
    content: attr(data-meaning);
    position: absolute; bottom: 125%; left: 50%; transform: translateX(-50%);
    background: #2c3e50; color: white; padding: 6px 12px;
    border-radius: 4px; font-size: 0.85rem; white-space: nowrap;
    z-index: 1000; pointer-events: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.dict-word:hover::before {
    content: ''; position: absolute; bottom: 115%; left: 50%; margin-left: -5px;
    border-width: 5px; border-style: solid; border-color: #2c3e50 transparent transparent transparent;
}

/* --- MODALS --- */
.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 500; display: none; align-items: center; justify-content: center;
}
.modal-backdrop.active { display: flex; }
.modal-window {
    background: white; width: 900px; max-width: 95%; border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); display: flex; flex-direction: column; max-height: 90vh;
}
.modal-top {
    padding: 15px 20px; border-bottom: 1px solid #dee2e6; display: flex; justify-content: space-between; align-items: center;
}
.modal-h-title { font-weight: 700; font-size: 1.1rem; color: var(--header-bg); text-transform: uppercase; }
.btn-close-red {
    background: var(--red-btn); color: white; border: none; padding: 6px 12px; font-weight: 600; border-radius: 4px; cursor: pointer;
}
.btn-blue-header {
    background: #17a2b8; /* Blue/Cyan color matching other theme elements */
    color: white;
    border: none;
    padding: 6px 12px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem; /* Match the close button size */
}

.btn-blue-header:hover {
    background: #138496;
}

/* Ensure hidden utility works if not already present */
.hidden {
    display: none !important;
}
.modal-body { padding: 20px; overflow-y: auto; background: #fff; }

.status-header { 
    background: #e9ecef; border: 1px solid #dee2e6; color: #495057; text-align: center;
    padding: 8px; font-weight: 600; margin-bottom: 0; margin-top: 15px;
}
.status-header:first-child { margin-top: 0; }
.tbl-status { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.tbl-status th, .tbl-status td { border: 1px solid #dee2e6; padding: 10px; text-align: center; }
.tbl-status th { background: #f8f9fa; font-weight: 600; }

.rev-controls { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.rev-btn {
    background: white; border: 1px solid #dee2e6; padding: 6px 15px; border-radius: 20px; cursor: pointer; color: #495057; font-size: 0.9rem;
}
.rev-btn:hover { background: #f8f9fa; }
.rev-btn.active { background: #17a2b8; color: white; border-color: #17a2b8; }
.rev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(45px, 1fr)); gap: 8px; }
.rev-cell {
    height: 40px; border: 1px solid #ced4da; border-radius: 4px; display: flex; align-items: center; justify-content: center;
    font-weight: 600; cursor: pointer; color: #495057; position: relative;
}
.rev-cell:hover { border-color: var(--blue-link); }
.rev-cell.active { border: 2px solid var(--red-btn); color: var(--red-btn); }
.rev-cell.answered { background: var(--header-bg); color: white; border-color: var(--header-bg); }
.rev-cell.marked::after {
    content: ''; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; background: orange; border-radius: 50%;
}

/* Review Grid Colors */
.rev-cell.is-correct { background-color: #28a745 !important; border-color: #28a745 !important; color: white !important; }
.rev-cell.is-wrong { background-color: #dc3545 !important; border-color: #dc3545 !important; color: white !important; }

.finish-warning {
    background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb;
    padding: 15px; border-radius: 4px; display: flex; gap: 15px; align-items: flex-start; margin-bottom: 20px;
}
.finish-box { border: 1px solid #dee2e6; padding: 20px; border-radius: 4px; }
.finish-label { background: #e9ecef; display: block; padding: 10px; font-weight: 600; margin: -20px -20px 20px -20px; border-bottom: 1px solid #dee2e6; }

/* Sidebar Settings */
.settings-panel {
    position: fixed; top: 0; right: -320px; width: 320px; height: 100%;
    background: white; box-shadow: -5px 0 15px rgba(0,0,0,0.1); z-index: 600;
    padding: 20px; transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex; flex-direction: column;
}
.settings-panel.open { right: 0; }
.st-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.st-title { font-weight: 700; color: var(--header-bg); font-size: 1.1rem; }
.st-group { margin-bottom: 30px; }
.st-label { display: block; margin-bottom: 10px; color: #495057; font-weight: 500; font-size: 0.95rem; }
.lang-opt {
    display: block; width: 100%; text-align: center; padding: 10px; border: 1px solid #dee2e6; background: #f8f9fa; margin-bottom: 5px;
    cursor: pointer; border-radius: 4px; font-weight: 500;
}
.lang-opt.selected { background: #28a745; color: white; border-color: #28a745; }
.font-resize { display: flex; border: 1px solid #dee2e6; border-radius: 4px; overflow: hidden; }
.font-btn { flex: 0 0 50px; border: none; background: #e9ecef; cursor: pointer; font-size: 1.2rem; font-weight: bold; }
.font-val { flex: 1; text-align: center; padding: 8px; font-weight: bold; font-size: 1.2rem; border-left: 1px solid #dee2e6; border-right: 1px solid #dee2e6; }

.hidden { display: none !important; }
/* --- USER HIGHLIGHTER --- */
.user-highlight {
    background-color: #ffeb3b; /* Yellow */
    color: #000 !important;    /* Force text black so it's readable in Dark Mode */
    cursor: pointer;
}
/* =========================================
   MOBILE / RESPONSIVE VIEW ADJUSTMENTS
   ========================================= */
@media (max-width: 992px) {
    /* --- CRITICAL SCROLLING FIXES --- */
    html, body {
        overflow-y: auto !important; /* Force browser scrollbar */
        height: auto !important;
        min-height: 100vh;
        overflow-x: hidden; /* Prevent horizontal wobble */
    }

    /* FIX: Remove 'display: flex' here so it stays hidden (none) until JS enables it */
    #view-exam {
        height: auto !important;
        overflow: visible !important;
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 10px;
        padding-bottom: 50px;
    }

    /* --- FLEX LAYOUT FOR EXAM AREA (Card Top, Buttons Bottom) --- */
    .exam-area {
        height: auto !important;
        overflow: visible !important;
        display: flex;
        flex-direction: row; /* Allow row layout for wrapping */
        flex-wrap: wrap;     /* Allow items to wrap to next line */
        width: 100%;
        max-width: 100%;
        gap: 10px;           /* Gap between buttons */
        justify-content: space-between;
    }

    /* 1. Question Card takes full top row */
    #q-card {
        order: 1;
        width: 100%;
        margin-bottom: 5px;
        height: auto !important;
        flex: 0 0 100%;
    }

    /* 2. Previous Button (Left) */
    #btn-prev {
        order: 2;
        width: 48%; /* Almost half width */
        flex: 0 0 48%;
        margin: 0;
        float: none; /* Disable floats */
    }

    /* 3. Next Button (Right) */
    #btn-next {
        order: 3;
        width: 48%; /* Almost half width */
        flex: 0 0 48%;
        margin: 0;
        float: none; /* Disable floats */
    }

    /* Button Styling */
    .nav-float {
            position: static; 
        }
    .nav-circle {
        width: 30px; height: 30px; margin-right: 8px; 
        box-shadow: none; border: 1px solid #eee;
    }
    .nav-text br { 
        display: block; /* Forces the break to happen */
        content: "";    /* Ensures it renders */
        margin-top: 2px;
    }
    .nav-text {
        font-size: 0.75rem; /* Optional: Make text slightly smaller to fit better */
        line-height: 1.1;   /* Tighten the line height slightly */
    }
    /* --- REST OF MOBILE STYLES --- */

    /* Header */
    #main-header-wrapper {
        height: auto; 
        flex-direction: column;
        position: relative;
    }
    .header-avatar-section { display: none; }
    .top-blue-bar { padding: 10px; }
    .bottom-white-bar {
        height: auto;
        flex-direction: column;
        padding: 10px 15px;
        gap: 15px;
    }
    .user-info-group {
        margin-right: 0;
        text-align: center;
        width: 100%;
        border-bottom: 1px solid #eee;
        padding-bottom: 10px;
    }
    .header-actions-group { width: 100%; justify-content: space-around; }
    .action-item span { display: none; } 
    .action-item svg { width: 28px; height: 28px; }
    .timer-group {
        width: 100%; justify-content: center; background: #f8f9fa;
        padding: 8px; border-radius: 4px; margin-top: 5px;
    }

    /* Login & Instructions */
    #view-login { 
        overflow-y: auto; 
        height: auto; 
        min-height: 100vh;
        position: relative; 
    }
    
    .login-hero {
        padding: 60px 20px 100px 20px; 
        /* Do NOT put background-color here, so it keeps the desktop blue */
    }
    
    .login-card-container {
        display: block; 
        margin-top: 0;
    }

    .login-card { 
        width: 90%; /* This makes it wide ONLY on mobile */
        margin: 0 auto 50px auto; 
        position: relative;
        top: -60px; 
    }
    
    .nav-float {
        position: static; 
    }
    
    /* Question Card Internals */
    .q-card {
        flex-direction: column; 
        overflow: visible !important;
        background: white;
    }
    .q-num-col {
        width: 100%; height: 50px; flex-direction: row;
        justify-content: space-between; padding: 0 20px;
        background-color: #f1f3f5; border-bottom: 1px solid #dee2e6;
    }
    .q-number-big { font-size: 1.4rem; margin-bottom: 0; margin-top: 0; }
    .q-bookmark-icon { width: 24px; height: 30px; }
    .q-body {
        padding: 20px;
        height: auto !important;
        overflow: visible !important;
    }

    /* Split View (Paragraph Questions) */
    .layout-split { flex-direction: column; height: auto !important; }
    .split-left-pane {
        height: auto; max-height: 350px; overflow-y: auto; 
        border-right: none; border-bottom: 5px solid #e9ecef; padding: 15px;
    }
    .split-right-pane {
        padding: 0; flex: 1; height: auto !important; overflow: visible !important;
    }
    .split-right-pane .q-num-col { display: flex; }
    
    .split-right-pane > div {
    flex-direction: column !important;
    height: auto !important;}

    .split-right-pane .q-body {
    padding-top: 20px !important; /* Overrides the inline JS style */
}

    /* Mobile Dark Mode Overrides */
    body.dark-mode .bottom-white-bar { background-color: #1a1a1a; border-color: #333; }
    body.dark-mode .user-info-group { border-color: #333; }
    body.dark-mode .timer-group { background-color: #2c2c2c; }
    body.dark-mode .nav-float { background-color: #1e1e1e; border-color: #333; }
    body.dark-mode .q-num-col { background-color: #263238; border-color: #333; }
    body.dark-mode .split-left-pane { border-bottom-color: #333; }
    body.dark-mode .q-card { box-shadow: none; }
    body.dark-mode .user-highlight { color: #000 !important; background-color: #ffeb3b; }
    
    /* Modals & Settings */
    .modal-window { width: 95%; height: 90%; }
    .rev-grid { grid-template-columns: repeat(5, 1fr); }
    .settings-panel { width: 100%; right: -100%; }

    /* 1. Make Toolbar Sticky & Horizontal Scrollable */
    .note-toolbar {
        position: sticky;       /* Stays at top of screen while scrolling */
        top: 0;                 
        z-index: 1000;          /* Ensure it sits above question text */
        overflow-x: auto;       /* Enable horizontal scrolling for tools */
        white-space: nowrap;    /* Keep buttons in one single row */
        padding: 10px;
        gap: 15px;              /* More space between groups */
        justify-content: flex-start; /* Align left to allow scrolling */
        background: #fff;
        border-bottom: 2px solid #007bff; /* Visual indicator of active mode */
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        
        /* Hide scrollbar for cleaner look but keep functionality */
        -ms-overflow-style: none;  /* IE and Edge */
        scrollbar-width: none;  /* Firefox */
    }
    
    /* Hide scrollbar for Chrome/Safari/Opera */
    .note-toolbar::-webkit-scrollbar {
        display: none;
    }

    /* 2. Prevent Groups from Shrinking */
    .nt-group {
        flex-shrink: 0; 
    }

    /* 3. Larger Touch Targets */
    .nt-btn {
        width: 44px;    /* Bigger buttons for fingers */
        height: 44px;
    }
    .nt-btn svg {
        width: 24px;    /* Bigger icons */
        height: 24px;
    }

    /* 4. Color Swatches Optimization */
    .nt-color {
        width: 34px;    /* Bigger color dots */
        height: 34px;
        margin: 0 2px;
    }

    /* 5. Slider Adjustment */
    .nt-slider {
        width: 100px;   /* Wider slider for easier control */
        height: 20px;   /* Taller touch area */
    }

    /* 6. Close Button Visibility */
    .nt-btn-close {
        padding: 0 15px;
        font-size: 1.5rem;
        font-weight: bold;
    }
    
    /* 7. Hide the 'Text' label on the Close button to save space if needed */
    /* Optional: Uncomment if you want to save more space */
    /* .nt-btn-text { font-size: 0.8rem; padding: 8px; } */

    /* 8. Ensure Canvas doesn't block scrolling when NOT drawing */
    /* (This interacts with the JS touch logic) */
    .note-canvas {
        touch-action: none; /* Critical: tells browser the canvas handles touches, preventing page scroll while drawing */
    }
}

/* --- MOBILE RESULT VIEW OPTIMIZATION --- */
@media (max-width: 992px) {
    
    /* 1. Container Spacing */
    #view-results {
        padding: 15px 10px; /* Reduce padding */
    }
    .res-container {
        width: 100%;
        margin-bottom: 60px; /* Space for scrolling */
    }

    /* 2. TRANSFORM SUMMARY TABLE INTO CARDS (Dashboard Style) */
    /* This hides the header and turns rows into a flexible grid */
    .res-summ-table, .res-summ-table tbody, .res-summ-table tr {
        display: block;
        width: 100%;
        border: none;
    }
    
    .res-summ-table thead {
        display: none; /* Hide standard headers */
    }

    .res-summ-table tr {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        background: transparent;
        padding: 0;
        border: none;
    }

    .res-summ-table td {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: #fff;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        padding: 15px 5px;
        margin: 0;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    /* --- REORDER CELLS FOR MOBILE DASHBOARD --- */
    
    /* 1. Test Name (Hide borders/bg, make it a header) */
    .res-summ-table td:nth-child(1) { 
        width: 100%; 
        background: transparent; 
        border: none; 
        box-shadow: none;
        font-size: 1.1rem; 
        padding: 5px;
        margin-bottom: 10px;
        text-decoration: underline;
    }

    /* 2. Score (Make it HUGE and at the top) */
    .res-summ-table td:nth-child(6) { 
        order: 2; 
        width: 100%; 
        background: #e3f2fd; /* Light blue bg */
        border-color: #90caf9;
        margin-bottom: 10px;
    }
    /* Label for Score */
    .res-summ-table td:nth-child(6)::before { 
        content: "PUANINIZ"; 
        font-size: 0.8rem; color: #555; font-weight: 700; margin-bottom: 5px; 
    }

/* 3. Stats Grid (All 4 in One Line) */
    
    /* Reduce the gap so they fit */
    .res-summ-table tr {
        gap: 5px; 
    }

    /* Target all 4 stat boxes together */
    .res-summ-table td:nth-child(2), /* Total */
    .res-summ-table td:nth-child(3), /* Correct */
    .res-summ-table td:nth-child(4), /* Wrong */
    .res-summ-table td:nth-child(5)  /* Empty */ 
    { 
        order: 3;       /* Group them below the score */
        flex: 1;        /* Force them to share space equally */
        width: auto;    /* Override fixed percentage widths */
        min-width: 0;   /* Allow them to shrink if needed */
        padding: 10px 2px; /* Reduce side padding to save space */
    }

    /* Make the labels smaller so they don't break lines */
    .res-summ-table td:nth-child(2)::before,
    .res-summ-table td:nth-child(3)::before,
    .res-summ-table td:nth-child(4)::before,
    .res-summ-table td:nth-child(5)::before { 
        font-size: 0.65rem; 
        white-space: nowrap; /* Prevent label wrapping */
    }
    
    /* Adjust the number size slightly for balance */
    .res-num {
        font-size: 1rem;
    }

    /* Add Labels to stats via CSS */
    .res-summ-table td:nth-child(2)::before { content: "Toplam"; font-size: 0.7rem; color: #777; margin-bottom: 2px; }
    .res-summ-table td:nth-child(3)::before { content: "Doğru";  font-size: 0.7rem; color: #777; margin-bottom: 2px; }
    .res-summ-table td:nth-child(4)::before { content: "Yanlış"; font-size: 0.7rem; color: #777; margin-bottom: 2px; }
    .res-summ-table td:nth-child(5)::before { content: "Boş";    font-size: 0.7rem; color: #777; margin-bottom: 2px; }

    /* 4. Action Button (Review) */
    .res-summ-table td:nth-child(7) { 
        order: 7; 
        width: 100%; 
        background: transparent; 
        border: none; 
        box-shadow: none; 
        padding: 0; 
        margin-top: 10px;
    }
    .btn-res-review {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
    }

    /* 3. DETAILED RESULTS TABLE OPTIMIZATION */
    .res-detail-table th, .res-detail-table td {
        padding: 8px 4px;
        font-size: 0.85rem; /* Smaller font */
    }
    /* Hide the "Durum" column text if it's too cramped, relying on color */
    /* Optional: Uncomment below if needed */
    /* .res-detail-table td:nth-child(4) { font-size: 0.75rem; } */

    /* 4. BOTTOM ACTION BUTTONS */
    #view-results .btn-login {
        width: 100%;
        margin-top: 10px;
        margin-left: 0 !important; /* Override inline styles */
        margin-right: 0 !important;
        display: flex;
        justify-content: center;
    }

    /* --- MOBILE DARK MODE ADJUSTMENTS --- */
    body.dark-mode .res-summ-table td {
        background: #2c2c2c;
        border-color: #444;
    }
    body.dark-mode .res-summ-table td:nth-child(6) {
        background: #0d2b42; /* Dark blue for score */
        border-color: #1c4b6e;
    }
    body.dark-mode .res-summ-table td::before {
        color: #bbb; /* Light text for labels */
    }
}
/* --- UPDATED LOGIN SCREEN STYLES --- */

/* 1. Test Selector (Radio Button Style) */
/* --- DROPDOWN STYLE TEST SELECTOR --- */

.test-dropdown-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.test-btn-trigger {
    background: #f8f9fa;
    border: 1px solid #ced4da;
    padding: 12px 15px;
    border-radius: 4px;
    font-size: 1rem;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    width: 100%;
    transition: border-color 0.2s;
}

.test-btn-trigger:hover {
    border-color: #007bff;
}

/* The Hidden Menu */
.test-custom-menu {
    position: absolute;
    top: 100%; /* Opens downwards */
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: none;
    flex-direction: column;
    z-index: 200; /* Higher than other elements */
    margin-top: 5px;
    max-height: 200px; /* Scrollable if too many tests */
    overflow-y: auto;
}

.test-custom-menu.show {
    display: flex;
}

.test-custom-option {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
    font-size: 0.95rem;
    color: #333;
    text-align: left;
    transition: background 0.1s;
}

.test-custom-option:last-child { border-bottom: none; }
.test-custom-option:hover { background-color: #f8f9fa; color: #007bff; }

/* Highlight the current page's test */
.test-custom-option.selected {
    background-color: #e3f2fd;
    color: #007bff;
    font-weight: 600;
}

/* 2. Custom Language Dropdown (Separate from Settings) */
.lang-wrapper-relative {
    position: relative;
    margin-top: 25px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.lang-btn-trigger {
    background: #f8f9fa;
    border: 1px solid #ced4da;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 0.95rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    min-width: 160px;
    justify-content: space-between;
}

.lang-custom-menu {
    position: absolute;
    top: 100%;       /* CHANGED: Opens downwards */
    bottom: auto;    /* CHANGED: Reset bottom property */
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    width: 160px;
    display: none;
    flex-direction: column;
    margin-top: 5px; /* CHANGED: Add space at top instead of bottom */
    z-index: 100;
}
.lang-custom-menu.show {
    display: flex;
}

.lang-custom-option {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
    font-size: 0.9rem;
    text-align: left;
}
.lang-custom-option:last-child { border-bottom: none; }
.lang-custom-option:hover { background-color: #f8f9fa; color: #007bff; }
.lang-custom-option.selected { font-weight: bold; color: #007bff; background-color: #e3f2fd; }

/* === RESULTS VIEW STYLES === */
#view-results {
    flex: 1;
    background-color: #eef1f5; /* Match screenshot bg */
    padding: 40px 20px;
    overflow-y: auto;
    align-items: center;
    flex-direction: column;
}

.res-container { width: 100%; max-width: 900px; }

.res-header-msg {
    background-color: #cce5f6;
    border: 1px solid #b8daff;
    color: #004085;
    padding: 20px;
    text-align: center;
    font-weight: 600;
    font-size: 1.3rem;
    border-radius: 4px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.res-summ-box {
    background: #e2e6ea;
    border: 1px solid #d6d8db;
    border-radius: 4px;
    overflow: hidden;
}

.res-summ-title {
    padding: 15px;
    text-align: center;
    font-weight: 700;
    color: #495057;
    border-bottom: 1px solid #d6d8db;
    background: #e9ecef;
}

.res-summ-table {
    width: 100%;
    border-collapse: collapse;
    background: #e2e6ea;
}
.res-summ-table th, .res-summ-table td {
    padding: 15px;
    text-align: center;
    border: 1px solid #d6d8db;
    color: #333;
}
.res-summ-table th { font-weight: 600; color: #495057; }
.res-num { font-weight: 700; font-size: 1.3rem; }

.btn-res-review {
    background-color: #17a2b8;
    color: white;
    border: none;
    padding: 8px 25px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
}
.btn-res-review:hover { background-color: #138496; }

/* Detailed Result Table */
.res-detail-table-wrap {
    max-height: 500px;
    overflow-y: auto;
}
.res-detail-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}
.res-detail-table th {
    position: sticky; top: 0;
    background: #e9ecef;
    padding: 12px;
    border: 1px solid #dee2e6;
    font-weight: 600;
}
.res-detail-table td {
    padding: 12px;
    text-align: center;
    border: 1px solid #dee2e6;
    font-weight: 500;
}
/* Row Colors based on result */
.res-row-correct { background-color: #d4edda; color: #155724; }
.res-row-wrong { background-color: #f8d7da; color: #721c24; }
.res-row-empty { background-color: #fff; color: #818182; }


/* === VIRTUAL KEYBOARD STYLES === */
#virtual-keyboard {
    position: fixed;
    bottom: -400px; /* Hidden by default */
    left: 50%;
    transform: translateX(-50%);
    background: #333; /* Dark bg as per image_1.png */
    padding: 15px;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: bottom 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#virtual-keyboard.active {
    bottom: 0;
}

.vk-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.vk-btn {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    font-weight: bold;
    border: 1px solid #555;
    border-radius: 6px;
    cursor: pointer;
    background: #444;
    color: white;
    transition: background 0.1s;
}
.vk-btn:active { background: #666; }

/* Action buttons (Clear, Delete) */
.vk-act { background: #555; font-size: 1rem; width: auto; flex: 1; }

/* OK Button */
.vk-ok { 
    background: #28a745; 
    border: 1px solid #28a745; 
    font-size: 1rem; 
    flex: 1.5; 
}
.vk-ok:active { background: #1e7e34; }

/* Mobile adjustment for Results view */
@media (max-width: 992px) {
     .res-summ-table th, .res-summ-table td { padding: 10px 5px; font-size: 0.9rem; }
     .res-num { font-size: 1.1rem; }
}

/* --- DARK MODE FOR RESULTS VIEW --- */

/* 1. Main Background */
body.dark-mode #view-results {
    background-color: #121212;
    color: #e0e0e0;
}

/* 2. Top Message Box (Success/Finish Msg) */
body.dark-mode .res-header-msg {
    background-color: #0d2b42; /* Dark blue background */
    border-color: #1c4b6e;
    color: #b8daff;
}

/* 3. Summary Box & Table Containers */
body.dark-mode .res-summ-box {
    background-color: #1e1e1e;
    border-color: #444;
}

body.dark-mode .res-summ-title {
    background-color: #2c2c2c;
    border-bottom-color: #444;
    color: #e0e0e0;
}

/* 4. Summary Table Cells */
body.dark-mode .res-summ-table {
    background-color: #1e1e1e;
}
body.dark-mode .res-summ-table th {
    background-color: #2c2c2c;
    color: #fff;
    border-color: #444;
}
body.dark-mode .res-summ-table td {
    color: #e0e0e0;
    border-color: #444;
}

/* 5. Detailed Answers Table */
body.dark-mode .res-detail-table {
    background-color: #1e1e1e;
}
body.dark-mode .res-detail-table th {
    background-color: #2c2c2c;
    border-color: #444;
    color: #fff;
}
body.dark-mode .res-detail-table td {
    border-color: #444;
}

/* 6. Result Rows (Correct/Wrong/Empty) */
/* We need darker colors so white text is readable */
body.dark-mode .res-row-correct {
    background-color: #1b4e26 !important; /* Dark Green */
    color: #d4edda !important;
}
body.dark-mode .res-row-wrong {
    background-color: #5a1a1a !important; /* Dark Red */
    color: #f8d7da !important;
}
body.dark-mode .res-row-empty {
    background-color: #333 !important;    /* Dark Gray */
    color: #aaa !important;
}

/* 7. "Back to Results" Button (Blue Header Button) */
body.dark-mode .btn-blue-header {
    background-color: #006064; /* Darker Cyan */
    color: #e0f7fa;
}
body.dark-mode .btn-blue-header:hover {
    background-color: #00838f;
}

/* 8. Fix for the "Review" button inside the results table */
body.dark-mode .btn-res-review {
    background-color: #006064;
    color: #ffffff;
}
body.dark-mode .btn-res-review:hover {
    background-color: #00838f;
}

/* --- DARK MODE FOR EXPLANATION BOX --- */
body.dark-mode .explanation-box {
    background-color: #0d2b10; /* Very dark green background */
    color: #e0e0e0;            /* Light grey text for readability */
    border-left: 4px solid #2ea043; /* Bright green accent line */
    border-top: 1px solid #1b4e26;
    border-right: 1px solid #1b4e26;
    border-bottom: 1px solid #1b4e26;
}

/* Optional: Adjust the "Correct Answer" text inside the box if it has specific colors */
body.dark-mode .explanation-box strong {
    color: #fff;
}

/* --- DARK MODE FOR FINISH EXAM MODAL --- */

/* 1. The Warning Box (Red Alert) */
body.dark-mode .finish-warning {
    background-color: #2c0b0e; /* Dark red background */
    color: #f1b0b7;            /* Light red/pink text */
    border-color: #58151c;     /* Darker red border */
}
/* Ensure the icon inside the warning box is visible */
body.dark-mode .finish-warning svg {
    fill: #e4606d !important;
}

/* 2. The Bottom Confirmation Box */
body.dark-mode .finish-box {
    border-color: #444;
    background-color: #1e1e1e;
    color: #ddd;
}

/* 3. "Sınavı Sonlandır" Label inside the box */
body.dark-mode .finish-label {
    background-color: #333;
    color: #fff;
    border-bottom-color: #444;
}

/* --- DARK MODE FOR TEST SELECTOR (LOGIN & REVIEW SCREENS) --- */

/* 1. The Dropdown Trigger Button */
body.dark-mode .test-btn-trigger {
    background-color: #1e1e1e;
    border-color: #444;
    color: #e0e0e0;
}
body.dark-mode .test-btn-trigger:hover {
    border-color: #007bff; /* Keep blue hover for visibility */
}
/* Fix the arrow icon inside the trigger */
body.dark-mode .test-btn-trigger svg {
    fill: #e0e0e0 !important;
}

/* 2. The Dropdown Menu List */
body.dark-mode .test-custom-menu {
    background-color: #1e1e1e;
    border-color: #444;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5); /* Darker shadow */
}

/* 3. Individual Options */
body.dark-mode .test-custom-option {
    border-bottom-color: #333;
    color: #b0b0b0;
}
body.dark-mode .test-custom-option:hover {
    background-color: #333;
    color: #fff;
}

/* 4. Selected Option */
body.dark-mode .test-custom-option.selected {
    background-color: #0d47a1; /* Dark blue background */
    color: #fff;
}
/* Subtext inside options */
body.dark-mode .test-custom-option div {
    color: #888 !important; /* Dim the sub-text */
}

/* --- PDF GENERATION STYLES --- */

/* Hide specific buttons when the 'is-printing' class is active */
body.is-printing .btn-login, 
body.is-printing .btn-res-review {
    display: none !important;
}

/* Ensure background colors print correctly */
body.is-printing .res-summ-title,
body.is-printing .res-header-msg {
    -webkit-print-color-adjust: exact; 
    print-color-adjust: exact;
}

/* Force text color to black for PDF readability if in Dark Mode */
body.is-printing .res-summ-box,
body.is-printing .res-summ-table th,
body.is-printing .res-summ-table td,
body.is-printing .res-detail-table th,
body.is-printing .res-detail-table td {
    color: #000 !important;
    border-color: #ccc !important;
    background-color: #fff !important;
}
/* --- PDF GENERATION STYLES (Additional Fixes) --- */

/* 1. Hide the top "Success/Past Get" message and buttons */
body.is-printing .res-header-msg,
body.is-printing .btn-login, 
body.is-printing .btn-res-review {
    display: none !important;
}

/* 2. CRITICAL FIX: Expand the table to show ALL 80 questions */
body.is-printing .res-detail-table-wrap {
    max-height: none !important;   /* Remove the 500px limit */
    height: auto !important;        /* Allow it to grow infinitely */
    overflow: visible !important;   /* Remove the scrollbar */
    display: block !important;
}

/* 3. Style adjustments for a cleaner PDF */
body.is-printing .res-container {
    max-width: 100% !important;     /* Use full A4 width */
    width: 100% !important;
    margin: 0 !important;
}

/* --- SCROLLBAR STYLING --- */

.q-body::-webkit-scrollbar,
.split-left-pane::-webkit-scrollbar {
  width: 8px;
}

/* Track */
.q-body::-webkit-scrollbar-track,
.split-left-pane::-webkit-scrollbar-track {
  background: #f1f1f1; 
}
 
/* Handle */
.q-body::-webkit-scrollbar-thumb,
.split-left-pane::-webkit-scrollbar-thumb {
  background: #ccc; 
  border-radius: 4px;
}

/* Handle on hover */
.q-body::-webkit-scrollbar-thumb:hover,
.split-left-pane::-webkit-scrollbar-thumb:hover {
  background: var(--header-bg); 
}

/* --- DYNAMIC BLANK FILLER STYLE --- */
.filled-blank {
    color: var(--red-btn); /* Red text */
    font-weight: bold;
    padding: 0 4px;
}

/* Ensure it looks good in dark mode */
body.dark-mode .filled-blank {
    color: #ff6b6b; /* Lighter red for dark mode contrast */
}

.active-cloze {
    color: var(--red-btn) !important;
    font-weight: bold;
}
/* Slider Style */
.nt-slider {
    width: 80px;
    cursor: pointer;
}

/* Specific style for the White color button so it is visible on white background */
.nt-color.white-btn {
    border: 1px solid #ccc; /* Light grey border */
}
/* Ensure the selected ring is visible for white button */
.nt-color.white-btn.selected {
    box-shadow: 0 0 0 2px #333; /* Darker ring when selected */
    border-color: transparent;
}