:root {
  color-scheme: light;
  --bg: #f6f3f8;
  --surface: #ffffff;
  --surface-2: #faf8fc;
  --ink: #262331;
  --muted: #706c7c;
  --line: #ded7e8;
  --accent: #8d7aa8;
  --accent-2: #c8bdd8;
  --accent-3: #efe9f6;
  --good: #4f8f71;
  --bad: #bf5b5b;
  --warn: #b98945;
  --shadow: 0 18px 50px rgba(77, 61, 96, 0.14);
  --radius: 8px;
}

body[data-theme="mint"] {
  --bg: #f2f7f3;
  --surface-2: #f7fbf7;
  --line: #d4e4d8;
  --accent: #6b9278;
  --accent-2: #b8d3c1;
  --accent-3: #e9f2ec;
}

body[data-theme="mist"] {
  --bg: #f1f5f8;
  --surface-2: #f8fbfd;
  --line: #d4e0e8;
  --accent: #6f8fa4;
  --accent-2: #bdd0dc;
  --accent-3: #e8f0f5;
}

body[data-theme="apricot"] {
  --bg: #f8f4ef;
  --surface-2: #fcfaf7;
  --line: #eadccc;
  --accent: #a78362;
  --accent-2: #dbc5af;
  --accent-3: #f3ebe2;
}

body[data-theme="sage"] {
  --bg: #f4f6ef;
  --surface-2: #fbfcf8;
  --line: #dce2ce;
  --accent: #808f63;
  --accent-2: #cbd5b3;
  --accent-3: #eff3e7;
}

body[data-theme="rose"] {
  --bg: #f8f2f4;
  --surface-2: #fcf8f9;
  --line: #ead5dd;
  --accent: #a77a8a;
  --accent-2: #ddbdc8;
  --accent-3: #f4e8ed;
}

body[data-theme="sea"] {
  --bg: #f0f7f7;
  --surface-2: #f7fcfc;
  --line: #cfe4e2;
  --accent: #628f8c;
  --accent-2: #b4d4d1;
  --accent-3: #e5f3f2;
}

body[data-theme="lilac"] {
  --bg: #f4f2f6;
  --surface-2: #faf9fc;
  --line: #ddd8e5;
  --accent: #7f7796;
  --accent-2: #c7c0d4;
  --accent-3: #ebe8f2;
}

body[data-theme="sunrise"] {
  --bg: #f8f4ec;
  --surface-2: #fffaf2;
  --line: #eadcc0;
  --accent: #a68b5c;
  --accent-2: #dbc99d;
  --accent-3: #f4ecd7;
}

body[data-theme="graphite"] {
  --bg: #f2f3f4;
  --surface-2: #fafafa;
  --line: #d9dde2;
  --accent: #687080;
  --accent-2: #bfc5ce;
  --accent-3: #ebedf0;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent-3) 70%, white 30%), transparent 34rem),
    linear-gradient(180deg, var(--bg), #ffffff 75%);
  color: var(--ink);
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
}

.app {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, auto) 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 10px clamp(18px, 3vw, 52px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0;
}

.brand-powered-rule {
  flex: 0 0 auto;
  width: 1px;
  height: 24px;
  background: #cbc5d8;
}

.powered-by {
  border: 0;
  background: transparent;
  color: #595565;
  font-size: clamp(1.18rem, 1.5vw, 1.42rem);
  font-weight: 900;
  white-space: nowrap;
}

.powered-by.hub-return {
  color: var(--accent);
  padding: 0 2px;
}

.powered-by.hub-return:hover {
  color: var(--accent-2);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
}

.topnav {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.topnav:empty {
  display: none;
}

.topnav span {
  align-self: center;
  color: var(--muted);
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell {
  width: min(1060px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(34px, 4vw, 56px) 0 56px;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: clamp(28px, 5vw, 68px);
  align-items: center;
  min-height: calc(100vh - 64px);
}

.intro {
  display: grid;
  gap: 24px;
  align-content: center;
}

.designer-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.98rem;
}

.designer-line .rule {
  width: 1px;
  height: 18px;
  background: var(--line);
}

.intro h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(2.4rem, 8vw, 5.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.intro h1 span {
  display: block;
  color: var(--accent);
}

.tagline {
  margin: 0;
  max-width: 620px;
  color: #3e394d;
  font-size: clamp(1.25rem, 2.6vw, 2rem);
  line-height: 1.45;
  font-weight: 800;
}

.auth-panel,
.panel,
.mini-card,
.admin-record-card,
.learning-card,
.result-panel,
.modal {
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 38px rgba(77, 61, 96, 0.1);
}

.auth-panel {
  padding: clamp(20px, 4vw, 30px);
}

.auth-panel h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: 0;
}

.tabs,
.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  background: var(--accent-3);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tab,
.segmented button {
  min-height: 42px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tab.active,
.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(77, 61, 96, 0.1);
}

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.field label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.field input,
.field textarea,
.field select,
.compact-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  outline: 0;
}

.field textarea {
  min-height: 180px;
  line-height: 1.55;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.compact-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 45%, transparent);
}

.hint,
.empty,
.meta {
  color: var(--muted);
}

.hint {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
}

.error {
  min-height: 22px;
  margin: 0;
  color: var(--bad);
  font-weight: 700;
}

.primary,
.secondary,
.ghost,
.danger,
.icon-btn {
  min-height: 42px;
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 24%, transparent);
}

