:root {
  --ink: #172026;
  --muted: #5c6970;
  --line: #dbe9e2;
  --paper: #f7faf8;
  --panel: #ffffff;
  --mint: #e2f3eb;
  --coral: #ffd0c0;
  --gold: #f5dc8c;
  --blue: #d2e4ff;
  --green: #367f60;
  --red: #a23b2a;
  --nav: #23342e;
  --sidebar: #fcfdfc;
  --soft: #edf6f1;
  --shadow: 0 18px 42px rgba(23, 32, 38, 0.07);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
}

button {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.24rem;
  line-height: 1.08;
}

h2 {
  font-size: clamp(1.35rem, 2.5vw, 2rem);
  line-height: 1.12;
}

h3 {
  font-size: 1rem;
  line-height: 1.25;
}

.eyebrow {
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.account-panel {
  display: grid;
  gap: 10px;
  justify-items: stretch;
  min-width: 0;
}

.account-toggle {
  display: none;
}

.account-toggle::marker {
  content: "";
}

.account-toggle::-webkit-details-marker {
  display: none;
}

.account-content {
  display: grid;
  gap: 10px;
  justify-items: stretch;
  min-width: 0;
}

.auth-status {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.auth-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
  padding: 8px 11px;
}

.auth-button:hover:not(:disabled) {
  border-color: var(--green);
  background: var(--mint);
}

.auth-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.google-signin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 40px;
  min-width: 198px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  background: #fff;
  color: #3c4043;
  cursor: pointer;
  font-family: Roboto, Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 20px;
  padding: 9px 12px;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.google-signin-button:hover:not(:disabled) {
  background: #f8fafd;
  border-color: #d2e3fc;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.18);
}

.google-signin-button:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

.google-signin-button:active:not(:disabled) {
  background: #f1f3f4;
  box-shadow: none;
}

.google-signin-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.google-signin-button.prominent {
  justify-self: start;
  min-width: 232px;
}

.google-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.google-icon.large {
  width: 24px;
  height: 24px;
}

.auth-gate {
  width: min(680px, calc(100% - 36px));
  margin: 46px auto;
}

.app-splash {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px;
}

.app-splash-panel {
  display: grid;
  gap: 14px;
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 36px);
}

.app-splash-panel h1 {
  color: var(--ink);
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  line-height: 1.05;
}

.loading-bar {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.loading-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: var(--green);
  animation: loading-slide 1.15s ease-in-out infinite;
}

@keyframes loading-slide {
  0% {
    transform: translateX(-110%);
  }

  55% {
    transform: translateX(80%);
  }

  100% {
    transform: translateX(250%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-bar span {
    animation: none;
    transform: none;
    width: 100%;
  }
}

.auth-gate-panel {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 34px);
}

.auth-gate-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #fff;
}

.accent-tool {
  position: relative;
  display: grid;
  gap: 10px;
}

.accent-button {
  display: grid;
  place-items: center;
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--green);
  cursor: pointer;
  font: inherit;
  font-size: 1.3rem;
  font-weight: 900;
}

.accent-button[aria-expanded="true"] {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.accent-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 15;
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 10px;
}

.accent-letters {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
}

.accent-letter {
  display: grid;
  place-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfaf7;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 850;
}

.accent-letter:hover {
  border-color: var(--green);
  background: var(--mint);
}

.accent-status {
  min-height: 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.menu-button {
  display: none;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  padding: 10px;
}

.menu-button span {
  display: block;
  height: 3px;
  margin: 5px 0;
  border-radius: 99px;
  background: var(--ink);
}

.layout {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr) 260px;
  gap: 24px;
  width: min(1480px, calc(100% - 32px));
  margin: 20px auto 38px;
  align-items: start;
}

.sidebar {
  align-self: start;
  display: grid;
  gap: 6px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sidebar);
  box-shadow: 0 16px 34px rgba(23, 32, 38, 0.06);
}

.sidebar-brand {
  display: grid;
  gap: 8px;
  padding: 4px 2px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
  color: var(--ink);
}

.sidebar-brand .eyebrow {
  color: var(--green);
}

