:root {
  color-scheme: light;
  --bg: #fff7ff;
  --panel: rgba(255, 255, 255, 0.78);
  --text: #231a2b;
  --muted: rgba(35, 26, 43, 0.62);
  --accent: #7c5cff;
  --accent2: #ff4fc3;
  --danger: #e11d48;
  --ok: #0f766e;
  --border: rgba(35, 26, 43, 0.12);
  --shadow: rgba(25, 10, 35, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: #2d1f0c;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}

#bgCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -3;
  pointer-events: none;
}

a {
  color: inherit;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 16px 50px var(--shadow);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.95), rgba(255, 79, 195, 0.9));
}

.brand h1 {
  font-size: 16px;
  margin: 0;
  letter-spacing: 0.3px;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 12px 22px rgba(25, 10, 35, 0.06);
}

.btn.primary {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.95), rgba(255, 79, 195, 0.82));
  border-color: rgba(124, 92, 255, 0.3);
  color: white;
}

.btn.done {
  background: rgba(15, 118, 110, 0.14);
  border-color: rgba(15, 118, 110, 0.35);
  color: rgba(15, 118, 110, 1);
}

.btn.danger {
  background: rgba(225, 29, 72, 0.10);
  border-color: rgba(225, 29, 72, 0.25);
}

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

@media (min-width: 900px) {
  .grid {
    grid-template-columns: 360px 1fr;
    align-items: start;
  }
}

.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 16px 50px var(--shadow);
  backdrop-filter: blur(10px);
  padding: 16px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

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

.row.wrap {
  flex-wrap: wrap;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

label {
  font-size: 12px;
  color: var(--muted);
}

input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  outline: none;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.tasks {
  display: grid;
  gap: 10px;
}

.taskItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
}

.taskItem strong {
  font-size: 14px;
}

.taskItem small {
  color: var(--muted);
}

.taskActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.taskScore {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(15, 118, 110, 0.28);
  background: rgba(15, 118, 110, 0.1);
  color: rgba(15, 118, 110, 1);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.pill {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.frameWrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
}

iframe {
  width: 100%;
  height: 560px;
  border: 0;
  display: block;
}

.toast {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(124, 92, 255, 0.35);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow: 0 18px 55px rgba(25, 10, 35, 0.25);
  backdrop-filter: blur(10px);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  max-width: min(92vw, 560px);
  text-align: center;
}

.alert {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.alert.ok {
  border-color: rgba(15, 118, 110, 0.25);
  background: rgba(15, 118, 110, 0.08);
}

.alert.bad {
  border-color: rgba(225, 29, 72, 0.25);
  background: rgba(225, 29, 72, 0.08);
}

.teacher-card {
  grid-column: 1 / -1;
}

.teacher-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 1.5fr);
  gap: 20px;
  align-items: start;
}

.teacher-layout textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  resize: vertical;
}

.teacher-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
  margin-top: 4px;
}

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

.teacher-panel-head label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin: 0;
}

.teacher-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.teacher-count {
  font-size: 11px;
  white-space: nowrap;
}

.teacher-marks-subtitle {
  margin: -4px 0 10px;
  font-size: 11px;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
}

.btn-icon {
  padding: 4px 8px;
  font-size: 14px;
  line-height: 1;
  min-width: 32px;
}

.teacher-table-wrap,
.teacher-marks-list {
  max-height: 420px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
}

.teacher-marks-panel .teacher-marks-list {
  max-height: min(68vh, 640px);
}

.teacher-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.teacher-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.teacher-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.95);
}

.teacher-table tbody tr:hover {
  background: rgba(124, 92, 255, 0.06);
}

.teacher-table tbody tr:last-child td {
  border-bottom: none;
}

