/* EduTogether Design System v2.0.0
 * New projects opt in with <body class="edu-app">.
 * Legacy design-system.css remains unchanged for existing projects.
 */

:root {
  color-scheme: light;
  --edu-brand: #b42362;
  --edu-brand-strong: #8e1c4e;
  --edu-brand-secondary: #4338ca;
  --edu-brand-mark-pink: #d53f8c;

  --edu-canvas: #f5f7fa;
  --edu-surface: #ffffff;
  --edu-surface-subtle: #eef1f5;
  --edu-surface-raised: #ffffff;
  --edu-ink: #182230;
  --edu-ink-muted: #5d6675;
  --edu-ink-subtle: #7e8795;
  --edu-border: #d8dee9;
  --edu-border-strong: #b8c0ce;

  --edu-success: #16794b;
  --edu-success-soft: #eaf7ef;
  --edu-warning: #8a6100;
  --edu-warning-soft: #fff6d8;
  --edu-danger: #b42318;
  --edu-danger-soft: #fff0ee;
  --edu-info: #1d4ed8;
  --edu-info-soft: #eef4ff;
  --edu-focus: #2563eb;

  --edu-accent: #b42362;
  --edu-accent-strong: #8e1c4e;
  --edu-accent-soft: #fff0f6;

  --edu-font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --edu-font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --edu-space-1: 4px;
  --edu-space-2: 8px;
  --edu-space-3: 12px;
  --edu-space-4: 16px;
  --edu-space-6: 24px;
  --edu-space-8: 32px;
  --edu-space-12: 48px;
  --edu-space-16: 64px;

  --edu-radius-sm: 4px;
  --edu-radius-control: 6px;
  --edu-radius-panel: 8px;
  --edu-radius-full: 999px;

  --edu-shadow-raised: 0 8px 24px rgb(24 34 48 / 9%);
  --edu-shadow-overlay: 0 18px 48px rgb(24 34 48 / 18%);
  --edu-header-height: 64px;
  --edu-content-width: 1120px;
  --edu-content-wide: 1280px;
  --edu-sidebar-width: 232px;
  --edu-motion-fast: 120ms;
  --edu-motion-standard: 180ms;
  --edu-motion-slow: 220ms;
}

html[data-edu-theme="math"] {
  --edu-accent: #1d4ed8;
  --edu-accent-strong: #173ea6;
  --edu-accent-soft: #eef4ff;
}

html[data-edu-theme="language"] {
  --edu-accent: #6d3bc1;
  --edu-accent-strong: #54279e;
  --edu-accent-soft: #f5f0ff;
}

html[data-edu-theme="science"] {
  --edu-accent: #0f766e;
  --edu-accent-strong: #0b5b55;
  --edu-accent-soft: #eaf8f5;
}

html[data-edu-theme="creative"] {
  --edu-accent: #c2410c;
  --edu-accent-strong: #9a3412;
  --edu-accent-soft: #fff2e8;
}

html[data-edu-theme="wellbeing"] {
  --edu-accent: #b42362;
  --edu-accent-strong: #8e1c4e;
  --edu-accent-soft: #fff0f6;
}

html[data-edu-theme="game"] {
  --edu-accent: #4338ca;
  --edu-accent-strong: #3730a3;
  --edu-accent-soft: #f0f0ff;
}

.edu-app,
.edu-app *,
.edu-app *::before,
.edu-app *::after {
  box-sizing: border-box;
}

.edu-app {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--edu-canvas);
  color: var(--edu-ink);
  font-family: var(--edu-font-sans);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.edu-app :where(h1, h2, h3, h4, p, ul, ol, figure) {
  margin-top: 0;
}

.edu-app :where(button, input, select, textarea) {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

.edu-app :where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--edu-focus) 34%, transparent);
  outline-offset: 2px;
}

.edu-app a {
  color: var(--edu-accent);
  text-underline-offset: 3px;
}

.edu-app img,
.edu-app svg {
  display: block;
  max-width: 100%;
}

.edu-app code,
.edu-app kbd,
.edu-app pre {
  font-family: var(--edu-font-mono);
}

.edu-shell {
  min-height: 100vh;
}

.edu-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--edu-header-height);
  border-bottom: 1px solid var(--edu-border);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(12px);
}

.edu-topbar__inner {
  width: min(calc(100% - 48px), var(--edu-content-wide));
  min-height: var(--edu-header-height);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--edu-space-6);
}

.edu-brand-lockup {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: var(--edu-space-3);
  color: var(--edu-ink);
  text-decoration: none;
}

