@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --blue: #4e72ff;
  --red: #fe6468;
  --yellow: #ffd558;
  --green: #33c480;
  --ink: #18213e;
  --muted: #657085;
  --line: #dfe5f1;
  --border: var(--line);
  --soft: #f5f7fc;
  --focus: rgba(78, 114, 255, 0.34);
  --success-soft: #edfbf5;
  --warning-soft: #fff8df;
  --error-soft: #fff1f1;
}

html {
  overflow-x: hidden;
}

body,
button,
input,
select {
  font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.brand {
  cursor: default;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.my-theralab-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border: 1px solid #cfd8ff;
  border-radius: 11px;
  color: #344fc7;
  background: #fff;
  font-weight: 750;
  text-decoration: none;
}

.my-theralab-link:hover {
  border-color: var(--blue);
  background: #f5f7ff;
}

@media (max-width: 560px) {
  .owner-review-banner {
    padding-inline: 14px;
  }

  .topbar {
    height: auto;
    min-height: 72px;
    gap: 12px;
    padding-block: 10px;
  }

  .brand small {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
  }

  .my-theralab-link {
    padding-inline: 10px;
  }
}

body {
  color: var(--ink);
  background: linear-gradient(180deg, #f7f9ff 0, #fff 440px);
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 10px;
  color: #fff;
  background: var(--blue);
  font-weight: 750;
  text-decoration: none;
  transform: translateY(-130%);
}

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

.owner-review-banner {
  border-bottom: 1px solid #efd378;
  color: #614c0b;
  background: var(--warning-soft);
}

.topbar {
  border-color: var(--line);
  box-shadow: 0 4px 18px rgba(24, 33, 62, 0.04);
}

.brand strong {
  color: var(--ink);
  letter-spacing: -0.02em;
}

.brand small {
  letter-spacing: 0.01em;
}

.card,
.auth-card,
.quiz-card,
.lesson-reader,
.module-header,
.study-today,
.study-search-box {
  border-color: var(--line);
  box-shadow: 0 8px 26px rgba(24, 33, 62, 0.045);
}

button,
input,
.my-theralab-link,
.reference-item a {
  min-height: 44px;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
a:focus-visible,
[role="option"]:focus-visible,
dialog:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.primary,
.secondary,
.link-button,
.tab,
.picker-trigger,
.count-option,
.today-action,
.choice,
.module-card,
.lesson-row,
.study-search-result,
.recommendation-card {
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.primary {
  background: var(--blue);
}

.secondary {
  border-color: #cdd7ff;
  color: #344fc7;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}

.status {
  color: #344fc7;
}

.status.success {
  color: #137a53;
}

.status.error {
  color: #a42c32;
}

.auth-tabs,
.workspace-tabs {
  border: 1px solid var(--line);
  background: #eef1f7;
}

.tab {
  min-height: 44px;
  font-weight: 700;
}

.tab.active,
.tab[aria-selected="true"] {
  color: #2946bc;
  background: #fff;
  box-shadow: 0 2px 8px rgba(24, 33, 62, 0.08), inset 0 0 0 1px #d6defc;
}

.filter-tray {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
}

.filter-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.field-label,
.count-field > span,
.picker-popover label {
  display: block;
  margin: 0 0 7px;
  color: #4b5770;
  font-size: 12px;
  font-weight: 750;
}

.filter-summary {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.builder {
  align-items: start;
  gap: 14px;
}

.field-group,
.count-field,
.picker {
  min-width: 0;
}

.field-group.full-span,
.count-field.full-span {
  grid-column: 1 / -1;
}

.native-control-fallback {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.picker {
  position: relative;
}

.picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid #d7deeb;
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.picker-trigger[aria-expanded="true"] {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(78, 114, 255, 0.12);
}

.picker-popover {
  position: absolute;
  inset: calc(100% + 7px) 0 auto;
  z-index: 30;
  width: 100%;
  max-height: min(360px, 58vh);
  padding: 12px;
  border: 1px solid #cfd8e8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(24, 33, 62, 0.15);
}

.picker-popover input {
  margin-bottom: 8px;
}

.picker-list {
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.picker-option {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.picker-option:hover,
.picker-option:focus-visible {
  border-color: #cbd6ff;
  background: #f5f7ff;
}

.picker-option[aria-selected="true"] {
  border-color: #bdcaff;
  color: #2946bc;
  background: #edf1ff;
  font-weight: 750;
}

.picker-empty {
  margin: 8px;
  color: var(--muted);
  font-size: 13px;
}

.decision-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #eef1f7;
}

.count-option {
  min-width: 0;
  min-height: 44px;
  border-color: transparent;
  background: transparent;
}

.count-option.active,
.count-option[aria-checked="true"] {
  border-color: #c6d1ff;
  color: #2946bc;
  background: #fff;
  box-shadow: 0 2px 8px rgba(24, 33, 62, 0.07);
}

.journey-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 14px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.journey-rail li {
  position: relative;
  min-width: 0;
  padding: 9px 10px 9px 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
  counter-increment: step;
}

.journey-rail li::before {
  content: counter(step);
  position: absolute;
  left: 10px;
  top: 50%;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #8a94a8;
  font-size: 10px;
  transform: translateY(-50%);
}

.journey-rail li[aria-current="step"] {
  border-color: #bdcaff;
  color: #2946bc;
  background: #edf1ff;
}

.journey-rail li[aria-current="step"]::before {
  background: var(--blue);
}

.progress-track {
  margin-top: 12px;
}

.choice {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.choice-copy {
  min-width: 0;
}

.choice-state {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: #334057;
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

.choice.correct {
  border-color: #79d2aa;
  background: var(--success-soft);
}

.choice.wrong {
  border-color: #f39a9d;
  background: var(--error-soft);
}

.feedback-card.correct {
  border-left: 4px solid var(--green);
  background: var(--success-soft);
}

.feedback-card.wrong {
  border-left: 4px solid var(--red);
  background: var(--error-soft);
}

.today-action,
.module-card,
.lesson-row,
.study-search-result,
.recommendation-card {
  min-height: 44px;
}

.today-action.today-primary {
  border-color: #c8d3ff;
  background: #f0f3ff;
}

.today-action:disabled,
.primary:disabled,
.secondary:disabled {
  opacity: 0.58;
}

.reference-item a {
  display: inline-flex;
  align-items: center;
}

.decision-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 24px 80px rgba(24, 33, 62, 0.24);
}

.decision-dialog::backdrop {
  background: rgba(24, 33, 62, 0.46);
  backdrop-filter: blur(3px);
}

.decision-dialog form {
  padding: 26px;
}

.decision-dialog h2 {
  margin-top: 8px;
  font-size: 25px;
}

.decision-dialog p {
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

footer {
  flex-wrap: wrap;
  gap: 10px 22px;
}

@media (max-width: 780px) {
  .filter-tray-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-summary {
    text-align: left;
  }

  .field-group.full-span,
  .count-field.full-span {
    grid-column: auto;
  }

  .picker-popover {
    position: relative;
    inset: 7px auto auto;
  }

  .journey-rail li {
    padding-left: 31px;
  }

  .choice {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .shell,
  .auth-card,
  .quiz-card,
  .card,
  .lesson-reader,
  .module-header {
    min-width: 0;
  }

  .shell {
    padding-inline: 14px;
  }

  .auth-card,
  .quiz-card,
  .lesson-reader {
    padding: 20px;
    border-radius: 18px;
  }

  .decision-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .journey-rail {
    gap: 5px;
  }

  .journey-rail li {
    padding: 30px 5px 7px;
    text-align: center;
  }

  .journey-rail li::before {
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions button {
    width: 100%;
  }

  footer {
    margin-inline: 14px;
  }
}

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