:root {
  --ink: #172033;
  --muted: #667085;
  --line: #d9e2ec;
  --bg: #f4f7fb;
  --white: #ffffff;
  --blue: #2563eb;
  --green: #10b981;
  --red: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 48px);
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 800;
}

.topbar nav {
  display: flex;
  gap: 16px;
  color: var(--muted);
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 48px;
}

.hero-band,
.class-head,
.panel,
.login-card,
.random-box,
.groups-box,
.student-entry,
.side-list,
.student-list {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.hero-band,
.class-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

h1,
h2,
h3 {
  margin: 0 0 14px;
}

.inline-form,
.group-controls {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--blue);
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

button.secondary {
  background: #475467;
}

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

.login-shell {
  min-height: 65vh;
  display: grid;
  place-items: center;
}

.login-card,
.panel.narrow {
  width: min(420px, 100%);
}

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

.notice {
  color: var(--green);
  font-weight: 700;
}

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

.class-card {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  transition: transform .16s ease, box-shadow .16s ease;
}

.class-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(23, 32, 51, .11);
}

.class-card strong {
  font-size: 24px;
}

.class-card span,
.hint,
.empty,
.backlink {
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
}

.tool-area {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.student-entry {
  grid-column: 1 / -1;
}

.name-display {
  min-height: 128px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 8px;
  color: #0f172a;
  background: linear-gradient(135deg, #fef3c7, #bfdbfe 48%, #bbf7d0);
  font-size: clamp(30px, 5vw, 58px);
  font-weight: 900;
  text-align: center;
}

.name-display.rolling {
  animation: pulse 480ms infinite alternate;
}

@keyframes pulse {
  from {
    transform: scale(.98);
    filter: saturate(.9);
  }
  to {
    transform: scale(1.02);
    filter: saturate(1.25);
  }
}

.side-list ul,
.group-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.side-list li {
  margin-bottom: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  color: #667085;
  background: #eef2f6;
}

.groups-output {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.group-card {
  min-height: 130px;
  border-radius: 8px;
  padding: 14px;
  color: #111827;
}

.group-card li {
  padding: 4px 0;
}

.color-0 { background: #bfdbfe; }
.color-1 { background: #bbf7d0; }
.color-2 { background: #fde68a; }
.color-3 { background: #fecdd3; }
.color-4 { background: #ddd6fe; }
.color-5 { background: #fed7aa; }

.student-list {
  margin-top: 18px;
}

.student-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px 6px 12px;
  background: #fff;
}

.chip.is-drawn {
  color: #667085;
  background: #eef2f6;
}

.chip button {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  background: #94a3b8;
}

@media (max-width: 820px) {
  .hero-band,
  .class-head,
  .workspace,
  .tool-area {
    display: grid;
    grid-template-columns: 1fr;
  }

  .page {
    width: min(100% - 20px, 1180px);
  }
}

/* Comic-Unterrichtsdesign */
body {
  font-family: "Comic Sans MS", "Trebuchet MS", Arial, sans-serif;
  background:
    radial-gradient(circle at 12% 16%, #ffe066 0 7%, transparent 8%),
    radial-gradient(circle at 86% 12%, #74c0fc 0 6%, transparent 7%),
    radial-gradient(circle at 78% 82%, #b2f2bb 0 8%, transparent 9%),
    linear-gradient(135deg, #fff3bf, #d0ebff 48%, #ffd6e7);
  min-height: 100vh;
}

.hero-band,
.class-head,
.panel,
.login-card,
.random-box,
.groups-box,
.side-list,
.class-card,
.group-card {
  border: 4px solid var(--ink);
  border-radius: 18px;
  box-shadow: 8px 8px 0 var(--ink);
}

button,
.button-link {
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #ff6b6b;
  color: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}

button:hover,
.button-link:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.name-display {
  min-height: 150px;
  border: 4px dashed var(--ink);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffec99, #a5d8ff 48%, #b2f2bb);
  font-size: clamp(34px, 6vw, 70px);
  text-shadow: 3px 3px 0 #ffffff;
}

.side-list li {
  border: 2px solid #98a2b3;
  border-radius: 14px;
}

.group-card {
  border-width: 3px;
  box-shadow: 5px 5px 0 var(--ink);
}
/* Admin-Zentrale Layout */
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  font-weight: 700;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 18px;
  align-items: start;
}

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

.admin-list a,
.admin-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fef3c7;
}

.admin-list a.active {
  background: #bbf7d0;
}

.admin-list span {
  color: #475467;
  font-size: 14px;
}

.admin-students {
  margin-top: 16px;
}

@media (max-width: 980px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}
/* Lehrkraft-Zuordnung */
.teacher-assignments {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.assignment-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #e7f5ff;
  box-shadow: 5px 5px 0 var(--ink);
}

.assignment-card strong {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.class-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.class-checkboxes label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
}

.class-checkboxes input {
  width: auto;
}
/* Klassen loeschen */
.class-admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fef3c7;
}

.class-admin-row.active {
  background: #bbf7d0;
}

.class-admin-row a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.small-button {
  width: 34px;
  height: 34px;
  padding: 0;
}

button.danger {
  background: #e03131;
}
/* Konstante Generatorgroesse */
.random-box {
  min-height: 330px;
  display: grid;
  grid-template-rows: auto 170px auto auto;
  align-content: start;
}

.name-display {
  height: 170px;
  min-height: 170px;
  max-height: 170px;
  width: 100%;
  overflow: hidden;
  padding: 12px 18px;
  line-height: 1.05;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  font-size: clamp(28px, 4.8vw, 58px);
}

.name-display.long-name {
  font-size: clamp(22px, 3.7vw, 42px);
}

.name-display.very-long-name {
  font-size: clamp(18px, 3vw, 32px);
}

#availableHint {
  min-height: 24px;
  margin-bottom: 0;
}