.teacher-num {
  width: 36px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.teacher-name {
  font-weight: 600;
  min-width: 100px;
}

.teacher-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.teacher-password-cell {
  min-width: 140px;
}

.teacher-password-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.teacher-password.is-hidden {
  filter: blur(6px);
  user-select: none;
}

.teacher-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.teacher-actions {
  width: 72px;
  text-align: right;
}

.teacher-student-card {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.teacher-student-card:last-child {
  border-bottom: none;
}

.teacher-student-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.teacher-student-name {
  font-weight: 700;
  font-size: 14px;
}

.teacher-student-user {
  font-size: 12px;
  margin-top: 2px;
}

.teacher-status {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  border: 1px solid var(--border);
}

.teacher-status.is-idle {
  color: var(--muted);
  background: rgba(35, 26, 43, 0.06);
}

.teacher-status.is-started {
  color: #b45309;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.35);
}

.teacher-status.is-finished {
  color: var(--ok);
  background: rgba(15, 118, 110, 0.12);
  border-color: rgba(15, 118, 110, 0.3);
}

.teacher-student-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.teacher-student-meta strong {
  color: var(--text);
  font-weight: 600;
  margin-right: 4px;
}

.teacher-task-list {
  display: grid;
  gap: 8px;
}

.teacher-task-card {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.65);
}

.teacher-task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.teacher-task-title {
  font-weight: 600;
  font-size: 13px;
}

.teacher-cat {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.teacher-cat.cat-a {
  color: #5b21b6;
  background: rgba(124, 92, 255, 0.16);
}

.teacher-cat.cat-b {
  color: #9d174d;
  background: rgba(255, 79, 195, 0.16);
}

.teacher-cat.cat-c {
  color: #0f766e;
  background: rgba(15, 118, 110, 0.14);
}

.teacher-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.teacher-metrics-section {
  margin-top: 2px;
}

.teacher-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}

.teacher-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.teacher-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(35, 26, 43, 0.06);
  font-size: 11px;
}

.teacher-metric-key {
  color: var(--muted);
  font-weight: 600;
}

.teacher-metric-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600;
}

.teacher-no-activity {
  margin: 0;
  font-size: 12px;
}

.teacher-exam-summary {
  margin: 10px 0 6px;
  font-size: 15px;
}

.teacher-skill-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.teacher-score-chip {
  padding: 4px 7px;
  font-size: 11px;
}

.teacher-score-chip.teacher-score-good {
  background: rgba(34, 197, 94, 0.3);
}

.teacher-score-chip.teacher-score-low {
  background: rgba(239, 68, 68, 0.25);
}

.teacher-score-val.teacher-score-big {
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.teacher-score-val.teacher-score-final {
  font-size: 0.9rem;
}

.teacher-score-good,
.teacher-score-low {
  color: inherit;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(20, 12, 28, 0.62);
  backdrop-filter: blur(4px);
}

.modal-card {
  width: min(820px, 100%);
  max-height: min(88vh, 920px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 80px rgba(20, 12, 28, 0.28);
  overflow: hidden;
}

.teacher-consent-card h2 {
  margin: 0;
  padding: 20px 22px 14px;
  font-size: 1.35rem;
  line-height: 1.3;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 22px 8px;
}

.modal-footer {
  padding: 14px 22px 20px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
}

body.modal-open {
  overflow: hidden;
}

.consent-section {
  margin-bottom: 22px;
}

.consent-section h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.consent-section h4 {
  margin: 14px 0 8px;
  font-size: 0.98rem;
}

.consent-section p,
.consent-section li {
  line-height: 1.55;
}

.consent-section ol {
  margin: 8px 0 0;
  padding-left: 1.35rem;
}

.consent-section li + li {
  margin-top: 6px;
}

.consent-example {
  margin: 10px 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(35, 26, 43, 0.04);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  white-space: pre-wrap;
}

.consent-thanks {
  margin: 18px 0 0;
  font-weight: 700;
}

.consent-actions {
  display: flex;
  justify-content: center;
}

@media (max-width: 980px) {
  .teacher-layout {
    grid-template-columns: 1fr;
  }

  .teacher-table-wrap,
  .teacher-marks-list {
    max-height: 360px;
  }
}