.edu-brand-lockup__mark {
  width: 38px;
  height: 32px;
  object-fit: contain;
}

.edu-brand-lockup__copy {
  min-width: 0;
}

.edu-brand-lockup__name,
.edu-brand-lockup__product {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edu-brand-lockup__name {
  color: var(--edu-brand);
  font-size: 15px;
  font-weight: 750;
  line-height: 20px;
}

.edu-brand-lockup__product {
  color: var(--edu-ink-muted);
  font-size: 12px;
  font-weight: 550;
  line-height: 16px;
}

.edu-topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--edu-space-2);
}

.edu-page {
  width: min(calc(100% - 48px), var(--edu-content-width));
  margin-inline: auto;
  padding-block: var(--edu-space-12) var(--edu-space-16);
}

.edu-page--wide {
  max-width: var(--edu-content-wide);
}

.edu-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--edu-space-8);
  margin-bottom: var(--edu-space-8);
  padding-bottom: var(--edu-space-6);
  border-bottom: 1px solid var(--edu-border);
}

.edu-page-header__title {
  margin-bottom: var(--edu-space-2);
  font-size: 32px;
  font-weight: 760;
  line-height: 40px;
}

.edu-page-header__summary {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--edu-ink-muted);
  font-size: 16px;
  line-height: 26px;
}

.edu-section {
  padding-block: var(--edu-space-12);
  border-bottom: 1px solid var(--edu-border);
}

.edu-section:last-child {
  border-bottom: 0;
}

.edu-section__heading {
  display: grid;
  grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  gap: var(--edu-space-8);
  margin-bottom: var(--edu-space-8);
}

.edu-section__title {
  margin-bottom: 0;
  font-size: 22px;
  font-weight: 720;
  line-height: 30px;
}

.edu-section__description {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--edu-ink-muted);
}

.edu-connection-title {
  position: relative;
  padding-left: var(--edu-space-4);
}

.edu-connection-title::before {
  content: "";
  position: absolute;
  inset: 4px auto 4px 0;
  width: 3px;
  border-radius: var(--edu-radius-full);
  background: var(--edu-accent);
}

.edu-stack {
  display: grid;
  gap: var(--edu-space-4);
}

.edu-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--edu-space-3);
}

.edu-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--edu-space-6);
}

.edu-split > * {
  min-width: 0;
}

.edu-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--edu-space-4);
}

.edu-grid > * {
  grid-column: span 4;
}

.edu-panel {
  border: 1px solid var(--edu-border);
  border-radius: var(--edu-radius-panel);
  background: var(--edu-surface);
}

.edu-panel__header,
.edu-panel__body,
.edu-panel__footer {
  padding: var(--edu-space-4) var(--edu-space-6);
}

.edu-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--edu-space-4);
  border-bottom: 1px solid var(--edu-border);
}

.edu-panel__footer {
  border-top: 1px solid var(--edu-border);
}

.edu-panel__title {
  margin: 0;
  font-size: 16px;
  font-weight: 680;
  line-height: 24px;
}

.edu-card {
  position: relative;
  min-width: 0;
  padding: var(--edu-space-4);
  border: 1px solid var(--edu-border);
  border-radius: var(--edu-radius-panel);
  background: var(--edu-surface);
  color: var(--edu-ink);
  transition: border-color var(--edu-motion-standard) ease,
    box-shadow var(--edu-motion-standard) ease,
    transform var(--edu-motion-standard) ease;
}

.edu-card--interactive {
  cursor: pointer;
}

.edu-card--interactive:hover {
  border-color: color-mix(in srgb, var(--edu-accent) 48%, var(--edu-border));
  box-shadow: var(--edu-shadow-raised);
  transform: translateY(-2px);
}

.edu-card[aria-selected="true"],
.edu-card.is-selected {
  border-color: var(--edu-accent);
  box-shadow: inset 3px 0 0 var(--edu-accent);
}

.edu-card__title {
  margin-bottom: var(--edu-space-1);
  font-size: 16px;
  font-weight: 680;
  line-height: 24px;
}

.edu-card__meta,
.edu-caption {
  margin-bottom: 0;
  color: var(--edu-ink-muted);
  font-size: 12px;
  font-weight: 520;
  line-height: 18px;
}

.edu-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--edu-space-2);
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--edu-radius-control);
  background: transparent;
  color: var(--edu-ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 20px;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--edu-motion-fast) ease,
    border-color var(--edu-motion-fast) ease,
    color var(--edu-motion-fast) ease,
    transform var(--edu-motion-fast) ease;
}

