/* ExamPulse TryPYQ — module-scoped styles
 *
 * Inherits tokens from shared/base.css; adds layout for the admin
 * upload form + mock list. Scoped with .trypyq- prefix so nothing
 * here can bleed into admin.html / student.html / qbank.html.
 */

.trypyq-header {
  max-width: 960px;
  margin: 24px auto 16px;
  padding: 0 20px;
}

/* WCAG AA contrast fix — the shared .text-muted token (#888) clocks
 * in at 3.76:1 on our dark cards, failing AA (needs 4.5:1 for body
 * text). Bumping to #9aa3ae gives us 5.04:1 without losing the
 * "secondary text" visual hierarchy. Applied only inside the
 * TryPYQ module so we don't disrupt other pages' design tokens. */
.trypyq-header .text-muted,
.trypyq-browse-body .text-muted,
.trypyq-hero .text-muted,
.trypyq-browse-card .text-muted,
.trypyq-attempt-header .text-muted,
.trypyq-attempt-body .text-muted,
.trypyq-result .text-muted,
.trypyq-list .text-muted,
.trypyq-form .text-muted {
  color: #9aa3ae;
}

/* Keyboard a11y — visible focus ring on every interactive
 * element within the module so tab-users never wonder where
 * they are. Mouse users keep the clean look thanks to
 * :focus-visible (not :focus). */
.trypyq-nav-link:focus-visible,
.trypyq-browse-card:focus-visible,
.trypyq-attempt-tab:focus-visible,
.trypyq-pdfnav-btn:focus-visible,
.trypyq-attempt-clear:focus-visible,
.trypyq-key-method:focus-visible,
.trypyq-bulk-drop:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 3px;
  border-radius: 6px;
}

