:root {
  color-scheme: light;
  --bg: var(--mist-050);
  --card: var(--white);
  --accent: var(--blue-900);
  --border: var(--mist-200);
  --text: var(--neutral-900);
  --muted: var(--neutral-300);
  --shadow: 0 10px 35px var(--fx-shadow-subtle);
  --success: var(--green-900);
  --error: var(--red-600);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", -apple-system, sans-serif;
  background: transparent;
  color: var(--text);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

html {
  background: transparent;
}

.modal-close {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(30, 30, 30, 0.55);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: rgba(30, 30, 30, 0.7);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 720px;
  width: 100%;
  display: grid;
  gap: 18px;
}

h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

p.lead {
  margin: 0;
  color: var(--muted);
}

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

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

.view {
  display: grid;
  gap: 14px;
}

[data-view][hidden] {
  display: none !important;
}

.choice-buttons {
  display: grid;
  gap: 10px;
}

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

.list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
}

.list-item--summary-keynote {
  background: rgba(191, 227, 255, 0.45);
}

.list-item--summary-goblin {
  background: rgba(221, 245, 210, 0.45);
}

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

.pattern-copy-select {
  min-width: 170px;
  width: auto;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  font: inherit;
}

.list-item-title {
  font-weight: 700;
}

.list-item-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

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

.summary-accordion {
  width: 100%;
}

.summary-accordion-toggle {
  list-style: none;
  cursor: pointer;
}

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

.summary-accordion-content {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.summary-subitem {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(16, 24, 40, 0.04);
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2 {
  margin: 0;
  font-size: 1.25rem;
}

form {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

label {
  font-weight: 600;
  font-size: 0.95rem;
}

input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(63, 109, 246, 0.18);
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 150ms ease;
  box-shadow: 0 10px 20px rgba(63, 109, 246, 0.25);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 6px 12px rgba(63, 109, 246, 0.2);
}

.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  box-shadow: none;
}

.secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(16, 24, 40, 0.06);
}

.secondary:active {
  transform: translateY(0);
  box-shadow: none;
}

.small {
  padding: 9px 12px;
  border-radius: 10px;
  font-weight: 600;
}

.hint {
  margin: 0;
}

.account-help {
  margin: 8px 0 0;
  line-height: 1.45;
}

.status {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 14px;
  background: var(--mist-100, #eef3ff);
}

.status strong {
  display: block;
  margin-bottom: 6px;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.inline {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input {
  padding-right: 44px;
}

.toggle-eye {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  padding: 6px;
  cursor: pointer;
  border-radius: 8px;
  box-shadow: none;
  transform: none;
  transition: color 120ms ease, background-color 120ms ease;
}

.toggle-eye:hover,
.toggle-eye:focus-visible {
  color: var(--text);
  background-color: rgba(63, 109, 246, 0.12);
  outline: none;
  transform: none;
  box-shadow: none;
}

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

.success {
  color: var(--success);
}

@media (max-width: 520px) {
  body {
    padding: 14px;
  }

  .card {
    padding: 18px;
  }

  .list-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .list-item-actions {
    justify-content: flex-start;
  }
}

.class-member-option {
  display: flex;
  align-items: center;
  gap: 10px;
}

.class-member-option input[type="checkbox"] {
  width: auto;
  flex: 0 0 auto;
}

#class-details[hidden], #individual-details[hidden] { display: none; }
.class-detail-fold { margin-block: 12px; padding: 12px; border: 1px solid #bbc9e1; border-radius: 12px; background: #f8faff; color: #14213b; min-width: 0; }
.class-detail-fold > summary { cursor: pointer; font-weight: 700; padding: 5px; }
.class-detail-fold[open] > summary { margin-bottom: 12px; }
.class-roster-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.class-roster-controls label { display: grid; gap: 6px; }
.class-roster-list { max-height: 50vh; overflow-y: auto; }
.class-roster-row { margin: 0; padding: 10px; border-bottom: 1px solid #d5deed; cursor: pointer; }
.class-roster-row:has(input:checked) { background: #e1edff; }
.class-roster-row small { display: block; color: #455573; margin-top: 4px; }
.class-roster-row input { accent-color: #315ea4; }
.class-score-scroll { overflow: auto; max-height: 60vh; margin-top: 14px; }
.class-score-scroll table { border-collapse: separate; border-spacing: 0; min-width: 100%; width: max-content; }
.class-score-scroll th, .class-score-scroll td { padding: 8px; border-bottom: 1px solid #ccd7e7; text-align: center; }
.class-score-scroll th { background: #e5edfa; }
.class-score-scroll thead th { position: sticky; top: 0; z-index: 2; }
.class-score-scroll tbody th { position: sticky; left: 0; text-align: left; z-index: 1; }
.class-result-fields { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(0, 2fr); gap: 6px 12px; font-size: 14px; overflow-wrap: anywhere; }
.class-result-fields dt { font-weight: 600; }
.class-result-fields dd { margin: 0; }
@media (max-width: 600px) {
  .class-roster-controls { grid-template-columns: 1fr; }
  .class-detail-fold { padding: 8px; }
  .class-result-fields { grid-template-columns: 1fr; }
  .class-result-fields dd { padding-bottom: 8px; }
}

/* Allow nested grids and long names to shrink inside the account card. */
.card, .card * { min-width: 0; }
.card { grid-template-columns: minmax(0, 1fr); }
.grid-single { grid-template-columns: minmax(0, 1fr); }
.card button, .card select { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.card .stack, .class-roster-row span { overflow-wrap: anywhere; }
.view-header { flex-wrap: wrap; }
#group-list-content[hidden] { display: none; }

#teacher-pattern-library[hidden] { display: none; }
#teacher-pattern-library .list-item { grid-template-columns: minmax(0, 1fr); }
#teacher-pattern-library .list-item-actions { justify-content: flex-start; }

.teacher-pattern-heading { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.teacher-pattern-heading h3 { margin: 0; overflow-wrap: anywhere; }
