/* ==========================================================================
   OSSLTprep – Student Runner Styles
   Complete version (no chince)
   ========================================================================== */

/* ---------- Base ---------- */
:root {
  --ink: #0b1a2a;
  --muted: #5b6b80;
  --brand: #2a6bff;
  --brand-hover: #1f56cc;
  --card: #ffffff;
  --bg: #eef5ff;
  --border: #d7e3f7;
  --sidebar-bg: #f7faff;
  --primary: #2a6bff;
  --primary-dark: #1a4fd4;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --font: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: linear-gradient(180deg, #cfe3ff 0%, #e9f1ff 100%);
  background-attachment: fixed;
  font-family: var(--font);
  color: var(--ink);
}

/* ---------- Shell Layout ---------- */
.runnerHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.runnerTitle {
  font-weight: 700;
  color: var(--brand);
  font-size: 16px;
}

.runnerSection {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.runnerBody {
  display: flex;
  flex-direction: row;
  min-height: calc(100vh - 180px);
  background: #f8fbff;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

/* ---------- Sidebar ---------- */
.runnerSidebar {
  width: 200px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

.sectionTabs {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.sectionTab {
  flex: 1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 0;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
  transition: 0.2s ease;
}

.sectionTab.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.sectionTab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.partList {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.partRow {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  font-size: 14px;
  color: var(--ink);
}

.partRow:hover {
  background: #f0f4ff;
  transform: translateY(-1px);
}

.partRow.is-active,
.partRow.active {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  border-color: var(--brand);
}

.partRow.partLocked {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Main ---------- */
.runnerMain {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
  box-sizing: border-box;

  /* widen and center main column */
  max-width: 1300px; /* you chose 1300px */
  margin: 0 auto;
}

.runnerPassage {
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);

  position: relative;
  max-width: 1100px;
  white-space: pre-wrap;
  padding-right: 72px; /* room for gutter numbers */
}

/* ensure markers position relative to the white card itself */
.runnerPassage .qCard { position: relative; }

.runnerPassage p {
  margin: 8px 0;
  line-height: 1.6;
  font-size: var(--passage-font-size, 15px);
}

.line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--passage-font-size, 15px);
  line-height: 1.6;
}

.line .ln {
  flex-shrink: 0;
  width: 28px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

/* ---------- Question Cards ---------- */
.qCard {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
  margin-bottom: 16px;
}

.qHead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.qTitle {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

.qHint {
  font-size: 12px;
  color: var(--muted);
}

.qBody {
  font-size: 14px;
  color: var(--ink);
}

/* ---------- Multiple Choice ---------- */
.qOptions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.qOption {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.qOption.selected {
  background: #e9f0ff;
  border-color: var(--brand);
}

.qOption input {
  margin-right: 10px;
}

/* ---------- Dropdown ---------- */
select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

/* ---------- Multi ---------- */
.qOptions input[type="checkbox"] {
  accent-color: var(--brand);
}

/* ---------- Short/Long ---------- */
input[type="text"],
textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 8px;
  box-sizing: border-box;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

/* ---------- Ordering ---------- */
.orderList {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
}

.orderItem {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
  cursor: grab;
  transition: background 0.15s;
}

.orderItem.dragging {
  opacity: 0.6;
  background: #f0f4ff;
}

/* ---------- Cloze ---------- */
.clozeWrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.clozeText {
  line-height: 1.8;
  background: #fdfdff;
  padding: 8px;
  border-radius: 8px;
  border: 1px dashed var(--border);
}

.blankSlot {
  display: inline-block;
  min-width: 80px;
  border-bottom: 2px solid var(--border);
  margin: 0 3px;
  padding: 0 4px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
}

.bankRow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bankChip {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: grab;
  transition: 0.2s ease;
}

.bankChip:hover {
  background: #f0f4ff;
}

.bankChip.used {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Footer Buttons ---------- */
.runnerFooter {
  background: #fff;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

.runnerActions button {
  padding: 10px 18px;
  border: none;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btnPrimary {
  background: var(--brand);
  color: #fff;
}

.btnPrimary:hover {
  background: var(--brand-hover);
}

.btnGhost {
  background: #f6f9ff;
  color: var(--brand);
  border: 1px solid var(--border);
}

.btnGhost:hover {
  background: #e9f0ff;
}

/* ---------- Saved Indicator ---------- */
.runnerSaved {
  font-size: 12px;
  color: var(--muted);
}

.runnerSaved.error {
  color: #c0392b;
}

/* ---------- Muted text ---------- */
.muted {
  color: var(--muted);
}

/* --- Line Number Overlays --- */
.line-marker {
  position: absolute;
  right: 16px;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
  font-family: var(--font);
  opacity: 0.8;
  z-index: 20;            /* ensure always above the card */
  pointer-events: none;   /* never catch clicks/selection */
}

/* ---------- Utility ---------- */
@media (max-width: 800px) {
  .runnerBody {
    flex-direction: column;
  }

  .runnerSidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .partRow {
    flex: 1 1 45%;
  }

  .runnerFooter {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ---------- Reading Toolbar ---------- */
.reading-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.reading-toolbar .tb-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.reading-toolbar .tb-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-right: 4px;
}
.reading-toolbar .tb-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 6px;
}
.tb-btn {
  background: #f6f9ff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  user-select: none;
}
.tb-btn:hover {
  background: #e9f0ff;
}
.tb-btn.active {
  background: #fef08a;
  border-color: #eab308;
  color: #854d0e;
}
.runnerPassage mark {
  background: #fef08a;
  border-radius: 2px;
  padding: 0 1px;
}
.runnerPassage.highlight-mode {
  cursor: text;
}

/* ---------- Transitions ---------- */
button,
select,
input,
textarea {
  transition: all 0.2s ease;
}