.primary:hover,
.secondary:hover,
.ghost:hover,
.danger:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.secondary {
  background: var(--accent-3);
  color: var(--ink);
  border: 1px solid var(--line);
}

.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid transparent;
}

.danger {
  background: #f8e8e8;
  color: var(--bad);
  border: 1px solid #edc9c9;
}

.icon-btn {
  width: 44px;
  padding: 0;
  background: var(--accent-3);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 1.3rem;
}

.wide {
  width: 100%;
}

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

.stack-lg {
  display: grid;
  gap: 24px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2,
.panel h2,
.result-panel h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  letter-spacing: 0;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.title-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.title-action-row .secondary {
  margin-top: 2px;
}

.export-toolbar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.learning-card {
  min-height: 190px;
  padding: 22px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  text-align: left;
  color: var(--ink);
  border-color: color-mix(in srgb, var(--line) 80%, var(--accent) 20%);
}

.learning-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.learning-card span {
  color: var(--muted);
  line-height: 1.5;
}

.learning-card .tile-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent-3);
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 900;
}

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

.swatch {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 7px;
  border: 1px solid var(--line);
  color: rgba(38, 35, 49, 0.72);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  overflow: hidden;
  position: relative;
  padding: 0 10px;
}

.swatch::after {
  content: none;
}

.swatch.active {
  outline: 3px solid color-mix(in srgb, var(--accent) 42%, transparent);
}

.panel {
  padding: clamp(18px, 3vw, 26px);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.page-head-actions {
  justify-content: flex-end;
  margin-left: auto;
}

.page-head-actions .view-switch {
  width: auto;
}

.result-toolbar {
  justify-content: space-between;
}

.toolbar-left {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar .compact-input {
  width: min(240px, 100%);
}

.count-field {
  width: min(260px, 100%);
}

.count-field .number-input {
  width: min(160px, 100%);
}

.small-btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.record-table {
  --record-time-col: 160px;
  --record-title-col: minmax(220px, 1fr);
  --record-mode-col: 112px;
  --record-accuracy-col: 112px;
  --record-correct-col: 96px;
  --record-total-col: 96px;
  --record-duration-col: 112px;
  --record-action-col: 112px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(77, 61, 96, 0.07);
}

html[lang="en"] .record-table {
  --record-time-col: 180px;
  --record-title-col: minmax(230px, 1fr);
  --record-mode-col: 154px;
  --record-accuracy-col: 110px;
  --record-correct-col: 88px;
  --record-total-col: 78px;
  --record-duration-col: 142px;
  --record-action-col: 118px;
}

.record-filters {
  display: grid;
  grid-template-columns:
    minmax(240px, 1.15fr)
    minmax(100px, 0.52fr)
    minmax(98px, 0.45fr)
    minmax(150px, 0.64fr)
    minmax(150px, 0.64fr)
    minmax(150px, 0.68fr);
  gap: 10px;
  row-gap: 10px;
  padding: 12px;
  align-items: end;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-3) 24%, #fff);
}

.record-filters .field {
  min-width: 0;
}

.record-filters .field span {
  white-space: nowrap;
}

.record-filters select,
.record-filters input {
  min-width: 0;
  min-height: 42px;
  font-size: 0.92rem;
}

.record-filter-set {
  grid-column: 1;
  grid-row: 1;
}

.record-filter-mode {
  grid-column: 2;
  grid-row: 1;
}

.record-filter-time {
  grid-column: 3;
  grid-row: 1;
}

.record-filter-accuracy {
  grid-column: 6;
  grid-row: 1;
}

.record-filter-start {
  grid-column: 4;
  grid-row: 1;
}

.record-filter-end {
  grid-column: 5;
  grid-row: 1;
}

.record-filter-start,
.record-filter-end {
  min-width: 0;
  align-self: end;
}

.record-filter-start,
.record-filter-end,
.record-filter-start input,
.record-filter-end input {
  cursor: pointer;
}

.date-inline-label {
  position: relative;
  gap: 0;
}

.date-inline-label::before {
  content: attr(data-placeholder);
  position: absolute;
  left: 12px;
  top: 50%;
  z-index: 1;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  pointer-events: none;
  transform: translateY(-50%);
}

.date-inline-label input {
  min-width: 0;
  padding-left: 84px;
  padding-right: 30px;
}

.record-table-head,
.record-table-row {
  min-width: 1040px;
  display: grid;
  grid-template-columns:
    var(--record-time-col)
    var(--record-title-col)
    var(--record-mode-col)
    var(--record-accuracy-col)
    var(--record-correct-col)
    var(--record-total-col)
    var(--record-duration-col)
    var(--record-action-col);
  align-items: stretch;
}

html[lang="en"] .record-table-head,
html[lang="en"] .record-table-row {
  min-width: 1160px;
}

.record-table.no-actions .record-table-head,
.record-table.no-actions .record-table-row {
  min-width: 928px;
  grid-template-columns:
    var(--record-time-col)
    var(--record-title-col)
    var(--record-mode-col)
    var(--record-accuracy-col)
    var(--record-correct-col)
    var(--record-total-col)
    var(--record-duration-col);
}

html[lang="en"] .record-table.no-actions .record-table-head,
html[lang="en"] .record-table.no-actions .record-table-row {
  min-width: 1040px;
}

.record-table-head {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
}

.record-table-head span,
.record-cell {
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.record-table-head span {
  white-space: nowrap;
}

.record-table-head span:nth-child(n+3),
.record-table-row .record-cell:nth-child(n+3) {
  justify-content: center;
  text-align: center;
}

.record-table-head span:last-child,
.record-cell:last-child {
  border-right: 0;
}

.record-table-row {
  border-top: 1px solid var(--line);
}

.record-title {
  font-weight: 900;
  overflow-wrap: anywhere;
}

.record-score {
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 900;
  white-space: nowrap;
}

.record-duration {
  color: var(--muted);
  font-weight: 800;
}

.record-time {
  color: var(--muted);
  font-weight: 800;
}

.view-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
}

.view-switch button {
  min-height: 42px;
}

.timed-test-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(77, 61, 96, 0.07);
}

