:root {
  color-scheme: dark;
  --paper: #070b10;
  --paper-2: #0d141b;
  --ink: #f4fbff;
  --ink-2: #bdd0dc;
  --muted: #91a5b3;
  --line: rgba(126, 232, 220, 0.18);
  --line-strong: rgba(126, 232, 220, 0.42);
  --green: #4fe3a4;
  --green-soft: rgba(79, 227, 164, 0.14);
  --blue: #52d7ff;
  --blue-soft: rgba(82, 215, 255, 0.14);
  --rust: #ff7d61;
  --rust-soft: rgba(255, 125, 97, 0.14);
  --gold: #ffd166;
  --gold-soft: rgba(255, 209, 102, 0.14);
  --violet: #d98cff;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.44);
  --radius: 8px;
  --font: "Outfit", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

button,
a,
input,
select,
textarea,
label.btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(82, 215, 255, 0.2);
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  transform: translateY(-180%);
  border: 2px solid var(--blue);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 800;
}

.skip-link:focus-visible { transform: translateY(0); }

.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

html { background: var(--paper); color: var(--ink); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    linear-gradient(90deg, rgba(34, 92, 145, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(34, 92, 145, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
}

body.auth-pending .app-shell,
body.auth-denied .app-shell { display: none; }

body.auth-ready .auth-gate { display: none; }

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.08;
}

.auth-card p {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.5;
}

.auth-message {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-2);
  background: var(--paper);
  line-height: 1.35;
}

.auth-message.denied {
  border-color: var(--rust);
  color: #ffd1c7;
  background: var(--rust-soft);
}

button,
input,
select,
textarea { font: inherit; }

button { cursor: pointer; }

a { color: inherit; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  color: #f8fbfb;
  background: #172033;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

.brand {
  display: grid;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #172033;
  background: #f4c766;
  font-weight: 900;
}

.brand-logo {
  width: 52px;
  height: 52px;
  display: block;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 5px;
}

.auth-card .brand-logo {
  width: 70px;
  height: 70px;
  border-color: var(--line);
}

.brand h1 {
  margin: 0;
  max-width: 220px;
  font-size: 1.28rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand p {
  margin: 0;
  color: rgba(248, 251, 251, 0.68);
  font-size: 0.84rem;
  line-height: 1.45;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav button {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: rgba(248, 251, 251, 0.75);
  background: transparent;
  text-align: left;
}

.nav button:hover,
.nav button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.13);
}

.nav .nav-ico {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #f4c766;
  font-size: 1rem;
}

.side-note {
  margin-top: 22px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 251, 251, 0.78);
  font-size: 0.82rem;
  line-height: 1.45;
}

.main {
  min-width: 0;
  width: 100%;
  max-width: 1600px;
  margin-inline: auto;
  padding: 24px clamp(18px, 3vw, 38px) 44px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.topbar h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  background: rgba(255, 253, 248, 0.74);
  font-size: 0.8rem;
  font-weight: 700;
}

.view { display: none; }
.view.active { display: block; }

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 8px 18px rgba(28, 34, 47, 0.05);
}

.panel.pad { padding: 18px; }

.panel-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.2;
}

.panel-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.metric {
  min-height: 118px;
  display: grid;
  align-content: space-between;
  padding: 16px;
}

.metric strong {
  display: block;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1;
}

.metric span {
  display: block;
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 0.88rem;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e0d2;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 24px 0 14px;
}

.section-head h3 {
  margin: 0;
  font-size: 1.2rem;
}

.muted {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.btn {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 800;
}

.btn:hover { border-color: var(--blue); }

.btn.primary {
  border-color: #153d2e;
  background: var(--green);
  color: #fff;
}

.btn.blue {
  border-color: #173f63;
  background: var(--blue);
  color: #fff;
}

.btn.rust {
  border-color: #7f2d1b;
  background: var(--rust);
  color: #fff;
}

.btn.ghost {
  background: transparent;
}

.btn.icon {
  width: 38px;
  padding: 0;
  display: grid;
  place-items: center;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 160px;
}

.field label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--paper-2);
  color: var(--ink);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.seg {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper-2);
}