.sidebar-brand h1 {
  color: var(--ink);
  font-size: 1.36rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-icon {
  display: block;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.book-picker {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
  margin-top: 8px;
}

.book-picker::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 14px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  pointer-events: none;
  transform: rotate(45deg);
}

.book-picker span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.book-picker select {
  appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  overflow: hidden;
  padding: 8px 34px 8px 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-picker option {
  color: var(--ink);
}

.book-picker select:focus {
  border-color: var(--green);
  outline: 2px solid rgba(47, 111, 79, 0.18);
  outline-offset: 2px;
}

.book-picker select:hover {
  border-color: #c8d5cf;
  background: #fdfefd;
}

.nav-button,
.ghost-button,
.answer-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.nav-button {
  text-align: left;
  padding: 11px 12px;
  font-weight: 800;
  background: transparent;
  border-color: transparent;
  color: var(--nav);
}

.nav-button:hover {
  transform: none;
  border-color: var(--line);
  background: var(--soft);
}

.ghost-button:hover,
.answer-button:hover {
  transform: translateY(-1px);
  border-color: var(--green);
}

.nav-button.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
  box-shadow: 0 10px 20px rgba(47, 111, 79, 0.16);
}

.nav-button.active:hover {
  background: var(--green);
  color: white;
}

.quiz-nav-button {
  background: #fff8e1;
  border-color: #f3e6b1;
  color: #6b4a08;
}

.quiz-nav-button.active {
  background: #9a6f0a;
  border-color: #9a6f0a;
  color: white;
}

.missed-nav-button {
  background: #fff0ea;
  border-color: #f3d6cb;
  color: var(--red);
}

.missed-nav-button.active {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.app-toolbar {
  display: none;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 0 2px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.study-rail {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 20px;
}

.rail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}

.rail-icon-button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 900;
}

.rail-icon-button:hover,
.rail-icon-button:focus-visible {
  background: var(--soft);
  outline: none;
}

.rail-panel .google-signin-button {
  width: 100%;
  min-width: 0;
}

.rail-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.section-head,
.review-panel,
.quiz-panel,
.missed-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 104px;
  padding: 24px 26px;
  border-left: 6px solid var(--green);
}

.ghost-button {
  padding: 0 14px;
  font-weight: 800;
}

.review-panel {
  padding: 18px;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.review-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.review-mode-field {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.review-mode-button {
  display: grid;
  place-items: center;
  min-width: 38px;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
}

.review-mode-button.active {
  background: var(--green);
  color: white;
}

.language-side-field {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.language-side-button {
  display: grid;
  place-items: center;
  min-width: 38px;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
}

.language-side-button.active {
  background: var(--green);
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 10px;
}

.card {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 16px rgba(23, 32, 38, 0.04);
  overflow: hidden;
}

.card-flip {
  width: 100%;
  min-height: 86px;
  border: 0;
  padding: 14px 14px 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.card-check {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  padding: 0 14px 14px;
}

.card-check-input {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 9px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
}

.card-check-input.correct {
  border-color: var(--green);
  background: var(--mint);
}

.card-check-input.wrong {
  border-color: var(--red);
  background: #ffe4dc;
}

.mini-check-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 850;
  padding: 0 9px;
}

.card-check-result {
  grid-column: 1 / -1;
  min-height: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.card-check-result.correct {
  color: var(--green);
}

.card-check-result.wrong {
  color: var(--red);
}

.card .front {
  display: block;
  font-size: 1.02rem;
  font-weight: 900;
  line-height: 1.2;
}

.card .back {
  display: none;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.32;
}

.card.flipped {
  background: #fff7df;
  border-color: #e8c45d;
}

.card.flipped .front {
  display: none;
}

.card.flipped .back {
  display: block;
}

.quiz-panel {
  padding: 22px;
}

.missed-panel {
  padding: 22px;
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.quiz-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mode-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(78px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f6f1;
}

.mode-button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 850;
}

.mode-button.active {
  background: var(--green);
  color: white;
}

.view-toggle {
  min-width: 190px;
}

.question {
  min-height: 56px;
  padding: 16px;
  border-radius: 8px;
  background: var(--blue);
  font-size: 1.18rem;
  font-weight: 850;
  line-height: 1.35;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.answer-button {
  padding: 14px;
  text-align: left;
  font-weight: 800;
  line-height: 1.25;
}

.answer-button.correct {
  border-color: var(--green);
  background: var(--mint);
}

.answer-button.wrong {
  border-color: var(--red);
  background: #ffe4dc;
}

.blank-form {
  margin-top: 14px;
}

.blank-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.blank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.blank-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 0 13px;
}

.blank-input:focus {
  border-color: var(--green);
  outline: 3px solid rgba(47, 111, 79, 0.16);
}

.blank-input.correct {
  border-color: var(--green);
  background: var(--mint);
}

.blank-input.wrong {
  border-color: var(--red);
  background: #ffe4dc;
}

.feedback {
  min-height: 28px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 750;
}

.quiz-paper-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  max-width: 720px;
  margin-bottom: 16px;
}

.quiz-paper-tools label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.quiz-paper-tools select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  padding: 0 12px;
}

.quiz-paper-tools select:focus {
  border-color: var(--green);
  outline: 3px solid rgba(47, 111, 79, 0.16);
}

.quiz-setup {
  max-width: 720px;
  display: grid;
  gap: 16px;
}

.quiz-unit-picker {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.quiz-unit-selector {
  display: grid;
  gap: 12px;
}

.quiz-book-group {
  display: grid;
  gap: 8px;
}

.quiz-book-title {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
  text-transform: uppercase;
}

.quiz-unit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quiz-unit-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.25;
}

.quiz-unit-option input {
  margin-top: 2px;
}

.quiz-unit-option:has(input:checked) {
  border-color: var(--green);
  background: var(--mint);
}

.quiz-count-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
}

.quiz-count-grid legend {
  grid-column: 1 / -1;
}

.quiz-count-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.quiz-start-row {
  display: flex;
  justify-content: flex-end;
}

.quiz-run {
  display: grid;
  gap: 14px;
}

.quiz-progress-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8df;
}