.timed-test-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.timed-test-table th,
.timed-test-table td {
  min-height: 54px;
  padding: 13px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.timed-test-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
  white-space: nowrap;
}

.table-head-filter {
  display: grid;
  grid-template-columns: auto minmax(148px, 1fr);
  align-items: center;
  gap: 12px;
  text-align: left;
}

.table-head-filter span {
  white-space: nowrap;
}

.table-head-filter select {
  width: 100%;
  min-height: 40px;
  font-size: 0.92rem;
}

.timed-test-table th:first-child,
.timed-test-table td:first-child {
  text-align: left;
}

.timed-test-table th:last-child,
.timed-test-table td:last-child {
  border-right: 0;
}

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

.timed-test-title {
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
}

.test-action-cell {
  display: inline-grid;
  justify-items: center;
  gap: 7px;
}

.test-calendar-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(77, 61, 96, 0.07);
}

.calendar-head {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(400px, 440px) minmax(260px, 1fr);
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
}

.calendar-head > div:first-child {
  min-width: 0;
}

.calendar-head > div:first-child .title-action-row {
  justify-content: flex-start;
}

.calendar-head h3 {
  margin: 0;
  font-size: 1.25rem;
}

.calendar-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.calendar-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-self: end;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.calendar-actions .small-btn {
  min-height: 40px;
}

.calendar-actions strong {
  min-width: 90px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
}

.calendar-controls {
  display: grid;
  width: min(440px, 100%);
  justify-self: center;
  margin-left: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  padding: 0;
  border: 0;
  background: transparent;
}

.calendar-date-field,
.calendar-date-field input {
  cursor: pointer;
}

.calendar-date-field {
  gap: 5px;
  min-width: 0;
}

.calendar-date-field input {
  min-height: 40px;
  padding: 8px 10px;
}

.calendar-date-field.date-inline-label input {
  padding-left: 72px;
}

.test-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.test-calendar-weekday,
.test-calendar-cell {
  min-height: 96px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.test-calendar-weekday {
  min-height: auto;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 900;
  text-align: center;
}

.test-calendar-weekday:nth-child(7n),
.test-calendar-cell:nth-child(7n) {
  border-right: 0;
}

.test-calendar-cell.is-empty {
  background: color-mix(in srgb, var(--accent-3) 32%, #fff);
}

.test-calendar-cell.is-today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.test-calendar-date {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
}

.test-calendar-items {
  display: grid;
  gap: 5px;
  margin-top: 6px;
}

.test-calendar-item {
  min-height: 34px;
  display: grid;
  gap: 2px;
  padding: 6px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-3) 58%, #fff);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.test-calendar-item strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.74rem;
}

.test-calendar-item span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 800;
}