.trypyq-tagline {
  font-size: 22px !important;
  font-weight: 800 !important;
  letter-spacing: -0.015em;
  line-height: 1.2;
  background: linear-gradient(135deg, #fbbf24 0%, #f87171 60%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-shadow: 0 0 40px rgba(251, 191, 36, 0.25);
  filter: drop-shadow(0 2px 6px rgba(248, 113, 113, 0.15));
}
@media (max-width: 600px) {
  .trypyq-tagline { font-size: 18px !important; }
}

.trypyq-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.trypyq-nav-link {
  color: var(--color-muted, #888);
  padding: 2px 6px;
  border-radius: 4px;
}
.trypyq-nav-link:hover {
  color: var(--color-text, #e6edf3);
  background: rgba(255, 255, 255, 0.04);
}
.trypyq-nav-link.is-active {
  color: var(--color-text, #e6edf3);
  font-weight: 600;
  background: rgba(96, 165, 250, 0.08);
}
.trypyq-nav-sep {
  color: var(--color-muted, #888);
  opacity: 0.5;
}
.trypyq-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.trypyq-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.trypyq-form,
.trypyq-list {
  max-width: 960px;
  margin: 16px auto;
  padding: 24px;
  background: var(--color-card, #161b22);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 10px;
}

/* Form layout — 2-column grid; fields set grid-column:1/-1 to span. */
.trypyq-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}
@media (max-width: 600px) {
  .trypyq-form-grid { grid-template-columns: 1fr; }
}

.trypyq-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.trypyq-field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text, #e6edf3);
}

/* Inputs — inherit .input styling from base.css; add full-width on
 * all form controls inside our grid. */
.trypyq-form input,
.trypyq-form select,
.trypyq-form textarea {
  width: 100%;
  box-sizing: border-box;
}

.trypyq-form textarea {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  resize: vertical;
}

/* Answer-key live preview under the textarea */
.trypyq-key-preview {
  margin-top: 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 6px;
  font-size: 12px;
  min-height: 38px;
}
.trypyq-key-preview-sample {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: var(--color-muted, #888);
  word-break: break-all;
  line-height: 1.5;
}

/* Bulk upload dialog */
.trypyq-bulk-drop {
  padding: 32px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  border: 2px dashed var(--color-border, #30363d);
  border-radius: 10px;
  color: var(--color-muted, #888);
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
  font-size: 14px;
}
.trypyq-bulk-drop:hover,
.trypyq-bulk-drop.is-drag {
  border-color: #60a5fa;
  background: rgba(96, 165, 250, 0.05);
  color: var(--color-text, #e6edf3);
}

.trypyq-bulk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 12px;
}
.trypyq-bulk-table th,
.trypyq-bulk-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--color-border, #30363d);
  vertical-align: middle;
}
.trypyq-bulk-table th {
  font-weight: 600;
  color: var(--color-muted, #888);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.trypyq-bulk-fname {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
}
.trypyq-bulk-input {
  padding: 4px 6px !important;
  font-size: 12px !important;
  width: 100%;
  min-width: 90px;
}

/* Bulk key assignment — one row per keyless mock, compact paste
 * area + live parse feedback so admins can fill many at once. */
.trypyq-bulkkey-row {
  padding: 12px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.05);
}
.trypyq-bulkkey-row:last-child { border-bottom: none; }
.trypyq-bulkkey-label {
  margin-bottom: 6px;
  font-size: 13px;
}
.trypyq-bulkkey-textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  resize: vertical;
}
.trypyq-bulkkey-preview {
  margin-top: 4px;
  font-size: 11.5px;
}

/* Manual-grid method (A-6d) — compact rows of clickable A/B/C/D
 * buttons for admins reading a physical answer key. Virtually
 * identical to the student bubble sheet, but rendered in the
 * admin's add/edit-key dialog. */
.trypyq-manual-grid {
  max-height: 340px;
  overflow-y: auto;
  padding: 8px 4px;
  border: 1px solid var(--color-border, #30363d);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}
.trypyq-manual-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-bottom: 1px dashed rgba(255,255,255,0.04);
}
.trypyq-manual-qnum {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: var(--color-muted, #888);
  width: 44px;
  flex-shrink: 0;
}
.trypyq-manual-bubble {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border, #30363d);
  background: transparent;
  color: var(--color-text, #e6edf3);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 100ms, border-color 100ms;
}
.trypyq-manual-bubble:hover { border-color: #60a5fa; }
.trypyq-manual-bubble.is-selected {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

/* Key dialog — method tabs (Paste / Upload) */
.trypyq-key-methods {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.trypyq-key-method {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--color-border, #30363d);
  border-radius: 6px;
  color: var(--color-muted, #888);
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.trypyq-key-method:hover {
  color: var(--color-text, #e6edf3);
}
.trypyq-key-method.is-active {
  background: rgba(96, 165, 250, 0.12);
  border-color: #60a5fa;
  color: #60a5fa;
}

/* PDF-upload progress */
.trypyq-progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}
.trypyq-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  transition: width 0.2s;
}

/* Form actions row (Save button + status) */
.trypyq-form-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border, #30363d);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

/* Mocks list table */
.trypyq-mocks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.trypyq-mocks-table th,
.trypyq-mocks-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border, #30363d);
}
.trypyq-mocks-table th {
  font-weight: 600;
  color: var(--color-muted, #888);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.trypyq-mocks-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ── Attempt screen ──────────────────────────────────────────────
 * Desktop: sticky header + split body (PDF | sheet).
 * Mobile:  header + tab switcher + single pane. */

.trypyq-attempt-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-bg, #0d1117);
  border-bottom: 1px solid var(--color-border, #30363d);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.trypyq-attempt-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text, #e6edf3);
}
.trypyq-attempt-subtitle {
  margin-top: 2px;
}
.trypyq-attempt-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.trypyq-attempt-timer {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text, #e6edf3);
  padding: 4px 12px;
  border: 1px solid var(--color-border, #30363d);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  min-width: 110px;
  text-align: center;
}
.trypyq-attempt-timer.is-urgent {
  color: #f87171;
  border-color: #f87171;
  background: rgba(248, 113, 113, 0.08);
}

/* Mobile tab switcher */
.trypyq-attempt-tabs {
  display: none;
  padding: 8px 20px;
  gap: 8px;
  border-bottom: 1px solid var(--color-border, #30363d);
}
.trypyq-attempt-tab {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--color-border, #30363d);
  border-radius: 6px;
  color: var(--color-muted, #888);
  font-size: 13px;
  cursor: pointer;
}
.trypyq-attempt-tab.is-active {
  background: rgba(96, 165, 250, 0.1);
  border-color: #60a5fa;
  color: #60a5fa;
}

.trypyq-attempt-body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 16px;
  padding: 16px 20px 80px;
  max-width: 1400px;
  margin: 0 auto;
}
.trypyq-attempt-pdf-wrap {
  display: flex;
  flex-direction: column;
  background: var(--color-card, #161b22);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 10px;
  overflow: hidden;
  max-height: calc(100vh - 140px);
}
.trypyq-attempt-pdf-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--color-border, #30363d);
  flex: 0 0 auto;
}
.trypyq-pdfnav-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--color-border, #30363d);
  border-radius: 6px;
  color: var(--color-text, #e6edf3);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.trypyq-pdfnav-btn:hover:not(:disabled) {
  background: rgba(96, 165, 250, 0.1);
  border-color: #60a5fa;
}
.trypyq-pdfnav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.trypyq-pdfnav-indicator {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted, #888);
  font-variant-numeric: tabular-nums;
}
.trypyq-attempt-pdf {
  padding: 12px;
  min-height: 400px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.trypyq-attempt-pdf-page {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.trypyq-attempt-sheet {
  background: var(--color-card, #161b22);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 10px;
  padding: 12px 12px 12px 16px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  position: sticky;
  top: 80px;
}
.trypyq-attempt-sheet-header {
  font-weight: 600;
  margin-bottom: 4px;
}
.trypyq-attempt-summary {
  margin-bottom: 10px;
}
.trypyq-attempt-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trypyq-attempt-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.04);
}
.trypyq-attempt-qnum {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: var(--color-muted, #888);
  width: 42px;
  flex-shrink: 0;
}
.trypyq-attempt-bubble {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border, #30363d);
  background: transparent;
  color: var(--color-text, #e6edf3);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
  /* Disable iOS tap highlight — we have our own hover/pressed styling */
  -webkit-tap-highlight-color: transparent;
}
.trypyq-attempt-bubble:hover {
  border-color: #60a5fa;
}
.trypyq-attempt-bubble:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 3px;
}
.trypyq-attempt-bubble.is-selected {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

/* Mobile: larger bubbles + tighter row padding so 150+ rows still
 * fit on a phone. 44px is Apple's recommended touch target. */
@media (max-width: 600px) {
  .trypyq-attempt-bubble { width: 44px; height: 44px; font-size: 15px; }
  .trypyq-attempt-qnum { width: 38px; font-size: 13px; }
  .trypyq-attempt-row { gap: 8px; padding: 6px 0; }
}

/* Numerical answer input (A-6b — JEE Adv numerical / integer
 * questions). Replaces the A/B/C/D bubbles with a plain number
 * field. Mobile keyboards open in decimal mode via inputmode. */
.trypyq-attempt-numinput {
  flex: 1;
  max-width: 200px;
  height: 38px;
  padding: 6px 10px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.trypyq-attempt-row.is-numeric {
  padding: 6px 0;
}

/* Multi-correct visual hint — subtle badge + slightly different
 * bubble border so users notice the "select all that apply" vibe. */
.trypyq-attempt-typebadge {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
  background: rgba(96, 165, 250, 0.1);
  color: #60a5fa;
  margin-left: 4px;
}
.trypyq-attempt-typebadge.is-multi {
  background: rgba(167, 139, 250, 0.12);
  color: #a78bfa;
}
.trypyq-attempt-row.is-multi .trypyq-attempt-bubble.is-selected {
  background: #a78bfa;
  border-color: #a78bfa;
}
.trypyq-attempt-clear {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--color-muted, #888);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
}
.trypyq-attempt-clear:hover {
  color: #f87171;
}

/* Mobile: stack panes, toggle via tabs. PDF-nav toolbar moves to
 * the BOTTOM of the pane (flex-direction:column-reverse) so the
 * Prev/Next buttons stay reachable with the thumb while scrolling
 * a 50-page PDF. */
@media (max-width: 800px) {
  .trypyq-attempt-tabs { display: flex; }
  .trypyq-attempt-body { grid-template-columns: 1fr; padding: 12px; }
  .trypyq-attempt-pdf-wrap,
  .trypyq-attempt-sheet { display: none; max-height: calc(100vh - 180px); position: static; }
  .trypyq-attempt-pdf-wrap.is-active {
    display: flex;
    flex-direction: column-reverse;
  }
  .trypyq-attempt-pdf-wrap.is-active .trypyq-attempt-pdf-nav {
    border-bottom: none;
    border-top: 1px solid var(--color-border, #30363d);
  }
  .trypyq-attempt-sheet.is-active { display: block; }
  .trypyq-attempt-timer { font-size: 18px; min-width: 88px; }
  .trypyq-pdfnav-btn { padding: 8px 14px; font-size: 13px; }
}

/* Submit / time-up lock — full-screen blocker so the student can't
 * miss that the attempt is being finalized. Replaces the easier-to-
 * miss toast on mobile. */
.trypyq-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 17, 23, 0.88);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.trypyq-lock-card {
  background: var(--color-card, #161b22);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 14px;
  padding: 28px 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.trypyq-lock-card h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ── Result screen ─────────────────────────────────────────────── */
.trypyq-result {
  max-width: 720px;
  margin: 40px auto;
  padding: 24px;
}
.trypyq-result-header {
  margin-bottom: 24px;
}
.trypyq-result-exam {
  font-size: 20px;
  font-weight: 700;
}
.trypyq-result-score-card {
  background: var(--color-card, #161b22);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 20px;
}
.trypyq-result-score-value {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
}
.trypyq-result-score-pct {
  margin-top: 8px;
  font-size: 18px;
}
.trypyq-result-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.trypyq-result-cell {
  background: var(--color-card, #161b22);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 10px;
  padding: 18px 12px;
  text-align: center;
}
.trypyq-result-cell-value {
  font-size: 32px;
  font-weight: 700;
}
.trypyq-result-cell-label {
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.trypyq-result-warn {
  padding: 14px 16px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  color: #f59e0b;
  margin-bottom: 16px;
}
.trypyq-result-warn .text-small {
  color: var(--color-text, #e6edf3);
  opacity: 0.8;
}
/* Cutoff reveal — the dramatic payoff of the whole module */
.trypyq-cutoff-banner {
  margin: 8px 0 24px;
  padding: 28px 24px;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 600px 300px at 50% -20%, rgba(96, 165, 250, 0.12), transparent 70%),
    linear-gradient(160deg, rgba(22, 27, 34, 0.95), rgba(13, 17, 23, 0.98));
  border: 1px solid var(--color-border, #30363d);
}
.trypyq-cutoff-inner {
  position: relative;
  z-index: 1;
  text-align: center;
}
.trypyq-cutoff-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--color-muted, #888);
  margin-bottom: 12px;
}
.trypyq-cutoff-verdict {
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 10px;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.3));
}
.trypyq-cutoff-verdict.is-qualified {
  background-image: linear-gradient(135deg, #4ade80 0%, #22d3ee 50%, #a78bfa 100%);
  text-shadow: 0 0 40px rgba(74, 222, 128, 0.25);
}
.trypyq-cutoff-verdict.is-close {
  background-image: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #f87171 100%);
  text-shadow: 0 0 40px rgba(251, 191, 36, 0.25);
}
.trypyq-cutoff-verdict.is-miss {
  background-image: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}
.trypyq-cutoff-sub {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text, #e6edf3);
  opacity: 0.85;
  margin: 0 auto 22px;
  max-width: 520px;
  line-height: 1.5;
}
.trypyq-cutoff-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 540px;
  margin: 0 auto;
}
.trypyq-cutoff-stat {
  padding: 14px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 10px;
}
.trypyq-cutoff-stat-value {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.trypyq-cutoff-stat-label {
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.trypyq-cutoff-foot {
  margin: 16px auto 0;
  max-width: 520px;
  font-size: 11.5px;
  color: var(--color-muted, #888);
  line-height: 1.4;
}
.trypyq-cutoff-source {
  margin: 4px 0 0;
  font-size: 11px;
  opacity: 0.6;
}
@media (max-width: 500px) {
  .trypyq-cutoff-stats { grid-template-columns: 1fr; }
}

.trypyq-result-cutoff-stub {
  padding: 14px 16px;
  background: rgba(96, 165, 250, 0.06);
  border: 1px dashed rgba(96, 165, 250, 0.3);
  border-radius: 8px;
  margin-bottom: 20px;
}
.trypyq-result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Browse screen — the "Do you have it in you?" showcase ────── */

/* Utility nav — tucked top-right so the hero is clean. */
.trypyq-util-nav {
  position: absolute;
  top: 14px;
  right: 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  z-index: 5;
}
/* Mobile: util nav sits above the hero instead of overlapping */
@media (max-width: 600px) {
  .trypyq-util-nav {
    position: static;
    justify-content: flex-end;
    padding: 10px 14px 0;
  }
}

/* Full-bleed hero banner. Huge type, big gradient wash, feels
 * like a tournament poster more than a settings page. */
.trypyq-hero {
  width: 100%;
  padding: clamp(48px, 8vw, 80px) clamp(16px, 4vw, 24px) clamp(40px, 7vw, 72px);
  margin: 0 0 clamp(24px, 4vw, 40px);
  text-align: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(251, 191, 36, 0.18), transparent 60%),
    radial-gradient(ellipse 700px 400px at 20% 100%, rgba(248, 113, 113, 0.15), transparent 60%),
    radial-gradient(ellipse 700px 400px at 80% 100%, rgba(167, 139, 250, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(96, 165, 250, 0.04), transparent 100%);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.trypyq-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 25% 30%, rgba(255,255,255,0.04) 1px, transparent 1.5px),
    radial-gradient(circle at 75% 70%, rgba(255,255,255,0.03) 1px, transparent 1.5px);
  background-size: 40px 40px, 60px 60px;
  opacity: 0.6;
  pointer-events: none;
}
.trypyq-hero-inner {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.trypyq-hero-question {
  font-size: clamp(32px, 6vw, 64px) !important;
  font-weight: 900 !important;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 14px !important;
  text-align: center;
  white-space: nowrap;
  background: linear-gradient(135deg, #ffffff 0%, #fde68a 35%, #fca5a5 70%, #c4b5fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-shadow: 0 4px 40px rgba(251, 191, 36, 0.25);
  filter: drop-shadow(0 4px 12px rgba(248, 113, 113, 0.15));
}
@media (max-width: 640px) {
  .trypyq-hero-question { white-space: normal; font-size: clamp(26px, 7vw, 40px) !important; }
}
.trypyq-hero-title {
  font-size: clamp(22px, 3.5vw, 38px);
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #fbbf24;
  margin: 0 0 18px;
  text-align: center;
  text-shadow: 0 0 30px rgba(251, 191, 36, 0.4);
}
.trypyq-hero-sub {
  font-size: clamp(14px, 1.5vw, 17px);
  font-weight: 500;
  color: #d1d5db;
  margin: 0;
  opacity: 0.85;
  letter-spacing: 0.1px;
  text-align: center;
}
.trypyq-browse-body {
  max-width: 1200px;
  margin: 0 auto 80px;
  padding: 0 24px 16px;
}
.trypyq-browse-count {
  margin-bottom: 20px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 6px;
  display: inline-block;
  font-size: 13px;
}
.trypyq-browse-empty {
  max-width: 500px;
  margin: 60px auto;
  padding: 48px 24px;
  text-align: center;
  background: var(--color-card, #161b22);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 16px;
}
.trypyq-browse-section {
  margin-bottom: 36px;
}
.trypyq-browse-section-title {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-muted, #888);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.trypyq-browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

/* Card — the real emotional anchor. Big year number, subtle
 * gradient background, lift + glow on hover so it feels clickable.
 * Left accent bar adds a hint of poster/ticket aesthetic. */
.trypyq-browse-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: linear-gradient(145deg, rgba(22, 27, 34, 0.95), rgba(13, 17, 23, 0.98));
  border: 1px solid var(--color-border, #30363d);
  border-radius: 14px;
  padding: 22px 20px 18px;
  color: var(--color-text, #e6edf3);
  transition: border-color 160ms, transform 160ms, box-shadow 160ms, background 160ms;
  overflow: hidden;
}
.trypyq-browse-card::before {
  content: '';
  position: absolute;
  top: 14px; bottom: 14px; left: 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(180deg, #60a5fa, #a78bfa);
  opacity: 0.7;
  transition: opacity 160ms, width 160ms;
}
.trypyq-browse-card:hover {
  border-color: rgba(96, 165, 250, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px -10px rgba(96, 165, 250, 0.35);
}
.trypyq-browse-card:hover::before {
  opacity: 1;
  width: 4px;
}
.trypyq-browse-card-year {
  font-size: 38px;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #93c5fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.trypyq-browse-card-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text, #e6edf3);
  opacity: 0.85;
  margin-top: 6px;
}
.trypyq-browse-card-meta {
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: 0.2px;
  opacity: 0.75;
}
.trypyq-browse-card-cta {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255,255,255,0.08);
  color: #60a5fa;
  font-weight: 700;
  font-size: 13px;
}
.trypyq-browse-card-pending {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 9px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 999px;
  color: #fbbf24;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.trypyq-result-pending-card {
  background: var(--color-card, #161b22);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 12px;
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 20px;
}

/* ── Sticky save-failure banner (attempt page) ────────────────────
 * Shown when 3 consecutive autosave attempts fail. Stays visible
 * until a save succeeds. Sticky-top + amber so the student can't
 * miss it while answering questions. */
.trypyq-save-fail-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 0;
  padding: 10px 16px;
  background: rgba(245, 158, 11, 0.18);
  border-bottom: 2px solid rgba(245, 158, 11, 0.6);
  color: #fbbf24;
  font-size: 13px;
  text-align: center;
  animation: trypyq-banner-pulse 2s ease-in-out infinite;
}
@keyframes trypyq-banner-pulse {
  0%, 100% { background: rgba(245, 158, 11, 0.18); }
  50%      { background: rgba(245, 158, 11, 0.30); }
}

/* ── Browse toolbar (student PYQ filter + sort) ──────────────────
 * Sits between the count badge and the exam sections. Inline form
 * controls so it reads like a refinement strip, not a heavy bar. */
.trypyq-browse-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}
.trypyq-browse-toolbar select {
  padding: 6px 10px;
  font-size: 13px;
  background: var(--color-card, #161b22);
  color: var(--color-text, #e6edf3);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 6px;
}

/* ── Bulk-key NTA auto-distribute panel ───────────────────────────
 * Collapsible <details> at the top of the bulk-key dialog. Closed
 * by default so the per-row Standard flow stays the default UX —
 * admins who don't need NTA never see the textarea. */
.trypyq-bulkkey-nta-panel {
  margin-top: 4px;
  padding: 12px 14px;
  background: rgba(96, 165, 250, 0.06);
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 10px;
}
.trypyq-bulkkey-nta-panel summary { list-style: none; outline: none; }
.trypyq-bulkkey-nta-panel summary::-webkit-details-marker { display: none; }
.trypyq-bulkkey-nta-panel summary::before {
  content: '▸ ';
  display: inline-block;
  margin-right: 4px;
  transition: transform 0.15s ease;
}
.trypyq-bulkkey-nta-panel[open] summary::before { transform: rotate(90deg); }

/* ── Bulk-action floating bar (admin list) ────────────────────────
 * Sticky at the bottom of the viewport whenever ≥1 row is selected.
 * Slides in via the display toggle in JS — no entry animation here
 * to avoid layout thrash on rapid checkbox clicking. */
.trypyq-bulk-bar {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  margin: 16px 0 0;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.trypyq-bulk-bar-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text, #e6edf3);
}
.btn--danger {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #f87171;
}
.btn--danger:hover { background: rgba(248, 113, 113, 0.25); }
.btn--danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── List filter toolbar (admin list) ─────────────────────────────
 * Sits above the audit banner. Inline form-style controls so the
 * filter feels like a native part of the table header rather than
 * a heavy modal toolbar. */
.trypyq-list-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  flex-wrap: wrap;
}
.trypyq-list-toolbar select {
  padding: 6px 10px;
  font-size: 13px;
  background: var(--color-card, #161b22);
  color: var(--color-text, #e6edf3);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 6px;
}

/* ── Academy-spec audit banner (admin list) ───────────────────────
 * Shown when one or more uploaded papers don't match EXAM_DEFAULTS.
 * Amber-warning palette (vs the blue download banner) to distinguish
 * "needs your attention" from "optional convenience". */
.trypyq-spec-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
}
.trypyq-spec-banner-txt { flex: 1; min-width: 220px; }
.trypyq-spec-banner-txt strong {
  display: block;
  color: #fbbf24;
  font-size: 14px;
  margin-bottom: 4px;
}

/* ── Offline cache banner (browse page) ─────────────────────────────
 * Sits between the paper-count line and the exam sections. Compact
 * card with a CTA on the right, expands into a progress bar during
 * bulk download. */
.trypyq-offline-banner {
  margin: 16px 0 20px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.10), rgba(167, 139, 250, 0.08));
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 12px;
}
.trypyq-offline-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.trypyq-offline-txt { flex: 1; min-width: 180px; }
.trypyq-offline-txt strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--color-text, #e6edf3);
}
.trypyq-offline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.trypyq-offline-bar {
  height: 6px;
  margin-top: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}
.trypyq-offline-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  transition: width 0.25s ease;
}
@media (max-width: 600px) {
  .trypyq-offline-inner { flex-direction: column; align-items: stretch; }
  .trypyq-offline-actions { justify-content: flex-end; }
}

/* ── Storage modal ──────────────────────────────────────────────── */
.trypyq-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px;
  z-index: 9999;
  animation: trypyq-fade-in 0.18s ease;
}
@keyframes trypyq-fade-in { from { opacity: 0; } to { opacity: 1; } }
.trypyq-storage-modal {
  background: var(--color-card, #161b22);
  border: 1px solid var(--color-border, #30363d);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}
.trypyq-modal-head {
  display: flex;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--color-border, #30363d);
}
.trypyq-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}
.trypyq-storage-summary {
  font-size: 12px;
  color: var(--color-muted, #9aa3ae);
  margin-bottom: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.trypyq-storage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.trypyq-storage-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
}
.trypyq-storage-main { flex: 1; min-width: 0; }
.trypyq-storage-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text, #e6edf3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trypyq-storage-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .trypyq-storage-row { flex-direction: column; align-items: stretch; }
  .trypyq-storage-actions { justify-content: flex-end; }
}