.seg button {
  min-height: 36px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 8px 11px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 800;
}

.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--blue); color: #fff; }

.course-stack {
  display: grid;
  gap: 12px;
}

.course-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
}

.course-name {
  font-weight: 900;
}

.course-name small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.module-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: 0.76rem;
  font-weight: 800;
}

.chip.easy { background: var(--green-soft); color: var(--green); border-color: #b8dccc; }
.chip.medium { background: var(--gold-soft); color: var(--gold); border-color: #e2c88d; }
.chip.hard { background: var(--rust-soft); color: var(--rust); border-color: #e5b8ab; }
.chip.blue { background: var(--blue-soft); color: var(--blue); border-color: #b7cce3; }

.question-list {
  display: grid;
  gap: 14px;
}

.question-pager {
  display: grid;
  gap: 14px;
}

.pager-head,
.pager-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pager-head {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.86);
}

.pager-head strong {
  display: block;
  margin-bottom: 3px;
}

.pager-head span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.pager-actions .btn[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

.q-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 16px;
}

.q-card[data-difficulty="easy"] { border-left-color: var(--green); }
.q-card[data-difficulty="medium"] { border-left-color: var(--gold); }
.q-card[data-difficulty="hard"] { border-left-color: var(--rust); }

.q-card.answered-correct {
  border-color: rgba(79, 227, 164, 0.62);
  box-shadow: 0 0 0 1px rgba(79, 227, 164, 0.18), 0 18px 42px rgba(0, 0, 0, 0.28);
}

.q-card.answered-wrong {
  border-color: rgba(255, 125, 97, 0.62);
  box-shadow: 0 0 0 1px rgba(255, 125, 97, 0.18), 0 18px 42px rgba(0, 0, 0, 0.28);
}

.q-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.q-stem {
  margin: 0 0 12px;
  font-size: 1.02rem;
  line-height: 1.55;
}

.choices {
  display: grid;
  gap: 7px;
  margin: 10px 0;
}

.choice {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  font-weight: 700;
}

.choice.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.answer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.answer-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: #fff;
}

.feedback {
  display: none;
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: #eef3f7;
  color: var(--ink-2);
  line-height: 1.45;
}

.feedback.show { display: block; }
.feedback.good { background: var(--green-soft); color: #174d3b; }
.feedback.bad { background: var(--rust-soft); color: #6e2617; }

.feedback strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.98rem;
}

.feedback span {
  display: block;
}

.reward-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.reward-line span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid rgba(126, 232, 220, 0.22);
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(7, 11, 16, 0.36);
  color: inherit;
  font-weight: 900;
}

.solution {
  display: none;
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fffaf0;
}

.solution.show,
body.print-answers .solution { display: block; }

.solution h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.solution ol {
  margin: 0;
  padding-left: 20px;
}

.solution li {
  margin-bottom: 6px;
  line-height: 1.42;
}

.plan-list {
  display: grid;
  gap: 10px;
}

.plan-question-panel {
  margin-top: 16px;
}

.study-steps {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-2);
  line-height: 1.5;
}

.study-steps li {
  margin-bottom: 7px;
}

.plan-day {
  display: grid;
  grid-template-columns: 118px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
}

.plan-day.today {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(34, 92, 145, 0.14);
}

.date-block {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 900;
}

.date-block small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--font);
}

.plan-main strong {
  display: block;
  margin-bottom: 4px;
}

.plan-main span {
  color: var(--ink-2);
  line-height: 1.45;
}

.report-list {
  display: grid;
  gap: 10px;
}

.report-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
}

.report-item strong { display: block; }
.report-item p {
  margin: 6px 0 0;
  color: var(--ink-2);
  line-height: 1.45;
}

