:root {
    --primary: #6366f1;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --secondary: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --correct: #10b981;
    --correct-bg: #ecfdf5;
    --incorrect: #f43f5e;
    --incorrect-bg: #fff1f2;
    --warning: #f59e0b;
    --border: #e2e8f0;
    --star-gold: #fbbf24;
    --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
    --transition: all 0.25s ease-in-out;
    --math-font: 'Georgia', 'Cambria', serif;
    --reveal-green: #047857;
}

.physics-quiz-page {
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

.top-controls {
    position: relative;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 15px;
    z-index: 100;
}

.home-btn {
    padding: 8px 14px;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 10px;
}

.card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    margin-top: 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: var(--transition);
}

#quiz-container.card { 
    padding: 24px 30px; 
    max-width: 900px; 
    margin: 10px auto; 
    min-height: 580px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.setup-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.setup-header h2 { margin: 0; font-weight: 700; font-size: 1.5em; }

/* 4-COLUMN SETUP GRID */
.setup-columns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.setup-column { display: flex; flex-direction: column; gap: 10px; }
.settings-group { background: #ffffff; padding: 10px; border-radius: 12px; border: 1px solid var(--border); box-sizing: border-box; }
.settings-group .title-label { font-weight: 600; display: block; margin-bottom: 6px; font-size: 0.9em; }
.settings-group-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.settings-group-header .title-label { margin-bottom: 0; }
.options-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }

.toggle-label, .simple-checkbox-label {
    display: flex; align-items: flex-start; cursor: pointer; padding: 6px 8px;
    border-radius: 8px; border: 2px solid transparent; background: var(--secondary);
    font-size: 0.82em; margin: 0; box-sizing: border-box; transition: var(--transition);
    line-height: 1.3;
}
.toggle-label input[type="radio"] { display: none; }
.simple-checkbox-label input[type="checkbox"], .simple-checkbox-label input[type="radio"] { display: inline-block; width: 14px; height: 14px; margin-right: 6px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }

.toggle-label:hover, .simple-checkbox-label:hover { background: #eef2ff; }
.toggle-label:has(input:checked), .simple-checkbox-label:has(input:checked) { background: #eef2ff; border-color: var(--primary); }
.toggle-label:has(input:checked) span, .simple-checkbox-label:has(input:checked) span { color: var(--primary); font-weight: 500; }

input[type="number"], input[type="text"], select.setup-select { padding: 6px 10px; font-size: 0.85em; border: 2px solid var(--border); border-radius: 8px; width: 100%; outline: none; background: var(--secondary); font-weight: 500; box-sizing: border-box; transition: var(--transition); }
input[type="number"]:focus, input[type="text"]:focus, select.setup-select:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }

.quiz-header, .quiz-subheader { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-shrink: 0; }

.star-symbol { color: var(--star-gold); font-size: 1.3em; display: inline-block; line-height: 1; transform: translateY(1px); }
.difficulty-stars { font-size: 1.3em; letter-spacing: 2px; line-height: 1; }
.star-active { color: var(--star-gold); }
.star-inactive { color: var(--border); }

.star-counter { font-size: 1.05em; font-weight: 700; padding: 6px 14px; border-radius: 12px; border: 1px solid rgba(251, 191, 36, 0.4); display: inline-flex; align-items: center; gap: 8px; background: #fff; position: relative; }
.star-counter.bump { animation: starBump 0.3s ease-out; }
@keyframes starBump { 0% { transform: scale(1); } 50% { transform: scale(1.15); box-shadow: 0 0 15px rgba(251, 191, 36, 0.6); } 100% { transform: scale(1); } }

.progress-container { width: 100%; background-color: var(--border); border-radius: 10px; height: 6px; margin-bottom: 12px; overflow: hidden; flex-shrink: 0; }
.progress-bar { height: 100%; background: var(--primary-gradient); width: 0%; border-radius: 10px; transition: width 0.4s ease; }
.progress-text { font-weight: 500; font-size: 0.85em; }

.in-quiz-settings { display: flex; gap: 10px; background: var(--secondary); padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); align-items: center; flex-wrap: wrap; }
.mini-toggle { display: flex; align-items: center; cursor: pointer; gap: 6px; }
.mini-toggle input { display: none; }
.mini-toggle .slider { width: 28px; height: 16px; background: #cbd5e1; border-radius: 20px; position: relative; transition: var(--transition); }
.mini-toggle .slider::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; background: white; border-radius: 50%; transition: var(--transition); }
.mini-toggle input:checked + .slider { background: var(--primary); }
.mini-toggle input:checked + .slider::after { transform: translateX(12px); }
.mini-toggle .label-text { font-size: 0.75em; font-weight: 600; color: var(--text-muted); transition: font-size 0.2s ease; }

.question-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-shrink: 0; }
.question-topic-badge { background: #eef2ff; color: var(--primary); padding: 4px 12px; border-radius: 12px; font-size: 0.75em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

.formula-hint-box { display: none; background: #eef2ff; border: 1px dashed var(--primary); color: #3730a3; padding: 12px; border-radius: 10px; margin-bottom: 12px; text-align: center; font-size: 1em; box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.1); flex-shrink: 0; animation: fadeIn 0.3s ease-out; }
.formula-hint-box.visible { display: block; }
.formula-hint-box .sym { font-family: var(--math-font); font-style: italic; font-weight: 600; font-size: 1.2em; color: var(--primary); display: block; margin-top: 4px; letter-spacing: 0.5px; }

#question-content {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    animation: fadeIn 0.35s ease-out;
}

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

.question-text { 
    font-size: 1.1em; 
    font-weight: 600; 
    margin-bottom: 20px; 
    color: var(--text-main);
    min-height: 52px;
}

.options-container { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 12px;
    margin-top: auto;
    min-height: 110px;
}

.option-label { display: flex; align-items: center; cursor: pointer; padding: 14px; border: 2px solid var(--border); border-radius: 10px; transition: var(--transition); font-size: 0.95em; background-color: #fff; color: var(--text-muted); user-select: none; box-sizing: border-box; }
.option-label strong { margin-right: 8px; color: var(--text-main); font-size: 1.05em; }
.option-label:hover:not(.locked) { background: #f8fafc; border-color: #cbd5e1; transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.option-label.selected:not(.locked) { background: #eef2ff; border-color: var(--primary); color: var(--primary); }
.option-label.selected:not(.locked) strong { color: var(--primary); }
.option-label.locked { cursor: default; opacity: 0.8; }
.option-label.show-correct { background: var(--correct-bg); border-color: var(--correct); color: #065f46; transform: none; box-shadow: none; }
.option-label.show-correct strong { color: #065f46; }
.option-label.show-incorrect { background: var(--incorrect-bg); border-color: var(--incorrect); color: #9f1239; transform: none; box-shadow: none;}
.option-label.show-incorrect strong { color: #9f1239; }

input[type="radio"].quiz-radio { display: none; }

/* Specific input for worksheet checkboxes */
input[type="checkbox"].quiz-tickbox {
    display: inline-block;
    width: 28px;
    height: 28px;
    margin-right: 14px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.hide-working .math-working { display: none; }

.typed-calc-wrapper {
    margin-top: auto;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.calc-input-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #ffffff;
    border: 2px solid var(--border);
    border-radius: 12px;
    transition: var(--transition);
}

.calc-input-box label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 1em;
}

.calc-input-box input {
    font-size: 1.1em;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: var(--secondary);
    font-weight: 600;
}

.calc-input-box input:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.calc-input-box .unit-tag {
    font-weight: 700;
    font-size: 1.05em;
    color: var(--text-muted);
}

.calc-feedback-msg {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.95em;
    font-weight: 600;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.calc-feedback-msg.show-correct {
    display: block;
    background: var(--correct-bg);
    color: #065f46;
    border: 1px solid var(--correct);
}

.calc-feedback-msg.show-incorrect {
    display: block;
    background: var(--incorrect-bg);
    color: #9f1239;
    border: 1px solid var(--incorrect);
}

/* EXAM MODE SPECIFIC STYLES */
.exam-mode-active #quiz-container {
    background: #ffffff !important;
    border: 2px solid #000000 !important;
    border-radius: 4px !important;
    color: #000000 !important;
    box-shadow: none !important;
    font-family: 'Arial', 'Helvetica Neue', Helvetica, sans-serif !important;
}

.exam-mode-active #star-counter,
.exam-mode-active .difficulty-stars { display: none !important; }

.exam-header-banner { border-bottom: 2px solid #000000; padding-bottom: 6px; margin-bottom: 12px; flex-shrink: 0; }
.exam-header-banner h2 { font-size: 1.2em; font-weight: bold; color: #000; margin: 0; text-transform: none; }
.exam-header-banner p { font-size: 0.85em; color: #333; margin: 2px 0 0 0; font-style: italic; }

.exam-question-body { color: #000000; font-size: 1.05em; line-height: 1.5; margin-bottom: 10px; min-height: 48px; }
.exam-mark-allocation { text-align: right; font-weight: bold; font-size: 0.9em; color: #000; margin: 5px 0 10px 0; flex-shrink: 0; }

.exam-lines-container { position: relative; margin: 10px 0; height: 152px; flex-shrink: 0; }
.exam-line { border-bottom: 1px dotted #555; height: 38px; width: 100%; box-sizing: border-box; }

.exam-solution-overlay {
    position: absolute; top: 0; left: 0; width: 100%; font-family: var(--math-font); font-size: 1.35em; color: var(--reveal-green); font-weight: 700; line-height: 38px; padding-left: 6px; pointer-events: none; z-index: 2;
}

.exam-solution-overlay sub, .exam-solution-overlay sup { font-size: 70%; line-height: 0; position: relative; vertical-align: baseline; }
.exam-solution-overlay sub { bottom: -0.2em; }
.exam-solution-overlay sup { top: -0.45em; }

.exam-answer-row { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 15px; font-size: 1.02em; font-weight: bold; color: #000; flex-shrink: 0; flex-wrap: wrap; }
.exam-answer-line { display: inline-block; border-bottom: 2px dotted #000; width: 150px; min-height: 28px; text-align: center; font-size: 1.25em; font-weight: bold; color: var(--reveal-green); line-height: 28px; }
.exam-unit-line { display: inline-block; border-bottom: 2px dotted #000; width: 70px; min-height: 28px; text-align: center; font-size: 1.25em; font-weight: bold; color: var(--reveal-green); line-height: 28px; }

/* WORKSHEET MODE SPECIFIC STYLES */
.worksheet-block {
    margin-bottom: 35px;
    padding-bottom: 30px;
    border-bottom: 2px dashed var(--border);
}
.worksheet-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.navigation-buttons { display: flex; justify-content: flex-end; margin-top: auto; padding-top: 20px; gap: 10px; flex-shrink: 0; }
.navigation-buttons.has-prev { justify-content: space-between; }

button { padding: 12px 24px; font-size: 0.95em; font-weight: 600; font-family: 'Poppins', sans-serif; background: var(--primary-gradient); color: white; border: none; border-radius: 10px; cursor: pointer; transition: var(--transition); flex: 1 1 auto; min-width: 120px; }
button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 12px -2px rgba(99, 102, 241, 0.4); }
button:disabled { background: #cbd5e1; cursor: not-allowed; color: #94a3b8; transform: none; box-shadow: none; }
button.btn-secondary { background: white; color: var(--text-main); border: 2px solid var(--border); box-shadow: none; max-width: 160px; }
button.btn-secondary:hover:not(:disabled) { background: #f8fafc; border-color: #cbd5e1; color: var(--primary); }
button.btn-action { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
button.btn-bonus { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: white; }
button.btn-tiny { padding: 4px 10px; font-size: 0.75em; min-width: auto; flex: none; border-radius: 6px; }
.btn-small { padding: 4px 8px; font-size: 0.75em; flex: none; min-width: auto; }

#timer-display { font-size: 0.95em; font-weight: 700; color: var(--incorrect); background: var(--incorrect-bg); padding: 6px 12px; border-radius: 10px; border: 1px dashed var(--incorrect); margin: 0; transition: font-size 0.2s ease; }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease-out;}
.modal-content { background: #fff; width: 95%; max-width: 800px; max-height: 85vh; border-radius: 16px; display: flex; flex-direction: column; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--secondary); border-radius: 16px 16px 0 0; }
.modal-header h3 { margin: 0; font-size: 1.1em; color: var(--primary); }
.close-modal-btn { background: none; border: none; font-size: 1.5em; color: var(--text-muted); cursor: pointer; padding: 0; min-width: auto; line-height: 1; }
.close-modal-btn:hover { color: var(--incorrect); transform: none; box-shadow: none; }
.modal-body { padding: 20px; overflow-y: auto; font-size: 0.9em; }

.eq-table { width: 100%; border-collapse: collapse; }
.eq-table th, .eq-table td { border: 1px solid var(--border); padding: 10px 14px; text-align: left; }
.eq-table th { background: #eef2ff; color: var(--primary); font-weight: 600; position: sticky; top: 0; }
.eq-table tr:nth-child(even) { background: var(--secondary); }
.eq-table .sym { font-family: var(--math-font); font-style: italic; font-weight: 600; font-size: 1.15em; color: var(--primary); white-space: nowrap; letter-spacing: 0.5px; }

#results-container { display: none; max-height: 90vh; overflow-y: auto; }
.score-banner { background: var(--primary-gradient); color: white; padding: 24px; border-radius: 16px; text-align: center; margin-bottom: 20px; }
.score-banner h2 { margin: 0 0 8px 0; font-size: 2.2em; font-weight: 700; }
.score-banner h3 { margin: 0 0 5px 0; font-size: 1.15em; color: #fbbf24; }
.review-item { margin-bottom: 12px; padding: 16px; border-radius: 12px; background: #fff; border: 1px solid var(--border); border-left: 6px solid; font-size: 0.95em; }
.review-correct { border-left-color: var(--correct); }
.review-incorrect { border-left-color: var(--incorrect); }
.review-item p { margin-top: 0; }

.results-actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.results-actions button { font-size: 1.05em; padding: 14px; }

.flying-star { position: fixed; color: var(--star-gold); font-size: 1.5em; z-index: 9999; pointer-events: none; transition: all 0.75s cubic-bezier(0.25, 0.1, 0.25, 1); }

/* PRESENTATION MODE */
body.presentation-mode { max-width: 100%; padding: 20px; }
body.presentation-mode .card, body.presentation-mode #quiz-container.card { max-width: 95%; padding: 40px; min-height: 700px; }
body.presentation-mode button { font-size: 1.3em; padding: 15px 25px; }
body.presentation-mode .btn-secondary.home-btn { font-size: 1em; padding: 10px 15px; }
body.presentation-mode .label-text { font-size: 1.1em; } 
body.presentation-mode .question-text { font-size: 1.8em; margin-bottom: 25px; line-height: 1.4; }
body.presentation-mode .option-label { font-size: 1.4em; padding: 20px; }
body.presentation-mode .star-counter { font-size: 1.6em; }
body.presentation-mode #timer-display { font-size: 1.4em; }

/* PRINT STYLES FOR EXAM/WORKSHEET MODE */
@media print {
    body { background: #fff !important; padding: 0 !important; margin: 0 !important; color: #000 !important; }
    .top-controls, .navigation-buttons, .progress-container, .in-quiz-settings, #star-counter, .difficulty-stars { display: none !important; }
    .card, #quiz-container.card { box-shadow: none !important; border: none !important; margin: 0 !important; padding: 0 !important; }
    .worksheet-block { break-inside: avoid; border-bottom: 1px solid #ccc; }
}

/* RESPONSIVE BREAKPOINTS FOR SETUP PAGE */
@media (max-width: 992px) {
    .setup-columns { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

@media (max-width: 576px) {
    .setup-columns { grid-template-columns: 1fr; }
    .card, #quiz-container.card { padding: 15px; min-height: auto; }
    .options-container { grid-template-columns: 1fr; }
    .setup-header h2 { font-size: 1.3em; }
}
/* MODULAR BANK: subtopics + future image references */
.subtopic-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-bottom: 7px; }
.reference-image-placeholder { border: 2px dashed var(--border); border-radius: 12px; background: var(--secondary); padding: 16px; margin: 8px 0 14px; min-height: 90px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-muted); font-weight: 400; }
.reference-image-placeholder strong { color: var(--text-main); margin-bottom: 3px; }
.reference-image-placeholder span { font-family: monospace; font-size: .85em; }
.reference-image-placeholder small { margin-top: 5px; }
@media (max-width: 992px) { .subtopic-options { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px) { .subtopic-options { grid-template-columns: 1fr; } }

/* QUESTION OPTIONS: integrated question type + calculation difficulty */
.question-type-group { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.question-type-title { font-size: 0.85em !important; font-weight: 600 !important; margin-bottom: 7px !important; }
.calculation-type-card { border: 1px solid var(--border); border-radius: 10px; background: var(--secondary); overflow: hidden; }
.calculation-type-card .calculation-main-label { border: 0; border-radius: 0; background: transparent; }
.calculation-type-card:has(#type-calculation:checked) { border-color: var(--primary); background: #f8faff; }
.calculation-difficulty-options { padding: 0 8px 8px 28px; transition: var(--transition); }
.calculation-difficulty-options.disabled { opacity: 0.42; pointer-events: none; filter: grayscale(0.35); }
.difficulty-caption { font-size: 0.72em; font-weight: 600; color: var(--text-muted); margin: 2px 0 5px; }
.difficulty-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.difficulty-choice { display: flex; align-items: flex-start; gap: 5px; cursor: pointer; padding: 5px 6px; border: 1px solid var(--border); border-radius: 7px; background: #fff; font-size: 0.72em; line-height: 1.15; transition: var(--transition); }
.difficulty-choice input { width: 13px; height: 13px; margin: 1px 0 0; accent-color: var(--primary); flex-shrink: 0; }
.difficulty-choice span { display: flex; flex-direction: column; gap: 1px; }
.difficulty-choice small { color: var(--text-muted); font-size: 0.88em; }
.difficulty-choice:has(input:checked) { border-color: var(--primary); background: #eef2ff; color: var(--primary); }
@media (max-width: 576px) { .difficulty-grid { grid-template-columns: 1fr; } }


/* COMPACT / DYNAMIC WORKSHEET UPDATE */
.worksheet-question-body { margin-bottom: 6px; }
.worksheet-inline-mark {
    display: inline;
    float: none;
    margin: 0 0 0 8px;
    white-space: nowrap;
    font-size: 0.86em;
}
.worksheet-dynamic-lines {
    height: calc(var(--worksheet-lines, 2) * 38px);
    min-height: 76px;
    margin-top: 6px;
}
.worksheet-dynamic-lines .exam-line { height: 38px; }
.worksheet-block .exam-answer-row { margin-top: 8px; }


/* STABILITY / UI POLISH PASS */
.count-badge { display:inline-flex; min-width:20px; height:18px; padding:0 5px; align-items:center; justify-content:center; border-radius:9px; background:#e0e7ff; color:var(--primary); font-size:.72em; font-weight:700; vertical-align:1px; }
.option-unavailable { opacity:.42 !important; filter:grayscale(.4); }
.option-unavailable:hover { transform:none !important; box-shadow:none !important; }
.availability-count { display:block; color:var(--text-muted); font-size:.76em; font-weight:400; margin-top:2px; }
.subtopic-footer { display:flex; justify-content:space-between; gap:12px; align-items:center; color:var(--text-muted); flex-wrap:wrap; }
#available-question-summary { color:var(--primary); font-size:.78em; }
.empty-availability { grid-column:1/-1; padding:12px; border:1px dashed var(--border); border-radius:9px; color:var(--text-muted); text-align:center; font-size:.82em; }
.mini-toggle.context-disabled { opacity:.4; pointer-events:none; }
#print-worksheet-btn { white-space:nowrap; }
.reference-image-placeholder { min-height:120px; }
.reference-image-placeholder::before { content:'IMAGE / GRAPH'; display:block; font-size:.72em; letter-spacing:.12em; font-weight:700; color:var(--primary); margin-bottom:5px; }
@media (max-width: 1150px) { .setup-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); } .subtopic-options { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 700px) { .setup-columns { grid-template-columns:1fr; } .subtopic-options { grid-template-columns:repeat(2,minmax(0,1fr)); } .quiz-subheader { align-items:flex-start; gap:8px; flex-direction:column; } .in-quiz-settings { width:100%; box-sizing:border-box; } }
@media (max-width: 480px) { .subtopic-options { grid-template-columns:1fr; } .difficulty-grid { grid-template-columns:1fr; } .top-controls { flex-wrap:wrap; } .top-controls button { min-width:0; } }
@media print { #print-worksheet-btn { display:none !important; } .reference-image-placeholder { min-height:80px; } }


/* HANDWRITTEN-STYLE WORKSHEET REVEALS */
.worksheet-block .exam-solution-overlay,
.worksheet-block .worksheet-revealed-answer {
    font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.worksheet-block .exam-solution-overlay {
    font-size: 1.18em;
    transform: rotate(-0.25deg);
}
.worksheet-block .worksheet-revealed-answer {
    font-size: 1.05em;
}

/* ============================================================
   JET-ED / GCSE PHYSICS QUIZ INTEGRATION FIXES
   Keep this section at the END of physics-quiz.css
   ============================================================ */


/* ------------------------------------------------------------
   1. KEEP QUIZ STYLES INSIDE THE QUIZ APPLICATION
   ------------------------------------------------------------ */

.physics-quiz-page {
    width: 100%;
    box-sizing: border-box;
    padding: 32px 0 60px;
    background: #f8fafc;
}

.physics-quiz-app {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}


/* ------------------------------------------------------------
   2. RESTORE THE GLOBAL JET-ED PAGE BANNER
   ------------------------------------------------------------ */

/*
   The quiz stylesheet contains styles that can interfere with
   the website banner. These rules restore the intended global
   banner layout.
*/

body > .page-header,
page-banner .page-header {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 24px 0;
    box-sizing: border-box;

    background: #111827;
    color: #ffffff;

    text-align: center;
}

page-banner {
    display: block;
    width: 100%;
}

page-banner .page-header .container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

page-banner .page-header h1 {
    display: block;

    margin: 0;
    padding: 0;

    width: auto;
    max-width: none;

    color: #ffffff;

    font-family: 'Inter', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;

    text-align: center;

    border: 0;
    background: transparent;
    box-shadow: none;
}

page-banner .page-header .header-desc {
    display: block;

    width: auto;
    max-width: 900px;

    margin: 6px auto 0;
    padding: 0;

    color: #9ca3af;

    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 300;
    line-height: 1.5;

    text-align: center;

    border: 0;
    background: transparent;
}


/* ------------------------------------------------------------
   3. PROTECT THE GLOBAL JET-ED HEADER
   ------------------------------------------------------------ */

site-header {
    display: block;
    width: 100%;
}

site-header header {
    width: 100%;
}

site-header .navbar {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}


/* ------------------------------------------------------------
   4. QUIZ SETUP LAYOUT
   ------------------------------------------------------------ */

.physics-quiz-app .setup-columns {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(230px, 1fr));

    gap: 16px;

    align-items: stretch;
}

.physics-quiz-app .setup-column {
    min-width: 0;
    width: 100%;
}

.physics-quiz-app .settings-group {
    width: 100%;
    min-width: 0;

    box-sizing: border-box;
}


/* ------------------------------------------------------------
   5. NORMAL OPTION GRIDS
   ------------------------------------------------------------ */

.physics-quiz-app .options-grid {
    width: 100%;
    min-width: 0;

    box-sizing: border-box;
}


/* ------------------------------------------------------------
   6. SUBTOPICS

   Don't force four tiny boxes across a narrow setup column.
   ------------------------------------------------------------ */

.physics-quiz-app .subtopic-options {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(150px, 1fr));

    gap: 10px;

    width: 100%;

    align-items: stretch;
}


/* Individual subtopic card */

.physics-quiz-app .subtopic-options .subtopic-choice {
    display: flex;

    align-items: flex-start;

    width: 100%;
    min-width: 0;
    min-height: 82px;

    padding: 12px;

    margin: 0;

    box-sizing: border-box;

    overflow: hidden;
}


/* Text section */

.physics-quiz-app .subtopic-options .subtopic-choice > span {
    display: block;

    min-width: 0;
    width: 100%;

    line-height: 1.25;

    white-space: normal;

    overflow-wrap: anywhere;
    word-break: normal;
}


/* Availability count */

.physics-quiz-app .subtopic-options .availability-count {
    display: block;

    margin-top: 5px;

    font-size: 0.78rem;
    line-height: 1.25;

    color: #64748b;

    white-space: normal;
}


/* Checkbox */

.physics-quiz-app .subtopic-options input[type="checkbox"] {
    flex: 0 0 auto;

    width: 18px;
    height: 18px;

    margin-top: 2px;
}


/* ------------------------------------------------------------
   7. GENERAL SETUP OPTION CARDS
   ------------------------------------------------------------ */

.physics-quiz-app .simple-checkbox-label,
.physics-quiz-app .toggle-label {
    min-width: 0;

    box-sizing: border-box;

    overflow: hidden;
}

.physics-quiz-app .simple-checkbox-label > span,
.physics-quiz-app .toggle-label > span {
    min-width: 0;

    white-space: normal;

    overflow-wrap: break-word;
}


/* ------------------------------------------------------------
   8. QUESTION TYPE / DIFFICULTY AREA
   ------------------------------------------------------------ */

.physics-quiz-app .question-type-block {
    width: 100%;
    min-width: 0;
}

.physics-quiz-app .nested-difficulty {
    width: 100%;

    margin-top: 8px;

    box-sizing: border-box;
}

.physics-quiz-app .difficulty-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 8px;

    width: 100%;
}

.physics-quiz-app .difficulty-choice {
    width: 100%;
    min-width: 0;

    box-sizing: border-box;
}


/* ------------------------------------------------------------
   9. SETUP HEADER / BUTTONS
   ------------------------------------------------------------ */

.physics-quiz-app .setup-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    flex-wrap: wrap;
}

.physics-quiz-app .setup-header h2 {
    margin: 0;
}

.physics-quiz-app .bank-availability-summary {
    margin-top: 4px;

    color: #64748b;

    font-size: 0.88rem;
}


/* Don't let the site's global .btn styles distort quiz buttons */

.physics-quiz-app button {
    font-family: 'Inter', sans-serif;
}


/* ------------------------------------------------------------
   10. TOP QUIZ CONTROLS
   ------------------------------------------------------------ */

.physics-quiz-app .top-controls {
    display: flex;

    justify-content: flex-end;
    align-items: center;

    gap: 10px;

    margin: 0 0 14px;

    flex-wrap: wrap;
}


/* ------------------------------------------------------------
   11. QUIZ CARD
   ------------------------------------------------------------ */

.physics-quiz-app .card {
    width: 100%;

    box-sizing: border-box;
}


/* ------------------------------------------------------------
   12. TABLET
   ------------------------------------------------------------ */

@media (max-width: 1100px) {

    .physics-quiz-app .setup-columns {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .physics-quiz-app .subtopic-options {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


/* ------------------------------------------------------------
   13. MOBILE
   ------------------------------------------------------------ */

@media (max-width: 700px) {

    .physics-quiz-page {
        padding: 20px 0 40px;
    }

    .physics-quiz-app {
        padding: 0 20px;
    }

    .physics-quiz-app .setup-columns {
        grid-template-columns: 1fr;
    }

    .physics-quiz-app .subtopic-options {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .physics-quiz-app .setup-header {
        align-items: stretch;
    }

    .physics-quiz-app .setup-header .btn-action {
        width: 100% !important;
    }

    .physics-quiz-app .top-controls {
        justify-content: stretch;
    }

    .physics-quiz-app .top-controls button {
        flex: 1 1 auto;
    }

}


/* ------------------------------------------------------------
   14. VERY SMALL MOBILE
   ------------------------------------------------------------ */

@media (max-width: 430px) {

    .physics-quiz-app .subtopic-options {
        grid-template-columns: 1fr;
    }

    .physics-quiz-app .difficulty-grid {
        grid-template-columns: 1fr;
    }

}


/* ------------------------------------------------------------
   15. PRINT

   Hide the website chrome when printing worksheets.
   ------------------------------------------------------------ */

@media print {

    site-header,
    page-banner,
    site-footer,
    .top-controls {
        display: none !important;
    }

    .physics-quiz-page {
        padding: 0;
        background: #ffffff;
    }

    .physics-quiz-app {
        max-width: none;
    }

}

/* Worksheet: one mark-worthy point per ruled line */
.worksheet-mark-points {
    display: grid;
    grid-auto-rows: 38px;
    line-height: 38px;
}
.worksheet-mark-point {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.worksheet-mark-number {
    flex: 0 0 auto;
    opacity: .65;
    font-size: .8em;
}


/* Revealed multi-mark answers wrap over the ruled worksheet lines. */
.worksheet-mark-points {
    display: block !important;
    line-height: 38px !important;
}
.worksheet-mark-point {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px;
    min-width: 0;
    min-height: 38px;
    line-height: 38px;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
}
.worksheet-mark-point > span:last-child {
    min-width: 0;
    flex: 1 1 auto;
    white-space: normal;
    overflow-wrap: break-word;
}
.worksheet-mark-number { line-height: 38px; }

/* Compact integrated topic/subtopic picker */
.physics-quiz-app .setup-column-topics { grid-column: span 2; }
.physics-quiz-app .topic-picker-group { height: auto !important; }
.physics-quiz-app .setup-help { color: var(--text-muted); font-weight: 500; }
.physics-quiz-app .topic-tree { display: grid; gap: 6px; margin-top: 8px; }
.physics-quiz-app .topic-branch { border: 1px solid var(--border); border-radius: 9px; background: var(--secondary); overflow: hidden; }
.physics-quiz-app .topic-picker-group .title-label { font-size: .9em; line-height: 1.3; }
.physics-quiz-app .topic-row { min-height: 42px; display: grid; grid-template-columns: 22px 28px minmax(0,1fr) auto; align-items: center; column-gap: 7px; padding: 4px 10px; }
.physics-quiz-app .topic-row label { cursor:pointer; min-width:0; }
.physics-quiz-app .topic-check { display:flex; align-items:center; justify-content:center; width:22px; }
.physics-quiz-app .topic-name { display:flex; align-items:center; min-width:0; }
.physics-quiz-app .topic-row input { width:17px; height:17px; margin:0; }
.physics-quiz-app .topic-expander { width:26px; height:26px; padding:0; border:1px solid var(--border); border-radius:6px; background:#fff; color:var(--primary); display:flex; align-items:center; justify-content:center; cursor:pointer; }
.physics-quiz-app .topic-expander span { display:block; font-size:22px; line-height:1; transform:rotate(0deg); transition:transform .15s ease; }
.physics-quiz-app .topic-expander:hover { background:var(--secondary); border-color:var(--primary); }
.physics-quiz-app .topic-expander:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
.physics-quiz-app .topic-branch.is-open .topic-expander span { transform:rotate(90deg); }
.physics-quiz-app .topic-count { color:var(--text-muted); font-size:.72rem; white-space:nowrap; }
.physics-quiz-app .topic-disabled .topic-row { opacity:.58; }
.physics-quiz-app .topic-subtopics { padding: 4px 10px 9px 57px; border-top:1px solid var(--border); background:#fff; }
.physics-quiz-app .topic-subtopics[hidden] { display:none; }
.physics-quiz-app .subtopic-inline { display:flex; align-items:center; gap:8px; min-height:30px; font-size:.86rem; cursor:pointer; }
.physics-quiz-app .subtopic-inline input { width:16px; height:16px; margin:0; }
.physics-quiz-app .subtopic-inline span { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; }
.physics-quiz-app .subtopic-inline small { color:var(--text-muted); font-size:.72rem; }
.physics-quiz-app .topic-tree-footer { margin-top:8px; color:var(--text-muted); font-size:.78rem; }
@media (max-width: 700px) { .physics-quiz-app .setup-column-topics { grid-column: span 1; } .physics-quiz-app .topic-count { display:none; } .physics-quiz-app .topic-subtopics { padding-left:20px; } }


/* Recall support uses the same in-quiz Hint and Word Bank controls as extended questions. */
.physics-quiz-app .recall-support { margin: 8px 0 10px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--secondary); font-size: .88rem; }
.physics-quiz-app .recall-word-bank .word-bank-tiles { margin-top: 7px; display:flex; flex-wrap:wrap; gap:6px; }
.physics-quiz-app .recall-bank-tile { cursor:default; }


/* Worksheet hint/reveal consistency: fixed ruled rhythm, handwriting hints in blue. */
.physics-quiz-app .worksheet-hint-overlay {
    --worksheet-row: 38px;
    box-sizing: border-box;
    margin: 10px 0;
    padding: 0 6px !important;
    min-height: calc(var(--worksheet-lines, 2) * var(--worksheet-row)) !important;
    font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive !important;
    font-size: 1.08rem;
    font-weight: 600;
    line-height: var(--worksheet-row) !important;
    color: #2563eb !important;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 37px,
        #98a2b3 37px,
        #98a2b3 38px
    ) !important;
    background-size: 100% var(--worksheet-row) !important;
}
.physics-quiz-app .worksheet-hint-overlay .scaffold-mark-line {
    box-sizing: border-box;
    display: block;
    min-height: var(--worksheet-row) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    line-height: var(--worksheet-row) !important;
    color: #2563eb !important;
    white-space: normal !important;
    overflow-wrap: break-word;
    background: none !important;
}
.physics-quiz-app .worksheet-hint-overlay .scaffold-mark-line::before {
    color: #2563eb !important;
}
.physics-quiz-app .worksheet-hint-overlay .extended-drop-gap {
    color: #2563eb !important;
    font-family: inherit !important;
}
/* Revealed/model answers remain visually distinct in green. */
.physics-quiz-app .exam-solution-overlay,
.physics-quiz-app .worksheet-revealed-answer,
.physics-quiz-app .worksheet-mark-points,
.physics-quiz-app .worksheet-mark-point {
    color: var(--reveal-green) !important;
}
/* Wrapped hint and reveal text consumes the next existing ruled row; no extra point gap. */
.physics-quiz-app .worksheet-mark-point {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 38px !important;
    line-height: 38px !important;
}
.physics-quiz-app .worksheet-mark-point > span:last-child {
    line-height: 38px !important;
}

/* v4 worksheet consistency: right-aligned marks, dark-blue draggable hints, bank below lines. */
.physics-quiz-app .worksheet-question-body {
    position: relative;
    padding-right: 92px;
}
.physics-quiz-app .worksheet-inline-mark {
    position: absolute;
    right: 0;
    bottom: 0;
    margin: 0;
    float: none;
    text-align: right;
    white-space: nowrap;
}
.physics-quiz-app .worksheet-hint-overlay,
.physics-quiz-app .worksheet-hint-overlay .scaffold-mark-line,
.physics-quiz-app .worksheet-hint-overlay .scaffold-mark-line::before,
.physics-quiz-app .worksheet-hint-overlay .extended-drop-gap {
    color: #173f73 !important;
}
.physics-quiz-app .recall-bank-tile { cursor: grab; }
.physics-quiz-app .recall-bank-tile:active { cursor: grabbing; }
.physics-quiz-app .worksheet-block .extended-word-bank,
.physics-quiz-app .worksheet-block .recall-word-bank {
    margin-top: 12px;
    margin-bottom: 8px;
}


/* Match the active GCSE quiz to the learning index page gutters. */
.physics-quiz-app,
page-banner .page-header .container {
    max-width: 1000px;
    padding-left: 32px;
    padding-right: 32px;
}
@media (max-width: 700px) {
    .physics-quiz-app,
    page-banner .page-header .container {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* v6: match the compact site gutters and isolate the topic expander from global button sizing. */
.physics-quiz-app {
    max-width: none;
    width: calc(100% - 40px);
    padding-left: 0;
    padding-right: 0;
}
.physics-quiz-app .topic-row {
    grid-template-columns: 22px 28px minmax(0, 1fr) auto;
    column-gap: 8px;
}
.physics-quiz-app .topic-expander {
    box-sizing: border-box;
    flex: 0 0 26px;
    min-width: 26px !important;
    max-width: 26px;
    width: 26px;
    height: 26px;
    padding: 0 !important;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: #fff;
    box-shadow: none;
    transform: none !important;
}
.physics-quiz-app .topic-expander:hover:not(:disabled) {
    transform: none !important;
    box-shadow: none;
}
.physics-quiz-app .topic-expander span {
    font-size: 18px;
    line-height: 1;
}
.physics-quiz-app .topic-name {
    padding-left: 0;
    overflow: hidden;
}
@media (max-width: 768px) {
    .physics-quiz-app { width: calc(100% - 28px); }
}
