:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  color-scheme: light;
  --canvas: #f8f9fa;
  --surface: #fff;
  --header: #fff;
  --header-muted: #5f6368;
  --focus: #1a73e8;
  --primary: #0b57d0;
  --primary-hover: #0842a0;
  --primary-ink: #fff;
  --ink: #202124;
  --muted: #5f6368;
  --line: #dadce0;
  --accent: #1a73e8;
  --accent-dark: #0b57d0;
  --danger: #a50e0e;
  --danger-light: #fce8e6;
  --danger-line: #e6a39d;
  --danger-key: #f7cfcc;
  --selected: #e8f0fe;
  --selected-line: #aecbfa;
  --progress-track: #e0e7f0;
  --key: #eef1f4;
  --key-ink: #3c4043;
  --success-ink: #0d652d;
  --success-surface: #e6f4ea;
  --success-line: #9acfa8;
  --success-key: #ceead6;
  --hover: #f1f3f4;
  --hover-line: #7baaf7;
  --disabled-surface: #e8eaed;
  --disabled-ink: #5f6368;
  --notice: #6c4300;
  --notice-surface: #fef7e0;
  --notice-line: #efcf82;
  --notice-key: #fce8b2;
  --shadow: rgb(32 33 36 / 5%);
  --brand-bg: #d3e3fd;
  --brand-ink: #0b57d0;
}


:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #202124;
  --surface: #292a2d;
  --header: #202124;
  --header-muted: #bdc1c6;
  --focus: #8ab4f8;
  --primary: #8ab4f8;
  --primary-hover: #aecbfa;
  --primary-ink: #172b4d;
  --ink: #e8eaed;
  --muted: #bdc1c6;
  --line: #4f5358;
  --accent: #8ab4f8;
  --accent-dark: #a8c7fa;
  --danger: #f6aea9;
  --danger-light: #3c2b2b;
  --danger-line: #a76561;
  --danger-key: #593636;
  --selected: #293a53;
  --selected-line: #506993;
  --progress-track: #3b434e;
  --key: #3c4043;
  --key-ink: #dfe3e8;
  --success-ink: #a8dab5;
  --success-surface: #26362c;
  --success-line: #628d6d;
  --success-key: #334c3a;
  --hover: #303134;
  --hover-line: #7a9ac9;
  --disabled-surface: #3c4043;
  --disabled-ink: #bdc1c6;
  --notice: #fddc91;
  --notice-surface: #393126;
  --notice-line: #8e7446;
  --notice-key: #4d3e27;
  --shadow: rgb(0 0 0 / 14%);
  --brand-bg: #334a6d;
  --brand-ink: #a8c7fa;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
button:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1:focus-visible { outline: 2px solid var(--focus); outline-offset: 5px; }
p, h1, h2, h3, dl, dd { margin: 0; }

