/* =========================================================
   ADMIN QUESTION SEARCH — QUESTION TEXT ONLY + DETAIL EDITOR
   ========================================================= */

.central-admin-search-result-card {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.central-admin-search-result-card:hover,
.central-admin-search-result-card:focus-visible {
  transform: translateY(-1px);
  border-color: color-mix(
    in srgb,
    #c58a00 62%,
    var(--border-subtle)
  );
  background: var(--surface-hover);
  outline: none;
}

.dark-mode .central-admin-search-result-card:hover,
.dark-mode .central-admin-search-result-card:focus-visible {
  border-color: color-mix(
    in srgb,
    #f8c94c 62%,
    var(--border-subtle)
  );
}

.central-admin-search-result-number {
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.central-admin-search-result-question {
  min-width: 0;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.central-admin-search-result-open {
  color: #c58a00;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.dark-mode .central-admin-search-result-open {
  color: #f8c94c;
}

.central-admin-question-detail-overlay {
  z-index: 10400;
  padding: 20px;
  align-items: center;
  justify-content: center;
}

.central-admin-question-detail-dialog {
  width: min(760px, 96vw);
  height: min(760px, 92vh);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
}

.central-admin-question-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.central-admin-question-detail-header > div > span {
  color: #c58a00;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.11em;
}

.dark-mode
  .central-admin-question-detail-header
  > div
  > span {
  color: #f8c94c;
}

.central-admin-question-detail-header h2 {
  margin: 5px 0 0;
  font-size: clamp(18px, 3vw, 24px);
  line-height: 1.25;
}

.central-admin-question-detail-header p {
  margin: 7px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
}

.central-admin-question-detail-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  overscroll-behavior: contain;
}

.central-admin-question-detail-view,
.central-admin-question-detail-edit {
  display: grid;
  gap: 16px;
}

.central-admin-question-detail-question-label,
.central-admin-question-detail-section-title {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.central-admin-question-detail-question {
  padding: 17px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.65;
}

.central-admin-question-detail-choices {
  display: grid;
  gap: 10px;
}

.central-admin-question-detail-choice {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  background: var(--surface);
}

.central-admin-question-detail-choice > strong {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-muted);
  font-size: 12px;
}

.central-admin-question-detail-choice > span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.45;
}

.central-admin-question-detail-choice > em {
  color: #16845b;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.dark-mode
  .central-admin-question-detail-choice
  > em {
  color: #55d6a3;
}

.central-admin-question-detail-choice.is-correct {
  border-color: rgba(52, 211, 153, 0.58);
  background: rgba(52, 211, 153, 0.08);
}

.central-admin-question-detail-edit > label {
  display: grid;
  gap: 8px;
}

.central-admin-question-detail-edit > label > span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.central-admin-question-detail-edit textarea {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  padding: 13px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  line-height: 1.55;
  box-sizing: border-box;
}

.central-admin-question-detail-choice-editor {
  display: grid;
  gap: 10px;
}

.central-admin-question-detail-choice-input {
  display: grid;
  grid-template-columns: auto 28px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 9px;
}

.central-admin-question-detail-choice-input
  input[type="radio"] {
  accent-color: #c58a00;
}

.dark-mode
  .central-admin-question-detail-choice-input
  input[type="radio"] {
  accent-color: #f8c94c;
}

.central-admin-question-detail-choice-input > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-muted);
  font-size: 11px;
  font-weight: 900;
}

.central-admin-question-detail-choice-input
  input[type="text"] {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
}

.central-admin-question-detail-choice-input button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface);
  color: var(--danger);
  cursor: pointer;
}

.central-admin-question-detail-choice-input
  button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.central-admin-question-detail-message {
  min-height: 18px;
  margin-top: 14px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
}

.central-admin-question-detail-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 22px
    calc(15px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-subtle);
}

.central-admin-question-detail-loading,
.central-admin-question-detail-error {
  margin: auto;
  padding: 28px;
  text-align: center;
}

.central-admin-question-detail-error h2 {
  margin: 0 0 8px;
}

.central-admin-question-detail-error p {
  margin: 0 0 18px;
  color: var(--text-secondary);
  line-height: 1.5;
}