.settings-grid {
  display: grid;
  gap: 12px;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 220px);
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
}

.setting-row strong {
  display: block;
}

.setting-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.setting-row select,
.setting-row input[type="number"] {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--paper);
  color: var(--ink);
}

.setting-row label.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-weight: 800;
}

.scan-preview {
  min-height: 220px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.78);
  color: var(--muted);
}

.scan-preview img {
  max-width: 100%;
  max-height: 420px;
  display: block;
}

.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-grid label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 800;
}

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.status-dot.ok { background: var(--green); }
.status-dot.warn { background: var(--gold); }

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  transform: translateY(12px);
  opacity: 0;
  border: 1px solid rgba(126, 232, 220, 0.28);
  border-radius: var(--radius);
  padding: 13px 14px;
  background: rgba(13, 20, 27, 0.94);
  color: var(--ink);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  transition: opacity 0.18s ease, transform 0.18s ease;
  backdrop-filter: blur(16px);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.good {
  border-color: rgba(79, 227, 164, 0.55);
}

.toast.bad {
  border-color: rgba(255, 125, 97, 0.55);
}

.toast strong {
  display: block;
  margin-bottom: 3px;
}

.toast span {
  display: block;
  color: var(--ink-2);
  line-height: 1.35;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 253, 248, 0.7);
}

/* Established command-center skin */

html { background: #070b10; color: var(--ink); }

body {
  color: var(--ink);
  background:
    linear-gradient(115deg, rgba(82, 215, 255, 0.12), transparent 28%, rgba(255, 209, 102, 0.08) 52%, transparent 78%),
    repeating-linear-gradient(90deg, rgba(126, 232, 220, 0.09) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(0deg, rgba(255, 209, 102, 0.055) 0 1px, transparent 1px 42px),
    #070b10;
  background-size: auto, 42px 42px, 42px 42px, auto;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: 0;
  background:
    linear-gradient(135deg, transparent 0 48%, rgba(82, 215, 255, 0.10) 48% 49%, transparent 49% 100%),
    linear-gradient(45deg, transparent 0 62%, rgba(255, 209, 102, 0.08) 62% 63%, transparent 63% 100%);
  background-size: 280px 280px, 220px 220px;
  opacity: 0.62;
}

body::after {
  z-index: 2;
  background: repeating-linear-gradient(180deg, transparent 0 7px, rgba(244, 251, 255, 0.018) 7px 8px);
  mix-blend-mode: screen;
}

.auth-gate,
.app-shell {
  position: relative;
  z-index: 1;
}

.auth-card,
.panel,
.q-card,
.plan-day,
.report-item,
.pager-head,
.scan-preview,
.field input,
.field select,
.field textarea,
.answer-input,
.choice,
.setting-row {
  backdrop-filter: blur(18px);
}

.auth-card {
  border-color: rgba(126, 232, 220, 0.34);
  background:
    linear-gradient(135deg, rgba(13, 20, 27, 0.96), rgba(20, 27, 35, 0.9)),
    var(--paper-2);
  box-shadow: var(--shadow), 0 0 44px rgba(82, 215, 255, 0.12);
}

.auth-card h1,
.topbar h2,
.metric strong {
  color: #ffffff;
  text-shadow: 0 0 24px rgba(82, 215, 255, 0.28);
}

.auth-card p,
.brand p,
.panel-title p,
.metric span,
.plan-main span,
.report-item p {
  color: var(--ink-2);
}

.auth-message {
  border-color: var(--line-strong);
  color: var(--ink-2);
  background: rgba(7, 11, 16, 0.72);
}

.app-shell {
  grid-template-columns: 300px minmax(0, 1fr);
}

.side {
  background:
    linear-gradient(180deg, rgba(8, 13, 20, 0.98), rgba(10, 16, 24, 0.94)),
    #080d14;
  border-right: 1px solid rgba(126, 232, 220, 0.20);
  box-shadow: 18px 0 60px rgba(0, 0, 0, 0.34);
}

.side::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, transparent, var(--blue), var(--gold), transparent);
  opacity: 0.72;
}