.test-calendar-item:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.folder-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.upload-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.template-btn {
  min-height: 44px;
  white-space: nowrap;
}

.assignment-flow {
  display: grid;
  gap: 18px;
}

.sub-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-3) 24%, #fff);
}

.assignment-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px;
}

.assignment-control-group {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 72%, var(--line));
  border-radius: 8px;
  background: var(--accent-3);
}

.assignment-settings {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 72%, var(--line));
  border-radius: 8px;
  background: var(--accent-3);
}

.assignment-type-options {
  max-width: 520px;
}

.exam-settings {
  display: none;
  grid-template-columns: minmax(118px, 0.62fr) minmax(112px, 0.54fr) minmax(130px, 0.62fr) minmax(120px, 0.58fr) minmax(360px, 1.6fr);
  gap: 12px;
}

.exam-settings .field:last-child span {
  white-space: nowrap;
}

.assignment-flow:has(input[name="taskType"][value="exam"]:checked) .exam-settings {
  display: grid;
}

.step-label {
  color: var(--ink);
  font-weight: 900;
}

.assignment-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.radio-card {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.radio-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-radius: 999px;
  box-shadow: inset 0 0 0 4px var(--surface);
}

.radio-card input:checked + .radio-box {
  border-color: var(--accent);
  background: var(--accent);
}

.radio-card:has(input:checked) {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: none;
}

.assignment-target-grid,
.assignment-panel-fields {
  display: grid;
  gap: 12px;
}

.assignment-picker {
  position: relative;
  z-index: 2;
}

.assignment-picker:focus-within {
  z-index: 20;
}

.assignment-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.assignment-picker-head .multi-picker-summary {
  flex: 0 0 auto;
  text-align: right;
}

.multi-picker {
  position: absolute;
  top: calc(100% - 2px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 230px;
  overflow-y: auto;
  display: none;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.assignment-picker:focus-within .multi-picker {
  display: grid;
}

.multi-picker-item {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.multi-picker-item[hidden] {
  display: none;
}

.multi-picker-item input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.multi-picker-item span {
  color: var(--ink);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.multi-picker-summary {
  color: var(--muted);
  font-weight: 800;
  min-height: 18px;
}

.assignment-field {
  display: none;
}

.assignment-flow:has(input[name="assignScope"][value="set"]:checked) .assignment-field[data-assignment-field="set"],
.assignment-flow:has(input[name="assignScope"][value="folder"]:checked) .assignment-field[data-assignment-field="folder"],
.assignment-flow:has(input[name="targetType"][value="student"]:checked) .assignment-field[data-assignment-field="student"],
.assignment-flow:has(input[name="targetType"][value="class"]:checked) .assignment-field[data-assignment-field="class"] {
  display: grid;
}

.assignment-submit {
  width: min(180px, 100%);
}

.class-member-form {
  display: grid;
  gap: 14px;
}

.class-member-form > .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.student-picker {
  max-height: 320px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-3) 34%, #fff);
}

.student-choice {
  position: relative;
  min-height: 72px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.student-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.86rem;
  font-weight: 900;
}

.student-choice input:checked + .check-box {
  border-color: var(--accent);
  background: var(--accent);
}

.student-choice input:checked + .check-box::after {
  content: "✓";
}

.student-choice.disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.student-choice-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.student-choice-main strong {
  overflow-wrap: anywhere;
}

.student-choice-main span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.preview-list,
.record-list,
.set-list,
.teacher-list {
  display: grid;
  gap: 10px;
}

.preview-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--accent-3);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.mini-card {
  padding: 14px;
  display: grid;
  gap: 8px;
}

.admin-record-card {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.admin-record-card > .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-record-card > .row strong {
  font-size: 1.15rem;
}

.mini-card.clickable {
  text-align: left;
}

.set-list-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.exam-task-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

.exam-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}

.set-open-area {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.set-open-area strong {
  overflow-wrap: anywhere;
}

.mini-card strong {
  font-size: 1.05rem;
}

.mini-card .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-3);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 800;
}

.badge.good {
  background: #e7f3ed;
  color: var(--good);
}

.badge.bad {
  background: #fae9e9;
  color: var(--bad);
}

.badge.learned {
  background: #e8f0fb;
  color: #466792;
}

.badge.mode-flashcards {
  background: #e8f0fb;
  color: #466792;
}

.badge.mode-matching {
  background: #e7f3ed;
  color: #44765f;
}

.badge.mode-test {
  background: #f7eadf;
  color: #9a6342;
}

.badge.mode-choice {
  background: #f7eadf;
  color: #9a6342;
}

.badge.mode-fill {
  background: #efe8fb;
  color: #6d5a94;
}

.timer-badge {
  background: color-mix(in srgb, var(--accent-3) 72%, #fff);
  border: 1px solid var(--line);
  color: var(--ink);
}

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

.mode-card {
  min-height: 230px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  display: grid;
  align-content: space-between;
  gap: 12px;
}

.mode-card strong {
  display: block;
  font-size: 1.12rem;
  margin-bottom: 6px;
}

.mode-card span {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.mode-card-footer {
  display: grid;
  gap: 10px;
}

.wrongbook-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.wrongbook-mode-card {
  display: grid;
  gap: 6px;
  width: 128px;
}

.wrongbook-mode-card .secondary,
.wrongbook-download {
  width: 100%;
}

.wrongbook-mode-card .number-input {
  min-height: 34px;
  padding: 6px 10px;
  text-align: center;
}

.wrongbook-download {
  width: auto;
  align-self: start;
  margin-left: auto;
}

.compact-count-field {
  width: min(260px, 100%);
}

.compact-count-field .number-input {
  width: min(150px, 100%);
}

.mode-type-row {
  display: grid;
  gap: 8px;
}

.small-check {
  min-height: 40px;
  padding: 0 12px;
}

.mode-start {
  display: grid;
  place-items: center;
  min-height: 42px;
  width: 100%;
  border-radius: 999px;
  background: var(--accent-3);
  color: var(--accent);
  font-weight: 900;
}

.mode-start:hover {
  background: var(--accent);
  color: #fff;
}

.flash-wrap {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 14px;
}

.flash-stage {
  min-height: min(56vh, 480px);
  perspective: 1200px;
}

.flash-card {
  position: relative;
  width: 100%;
  min-height: min(56vh, 480px);
  transform-style: preserve-3d;
  transition: transform 0.42s ease;
}

.flash-card.flipped {
  transform: rotateX(180deg);
}

.flash-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vw, 56px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.82)),
    var(--surface);
  box-shadow: var(--shadow);
  backface-visibility: hidden;
  text-align: center;
}