.edu-button:active:not(:disabled) {
  transform: translateY(1px);
}

.edu-button:disabled,
.edu-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.48;
}

.edu-button--primary {
  background: var(--edu-accent);
  color: #ffffff;
}

.edu-app .edu-button--primary {
  color: #ffffff;
}

.edu-button--primary:hover:not(:disabled) {
  background: var(--edu-accent-strong);
}

.edu-button--secondary {
  border-color: var(--edu-border-strong);
  background: var(--edu-surface);
}

.edu-button--secondary:hover:not(:disabled) {
  border-color: var(--edu-accent);
  color: var(--edu-accent-strong);
}

.edu-button--ghost:hover:not(:disabled) {
  background: var(--edu-accent-soft);
  color: var(--edu-accent-strong);
}

.edu-button--danger {
  border-color: color-mix(in srgb, var(--edu-danger) 35%, var(--edu-border));
  color: var(--edu-danger);
}

.edu-button--large {
  min-height: 44px;
  padding-inline: 18px;
  font-size: 15px;
}

.edu-icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.edu-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.edu-field {
  display: grid;
  gap: var(--edu-space-2);
}

.edu-label {
  font-size: 14px;
  font-weight: 650;
  line-height: 20px;
}

.edu-input,
.edu-select,
.edu-textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--edu-border-strong);
  border-radius: var(--edu-radius-control);
  background: var(--edu-surface);
  transition: border-color var(--edu-motion-fast) ease,
    box-shadow var(--edu-motion-fast) ease;
}

.edu-input:hover,
.edu-select:hover,
.edu-textarea:hover {
  border-color: var(--edu-ink-subtle);
}

.edu-input:focus,
.edu-select:focus,
.edu-textarea:focus {
  border-color: var(--edu-focus);
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--edu-focus) 16%, transparent);
}

.edu-textarea {
  min-height: 96px;
  resize: vertical;
}

.edu-help,
.edu-error {
  min-height: 18px;
  margin: 0;
  font-size: 12px;
  line-height: 18px;
}

.edu-help {
  color: var(--edu-ink-muted);
}

.edu-error {
  color: var(--edu-danger);
}

.edu-segmented {
  width: fit-content;
  max-width: 100%;
  display: flex;
  gap: 2px;
  padding: 3px;
  overflow-x: auto;
  border: 1px solid var(--edu-border);
  border-radius: var(--edu-radius-panel);
  background: var(--edu-surface-subtle);
  scrollbar-width: none;
}

.edu-segmented::-webkit-scrollbar {
  display: none;
}

.edu-segmented__item {
  min-height: 32px;
  padding: 6px 12px;
  border: 0;
  border-radius: var(--edu-radius-sm);
  background: transparent;
  color: var(--edu-ink-muted);
  font-size: 13px;
  font-weight: 620;
  white-space: nowrap;
  cursor: pointer;
}

.edu-segmented__item:hover {
  color: var(--edu-ink);
}

.edu-segmented__item[aria-pressed="true"],
.edu-segmented__item.is-active {
  background: var(--edu-surface);
  color: var(--edu-accent-strong);
  box-shadow: 0 1px 2px rgb(24 34 48 / 10%);
}

.edu-tag,
.edu-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--edu-radius-full);
  font-size: 12px;
  font-weight: 650;
  line-height: 16px;
}

.edu-tag {
  border: 1px solid var(--edu-border);
  background: var(--edu-surface);
  color: var(--edu-ink-muted);
}

.edu-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.edu-status--success {
  background: var(--edu-success-soft);
  color: var(--edu-success);
}

.edu-status--warning {
  background: var(--edu-warning-soft);
  color: var(--edu-warning);
}

.edu-status--danger {
  background: var(--edu-danger-soft);
  color: var(--edu-danger);
}

.edu-notice {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: var(--edu-space-3);
  padding: var(--edu-space-4);
  border: 1px solid var(--edu-border);
  border-left: 3px solid var(--edu-info);
  border-radius: var(--edu-radius-control);
  background: var(--edu-surface);
}

.edu-notice--success {
  border-left-color: var(--edu-success);
  background: var(--edu-success-soft);
}

.edu-notice--warning {
  border-left-color: var(--edu-warning);
  background: var(--edu-warning-soft);
}

.edu-notice--danger {
  border-left-color: var(--edu-danger);
  background: var(--edu-danger-soft);
}

.edu-progress {
  display: grid;
  gap: var(--edu-space-2);
}