.brand {
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  border-bottom-color: rgba(126, 232, 220, 0.18);
}

.brand-logo {
  border-color: rgba(126, 232, 220, 0.36);
  background: rgba(244, 251, 255, 0.94);
  box-shadow: 0 0 28px rgba(82, 215, 255, 0.18);
}

.brand h1 {
  color: #fff;
  font-size: 1.12rem;
}

.nav {
  gap: 8px;
}

.nav button {
  grid-template-columns: 32px 1fr;
  min-height: 46px;
  border-color: rgba(126, 232, 220, 0.09);
  color: rgba(244, 251, 255, 0.72);
  background: rgba(244, 251, 255, 0.025);
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav button:hover,
.nav button.active {
  color: #fff;
  border-color: rgba(82, 215, 255, 0.45);
  background: linear-gradient(90deg, rgba(82, 215, 255, 0.18), rgba(79, 227, 164, 0.08), rgba(255, 209, 102, 0.06));
  box-shadow: inset 3px 0 0 var(--blue), 0 0 24px rgba(82, 215, 255, 0.08);
}

.nav button:hover {
  transform: translateX(2px);
}

.nav .nav-ico {
  width: 21px;
  height: 21px;
  color: var(--gold);
  filter: drop-shadow(0 0 10px rgba(255, 209, 102, 0.28));
}

.side-note {
  border: 1px solid rgba(126, 232, 220, 0.18);
  background: rgba(244, 251, 255, 0.055);
  color: rgba(244, 251, 255, 0.72);
}

.main {
  padding: 28px clamp(18px, 3vw, 42px) 48px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: -28px calc(clamp(18px, 3vw, 42px) * -1) 0;
  padding: 22px clamp(18px, 3vw, 42px) 18px;
  border-bottom-color: rgba(126, 232, 220, 0.18);
  background: rgba(7, 11, 16, 0.78);
  backdrop-filter: blur(20px);
}

.topbar h2 {
  font-size: clamp(1.45rem, 3vw, 2.55rem);
}

.pill {
  border-color: rgba(126, 232, 220, 0.28);
  color: var(--ink-2);
  background: rgba(13, 20, 27, 0.76);
  box-shadow: inset 0 0 0 1px rgba(244, 251, 255, 0.025);
}

.panel,
.q-card,
.plan-day,
.report-item,
.pager-head,
.setting-row {
  border-color: rgba(126, 232, 220, 0.19);
  background:
    linear-gradient(150deg, rgba(244, 251, 255, 0.075), rgba(244, 251, 255, 0.026)),
    rgba(13, 20, 27, 0.84);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}

.panel:hover,
.q-card:hover,
.plan-day:hover,
.report-item:hover {
  border-color: rgba(82, 215, 255, 0.36);
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 128px;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent, rgba(82, 215, 255, 0.10), transparent),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(126, 232, 220, 0.06) 18px 19px, transparent 19px 28px);
  opacity: 0.55;
}

.metric > * {
  position: relative;
}

.bar {
  height: 11px;
  border: 1px solid rgba(126, 232, 220, 0.16);
  background: rgba(244, 251, 255, 0.08);
}

.bar > i {
  background: linear-gradient(90deg, var(--green), var(--blue), var(--gold));
  box-shadow: 0 0 18px rgba(82, 215, 255, 0.28);
}

.btn {
  border-color: rgba(126, 232, 220, 0.36);
  color: var(--ink);
  background: rgba(13, 20, 27, 0.84);
  box-shadow: inset 0 0 0 1px rgba(244, 251, 255, 0.035);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--blue);
  box-shadow: 0 0 22px rgba(82, 215, 255, 0.14);
}

