@import "./practice-palette.css";
@import "../../site/theme-transition.css";

html[data-theme="dark"],
html[data-theme="dark"] body {
  background: var(--shell-paper);
  color: var(--shell-ink);
}

html[data-theme="dark"] :is(.card, .homeworkPanel, .wrongReviewCard, .wrongReviewEmpty, .theoryReviewChoice) {
  background: var(--shell-surface);
  border-color: var(--shell-line);
  color: var(--shell-ink);
}

html[data-theme="dark"] :is(.helpText, .siteFooter, .examStatus, .homeworkStatus[data-kind="pending"]) { color: var(--shell-muted); }
html[data-theme="dark"] .homeworkStatus[data-kind="ok"] { color: var(--shell-success); }
html[data-theme="dark"] .homeworkStatus[data-kind="error"] { color: var(--shell-error); }

html[data-theme="dark"] .wrap :is(input, textarea, select) {
  background: var(--shell-paper) !important;
  color: var(--shell-ink) !important;
  border-color: var(--shell-control-line) !important;
}
html[data-theme="dark"] .wrap :is(input, textarea, select):focus { border-color: var(--shell-accent) !important; }
html[data-theme="dark"] .wrap :is(input, textarea)::placeholder { color: var(--shell-muted); opacity: 1; }
html[data-theme="dark"] .wrap :focus-visible { outline: 2px solid var(--shell-accent); outline-offset: 2px; }

html[data-theme="dark"] .wrap :where(.btn:not(.btnPrimary, .homeExamBtn), .qbtn) {
  background: var(--shell-hover) !important;
  color: var(--shell-ink) !important;
  border-color: var(--shell-control-line) !important;
}
html[data-theme="dark"] .wrap :where(.btnPrimary, .homeExamBtn):hover:not([disabled]) {
  background: var(--shell-accent-hover) !important;
}
html[data-theme="dark"] .wrap #nextBtn {
  background: var(--shell-hover) !important;
  border-color: var(--shell-accent) !important;
  color: var(--shell-accent) !important;
}
html[data-theme="dark"] .wrap #nextBtn:disabled {
  border-color: var(--shell-control-line) !important;
  color: var(--shell-muted) !important;
  opacity: 1;
}
html[data-theme="dark"] .qbtn.current {
  outline: 2px solid var(--shell-accent) !important;
  outline-offset: 2px;
  box-shadow: none;
}

html[data-theme="dark"] :is(.examChoice.selected, .examQnav .qbtn.answered) {
  background: var(--shell-accent-tint) !important;
  border-color: var(--shell-accent) !important;
}
html[data-theme="dark"] .examChoice.selected { box-shadow: 0 0 0 3px var(--shell-focus-tint); }
html[data-theme="dark"] .learnShellPage .examTimer.urgent {
  color: var(--shell-error) !important;
  border-color: var(--shell-error) !important;
  background: color-mix(in srgb, var(--shell-error) 16%, var(--shell-surface)) !important;
}

html[data-theme="dark"] :is(.qbtn.correct, .choiceBtn.correctChoice, .theoryReviewChoice.correctAnswer, .theoryReviewBadge.correct) {
  --state-color: var(--shell-success);
}
html[data-theme="dark"] :is(.qbtn.wrong, .choiceBtn.wrongChoice, .theoryReviewChoice.wrongSelected, .theoryReviewBadge.wrong) {
  --state-color: var(--shell-error);
}
html[data-theme="dark"] .qbtn.fixed { --state-color: var(--shell-retry); }
html[data-theme="dark"] :is(.qbtn.correct, .qbtn.wrong, .qbtn.fixed, .choiceBtn.correctChoice, .choiceBtn.wrongChoice, .theoryReviewChoice.correctAnswer, .theoryReviewChoice.wrongSelected) {
  background: color-mix(in srgb, var(--state-color) 14%, var(--shell-surface)) !important;
  border-color: var(--state-color) !important;
}
html[data-theme="dark"] :is(.theoryReviewBadge.correct, .theoryReviewBadge.wrong) {
  background: color-mix(in srgb, var(--state-color) 18%, var(--shell-surface));
  color: var(--state-color);
}
html[data-theme="dark"] :is(.theoryReviewQuestion, .theoryReviewChoiceText) { color: var(--shell-ink); }
html[data-theme="dark"] :is(.helpText kbd, .theoryReviewChoiceNumber) { background: var(--shell-hover); color: var(--shell-ink); }

/* Keep notation paper light in both questions and reviews. */
html[data-theme="dark"] :is(.notationCard, #scoreArea) {
  background: var(--shell-surface) !important;
  border-color: var(--shell-line) !important;
}
html[data-theme="dark"] .theoryPanel {
  background: transparent;
  border-color: var(--shell-line);
}
html[data-theme="dark"] :is(.wrongReviewImage, .theoryNotation, .theoryReviewKey, .theoryReviewNotation, .choiceNotation) {
  background: #fff;
  border-color: var(--shell-line);
}
html[data-theme="dark"] .piano-key.white.active { background: var(--shell-accent); }
html[data-theme="dark"] .piano-key.black.active { background: var(--shell-accent); border-color: var(--shell-on-accent); }