@media (max-width: 760px) {
  .central-admin-search-result-card {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }

  .central-admin-search-result-number {
    grid-column: 1 / -1;
  }

  .central-admin-question-detail-overlay {
    padding: 0;
    align-items: stretch;
  }

  .central-admin-question-detail-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .central-admin-question-detail-header,
  .central-admin-question-detail-body,
  .central-admin-question-detail-footer {
    padding-inline: 16px;
  }

  .central-admin-question-detail-choice {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .central-admin-question-detail-choice > em {
    grid-column: 2;
  }

  .central-admin-question-detail-footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .central-admin-question-detail-footer button {
    width: 100%;
    min-height: 46px;
  }

  .central-admin-question-detail-choice-input {
    grid-template-columns: auto 26px minmax(0, 1fr) 34px;
  }
}

/* =========================================================
   UNFINISHED ASSESSMENT RECOVERY
   ========================================================= */


.unfinished-assessment-overlay {
  position: fixed;
  inset: 0;
  z-index: 10550;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  box-sizing: border-box;
  background: var(--overlay-bg);
  backdrop-filter: blur(10px);
}

.unfinished-assessment-dialog {
  width: min(640px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  box-shadow: 0 30px 95px rgba(0, 0, 0, 0.46);
}

.unfinished-assessment-header {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 40px;
  align-items: start;
  gap: 14px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.unfinished-assessment-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(248, 201, 76, 0.42);
  border-radius: 14px;
  background: rgba(248, 201, 76, 0.1);
  color: #a87300;
}

.dark-mode .unfinished-assessment-icon {
  color: #f8c94c;
}

.unfinished-assessment-icon svg {
  width: 24px;
  height: 24px;
}

.unfinished-assessment-heading {
  min-width: 0;
}

.unfinished-assessment-header h2 {
  margin: 0;
  color: #f8c94c;
  font-size: clamp(17px, 3vw, 24px);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.12;
}

.unfinished-assessment-header p {
  margin: 10px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.unfinished-assessment-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}

.unfinished-assessment-close:hover,
.unfinished-assessment-close:focus-visible {
  background: var(--surface-hover);
  outline: none;
}

.unfinished-assessment-body {
  display: grid;
  gap: 12px;
  padding: 16px 22px 18px;
}

.unfinished-assessment-name {
  display: grid;
  gap: 5px;
  padding: 14px 15px;
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  background: var(--surface-muted);
}

.unfinished-assessment-name span,
.unfinished-assessment-details span,
.unfinished-assessment-progress-copy span {
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.unfinished-assessment-name strong {
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.42;
}

.unfinished-assessment-progress-card {
  display: grid;
  gap: 10px;
  padding: 14px 15px;
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  background: var(--surface);
}

.unfinished-assessment-progress-copy {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.unfinished-assessment-progress-copy > div {
  display: grid;
  gap: 4px;
}

.unfinished-assessment-progress-copy > div > strong {
  font-size: 13px;
}

.unfinished-assessment-progress-copy > div > small {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.35;
}

.unfinished-assessment-progress-copy > strong {
  color: #a87300;
  font-size: 18px;
  line-height: 1;
  white-space: nowrap;
}

.dark-mode .unfinished-assessment-progress-copy > strong {
  color: #f8c94c;
}

.unfinished-assessment-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.unfinished-assessment-progress-track > span {
  display: block;
  min-width: 2px;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d89a13, #f8c94c);
}

.unfinished-assessment-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.unfinished-assessment-detail-card {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  background: var(--surface-muted);
}

.unfinished-assessment-detail-wide {
  grid-column: 1 / -1;
}

.unfinished-assessment-details strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.unfinished-assessment-note {
  padding: 12px 14px;
  border: 1px solid rgba(248, 201, 76, 0.42);
  border-radius: 11px;
  background: rgba(248, 201, 76, 0.08);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.unfinished-assessment-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-subtle);
}

.unfinished-assessment-actions button {
  min-height: 44px;
  padding: 11px 16px;
  border-radius: 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.unfinished-assessment-discard {
  border: 1px solid rgba(214, 66, 85, 0.52);
  background: rgba(214, 66, 85, 0.07);
  color: #c93247;
}

.dark-mode .unfinished-assessment-discard {
  color: #ff8995;
}

.unfinished-assessment-resume {
  border: 1px solid #d89a13;
  background: #f8c94c;
  color: #151515;
}

.unfinished-assessment-actions button:hover,
.unfinished-assessment-actions button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

@media (max-width: 760px) {
  .unfinished-assessment-overlay {
    padding: 14px;
  }

  .unfinished-assessment-dialog {
    width: min(100%, 560px);
    border-radius: 18px;
  }

  .unfinished-assessment-header {
    grid-template-columns: 42px minmax(0, 1fr) 36px;
    gap: 12px;
    padding: 18px 16px 15px;
  }

  .unfinished-assessment-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .unfinished-assessment-icon svg {
    width: 20px;
    height: 20px;
  }

  .unfinished-assessment-header h2 {
    font-size: 14px;
    letter-spacing: 0.12em;
  }

  .unfinished-assessment-header p {
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.48;
  }

  .unfinished-assessment-body {
    gap: 10px;
    padding: 14px 16px 16px;
  }

  .unfinished-assessment-name,
  .unfinished-assessment-progress-card,
  .unfinished-assessment-detail-card {
    padding: 12px 13px;
  }

  .unfinished-assessment-name strong {
    font-size: 13px;
  }

  .unfinished-assessment-progress-copy {
    gap: 12px;
  }

  .unfinished-assessment-progress-copy > div > strong {
    font-size: 12px;
  }

  .unfinished-assessment-progress-copy > div > small {
    font-size: 10px;
  }

  .unfinished-assessment-progress-copy > strong {
    font-size: 16px;
  }

  .unfinished-assessment-details {
    gap: 9px;
  }

  .unfinished-assessment-details strong {
    font-size: 11px;
  }

  .unfinished-assessment-actions {
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  }

  .unfinished-assessment-actions button {
    width: 100%;
    min-height: 42px;
    padding-inline: 12px;
    font-size: 11px;
  }
}

/* Quick Insights popup table alignment */
.quick-insights-modal-table-head > span {
  text-align: center;
}

.quick-insights-subject-row > strong:nth-child(2),
.quick-insights-subject-row > strong:nth-child(4) {
  width: 100%;
  text-align: center;
  justify-self: stretch;
}

.quick-insights-subject-row > div:first-child {
  text-align: left;
}

/* =========================================================
   QUICK INSIGHTS — MERGED BEST SCORE, THREE-COLUMN TABLE
   ========================================================= */

/*
  Use the same layout on every screen size:
  Subject | Best Score | Accuracy
*/
.quick-insights-modal,
.quick-insights-modal-table,
.quick-insights-modal-list {
  max-width: 100%;
}

.quick-insights-modal-table {
  width: auto;
  overflow: hidden;
}

.quick-insights-modal-list {
  overflow-x: hidden;
}

.quick-insights-modal-table-head,
.quick-insights-subject-row {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  grid-template-columns:
    minmax(0, 2fr)
    minmax(92px, 0.82fr)
    minmax(72px, 0.68fr);
}

.quick-insights-modal-table-head > span,
.quick-insights-subject-row > * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.quick-insights-modal-table-head > span {
  overflow: hidden;
  overflow-wrap: anywhere;
  text-align: center;
}

.quick-insights-subject-row > div:first-child {
  overflow: hidden;
  text-align: left;
}

.quick-insights-subject-row > strong:nth-child(2),
.quick-insights-subject-row > strong:nth-child(3) {
  display: block;
  width: 100%;
  overflow: hidden;
  justify-self: stretch;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .quick-insights-modal-overlay {
    padding: 10px;
  }

  .quick-insights-modal {
    width: 100%;
    max-width: 100%;
  }

  .quick-insights-modal-table {
    width: auto;
    margin: 12px;
  }

  .quick-insights-modal-table-head,
  .quick-insights-subject-row {
    grid-template-columns:
      minmax(0, 1.72fr)
      minmax(78px, 0.78fr)
      minmax(58px, 0.58fr);
    gap: 5px;
  }

  .quick-insights-modal-table-head span:nth-child(3),
  .quick-insights-subject-row > *:nth-child(3) {
    display: block;
  }

  .quick-insights-modal-table-head {
    padding: 9px 7px;
    font-size: 7.5px;
    letter-spacing: 0.035em;
    line-height: 1.15;
  }

  .quick-insights-modal-table-head > span {
    white-space: normal;
  }

  .quick-insights-subject-row {
    padding: 11px 7px;
    font-size: 9.5px;
  }

  .quick-insights-subject-row > div {
    gap: 3px;
  }

  .quick-insights-subject-row > div > strong {
    font-size: 10px;
  }

  .quick-insights-subject-set {
    font-size: 7px;
    letter-spacing: 0.035em;
  }
}

@media (max-width: 390px) {
  .quick-insights-modal-overlay {
    padding: 6px;
  }

  .quick-insights-modal-table {
    margin: 10px 8px 12px;
  }

  .quick-insights-modal-table-head,
  .quick-insights-subject-row {
    grid-template-columns:
      minmax(0, 1.62fr)
      minmax(70px, 0.76fr)
      minmax(52px, 0.56fr);
    gap: 3px;
  }

  .quick-insights-modal-table-head {
    padding-inline: 5px;
    font-size: 7px;
  }

  .quick-insights-subject-row {
    padding-inline: 5px;
    font-size: 9px;
  }
}

.flashcard-import-restriction-overlay {
  z-index: 10500;
}

.flashcard-import-restriction-box {
  width: min(560px, calc(100vw - 28px));
}

/* =========================================================
   ATTEMPT HISTORY — COMPACT, ALIGNED THREE-COLUMN LAYOUT
   ========================================================= */

.attempt-history-dialog {
  width: min(820px, 96vw);
  height: auto;
  max-height: min(760px, 92vh);
}

.attempt-history-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.attempt-history-summary > div {
  align-content: center;
  min-height: 72px;
}

.attempt-history-summary strong {
  font-variant-numeric: tabular-nums;
}

.attempt-history-last-completed {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 0 24px 15px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.35;
}

.attempt-history-last-completed > span {
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.attempt-history-last-completed > strong {
  color: var(--text-primary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.attempt-history-last-completed > em {
  color: var(--text-secondary);
  font-size: 10px;
  font-style: normal;
}

.attempt-history-content {
  flex: 0 1 auto;
  max-height: min(470px, 58vh);
}

.attempt-history-table {
  flex: 0 1 auto;
  max-height: min(450px, 55vh);
}

.attempt-history-table-head,
.attempt-history-row {
  grid-template-columns: minmax(126px, 1.12fr) minmax(128px, 1fr) minmax(92px, 0.7fr);
  gap: 16px;
}

.attempt-history-table-head > span:first-child { text-align: left; }
.attempt-history-table-head > span:nth-child(2),
.attempt-history-table-head > span:nth-child(3) { text-align: center; }

.attempt-history-row {
  min-height: 76px;
  align-items: center;
}

.attempt-history-completed,
.attempt-history-attempt,
.attempt-history-result { min-width: 0; }

.attempt-history-completed {
  display: grid;
  gap: 5px;
  text-align: left;
}

.attempt-history-completed > strong {
  color: var(--text-primary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  white-space: nowrap;
}

.attempt-history-completed > small {
  margin: 0;
  color: var(--text-secondary);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.attempt-history-attempt {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.attempt-history-type {
  display: inline-flex;
  justify-content: center;
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 9.5px;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
}

.attempt-history-result {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.attempt-history-result > strong {
  color: var(--text-primary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.attempt-history-result > small {
  display: block;
  margin: 0;
  font-size: 9px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.attempt-history-accuracy.is-excellent { color: #16845b; }
.attempt-history-accuracy.is-improving { color: #b97700; }
.attempt-history-accuracy.is-need-practice { color: #d64255; }
.dark-mode .attempt-history-accuracy.is-excellent { color: #55d6a3; }
.dark-mode .attempt-history-accuracy.is-improving { color: #f8c94c; }
.dark-mode .attempt-history-accuracy.is-need-practice { color: #ff8995; }

.attempt-history-row.is-admin-adjustment {
  box-shadow: inset 3px 0 0 rgba(248, 201, 76, 0.72);
}

.attempt-history-empty,
.attempt-history-loading { min-height: 150px; }

@media (max-width: 760px) {
  .attempt-history-dialog {
    width: 100%;
    height: auto;
    max-height: 94dvh;
  }

  .attempt-history-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .attempt-history-summary > div {
    min-height: 66px;
    padding: 9px 8px;
  }

  .attempt-history-summary span {
    font-size: 7.5px;
    letter-spacing: 0.055em;
  }

  .attempt-history-summary strong { font-size: 12px; }

  .attempt-history-last-completed {
    flex-wrap: wrap;
    padding: 0 18px 13px;
    font-size: 8.5px;
  }

  .attempt-history-last-completed > strong { font-size: 9.5px; }
  .attempt-history-last-completed > em { font-size: 8.5px; }

  .attempt-history-content { max-height: min(500px, 60dvh); }
  .attempt-history-table { max-height: min(480px, 57dvh); }

  .attempt-history-table-head,
  .attempt-history-row {
    grid-template-columns: minmax(92px, 1.08fr) minmax(86px, 0.95fr) minmax(66px, 0.64fr);
    gap: 5px;
  }

  .attempt-history-table-head {
    padding: 10px 8px;
    font-size: 7px;
    letter-spacing: 0.035em;
  }

  .attempt-history-row {
    min-height: 72px;
    padding: 11px 8px;
  }

  .attempt-history-completed > strong { font-size: 9.5px; }
  .attempt-history-completed > small { font-size: 8px; }
  .attempt-history-type { padding: 5px 6px; font-size: 8px; }
  .attempt-history-result > strong { font-size: 10px; }
  .attempt-history-result > small { font-size: 7.5px; }
}

@media (max-width: 390px) {
  .attempt-history-table-head,
  .attempt-history-row {
    grid-template-columns: minmax(88px, 1.05fr) minmax(78px, 0.9fr) minmax(62px, 0.62fr);
    gap: 3px;
  }

  .attempt-history-table-head { padding-inline: 6px; font-size: 6.5px; }
  .attempt-history-row { padding-inline: 6px; }
  .attempt-history-type { font-size: 7.5px; }
}

/* =========================================================
   ATTEMPT HISTORY — COMPACT CENTERED SPACING REFINEMENT
   ========================================================= */

/* Keep the same card widths while reducing unnecessary height. */
.attempt-history-summary {
  gap: 9px;
  padding: 12px 24px;
}

.attempt-history-summary > div {
  min-height: 0;
  align-content: center;
  gap: 3px;
  padding: 8px 12px;
}

.attempt-history-summary span {
  line-height: 1.15;
}

.attempt-history-summary strong {
  line-height: 1.15;
}

/* Give Last Completed balanced breathing room above and below. */
.attempt-history-last-completed {
  justify-content: center;
  padding: 10px 24px;
  line-height: 1.2;
  text-align: center;
}

/* Reduce the space between the Last Completed line and the table. */
.attempt-history-content {
  padding: 12px 24px 18px;
}

/* Use evenly aligned, centered columns. */
.attempt-history-table-head,
.attempt-history-row {
  grid-template-columns:
    minmax(0, 1fr)
    minmax(0, 1fr)
    minmax(0, 1fr);
  gap: 8px;
}

.attempt-history-table-head > span,
.attempt-history-table-head > span:first-child,
.attempt-history-table-head > span:nth-child(2),
.attempt-history-table-head > span:nth-child(3) {
  text-align: center;
}

/* Compact each attempt row and center every cell. */
.attempt-history-row {
  min-height: 0;
  align-items: center;
  padding-top: 10px;
  padding-bottom: 10px;
}

.attempt-history-completed,
.attempt-history-attempt,
.attempt-history-result {
  width: 100%;
  min-width: 0;
  justify-items: center;
  justify-content: center;
  text-align: center;
}

.attempt-history-completed {
  gap: 3px;
  text-align: center;
}

.attempt-history-completed > strong,
.attempt-history-completed > small {
  width: 100%;
  text-align: center;
}

.attempt-history-result {
  gap: 3px;
}

/* Attempt labels are plain centered text, not pills or cards. */
.attempt-history-type {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text-primary);
  line-height: 1.3;
  text-align: center;
}

/* Keep admin-edit distinction subtle without affecting alignment. */
.attempt-history-row.is-admin-adjustment {
  box-shadow: inset 2px 0 0 rgba(248, 201, 76, 0.65);
}

@media (max-width: 760px) {
  .attempt-history-summary {
    gap: 6px;
    padding: 10px 14px;
  }

  .attempt-history-summary > div {
    min-height: 0;
    padding: 7px 6px;
  }

  .attempt-history-last-completed {
    justify-content: center;
    gap: 4px;
    padding: 9px 14px;
    text-align: center;
  }

  .attempt-history-content {
    padding: 10px 12px 14px;
  }

  .attempt-history-table-head,
  .attempt-history-row {
    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, 1fr)
      minmax(0, 1fr);
    gap: 3px;
  }

  .attempt-history-table-head {
    padding: 9px 5px;
  }

  .attempt-history-row {
    min-height: 0;
    padding: 9px 5px;
  }

  .attempt-history-type {
    padding: 0;
    font-size: 8px;
  }
}

@media (max-width: 390px) {
  .attempt-history-table-head,
  .attempt-history-row {
    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, 1fr)
      minmax(0, 1fr);
    gap: 2px;
  }

  .attempt-history-row {
    padding-block: 8px;
  }
}


/* =========================================================
   QUICK INSIGHTS — UNATTEMPTED SCORE DISTINCTION
   ========================================================= */

/*
  A genuine zero-score attempt remains 0%.
  Subjects that have never been attempted use a neutral status label.
*/
.quick-insights-accuracy-value.is-unattempted {
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.035em;
  line-height: 1.15;
  text-transform: uppercase;
  text-overflow: clip;
  white-space: normal;
}

@media (max-width: 760px) {
  .quick-insights-accuracy-value.is-unattempted {
    font-size: 7.5px;
    letter-spacing: 0.02em;
  }
}

/* =========================================================
   AUTHENTICATION SCREEN — DARK PROFESSIONAL EXPERIENCE
   ========================================================= */

/*
  The authentication screen remains dark and professional regardless of the
  dashboard theme saved on the device. The dashboard's existing mono font is
  intentionally preserved.
*/
.user-auth-overlay {
  color-scheme: dark;
  padding: 20px;
  background:
    radial-gradient(circle at 50% -10%, rgba(248, 201, 76, 0.1), transparent 34%),
    linear-gradient(180deg, rgba(4, 6, 9, 0.96), rgba(2, 3, 6, 0.985));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.user-auth-dialog {
  width: min(100%, 460px);
  max-height: calc(100dvh - 40px);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 20px;
  background: linear-gradient(180deg, #171b21 0%, #11151a 100%);
  color: #f4f5f7;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.user-auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.user-auth-brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(248, 201, 76, 0.48);
  border-radius: 12px;
  background: rgba(248, 201, 76, 0.09);
  color: #f8c94c;
  font-family: var(--app-font) !important;
  font-size: calc(11px * var(--quiz-font-scale));
  font-weight: 800;
  letter-spacing: 0.04em;
}

.user-auth-brand-copy {
  min-width: 0;
}

.user-auth-dialog .user-auth-eyebrow {
  margin: 0;
  color: #f8c94c;
  font-size: calc(10px * var(--quiz-font-scale));
  font-weight: 800;
  letter-spacing: 0.12em;
}

.user-auth-brand-note {
  margin-top: 3px;
  color: #8f97a3;
  font-family: var(--app-font) !important;
  font-size: calc(9px * var(--quiz-font-scale));
  letter-spacing: 0.025em;
}

.user-auth-dialog .user-auth-title {
  color: #f7f8fa;
  font-size: calc(26px * var(--quiz-font-scale));
  letter-spacing: -0.045em;
}

.user-auth-dialog .user-auth-description {
  margin: 11px 0 22px;
  color: #aab0ba;
  font-size: calc(12px * var(--quiz-font-scale));
  line-height: 1.65;
}

.user-auth-dialog .user-auth-tabs {
  gap: 5px;
  padding: 4px;
  margin-bottom: 20px;
  border-color: rgba(255, 255, 255, 0.09);
  background: #0d1014;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.user-auth-dialog .user-auth-tab {
  color: #858d99;
}

.user-auth-dialog .user-auth-tab:hover {
  color: #e7e9ed;
  background: #171b21;
}

.user-auth-dialog .user-auth-tab.active,
.dark-mode .user-auth-dialog .user-auth-tab.active {
  color: #f8c94c;
  border-color: rgba(248, 201, 76, 0.34);
  background: rgba(248, 201, 76, 0.085);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.user-auth-dialog .user-auth-form {
  gap: 9px;
}

.user-auth-dialog .user-auth-label {
  color: #dfe2e7;
}

.user-auth-dialog .user-auth-input {
  min-height: 46px;
  border-color: rgba(255, 255, 255, 0.1);
  background: #0c0f13;
  color: #f5f6f8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.user-auth-dialog .user-auth-input::placeholder {
  color: #666e79;
}

.user-auth-dialog .user-auth-input:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.user-auth-dialog .user-auth-input:focus {
  border-color: rgba(248, 201, 76, 0.64);
  background: #101419;
  box-shadow:
    0 0 0 3px rgba(248, 201, 76, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.user-auth-password-field {
  position: relative;
  min-width: 0;
}

.user-auth-password-field .user-auth-input {
  padding-right: 50px;
}

.user-auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #777f8a;
  cursor: pointer;
  transform: translateY(-50%);
  transition:
    color 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.user-auth-password-toggle:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
  color: #f8c94c;
}

.user-auth-password-toggle:focus-visible {
  outline: none;
  border-color: rgba(248, 201, 76, 0.58);
  background: rgba(248, 201, 76, 0.075);
  color: #f8c94c;
  box-shadow: 0 0 0 3px rgba(248, 201, 76, 0.11);
}

.user-auth-eye {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.user-auth-eye-open {
  display: none;
}

.user-auth-password-toggle.is-visible .user-auth-eye-closed {
  display: none;
}

.user-auth-password-toggle.is-visible .user-auth-eye-open {
  display: block;
}

.user-auth-dialog .user-auth-message {
  color: #979faa;
}

.user-auth-dialog .user-auth-message.error {
  color: #ff8995;
}

.user-auth-dialog .user-auth-message.success {
  color: #71d6a1;
}

.user-auth-dialog .user-auth-submit {
  min-height: 46px;
  margin-top: 2px;
  border-color: #d89a13;
  background: #f8c94c;
  color: #151515;
  box-shadow:
    0 8px 20px rgba(216, 154, 19, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.user-auth-dialog .user-auth-submit:hover:not(:disabled),
.dark-mode .user-auth-dialog .user-auth-submit:hover:not(:disabled) {
  filter: brightness(1.035);
  box-shadow:
    0 10px 24px rgba(216, 154, 19, 0.23),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.user-auth-dialog .user-auth-link {
  color: #a8afb9;
  text-decoration: none;
}

.user-auth-dialog .user-auth-link:hover {
  color: #f8c94c;
  text-decoration: underline;
}

.user-auth-dialog .user-auth-footnote {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  margin-top: 18px;
  padding-top: 16px;
  border-top-color: rgba(255, 255, 255, 0.08);
  color: #777f8a;
  font-size: calc(9px * var(--quiz-font-scale));
  text-align: left;
}

.user-auth-footnote-icon {
  flex: 0 0 auto;
  color: #f8c94c;
  font-weight: 900;
}

.user-auth-dialog input:-webkit-autofill,
.user-auth-dialog input:-webkit-autofill:hover,
.user-auth-dialog input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f5f6f8;
  -webkit-box-shadow: 0 0 0 1000px #0c0f13 inset;
  caret-color: #f5f6f8;
  transition: background-color 9999s ease-out 0s;
}

@media (max-width: 560px) {
  .user-auth-overlay {
    padding: 14px;
  }

  .user-auth-dialog {
    width: 100%;
    max-height: calc(100dvh - 28px);
    padding: 22px 18px;
    border-radius: 17px;
  }

  .user-auth-brand {
    margin-bottom: 18px;
  }

  .user-auth-brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    border-radius: 11px;
  }

  .user-auth-dialog .user-auth-title {
    font-size: calc(22px * var(--quiz-font-scale));
  }

  .user-auth-dialog .user-auth-description {
    margin-bottom: 18px;
    font-size: calc(11px * var(--quiz-font-scale));
  }

  .user-auth-dialog .user-auth-tabs {
    margin-bottom: 17px;
  }
}

/* =========================================================
   DASHBOARD INSIGHTS — COMPACT QUICK INSIGHTS + MISTAKES
   ========================================================= */

.dashboard-tools-row {
  display: grid;
  grid-template-columns: minmax(250px, 0.82fr) minmax(0, 1.18fr);
  align-items: stretch;
  gap: 16px;
}

.quick-insights-card,
.mistakes-review-card {
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--surface-elevated), var(--surface)) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-card), var(--inner-highlight) !important;
}

.quick-insights-card {
  padding: 18px;
}

.quick-insights-title,
.mistakes-review-title {
  margin: 0;
  color: var(--text-primary) !important;
  font-size: calc(12px * var(--quiz-font-scale));
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.quick-insights-title {
  margin-bottom: 12px;
}

.quick-insights-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  text-align: left;
}

.quick-insights-col {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  align-items: center;
  justify-content: stretch;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  background: var(--surface-muted);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.quick-insights-col::after,
.quick-insights-col:not(:last-child)::after {
  display: none;
  content: none;
}

.quick-insights-col:hover,
.quick-insights-col:focus-visible {
  background: var(--surface-hover);
  border-color: var(--accent-border);
  transform: translateY(-1px);
}

.quick-insights-count {
  color: var(--text-primary) !important;
  font-size: calc(28px * var(--quiz-font-scale));
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.quick-insights-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.quick-insights-label-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  margin: 0;
  color: var(--text-primary) !important;
}

.quick-insights-icon {
  width: 17px;
  height: 17px;
}

.quick-insights-label {
  min-width: 0;
  color: var(--text-primary) !important;
  font-size: calc(12px * var(--quiz-font-scale));
  font-weight: 800;
  line-height: 1.2;
}

.quick-insights-range {
  margin: 0;
  color: var(--text-secondary) !important;
  font-size: calc(9px * var(--quiz-font-scale));
  font-weight: 600;
  line-height: 1.35;
  opacity: 1;
}

.mistakes-review-card {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.mistakes-review-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mistakes-review-summary {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface-muted);
}

.mistakes-review-summary > strong {
  min-width: 54px;
  color: #d89a13;
  font-size: calc(35px * var(--quiz-font-scale));
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.dark-mode .mistakes-review-summary > strong {
  color: #f8c94c;
}

.mistakes-review-summary > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.mistakes-review-summary span {
  color: var(--text-primary);
  font-size: calc(12px * var(--quiz-font-scale));
  font-weight: 800;
  line-height: 1.25;
}

.mistakes-review-summary small {
  color: var(--text-secondary);
  font-size: calc(9px * var(--quiz-font-scale));
  font-weight: 600;
  line-height: 1.4;
}

.mistakes-review-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.mistakes-review-mode-grid > div {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface-muted);
}

.mistakes-review-mode-grid span {
  min-width: 0;
  color: var(--text-secondary);
  font-size: calc(9px * var(--quiz-font-scale));
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
}

.mistakes-review-mode-grid strong {
  color: var(--text-primary);
  font-size: calc(17px * var(--quiz-font-scale));
  font-weight: 900;
  line-height: 1;
}

.mistakes-review-open {
  width: 100%;
  min-height: 40px;
  margin-top: auto;
  padding: 9px 13px;
  border: 1px solid #d89a13;
  border-radius: 10px;
  background: #f8c94c;
  color: #151515;
  font: inherit;
  font-size: calc(10px * var(--quiz-font-scale));
  font-weight: 900;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    filter 0.18s ease;
}

.mistakes-review-open:not(:disabled):hover,
.mistakes-review-open:not(:disabled):focus-visible {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.mistakes-review-open:disabled {
  border-color: var(--border-subtle);
  background: var(--surface-muted);
  color: var(--text-secondary);
  cursor: default;
  opacity: 1;
}

.board-countdown-container {
  grid-column: 1 / -1;
}

.mistakes-review-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10560;
  display: grid;
  place-items: center;
  padding: 18px;
  box-sizing: border-box;
  background: var(--overlay-bg);
  backdrop-filter: blur(10px);
}

.mistakes-review-modal {
  width: min(720px, calc(100vw - 36px));
  max-height: min(760px, calc(100dvh - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

.mistakes-review-modal-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: start;
  gap: 16px;
  padding: 20px 22px 17px;
  border-bottom: 1px solid var(--border-subtle);
}

.mistakes-review-modal-header > div > span {
  display: block;
  margin-bottom: 6px;
  color: #d89a13;
  font-size: calc(9px * var(--quiz-font-scale));
  font-weight: 900;
  letter-spacing: 0.1em;
}

.dark-mode .mistakes-review-modal-header > div > span {
  color: #f8c94c;
}

.mistakes-review-modal-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: calc(23px * var(--quiz-font-scale));
  line-height: 1.15;
}

.mistakes-review-modal-header p {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: calc(11px * var(--quiz-font-scale));
  line-height: 1.5;
}

.mistakes-review-modal-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 22px;
  cursor: pointer;
}

.mistakes-review-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 22px 0;
}

.mistakes-review-tab {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font: inherit;
  font-size: calc(9px * var(--quiz-font-scale));
  font-weight: 800;
  cursor: pointer;
}

.mistakes-review-tab.is-active {
  border-color: rgba(248, 201, 76, 0.55);
  background: rgba(248, 201, 76, 0.09);
  color: var(--text-primary);
}

.mistakes-review-modal-list {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 14px 22px 18px;
  overscroll-behavior: contain;
}

.mistakes-review-question-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  background: var(--surface-muted);
}

.mistakes-review-question-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.mistakes-review-question-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.mistakes-review-question-meta span {
  max-width: 100%;
  overflow: hidden;
  padding: 3px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: calc(8px * var(--quiz-font-scale));
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mistakes-review-question-copy > strong {
  overflow-wrap: anywhere;
  color: var(--text-primary);
  font-size: calc(11px * var(--quiz-font-scale));
  line-height: 1.45;
}

.mistakes-review-question-copy > small {
  color: var(--text-secondary);
  font-size: calc(8px * var(--quiz-font-scale));
  line-height: 1.35;
}

.mistakes-review-missed-count {
  align-self: center;
  min-width: 54px;
  display: grid;
  justify-items: center;
  gap: 2px;
}

.mistakes-review-missed-count strong {
  color: #f87171;
  font-size: calc(20px * var(--quiz-font-scale));
  line-height: 1;
}

.mistakes-review-missed-count span {
  color: var(--text-secondary);
  font-size: calc(8px * var(--quiz-font-scale));
  font-weight: 800;
  text-transform: uppercase;
}

.mistakes-review-empty {
  padding: 28px 18px;
  border: 1px dashed var(--border-subtle);
  border-radius: 11px;
  color: var(--text-secondary);
  font-size: calc(11px * var(--quiz-font-scale));
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

.mistakes-review-modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-subtle);
}

.mistakes-review-mode-note {
  color: var(--text-secondary);
  font-size: calc(9px * var(--quiz-font-scale));
  font-weight: 600;
  line-height: 1.4;
}

.mistakes-review-start {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid #d89a13;
  border-radius: 10px;
  background: #f8c94c;
  color: #151515;
  font: inherit;
  font-size: calc(10px * var(--quiz-font-scale));
  font-weight: 900;
  cursor: pointer;
}

.mistakes-review-start:disabled {
  border-color: var(--border-subtle);
  background: var(--surface-muted);
  color: var(--text-secondary);
  cursor: default;
  opacity: 1;
}

@media (max-width: 700px) {
  .dashboard-tools-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .quick-insights-card,
  .mistakes-review-card {
    height: auto;
  }

  .quick-insights-card,
  .mistakes-review-card {
    padding: 15px;
  }

  .quick-insights-title,
  .mistakes-review-card-header {
    margin-bottom: 10px;
  }

  .quick-insights-col {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    padding: 9px 11px;
  }

  .quick-insights-count {
    font-size: calc(24px * var(--quiz-font-scale));
  }

  .quick-insights-icon {
    width: 15px;
    height: 15px;
  }

  .quick-insights-label {
    font-size: calc(11px * var(--quiz-font-scale));
  }

  .quick-insights-range {
    font-size: calc(8px * var(--quiz-font-scale));
  }

  .mistakes-review-summary {
    padding: 12px;
  }

  .mistakes-review-summary > strong {
    min-width: 46px;
    font-size: calc(30px * var(--quiz-font-scale));
  }

  .board-countdown-container {
    grid-column: auto;
  }

  .mistakes-review-modal-overlay {
    padding: 12px;
  }

  .mistakes-review-modal {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 16px;
  }

  .mistakes-review-modal-header {
    padding: 17px 15px 14px;
  }

  .mistakes-review-tabs {
    gap: 6px;
    padding: 12px 15px 0;
  }

  .mistakes-review-tab {
    padding-inline: 6px;
    font-size: calc(8px * var(--quiz-font-scale));
  }

  .mistakes-review-modal-list {
    padding: 12px 15px 15px;
  }

  .mistakes-review-question-row {
    gap: 10px;
    padding: 11px 12px;
  }

  .mistakes-review-modal-actions {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    padding: 12px 15px calc(13px + env(safe-area-inset-bottom));
  }

  .mistakes-review-start {
    width: 100%;
  }
}

@media (max-width: 380px) {
  .mistakes-review-mode-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .mistakes-review-tabs {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =========================================================
   DASHBOARD INSIGHTS — SUBJECT-BASED MISTAKES REVIEW
   ========================================================= */

.mistakes-review-subject-summary {
  min-width: 0;
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.mistakes-review-subject-summary-head {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-inline: 2px;
}

.mistakes-review-subject-summary-head > span {
  min-width: 0;
  color: var(--text-primary);
  font-size: calc(9px * var(--quiz-font-scale));
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.25;
  text-transform: uppercase;
}

.mistakes-review-subject-summary-head > small {
  color: var(--text-secondary);
  font-size: calc(8px * var(--quiz-font-scale));
  font-weight: 600;
  line-height: 1.25;
  text-align: right;
}

.mistakes-review-subject-list {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.mistakes-review-subject-button,
.mistakes-review-more-subjects {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.mistakes-review-subject-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  text-align: left;
}

.mistakes-review-subject-button > span {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: calc(9px * var(--quiz-font-scale));
  font-weight: 750;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mistakes-review-subject-button > strong {
  min-width: 24px;
  color: #d89a13;
  font-size: calc(14px * var(--quiz-font-scale));
  font-weight: 900;
  line-height: 1;
  text-align: right;
}

.dark-mode .mistakes-review-subject-button > strong {
  color: #f8c94c;
}

.mistakes-review-more-subjects {
  min-height: 31px;
  padding: 7px 10px;
  color: var(--text-secondary);
  font-size: calc(8px * var(--quiz-font-scale));
  font-weight: 800;
  text-align: center;
}

.mistakes-review-subject-button:hover,
.mistakes-review-subject-button:focus-visible,
.mistakes-review-more-subjects:hover,
.mistakes-review-more-subjects:focus-visible {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  outline: none;
  transform: translateY(-1px);
}

.mistakes-review-subject-filter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px 22px 0;
}

.mistakes-review-subject-filter label {
  color: var(--text-secondary);
  font-size: calc(9px * var(--quiz-font-scale));
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.mistakes-review-subject-filter select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 34px 8px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--text-primary);
  font: inherit;
  font-size: calc(10px * var(--quiz-font-scale));
  font-weight: 750;
}

.mistakes-review-subject-filter select:focus-visible {
  border-color: var(--accent-border);
  outline: 2px solid rgba(248, 201, 76, 0.2);
  outline-offset: 1px;
}

@media (max-width: 700px) {
  .dashboard-tools-row {
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    align-items: stretch;
    gap: 8px;
  }

  .quick-insights-card,
  .mistakes-review-card {
    min-width: 0;
    height: 100%;
    padding: 10px;
    border-radius: 12px;
  }

  .quick-insights-title,
  .mistakes-review-title {
    font-size: calc(9px * var(--quiz-font-scale));
    letter-spacing: 0.06em;
  }

  .quick-insights-title,
  .mistakes-review-card-header {
    margin-bottom: 8px;
  }

  .quick-insights-grid {
    gap: 6px;
  }

  .quick-insights-col {
    grid-template-columns: 31px minmax(0, 1fr);
    gap: 6px;
    padding: 7px 7px;
    border-radius: 9px;
  }

  .quick-insights-count {
    font-size: calc(20px * var(--quiz-font-scale));
  }

  .quick-insights-label-row {
    gap: 4px;
  }

  .quick-insights-icon {
    width: 12px;
    height: 12px;
  }

  .quick-insights-label {
    font-size: calc(8px * var(--quiz-font-scale));
    line-height: 1.18;
  }

  .quick-insights-range {
    font-size: calc(6.5px * var(--quiz-font-scale));
    line-height: 1.25;
  }

  .mistakes-review-card-header {
    gap: 6px;
  }

  .mistakes-review-summary {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
    border-radius: 9px;
  }

  .mistakes-review-summary > strong {
    min-width: 34px;
    font-size: calc(24px * var(--quiz-font-scale));
  }

  .mistakes-review-summary > div {
    gap: 2px;
  }

  .mistakes-review-summary span {
    font-size: calc(8px * var(--quiz-font-scale));
    line-height: 1.2;
  }

  .mistakes-review-summary small {
    font-size: calc(6.5px * var(--quiz-font-scale));
    line-height: 1.3;
  }

  .mistakes-review-subject-summary {
    gap: 5px;
    margin-top: 6px;
  }

  .mistakes-review-subject-summary-head {
    display: grid;
    gap: 1px;
  }

  .mistakes-review-subject-summary-head > span {
    font-size: calc(7px * var(--quiz-font-scale));
  }

  .mistakes-review-subject-summary-head > small {
    font-size: calc(6px * var(--quiz-font-scale));
    text-align: left;
  }

  .mistakes-review-subject-list {
    gap: 4px;
  }

  .mistakes-review-subject-button {
    gap: 6px;
    padding: 6px 7px;
    border-radius: 8px;
  }

  .mistakes-review-subject-button > span {
    font-size: calc(7px * var(--quiz-font-scale));
  }

  .mistakes-review-subject-button > strong {
    min-width: 17px;
    font-size: calc(11px * var(--quiz-font-scale));
  }

  .mistakes-review-more-subjects {
    min-height: 25px;
    padding: 5px 7px;
    font-size: calc(6.5px * var(--quiz-font-scale));
  }

  .mistakes-review-open {
    min-height: 31px;
    margin-top: 7px;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: calc(7px * var(--quiz-font-scale));
  }

  .board-countdown-container {
    grid-column: 1 / -1;
  }

  .mistakes-review-subject-filter {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 12px 15px 0;
  }

  .mistakes-review-subject-filter label {
    font-size: calc(8px * var(--quiz-font-scale));
  }

  .mistakes-review-subject-filter select {
    min-height: 38px;
    font-size: calc(9px * var(--quiz-font-scale));
  }
}

@media (max-width: 380px) {
  .dashboard-tools-row {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 6px;
  }

  .quick-insights-card,
  .mistakes-review-card {
    padding: 8px;
  }

  .quick-insights-col {
    grid-template-columns: 27px minmax(0, 1fr);
    gap: 4px;
    padding: 6px;
  }

  .quick-insights-count {
    font-size: calc(18px * var(--quiz-font-scale));
  }

  .mistakes-review-summary {
    grid-template-columns: 29px minmax(0, 1fr);
    gap: 6px;
    padding: 7px;
  }

  .mistakes-review-summary > strong {
    min-width: 29px;
    font-size: calc(21px * var(--quiz-font-scale));
  }
}