.btn.primary {
  border-color: rgba(79, 227, 164, 0.72);
  background: linear-gradient(135deg, rgba(79, 227, 164, 0.92), rgba(82, 215, 255, 0.72));
  color: #071015;
}

.btn.rust {
  border-color: rgba(255, 125, 97, 0.72);
  background: linear-gradient(135deg, rgba(255, 125, 97, 0.92), rgba(255, 209, 102, 0.72));
  color: #170906;
}

.btn.ghost {
  background: rgba(244, 251, 255, 0.035);
}

.field input,
.field select,
.field textarea,
.answer-input,
.setting-row select,
.setting-row input[type="number"] {
  border-color: rgba(126, 232, 220, 0.30);
  background: rgba(7, 11, 16, 0.76);
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.answer-input:focus,
.setting-row select:focus {
  outline: 2px solid rgba(82, 215, 255, 0.42);
  outline-offset: 2px;
}

.seg {
  border-color: rgba(126, 232, 220, 0.30);
  background: rgba(13, 20, 27, 0.84);
}

.seg button {
  border-right-color: rgba(126, 232, 220, 0.18);
  color: var(--ink-2);
}

.seg button.active {
  background: linear-gradient(135deg, rgba(82, 215, 255, 0.72), rgba(217, 140, 255, 0.42));
  color: #fff;
}

.course-row,
.choice,
.feedback,
.solution,
.empty,
.scan-preview {
  border-color: rgba(126, 232, 220, 0.18);
  background: rgba(7, 11, 16, 0.54);
}

.course-name,
.panel-title h3,
.report-item strong,
.plan-main strong,
.setting-row strong,
.q-stem {
  color: #fff;
}

.chip {
  border-color: rgba(126, 232, 220, 0.20);
  color: var(--ink-2);
  background: rgba(244, 251, 255, 0.055);
}

.chip.easy { background: var(--green-soft); color: var(--green); border-color: rgba(79, 227, 164, 0.35); }
.chip.medium { background: var(--gold-soft); color: var(--gold); border-color: rgba(255, 209, 102, 0.35); }
.chip.hard { background: var(--rust-soft); color: var(--rust); border-color: rgba(255, 125, 97, 0.35); }
.chip.blue { background: var(--blue-soft); color: var(--blue); border-color: rgba(82, 215, 255, 0.35); }

.q-card {
  position: relative;
  overflow: hidden;
  border-left-width: 1px;
}

.q-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--gold), var(--rust));
}

.q-card[data-difficulty="easy"]::before { background: linear-gradient(90deg, var(--green), var(--blue)); }
.q-card[data-difficulty="medium"]::before { background: linear-gradient(90deg, var(--gold), var(--green)); }
.q-card[data-difficulty="hard"]::before { background: linear-gradient(90deg, var(--rust), var(--gold)); }

.choice:hover,
.choice.selected {
  border-color: var(--blue);
  background: rgba(82, 215, 255, 0.13);
  color: #fff;
}

.choice:disabled,
.btn:disabled,
.seg button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

:where(button, a, input, select, textarea, label.btn):focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.seg:focus-within,
.tag-grid label:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(82, 215, 255, 0.18);
}

h1,
h2,
h3,
h4,
h5 { text-wrap: balance; }

p,
li { text-wrap: pretty; }

[id] { scroll-margin-top: 110px; }

.menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 45;
  border: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(2px);
}

.feedback.good {
  border-color: rgba(79, 227, 164, 0.28);
  background: rgba(79, 227, 164, 0.13);
  color: #bcffe3;
}

.feedback.bad {
  border-color: rgba(255, 125, 97, 0.32);
  background: rgba(255, 125, 97, 0.13);
  color: #ffd1c7;
}

.solution {
  border-style: solid;
  background: rgba(255, 209, 102, 0.08);
}

