:root { color-scheme: dark; font-family: system-ui, sans-serif; color: #e6e9eb; background: #292e34; font-size: 16px; letter-spacing: 0; }
* { box-sizing: border-box; }
body { margin: 0; }
main { width: min(100% - 32px, 1000px); margin: 20px auto 48px; }
button, select, textarea { font: inherit; color: inherit; }
button, select { border: 1px solid #58616b; border-radius: 5px; background: #353c44; min-height: 40px; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 13px; cursor: pointer; }
button:hover:not(:disabled) { background: #454e57; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #a9c6e3; outline-offset: 3px; }
svg { width: 18px; height: 18px; flex-shrink: 0; }
a { color: #b8cfe3; text-decoration: none; }
a:hover { text-decoration: underline; }
.page-head, .heading, .toolbar, .filters, .actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-head a { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.heading { margin: 20px 0; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0; font-weight: 600; }
#mastery { font-size: 14px; color: #b4c8b5; white-space: nowrap; }
.segmented { display: flex; }
.segmented button { border-radius: 0; }
.segmented button:first-child { border-radius: 5px 0 0 5px; }
.segmented button:last-child { border-radius: 0 5px 5px 0; }
.segmented button + button { border-left: 0; }
button[aria-pressed="true"] { background: #4b5963; border-color: #a2b6c6; color: #fff; }
.ordering button { width: 43px; padding: 8px; }
.filters { margin: 16px 0 12px; }
.categories { display: flex; gap: 14px; }
.categories button { padding: 8px 0; border: 0; background: none; border-radius: 0; border-bottom: 2px solid transparent; font-size: 14px; }
.categories button[aria-pressed="true"] { border-bottom-color: #bdd7bf; }
select { max-width: 220px; padding: 7px; font-size: 14px; }
.progress { display: flex; align-items: center; gap: 16px; margin: 10px 0; }
progress { flex: 1; width: 0; height: 4px; accent-color: #b5cbb5; }
#position { min-width: 115px; text-align: right; font-size: 13px; color: #b6bdc4; }
.quiz-card { position: relative; border: 1px solid #66717b; border-radius: 7px; background: #333a42; display: flex; flex-direction: column; height: min(575px, var(--card-room, 62dvh)); min-height: 230px; transition: border-color .15s, background .15s; }
.quiz-card.all-correct { border-color: #92c3a0; background: #2d4039; }
.quiz-card .quiz-skip-tools { position: absolute; right: 8px; top: 8px; margin: 0; z-index: 1; }
.card-head { padding: 18px 54px 14px 22px; display: flex; align-items: center; gap: 14px; justify-content: space-between; border-bottom: 1px solid #56606a; flex-shrink: 0; }
.card-head h2 { font-size: 24px; margin: 0; overflow-wrap: anywhere; }
#card-category { margin: 0 0 5px; font-size: 12px; color: #bcc3ca; }
#card-result { font-size: 13px; text-align: right; color: #bfe0c7; }
#card-content { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 8px 22px 18px; }
.answer-part { padding: 13px 0; border-bottom: 1px solid #535e67; }
.answer-part:last-child { border-bottom: 0; }
.answer-part label, .part-label { display: block; font-size: 14px; margin: 0 0 8px; line-height: 1.45; }
.answer-row { display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 10px; align-items: start; }
textarea { width: 100%; min-height: 44px; height: 44px; max-height: 140px; resize: vertical; padding: 10px 12px; background: #292f35; border: 1px solid #6b7580; border-radius: 4px; line-height: 1.4; }
.check-part { width: 44px; height: 44px; padding: 10px; }
.answer-part[data-state="correct"] textarea { border-color: #8fc29d; color: #d2eed9; background: #2a4235; }
.answer-part[data-state="correct"] .check-part { opacity: 1; background: #456b50; border-color: #8fc29d; }
.answer-part[data-state="wrong"] textarea { border-color: #d19a9a; }
.part-feedback { margin: 6px 0 0; font-size: 13px; line-height: 1.45; color: #ced6dd; }
.answer-part[data-state="wrong"] .part-feedback { color: #edb8b8; }
.answer-part[data-state="correct"] .part-feedback { color: #bfe0c7; }
.study-answer { font-size: 16px; line-height: 1.5; margin: 7px 0 0; color: #c9e0bd; }
.actions { min-height: 58px; margin-top: 8px; }
.icon { width: 42px; padding: 8px; }
#self-actions { display: flex; gap: 8px; justify-content: center; }
#knew { border-color: #85ae91; }
#didnt { border-color: #bc8f96; }
#sync-status, .written-stats-status { font-size: 12px; min-height: 18px; color: #bec8d1; margin: 4px 0; }
#ans-explanation-content { margin-top: 18px; line-height: 1.65; color: #c8d2d9; font-size: 15px; }
#ans-explanation-content p { margin: 0 0 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[hidden] { display: none !important; }
.spinning { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinning { animation: none; } }
@media (max-width: 600px) {
  main { width: calc(100% - 24px); margin-top: 14px; }
  h1 { font-size: 19px; }
  .heading { margin: 16px 0; gap: 8px; }
  .toolbar { flex-wrap: wrap; gap: 10px; }
  .filters { align-items: flex-start; flex-direction: column; gap: 5px; }
  .categories { justify-content: space-between; width: 100%; }
  select { max-width: 100%; width: 100%; }
  .card-head { padding: 14px 45px 12px 14px; }
  #card-content { padding: 4px 14px 16px; }
  .card-head h2 { font-size: 22px; }
  #card-result { max-width: 110px; }
  .actions { gap: 6px; }
  #self-actions { gap: 5px; }
  #self-actions button { font-size: 13px; padding: 8px; }
  #self-actions button svg { display: none; }
  #next { padding: 8px; }
  #card-category { font-size: 11px; }
}