.masthead {
  background: var(--header);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  max-width: 1216px;
  margin: 0 auto;
  padding: 10px clamp(16px, 4vw, 56px);
}
.site-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.125rem;
  font-weight: 680;
  letter-spacing: -.025em;
}
.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 6px);
  align-content: center;
  justify-content: center;
  gap: 3px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 9px;
  background: var(--brand-bg);
  transform: rotate(-5deg);
}
.brand-mark i { width: 6px; height: 6px; border-radius: 2px; background: var(--brand-ink); }
.brand-mark i:last-child { background: transparent; border: 1px solid var(--brand-ink); }
.bank-size { font-size: .875rem; color: var(--header-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }


.masthead-actions { display: flex; align-items: center; gap: 18px; }
.theme-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  touch-action: manipulation;
}
.theme-button:focus-visible { outline-color: var(--focus); }
.theme-icon { display: block; position: relative; width: 18px; height: 18px; }
.theme-icon::before, .theme-icon::after { content: ""; position: absolute; }
.theme-icon::before {
  inset: -2px 0 1px 3px;
  border-radius: 50%;
  box-shadow: -4px 3px 0 -1px currentColor;
}
:root[data-theme="dark"] .theme-icon::before {
  inset: 5px;
  border: 1.5px solid currentColor;
  box-shadow: none;
}
:root[data-theme="dark"] .theme-icon::after {
  inset: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: .9;
  box-shadow: 0 -8px currentColor, 0 8px currentColor,
    -8px 0 currentColor, 8px 0 currentColor,
    -6px -6px currentColor, 6px -6px currentColor,
    -6px 6px currentColor, 6px 6px currentColor;
}
.setup-layout {
  max-width: 784px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 68px) clamp(16px, 4vw, 48px) 48px;
}
.setup-card .controls { justify-content: flex-end; flex-wrap: wrap; }
.attempt-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-left: auto; }
.setup-card .controls:has(#close-setup:not([hidden])) { justify-content: space-between; }
.topic-picker, .mode-picker { min-inline-size: 0; margin: 20px 0 0; padding: 0; border: 0; }
.topic-picker legend, .mode-picker legend { padding: 0; font-size: .9375rem; font-weight: 690; }
.mode-options { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.mode-options label { position: relative; flex: 1 1 auto; min-width: max-content; cursor: pointer; }
.mode-options input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mode-options span {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 650;
}
.mode-options input:checked + span { background: var(--selected); border-color: var(--hover-line); color: var(--accent-dark); }
.mode-options input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }
.mode-hint { margin-top: 9px; font-size: .875rem; line-height: 1.45; color: var(--muted); }
.picker-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
#selection-count { color: var(--muted); font-size: .9375rem; font-variant-numeric: tabular-nums; }
.text-button {
  min-height: 38px;
  padding: 5px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent-dark);
  font-size: .875rem;
  font-weight: 670;
  touch-action: manipulation;
}
.picker-options { display: grid; gap: 7px; }
.picker-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.picker-option:has(input:checked) { background: var(--selected); border-color: var(--selected-line); }
.picker-option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.picker-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: inherit; }
.picker-option input:focus-visible { outline: none; }
.picker-option .topic-count { text-align: right; }

.layout {
  display: grid;
  grid-template-columns: minmax(218px, 260px) minmax(0, 1fr);
  gap: clamp(24px, 4.2vw, 66px);
  max-width: 1216px;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 68px) clamp(16px, 4vw, 56px) 48px;
}
.sidebar { min-width: 0; }
.topics-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 0 9px 10px 12px;
  border-bottom: 1px solid var(--line);
}
.topics-heading h2 { font-size: 1.125rem; font-weight: 690; letter-spacing: -.018em; }
#topics-details { margin-top: 9px; }
#topics-details summary { display: none; }
#topics { display: grid; gap: 4px; }
.topic-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 55px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  text-align: left;
}
.topic-button[aria-current="true"] { background: var(--selected); border-color: var(--selected-line); color: var(--accent-dark); }
.topic-name { font-size: .9375rem; font-weight: 570; line-height: 1.3; }
.topic-count { font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.topic-button[aria-current="true"] .topic-count { color: var(--accent-dark); }
.storage-note { padding: 14px 12px 0; border-top: 1px solid var(--line); margin-top: 15px; color: var(--muted); font-size: .8125rem; line-height: 1.55; }
.storage-note:empty { display: none; }

.workspace { min-width: 0; }
.session-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--canvas);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0 10px;
  margin-bottom: 12px;
  padding: 1px 0 6px;
  border-bottom: 1px solid var(--line);
}
.session-mode { font-weight: 680; font-size: .9375rem; }
.session-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 7px; margin-left: auto; }
.session-actions .text-button { min-height: 44px; }
.home-button { min-height: 40px; padding: 7px 10px; text-align: center; color: var(--accent-dark); font-size: .8125rem; }
.reset-button { color: var(--danger); }
#question-card, #result-card { scroll-margin-block-start: 100px; }
.progress-panel { margin-bottom: 23px; }
.progress-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  font-size: .875rem;
  line-height: 1.4;
  color: var(--muted);
}
.progress-label span:first-child { color: var(--ink); font-weight: 650; }
#overall-count { font-variant-numeric: tabular-nums; }
progress {
  display: block;
  width: 100%;
  height: 7px;
  margin-top: 9px;
  appearance: none;
  border: none;
  border-radius: 99px;
  overflow: hidden;
  color: var(--accent);
  background: var(--progress-track);
}
progress::-webkit-progress-bar { background: var(--progress-track); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }

.card {
  padding: clamp(20px, 3.2vw, 38px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 26px var(--shadow);
}
.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px 16px;
  margin-bottom: 17px;
  font-size: .875rem;
  line-height: 1.4;
}
.question-actions { display: flex; align-items: center; gap: 8px; margin: -5px -5px -5px 0; }
.question-topic { color: var(--accent-dark); font-weight: 690; }
.question-number { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.question-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 12px;
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}
.question-stats span { padding: 3px 8px; border-radius: 6px; background: var(--key); color: var(--key-ink); }
.question-stats span:first-child { color: var(--success-ink); background: var(--success-surface); }
.question-stats span:last-child { color: var(--danger); background: var(--danger-light); }
.favorite-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  touch-action: manipulation;
}
.favorite-button[aria-pressed="true"] { color: var(--notice); background: var(--notice-surface); border-color: var(--notice-line); }
.card h1 {
  font-size: clamp(1.375rem, 2.45vw, 2.125rem);
  font-weight: 700;
  letter-spacing: -.032em;
  line-height: 1.22;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.option-instruction { margin: 19px 0 10px; font-size: .875rem; line-height: 1.4; color: var(--muted); }
.options { display: grid; gap: 8px; }
.option-instruction[hidden] + .options { margin-top: 19px; }
.option {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr);
  align-items: center;
  gap: 10px 13px;
  width: 100%;
  min-height: 60px;
  padding: 12px 15px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  touch-action: manipulation;
}
.option-key {
  display: grid;
  align-items: center;
  justify-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--key);
  color: var(--key-ink);
  font-size: .875rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.option-text { font-size: 1rem; line-height: 1.45; overflow-wrap: anywhere; }
.option[aria-disabled="true"] { cursor: default; }
.option.option-selected { color: var(--accent-dark); background: var(--selected); border-color: var(--hover-line); }
.option.correct { color: var(--success-ink); background: var(--success-surface); border-color: var(--success-line); }
.option.correct .option-key { background: var(--success-key); color: var(--success-ink); }
.option.wrong { color: var(--danger); background: var(--danger-light); border-color: var(--danger-line); }
.option.wrong .option-key { background: var(--danger-key); color: var(--danger); }
.option-status { grid-column: 2; font-size: .8125rem; font-weight: 690; line-height: 1.3; }
.option-status:empty { display: none; }
.feedback { font-size: .9375rem; font-weight: 670; line-height: 1.45; }
.feedback:not(:empty) { margin-top: 15px; }
.explanation {
  margin-top: 9px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--hover);
  font-size: .9375rem;
  line-height: 1.55;
}
.explanation:has(#explanation-text[hidden]) { padding: 0; border: 0; background: transparent; }
.explanation #explanation-text:not([hidden]) + .discrepancy { margin-top: 9px; }
.discrepancy {
  padding: 10px 12px;
  border-left: 3px solid var(--notice-line);
  border-radius: 6px;
  background: var(--notice-surface);
  color: var(--notice);
}
.discrepancy h2 { margin-bottom: 3px; font-size: .9375rem; font-weight: 690; }
.feedback.correct { color: var(--accent-dark); }
.feedback.wrong { color: var(--danger); }
.controls {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 10px;
  padding-top: 18px;
  margin-top: 23px;
  border-top: 1px solid var(--line);
}
.button {
  min-height: 46px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: .9375rem;
  font-weight: 665;
  line-height: 1.35;
  touch-action: manipulation;
}
.button-danger { color: var(--danger); background: var(--danger-light); border-color: var(--danger-line); }
.confirm-dialog {
  width: min(440px, calc(100vw - 32px));
  max-width: none;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 26px var(--shadow);
}
.confirm-dialog::backdrop { background: rgb(20 21 24 / 65%); }
.confirm-dialog h2 { font-size: 1.25rem; }
.confirm-dialog p { margin-top: 10px; color: var(--muted); line-height: 1.45; }
.button-secondary { background: var(--surface); border-color: var(--line); }
.button-primary { background: var(--primary); color: var(--primary-ink); }
.button-primary:disabled { background: var(--disabled-surface); color: var(--disabled-ink); }
.button-secondary:disabled { background: var(--surface); color: var(--disabled-ink); }

.result-score {
  margin-top: 16px;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  color: var(--accent-dark);
  font-weight: 730;
  line-height: 1;
  letter-spacing: -.06em;
  font-variant-numeric: tabular-nums;
}
.result-caption { margin-top: 8px; color: var(--muted); }
.result-skipped { margin-top: 8px; }
.breakdown { margin-top: 23px; }
.breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: .9375rem;
}
.breakdown div:last-child { border-bottom: 0; }
.breakdown dd { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; }
#load-error p { margin-top: 12px; }