.plan-day.today {
  border-color: rgba(82, 215, 255, 0.54);
  box-shadow: 0 0 0 1px rgba(82, 215, 255, 0.16), 0 18px 44px rgba(0, 0, 0, 0.26);
}

.scan-preview {
  color: var(--muted);
}

.status-dot {
  box-shadow: 0 0 12px currentColor;
}

.mobile-menu svg {
  width: 20px;
  height: 20px;
}

.mobile-menu { display: none; }

@media (max-width: 1020px) {
  .app-shell { grid-template-columns: 1fr; }
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(320px, 88vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  body.menu-open .side { transform: translateX(0); }
  body.menu-open { overflow: hidden; }
  body.menu-open .menu-backdrop { display: block; }
  .mobile-menu {
    display: inline-grid;
    place-items: center;
  }
  .main { padding-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .nav button:hover,
  .btn:hover { transform: none; }
}

@media (forced-colors: active) {
  :where(button, a, input, select, textarea, label.btn):focus-visible {
    outline-color: Highlight;
  }

  .status-dot { forced-color-adjust: none; }
}

@media (max-width: 860px) {
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4 { grid-template-columns: 1fr; }
  .course-row,
  .plan-day,
  .setting-row { grid-template-columns: 1fr; }
  .answer-row { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
  .topbar-meta { justify-content: flex-start; }
}

/* Teaching Watch-Outs */
.wo-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 4px; }
.wo-module { margin-top: 16px; }
.wo-mnum { display: inline-block; font-size: 12px; font-weight: 800; color: var(--gold); background: var(--gold-soft); border-radius: 6px; padding: 1px 8px; margin-right: 8px; vertical-align: 2px; }
.wo-list { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 900px) { .wo-list { grid-template-columns: 1fr 1fr; } }
.wo-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--paper-2); }
.wo-item h5 { margin: 0 0 6px; font-size: 14px; font-weight: 800; line-height: 1.35; color: var(--ink); display: flex; gap: 9px; align-items: flex-start; }
.wo-item h5::before { content: ""; flex: 0 0 8px; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--gold); }
.wo-item p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.wo-eg { margin-top: 9px; font-size: 12.5px; line-height: 1.5; color: var(--ink); background: var(--green-soft); border-left: 3px solid var(--green); padding: 6px 10px; border-radius: 0 6px 6px 0; }
.wo-universal { border-color: var(--rust); }
.wo-universal .wo-item h5::before { background: var(--rust); }

@media print {
  .wo-course { display: block !important; }
  .wo-tabs { display: none !important; }
  .wo-item, .wo-module { break-inside: avoid; }
}

@media print {
  @page { margin: 0.45in; }
  body {
    color-scheme: light;
    --paper: #fff;
    --paper-2: #fff;
    --ink: #111;
    --ink-2: #333;
    --muted: #555;
    --line: #c9c9c9;
    --line-strong: #777;
    --green: #1f7a5c;
    --green-soft: #e4f2ec;
    --blue: #225c91;
    --blue-soft: #e4edf7;
    --rust: #a8492f;
    --rust-soft: #f5e7e1;
    --gold: #a16f20;
    --gold-soft: #f7edda;

    background: #fff;
    color: #111;
  }
  body::before,
  body::after { display: none; }
  .side,
  .topbar,
  .section-head .actions,
  .no-print,
  .nav,
  .mobile-menu,
  .side-note,
  .answer-row .btn,
  .seg { display: none !important; }
  .app-shell,
  .main { display: block; padding: 0; }
  .view { display: none !important; }
  .view.active { display: block !important; }
  .panel,
  .q-card,
  .plan-day,
  .report-item {
    break-inside: avoid;
    box-shadow: none;
    background: #fff;
  }
  .q-card { margin-bottom: 12px; }
  .answer-input {
    min-height: 72px;
    border-color: #777;
  }
  .feedback { display: none !important; }
  body.print-answers .solution { display: block !important; }
}