.quiz-progress-row .feedback {
  margin-top: 0;
}

.quiz-questions {
  display: grid;
  gap: 12px;
}

.quiz-footer {
  display: flex;
  justify-content: flex-end;
}

.quiz-question-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.quiz-question-card h3 {
  margin-bottom: 10px;
}

.quiz-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quiz-choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  cursor: pointer;
  font-weight: 750;
  line-height: 1.25;
}

.quiz-choice input {
  margin-top: 2px;
}

.quiz-choice:has(input:checked) {
  border-color: var(--green);
  background: var(--mint);
}

.quiz-results {
  display: grid;
  gap: 14px;
}

.missed-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.missed-tools .feedback {
  margin-top: 0;
}

.missed-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.danger-button {
  border-color: #df9b8c;
  color: var(--red);
}

.danger-button:hover {
  border-color: var(--red);
}

.ghost-button:disabled,
.danger-button:disabled {
  border-color: var(--line);
  color: var(--muted);
  cursor: default;
  opacity: 0.65;
  transform: none;
}

.missed-list {
  display: grid;
  gap: 7px;
}

.missed-item {
  border: 1px solid var(--line);
  border-left: 5px solid var(--red);
  border-radius: 8px;
  background: var(--panel);
  padding: 9px 10px;
}

.missed-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.missed-item-head h3 {
  margin: 0;
}

.missed-item p {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 750;
}

.mini-delete-button {
  min-height: 32px;
  border: 1px solid #df9b8c;
  border-radius: 8px;
  background: white;
  color: var(--red);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  padding: 0 10px;
}

.mini-delete-button:hover {
  border-color: var(--red);
  transform: translateY(-1px);
}

.correct-text {
  color: var(--green) !important;
}

.wrong-text {
  color: var(--red) !important;
}

.missed-print-sheet {
  display: none;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 268px minmax(0, 1fr);
  }

  .study-rail {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 35;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .rail-panel {
    display: grid;
    place-items: center;
    width: 52px;
    min-height: 52px;
    padding: 0;
    overflow: visible;
  }

  .rail-label,
  .account-content {
    display: none;
  }

  .account-toggle {
    display: grid;
    list-style: none;
  }

  .account-panel[open] .account-content {
    position: absolute;
    right: 64px;
    bottom: 0;
    display: grid;
    width: min(260px, calc(100vw - 104px));
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 14px;
  }

  .account-panel[open] .account-content .rail-label {
    display: block;
  }

  .accent-tool .rail-label {
    display: none;
  }

  .accent-button {
    width: 52px;
    height: 52px;
    border: 0;
    background: transparent;
  }

  .accent-button[aria-expanded="true"] {
    background: var(--green);
  }

  .accent-panel {
    top: auto;
    right: 64px;
    bottom: 0;
    width: min(360px, calc(100vw - 104px));
  }
}

@media (max-width: 880px) {
  .app-toolbar {
    display: block;
    height: 0;
    padding: 0;
  }

  .menu-button {
    position: fixed;
    right: 18px;
    bottom: 142px;
    z-index: 40;
    display: grid;
    width: 52px;
    height: 52px;
    box-shadow: var(--shadow);
  }

  .layout {
    grid-template-columns: 1fr;
    width: min(100% - 24px, 760px);
  }

  .sidebar {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    right: 84px;
    bottom: 14px;
    z-index: 34;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    max-height: none;
    box-shadow: 0 22px 70px rgba(23, 32, 38, 0.18);
  }

  .sidebar-brand {
    grid-column: 1 / -1;
  }

  .sidebar.open {
    display: grid;
  }

  .nav-button {
    text-align: center;
  }
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .section-head,
  .quiz-header,
  .panel-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .accent-panel {
    right: 64px;
    left: auto;
  }

  .quiz-actions,
  .blank-row,
  .review-actions,
  .quiz-paper-tools,
  .missed-item-head,
  .missed-tools,
  .missed-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .sidebar,
  .cards,
  .answers,
  .quiz-unit-grid,
  .quiz-count-grid,
  .quiz-choice-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: white;
  }

  .app-toolbar,
  .sidebar,
  .study-rail,
  .section-head,
  .review-panel,
  .quiz-panel,
  .missed-tools,
  .missed-list {
    display: none !important;
  }

  .layout {
    display: block;
    width: 100%;
    margin: 0;
  }

  .workspace,
  .missed-panel,
  .missed-print-sheet {
    display: block;
  }

  .missed-panel {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .print-question,
  .print-answer {
    break-inside: avoid;
    margin-bottom: 10px;
    padding: 0;
  }

  .print-question h3,
  .print-answer h3 {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
  }

  .print-answer-line {
    height: 22px;
    margin-top: 8px;
    border-bottom: 1px solid #222;
  }

  .print-answer-key {
    break-before: page;
  }

  .print-answer p {
    margin-top: 3px;
    color: #000;
    font-size: 12px;
    font-weight: 700;
  }
}