.flash-face.back {
  transform: rotateX(180deg);
  background: linear-gradient(145deg, var(--accent-3), #fff);
}

.flash-text {
  margin: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(2rem, 7vw, 4.5rem);
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: 0;
}

.flash-definition {
  font-size: clamp(1.5rem, 4.4vw, 3rem);
}

.progress-line {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--accent-3);
}

.progress-line span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.22s ease;
}

.match-board {
  position: relative;
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(90px, 18vw) minmax(140px, 1fr);
  gap: clamp(14px, 3vw, 26px);
  align-items: start;
  min-height: 420px;
}

.match-complete-callout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-3) 58%, #fff);
}

.match-complete-callout strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 1.1rem;
}

.match-complete-callout span {
  color: var(--muted);
  font-weight: 800;
}

.match-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.match-line {
  pointer-events: stroke;
  cursor: pointer;
  stroke-width: 4;
  fill: none;
  stroke: var(--accent);
  filter: drop-shadow(0 4px 8px rgba(77, 61, 96, 0.2));
  animation: drawLine 0.28s ease both, pulseLine 1s ease-in-out infinite;
}

.match-line.correct {
  stroke: var(--good);
  animation: drawLine 0.28s ease both;
}

.match-line.wrong {
  stroke: var(--bad);
  animation: drawLine 0.28s ease both;
}

@keyframes drawLine {
  from {
    stroke-dasharray: 12 12;
    stroke-dashoffset: 80;
  }
  to {
    stroke-dasharray: 999 0;
    stroke-dashoffset: 0;
  }
}

@keyframes pulseLine {
  0%,
  100% {
    opacity: 0.75;
  }
  50% {
    opacity: 1;
  }
}

.match-col {
  display: grid;
  gap: 12px;
}

.match-spacer {
  min-height: 1px;
}

.match-item {
  min-height: 56px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  text-align: left;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 18px rgba(77, 61, 96, 0.06);
}

.match-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 42%, transparent);
}

.match-item.linked {
  background: var(--surface-2);
}

.match-item.correct {
  border-color: color-mix(in srgb, var(--good) 50%, var(--line));
}

.match-item.wrong {
  border-color: color-mix(in srgb, var(--bad) 50%, var(--line));
}

.bolt {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-left: 8px;
  border-radius: 999px;
  background: #ffe5a3;
  color: #704b00;
  font-weight: 900;
  animation: pop 0.36s ease both;
}