.edu-progress__meta {
  display: flex;
  justify-content: space-between;
  gap: var(--edu-space-4);
  color: var(--edu-ink-muted);
  font-size: 12px;
  font-weight: 620;
  line-height: 18px;
}

.edu-progress__track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--edu-radius-full);
  background: var(--edu-surface-subtle);
}

.edu-progress__bar {
  width: var(--edu-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--edu-accent);
  transition: width var(--edu-motion-slow) ease;
}

.edu-choice-list {
  display: grid;
  gap: var(--edu-space-3);
}

.edu-choice {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 20px;
  align-items: center;
  gap: var(--edu-space-3);
  padding: 10px 14px;
  border: 1px solid var(--edu-border);
  border-radius: var(--edu-radius-control);
  background: var(--edu-surface);
  color: var(--edu-ink);
  text-align: left;
  cursor: pointer;
}

.edu-choice:hover {
  border-color: color-mix(in srgb, var(--edu-accent) 48%, var(--edu-border));
}

.edu-choice[aria-checked="true"],
.edu-choice.is-selected {
  border-color: var(--edu-accent);
  background: var(--edu-accent-soft);
}

.edu-choice.is-correct {
  border-color: var(--edu-success);
  background: var(--edu-success-soft);
}

.edu-choice.is-incorrect {
  border-color: var(--edu-danger);
  background: var(--edu-danger-soft);
}

.edu-choice__key {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--edu-border-strong);
  border-radius: var(--edu-radius-sm);
  color: var(--edu-ink-muted);
  font-size: 12px;
  font-weight: 700;
}

.edu-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--edu-border);
  border-radius: var(--edu-radius-panel);
  background: var(--edu-surface);
}

.edu-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.edu-table th,
.edu-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--edu-border);
  text-align: left;
  vertical-align: middle;
}

.edu-table th {
  background: var(--edu-surface-subtle);
  color: var(--edu-ink-muted);
  font-size: 12px;
  font-weight: 680;
}

.edu-table tbody tr:last-child td {
  border-bottom: 0;
}

.edu-table tbody tr:hover {
  background: color-mix(in srgb, var(--edu-accent-soft) 48%, white);
}

.edu-code {
  max-width: 100%;
  margin: 0;
  padding: var(--edu-space-4);
  overflow-x: auto;
  border: 1px solid #2d3948;
  border-radius: var(--edu-radius-panel);
  background: #182230;
  color: #e8ecf3;
  font-size: 13px;
  line-height: 21px;
}

.edu-token-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--edu-space-4);
}

.edu-token {
  overflow: hidden;
  border: 1px solid var(--edu-border);
  border-radius: var(--edu-radius-panel);
  background: var(--edu-surface);
}

.edu-token__swatch {
  height: 88px;
  background: var(--token-color);
}

.edu-token__copy {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
}

.edu-token__name {
  font-size: 13px;
  font-weight: 650;
}

.edu-token__value {
  color: var(--edu-ink-muted);
  font-family: var(--edu-font-mono);
  font-size: 11px;
}

.edu-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.edu-hidden {
  display: none !important;
}

.edu-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 960px) {
  .edu-section__heading {
    grid-template-columns: 1fr;
    gap: var(--edu-space-3);
  }

  .edu-grid > * {
    grid-column: span 6;
  }

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

@media (max-width: 720px) {
  .edu-topbar__inner,
  .edu-page {
    width: min(calc(100% - 32px), var(--edu-content-width));
  }

  .edu-topbar__actions .edu-button:not(.edu-icon-button) span {
    display: none;
  }

  .edu-page {
    padding-block: var(--edu-space-8) var(--edu-space-12);
  }

  .edu-page-header {
    grid-template-columns: 1fr;
    align-items: start;
    gap: var(--edu-space-4);
  }

  .edu-page-header__title {
    font-size: 26px;
    line-height: 34px;
  }

  .edu-section {
    padding-block: var(--edu-space-8);
  }

  .edu-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .edu-grid > * {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .edu-brand-lockup__product {
    display: none;
  }

  .edu-token-grid {
    grid-template-columns: 1fr;
  }

  .edu-panel__header,
  .edu-panel__body,
  .edu-panel__footer {
    padding-inline: var(--edu-space-4);
  }
}

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

@media print {
  .edu-topbar,
  .edu-no-print {
    display: none !important;
  }

  .edu-app {
    background: #ffffff;
  }

  .edu-page {
    width: 100%;
    max-width: none;
    padding: 0;
  }
}