.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.page-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.page-heading .button {
  min-height: 42px;
  padding-inline: 12px;
  color: var(--accent-dark);
  font-size: .875rem;
}
.search-panel { margin-top: 20px; }
.search-panel label { display: block; margin-bottom: 7px; font-size: .9375rem; font-weight: 640; }
.search-panel input {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.search-panel input::placeholder { color: var(--muted); }
.search-panel input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.secondary-copy { color: var(--muted); font-size: .9375rem; line-height: 1.5; }
#search-status:not(:empty) { margin-top: 10px; }
.search-results, .exam-error-list { display: grid; gap: 10px; margin-top: 12px; }
.search-result, .exam-mistake {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-wrap: anywhere;
}
.study-topic {
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 620;
  line-height: 1.4;
}
.search-result summary {
  position: relative;
  display: block;
  padding: 11px 41px 12px 14px;
  min-height: 51px;
  cursor: pointer;
}
.search-result summary:focus-visible { border-radius: 8px; }
.search-result summary::after {
  content: "";
  position: absolute;
  top: 21px;
  right: 17px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}
.search-result[open] summary::after { transform: rotate(225deg); top: 25px; }
.search-result summary::-webkit-details-marker { display: none; }
.search-question { display: block; margin-top: 3px; font-weight: 630; line-height: 1.45; }
.search-result .answer-details { padding: 0 14px 14px; }
#search-more { margin-top: 12px; }
.empty-history { margin-top: 18px; }
.history-list { display: grid; gap: 10px; padding: 0; margin: 16px 0 0; list-style: none; }
.history-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 5px 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  line-height: 1.45;
}
.history-entry time { font-weight: 680; }
.history-score { color: var(--accent-dark); font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.history-topics { grid-column: 1 / -1; color: var(--muted); font-size: .875rem; }
.history-review { grid-column: 1 / -1; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.history-review summary { width: fit-content; padding: 6px 0; color: var(--accent-dark); font-size: .875rem; font-weight: 680; cursor: pointer; }
.history-review .exam-error-list { margin-top: 6px; }
.exam-errors { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.exam-errors h2 { font-size: 1.1875rem; letter-spacing: -.015em; }
#exam-errors-empty { margin-top: 8px; }
.exam-mistake { padding: 14px; }
.exam-mistake h3 { margin: 5px 0 12px; font-size: 1rem; line-height: 1.45; }
.review-answers { display: grid; gap: 5px; font-size: .9375rem; line-height: 1.45; }
.review-answers dt { font-size: .8125rem; font-weight: 680; color: var(--muted); }
.review-answers dd + dt { margin-top: 4px; }
.review-answers dd { padding: 8px 10px; border-radius: 6px; }
.review-correct { color: var(--success-ink); background: var(--success-surface); }
.review-incorrect { color: var(--danger); background: var(--danger-light); }
.review-explanation { margin-top: 11px; font-size: .9375rem; line-height: 1.55; }
.answer-details .discrepancy { margin-top: 9px; font-size: .875rem; line-height: 1.5; }
.answer-details .discrepancy p { margin-top: 3px; }

@media (hover: hover) {
  .search-result summary:hover { background: var(--hover); border-radius: 9px; }
  .mode-options input:not(:checked) + span:hover, .favorite-button[aria-pressed="false"]:hover { background: var(--hover); }
  .button-danger:hover { border-color: var(--danger); }
  .theme-button:hover { background: var(--hover); }
  .text-button:hover { background: var(--hover); }
  .picker-option:not(:has(input:checked)):hover { background: var(--hover); }
  .topic-button:not([aria-current="true"]):hover { background: var(--hover); }
  .option:not([aria-disabled="true"]):hover { border-color: var(--hover-line); background: var(--hover); }
  .button-primary:not(:disabled):hover { background: var(--primary-hover); }
  .button-secondary:not(:disabled):hover { background: var(--hover); }
}

@media (max-width: 720px) {
  .masthead-inner { min-height: 60px; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 18px; padding-top: 18px; }
  .sidebar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; }
  .topics-heading { grid-column: 2; grid-row: 1; padding: 0; border: 0; }
  .topics-heading h2 { display: none; }
  .topics-heading .home-button { min-height: 46px; padding-inline: 9px; }
  #topics-details { grid-column: 1; grid-row: 1; }
  .sidebar:has(#topics-details[hidden]) .topics-heading { grid-column: 1; justify-self: start; }
  .topics-heading .home-button { max-width: 13.5rem; }
  .storage-note { grid-column: 1 / -1; }
  #topics-details { margin: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
  #topics-details summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 9px 12px;
    list-style: none;
    cursor: pointer;
    font-weight: 630;
    font-size: .9375rem;
  }
  #topics-details summary::-webkit-details-marker { display: none; }
  #mobile-topic-count { margin-left: auto; margin-right: 3px; color: var(--muted); font-size: .8125rem; font-weight: 450; }
  #topics-details summary::after {
    content: "";
    width: 8px;
    height: 8px;
    margin-right: 3px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: translateY(-2px) rotate(45deg);
  }
  #topics-details[open] summary::after { transform: translateY(2px) rotate(225deg); }
  #topics { padding: 0 6px 6px; gap: 2px; }
  .topic-button { min-height: 47px; }
  .storage-note { display: none; }
  .sidebar:has(#topics-details[open]) .storage-note:not(:empty) { display: block; padding: 0 1px; border: 0; margin-top: 8px; }
  .progress-panel { margin-bottom: 16px; }
  .card { border-radius: 14px; }
  .card-heading { margin-bottom: 12px; align-items: center; }
}
@media (max-width: 540px) {
  .mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-options label { min-width: 0; }
  .mode-options span { text-align: center; }
  .topics-heading .home-button { max-width: 11rem; }
  .session-actions { justify-content: flex-end; }
}
@media (max-width: 400px) {
  .masthead-inner, .layout, .setup-layout { padding-inline: 12px; }
  .card { padding: 16px; }
  .option { padding-inline: 10px; column-gap: 9px; }
  .button { padding-inline: 12px; }
  #mobile-topic-count { display: none; }
  .masthead-actions { gap: 8px; }
  .bank-size { display: none; }
  .mode-options label { min-width: 0; }
  .mode-options span { padding-inline: 8px; }
  .session-actions { gap: 0 3px; }
  .session-actions .text-button { padding-inline: 4px; font-size: .8125rem; }
}

.account-layout { max-width: 550px; }
.auth-switch, .auth-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.auth-actions { justify-content: flex-end; }
.auth-switch .button[aria-pressed="true"] { color: var(--accent-dark); border-color: var(--hover-line); background: var(--selected); }
.auth-note { margin-top: 13px; }
.auth-form { display: grid; gap: 14px; margin-top: 20px; }
.auth-field { display: grid; gap: 7px; }
.auth-field label { font-size: .9375rem; font-weight: 630; }
.auth-field input {
  width: 100%;
  min-height: 46px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.auth-field input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.auth-error, .auth-recovery-result { padding: 10px 12px; border-radius: 7px; line-height: 1.5; }
.auth-error { color: var(--danger); background: var(--danger-light); }
.auth-recovery-result { display: grid; gap: 5px; background: var(--selected); }
.auth-recovery-result code { font-size: 1rem; overflow-wrap: anywhere; user-select: all; }
.auth-back { display: inline-flex; align-items: center; text-decoration: none; }
.account-menu { position: relative; z-index: 3; min-width: 0; }
.account-menu summary {
  max-width: 10rem;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  list-style: none;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 650;
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  min-width: 12.5rem;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 4px 14px var(--shadow);
}
.account-options a, .account-options button {
  display: block;
  padding: 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  font-size: .875rem;
}
.account-options :is(a, button):hover { background: var(--hover); }
.account-sync { min-height: 1.3em; margin-top: 10px; }
.account-sync[data-state="error"] { color: var(--danger); }

@media (max-width: 540px) {
  .masthead:has(.account-menu) .bank-size { display: none; }
  .masthead:has(.account-menu) .masthead-actions { gap: 6px; }
  .account-menu summary { max-width: 6.5rem; }
}
@media (max-width: 360px) {
  .masthead:has(.account-menu) .site-title { gap: 6px; font-size: .875rem; }
}