@keyframes pop {
  from {
    transform: scale(0.3) rotate(-15deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.quiz-layout {
  display: grid;
  gap: 18px;
}

.practice-shell {
  padding-top: clamp(24px, 3vw, 40px);
}

.practice-shell.stack-lg {
  gap: 18px;
}

.practice-shell .section-head {
  margin-bottom: 8px;
}

.practice-shell .section-head h2 {
  font-size: clamp(1.55rem, 3vw, 2.2rem);
}

.practice-shell .section-head p {
  margin-top: 4px;
}

.practice-shell .quiz-layout {
  gap: 14px;
}

.question-panel {
  min-height: 360px;
  display: grid;
  gap: 18px;
  align-content: start;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.practice-shell .question-panel {
  min-height: 0;
  gap: 14px;
  padding: clamp(16px, 2.4vw, 24px);
}

.question-title {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 2.5rem);
  line-height: 1.22;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.practice-shell .question-title {
  font-size: clamp(1.75rem, 3.6vw, 3rem);
}

.option-grid {
  display: grid;
  gap: 10px;
}

.option {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: start;
  gap: 10px;
  min-height: 54px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: left;
  color: var(--ink);
}

.practice-shell .option-grid {
  gap: 8px;
}

.practice-shell .option {
  min-height: 48px;
  padding: 12px 14px;
}

.radio-dot,
.check-dot {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid var(--accent-2);
  background: #fff;
}

.radio-dot {
  border-radius: 999px;
}

.check-dot {
  border-radius: 5px;
  display: inline-grid;
  place-items: center;
  color: transparent;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.option.selected {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 36%, transparent);
}

.option.selected .radio-dot::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 4px;
  border-radius: 999px;
  background: var(--accent);
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.check-card {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.check-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 36%, transparent);
}

.check-card.active .check-dot {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.check-card.active .check-dot::after {
  content: "✓";
}

.result-panel {
  padding: clamp(20px, 4vw, 32px);
}

.score {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
}

.score strong {
  font-size: clamp(2.5rem, 8vw, 5rem);
  color: var(--accent);
  line-height: 1;
}

.success-banner {
  position: fixed;
  top: 42%;
  left: 50%;
  z-index: 160;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 76px;
  min-width: min(560px, calc(100vw - 34px));
  padding: 18px 34px;
  border: 2px solid color-mix(in srgb, var(--good) 38%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--good) 12%, white);
  color: #315f49;
  box-shadow: 0 26px 72px rgba(79, 143, 113, 0.34);
  animation: successBannerIn 0.22s ease-out, successBannerGlow 1.2s ease-in-out infinite alternate;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.success-banner strong {
  color: var(--good);
  font-size: clamp(1.8rem, 4vw, 2.55rem);
  letter-spacing: 0;
}

@keyframes successBannerIn {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 14px)) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes successBannerGlow {
  from {
    box-shadow: 0 26px 72px rgba(79, 143, 113, 0.28);
  }

  to {
    box-shadow: 0 30px 90px rgba(79, 143, 113, 0.42);
  }
}

.result-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.result-mark.correct {
  background: color-mix(in srgb, var(--good) 16%, white);
  color: var(--good);
}

.result-mark.incorrect {
  background: color-mix(in srgb, var(--bad) 16%, white);
  color: var(--bad);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
}

.detail-table th,
.detail-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.detail-table th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.88rem;
}

.staff-account-table th:nth-child(n+4),
.staff-account-table td:nth-child(n+4) {
  text-align: center;
}

.staff-account-table .small-btn {
  margin-inline: auto;
}

.wrongbook-table th:last-child,
.wrongbook-table td:last-child {
  width: 120px;
  text-align: center;
  vertical-align: middle;
}

.wrongbook-table td:last-child .small-btn {
  margin-inline: auto;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.side-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.side-menu button {
  flex: 1 1 136px;
  justify-content: center;
  min-width: 136px;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(36, 31, 48, 0.42);
}

.modal {
  width: min(460px, 100%);
  padding: 22px;
  display: grid;
  gap: 16px;
}

.toast {
  position: fixed;
  top: 42%;
  left: 50%;
  z-index: 170;
  min-width: min(520px, calc(100vw - 34px));
  max-width: min(640px, calc(100vw - 34px));
  min-height: 64px;
  padding: 16px 30px;
  border-radius: 999px;
  background: #2f2938;
  color: white;
  box-shadow: 0 26px 72px rgba(36, 31, 48, 0.34);
  font-size: clamp(1.18rem, 2.4vw, 1.65rem);
  font-weight: 900;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: toastPop 0.22s ease-out;
}

@keyframes toastPop {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 12px)) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.desktop-only {
  display: inline;
}

@media (max-width: 900px) {
  .auth-shell,
  .dashboard-grid,
  .split,
  .upload-file-row,
  .assignment-controls,
  .assignment-target-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

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

  .record-filters {
    grid-template-columns: 1fr;
  }

  .exam-settings {
    grid-template-columns: 1fr;
  }

  .calendar-head {
    grid-template-columns: 1fr;
  }

  .calendar-actions {
    justify-self: start;
    justify-content: flex-start;
  }

  .calendar-controls {
    justify-self: stretch;
    width: 100%;
    margin-left: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .test-calendar-grid {
    min-width: 720px;
  }

  .test-calendar-panel {
    overflow-x: auto;
  }

  .exam-settings .field:last-child span {
    white-space: normal;
  }

  .record-filter-set,
  .record-filter-mode,
  .record-filter-time,
  .record-filter-accuracy,
  .record-filter-start,
  .record-filter-end {
    grid-column: auto;
    grid-row: auto;
    margin-left: 0;
  }

  .auth-shell {
    align-items: start;
  }

  .side-menu {
    position: static;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .side-menu button {
    flex: 0 0 auto;
    min-width: 148px;
    scroll-snap-align: start;
  }

  .theme-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
    min-height: auto;
    padding: 14px 16px 12px;
  }

  .topbar > div:nth-child(2) {
    display: none;
  }

  .brand-cluster {
    gap: 9px;
    width: 100%;
  }

  .brand {
    gap: 8px;
    min-width: 0;
    font-size: 1rem;
    white-space: nowrap;
  }

  .brand span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-powered-rule {
    height: 22px;
  }

  .powered-by {
    font-size: 1.05rem;
  }

  .topnav {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 3px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .topnav span {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 128px;
    font-size: 0.9rem;
  }

  .topnav .role-separator,
  .topnav .user-role {
    display: none;
  }

  .topnav .ghost,
  .topnav .secondary,
  .topnav .danger {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 12px;
    white-space: nowrap;
    font-size: 0.92rem;
    line-height: 1.1;
    scroll-snap-align: start;
  }

  .desktop-only {
    display: none;
  }

  .shell {
    width: min(100% - 24px, 1060px);
    padding-top: 20px;
    padding-bottom: 34px;
  }

  .auth-shell {
    min-height: auto;
    gap: 14px;
    padding-top: 14px;
    padding-bottom: 28px;
  }

  .auth-shell .intro {
    gap: 8px;
  }

  .auth-shell .designer-line {
    gap: 6px;
    font-size: 0.8rem;
    line-height: 1.25;
  }

  .auth-shell .designer-line .rule {
    height: 14px;
  }

  .intro h1 {
    font-size: clamp(2.3rem, 15vw, 4rem);
  }

  .auth-shell .intro h1 {
    font-size: clamp(1.9rem, 8vw, 2.35rem);
    line-height: 1.04;
  }

  .auth-shell .intro h1 span {
    display: inline;
  }

  .auth-shell .tagline {
    font-size: 1rem;
    line-height: 1.3;
  }

  .auth-panel {
    padding: 16px;
  }

  .auth-panel h2 {
    font-size: 1.28rem;
  }

  .auth-panel .form-grid {
    gap: 10px;
    margin-top: 10px;
  }

  .auth-panel .field {
    gap: 5px;
  }

  .auth-panel .field input {
    min-height: 40px;
    padding: 8px 10px;
  }

  .auth-panel .primary {
    min-height: 40px;
  }

  .panel,
  .mini-card,
  .admin-record-card,
  .result-panel {
    padding: 14px;
  }

  .stack-lg {
    gap: 18px;
  }

  .section-head {
    gap: 10px;
    margin-bottom: 10px;
  }

  .section-head h2,
  .panel h2,
  .result-panel h2 {
    font-size: clamp(1.45rem, 8vw, 1.95rem);
  }

  .section-head p {
    font-size: 0.94rem;
    line-height: 1.45;
  }

  .title-action-row,
  .export-toolbar,
  .toolbar-left {
    gap: 8px;
  }

  .dashboard-grid,
  .mode-grid {
    gap: 12px;
  }

  .dashboard-home > .section-head p,
  .dashboard-home .panel .section-head p,
  .dashboard-home .learning-card-desc {
    display: none;
  }

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

  .dashboard-home .learning-card {
    min-height: 104px;
    align-content: center;
    justify-items: center;
    text-align: center;
  }

  .dashboard-home .learning-card strong {
    margin-bottom: 0;
  }

  .mode-grid {
    grid-template-columns: 1fr;
  }

  .learning-card {
    min-height: 128px;
    padding: 16px;
    gap: 12px;
  }

  .learning-card strong {
    margin-bottom: 5px;
    font-size: 1.18rem;
  }

  .learning-card span {
    font-size: 0.94rem;
    line-height: 1.42;
  }

  .learning-card .tile-icon {
    width: 36px;
    height: 36px;
  }

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

  .swatch {
    min-height: 38px;
  }

  .record-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
  }

  .record-filter-set,
  .record-filter-accuracy {
    grid-column: 1 / -1;
  }

  .record-filters select,
  .record-filters input,
  .field input,
  .field textarea,
  .field select,
  .compact-input {
    min-height: 40px;
    font-size: 0.95rem;
  }

  .record-table-head,
  .record-table-row {
    min-width: 860px;
  }

  .record-table.no-actions .record-table-head,
  .record-table.no-actions .record-table-row {
    min-width: 760px;
  }

  .record-table-head span,
  .record-cell {
    min-height: 48px;
    padding: 10px 12px;
  }

  .folder-row,
  .search-line {
    grid-template-columns: 1fr;
  }

  .upload-file-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .view-switch {
    width: 100%;
    gap: 8px;
  }

  .view-switch button {
    flex: 1 1 120px;
  }

  .timed-test-table {
    min-width: 820px;
  }

  .timed-test-table th,
  .timed-test-table td {
    padding: 10px 12px;
  }

  .table-head-filter {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .test-calendar-panel {
    padding: 12px;
    gap: 12px;
  }

  .calendar-head {
    gap: 10px;
  }

  .calendar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .calendar-actions strong {
    min-width: 82px;
  }

  .calendar-controls {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .test-calendar-grid {
    min-width: 640px;
  }

  .test-calendar-weekday,
  .test-calendar-cell {
    min-height: 86px;
    padding: 6px;
  }

  .test-calendar-item {
    min-height: 30px;
    padding: 5px 6px;
  }

  .assignment-controls {
    gap: 14px;
  }

  .assignment-control-group,
  .assignment-settings,
  .sub-panel {
    padding: 14px;
    gap: 12px;
  }

  .assignment-options {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .assignment-type-options {
    max-width: none;
  }

  .assignment-picker-head {
    display: grid;
    gap: 4px;
  }

  .assignment-picker-head .multi-picker-summary {
    text-align: left;
  }

  .multi-picker {
    max-height: 260px;
  }

  .assignment-submit {
    width: 100%;
  }

  .set-list-card,
  .exam-task-card {
    grid-template-columns: 1fr;
  }

  .set-open-area {
    width: 100%;
  }

  .flash-wrap {
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    gap: 8px;
  }

  .flash-stage,
  .flash-card {
    min-height: 420px;
  }

  .match-board {
    grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
    gap: 8px;
  }

  .match-complete-callout {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }

  .match-complete-callout .primary {
    width: 100%;
  }

  .match-item {
    min-height: 62px;
    padding: 10px;
    font-size: 0.92rem;
  }

  .detail-table {
    display: block;
    overflow-x: auto;
  }

  .section-head {
    display: grid;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar .primary,
  .toolbar .secondary,
  .toolbar .ghost,
  .toolbar .danger {
    flex: 1 1 auto;
  }
}

@media (max-width: 430px) {
  .topbar {
    padding: 12px 14px 10px;
  }

  .brand-cluster {
    gap: 7px;
  }

  .brand {
    gap: 7px;
    font-size: 0.94rem;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 7px;
  }

  .brand-powered-rule {
    height: 20px;
  }

  .powered-by {
    font-size: 0.98rem;
  }

  .topnav {
    gap: 6px;
  }

  .topnav .ghost,
  .topnav .secondary,
  .topnav .danger {
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.84rem;
    border-radius: 6px;
  }

  .auth-shell {
    gap: 12px;
    padding-top: 10px;
    padding-bottom: 22px;
  }

  .auth-shell .intro h1 {
    font-size: clamp(1.68rem, 7.5vw, 2rem);
  }

  .auth-shell .tagline {
    font-size: 0.94rem;
  }

  .auth-panel {
    padding: 14px;
  }

  .auth-panel .form-grid {
    gap: 8px;
    margin-top: 8px;
  }

  .auth-panel .field input {
    min-height: 38px;
  }

  .auth-panel .primary {
    min-height: 38px;
  }

  .shell {
    width: min(100% - 18px, 1060px);
    padding-top: 16px;
  }

  .section-head h2,
  .panel h2,
  .result-panel h2 {
    font-size: clamp(1.35rem, 8.5vw, 1.75rem);
  }

  .learning-card {
    min-height: 116px;
    padding: 14px;
  }

  .title-action-row .secondary,
  .export-toolbar .secondary,
  .toolbar .secondary,
  .toolbar .primary,
  .toolbar .ghost,
  .toolbar .danger {
    min-height: 38px;
    padding: 0 11px;
    font-size: 0.9rem;
  }

  .theme-grid {
    gap: 7px;
  }

  .record-filters {
    padding: 9px;
  }

  .calendar-controls {
    grid-template-columns: 1fr;
  }

  .calendar-actions {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
  }

  .calendar-actions .small-btn {
    min-height: 36px;
    padding: 0 10px;
  }

  .calendar-actions strong {
    min-width: 0;
  }

  .assignment-control-group,
  .assignment-settings,
  .sub-panel {
    padding: 12px;
  }

  .mode-card {
    min-height: 190px;
    padding: 14px;
  }

  .flash-stage,
  .flash-card {
    min-height: 360px;
  }
}
