:root {
  color-scheme: light;
  --ink: #1c1e1f;
  --muted: #3f3f3f;
  --line: #929799;
  --panel: #ffffff;
  --page: #f6f8fa;
  --soft: #eef4f8;
  --brand-dark: #09223b;
  --brand-blue: #124475;
  --brand-mid: #577898;
  --brand-light: #aec5d6;
  --accent: #f76f00;
  --accent-strong: #e06300;
  --accent-soft: #fccea8;
  --focus: #01a8e6;
  --focus-soft: #a5e1f7;
  --warn: #f76f00;
  --danger: #a61b1b;
  --danger-soft: #ffe4e4;
  --success: #16833a;
  --success-soft: #e8f7ed;
  --ok: #124475;
  --ok-soft: #e6f2fa;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-strong: 0 6px 20px rgba(0, 0, 0, 0.08);
  font-family:
    "Wix Madefor Text", "Familjen Grotesk", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(174, 197, 214, 0.22), rgba(246, 248, 250, 0) 320px),
    var(--page);
  color: var(--ink);
}

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

input,
select,
textarea {
  font-size: 16px;
}

button {
  border: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 14px clamp(16px, 4vw, 36px);
  border-bottom: 1px solid rgba(174, 197, 214, 0.28);
  background: rgba(9, 34, 59, 0.96);
  backdrop-filter: blur(16px);
  color: #ffffff;
}

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

.topbar-actions .btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.74);
  color: #ffffff;
}

.topbar-actions .btn:hover {
  background: #ffffff;
  color: var(--brand-dark);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-family: "Familjen Grotesk", "Wix Madefor Text", Arial, sans-serif;
  font-size: 0.94rem;
  font-weight: 700;
}

.brand-logo {
  display: block;
  width: auto;
  max-width: 74px;
  height: 52px;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-title {
  margin: 0;
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  font-family: "Familjen Grotesk", "Wix Madefor Text", Arial, sans-serif;
  font-weight: 700;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.container {
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.teacher-grid {
  display: grid;
  grid-template-columns: minmax(310px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.student-wrap {
  width: min(620px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.entry-wrap {
  width: min(520px, calc(100vw - 32px));
  margin: 0 auto;
  min-height: calc(100vh - 112px);
  padding: 32px 0 48px;
  display: grid;
  gap: 14px;
  align-content: center;
}

.entry-panel {
  min-height: 0;
}

.entry-panel .panel-header {
  justify-content: center;
  text-align: center;
}

.entry-panel .panel-title {
  font-size: 1.25rem;
}

.staff-entry-text {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

.staff-entry-text a {
  color: var(--brand-dark);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.class-code-input {
  text-transform: uppercase;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(146, 151, 153, 0.38);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 0;
}

.panel-title {
  margin: 0;
  font-size: 1rem;
  font-family: "Familjen Grotesk", "Wix Madefor Text", Arial, sans-serif;
  font-weight: 700;
}

.panel-body {
  padding: 18px;
}

.panel-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

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

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

.setting {
  display: grid;
  gap: 8px;
}

.setting-label {
  color: var(--brand-blue);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  min-height: 42px;
  padding: 3px;
  border: 1px solid rgba(87, 120, 152, 0.46);
  border-radius: 8px;
  background: var(--soft);
}

.segmented button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--brand-blue);
  font-weight: 700;
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  background: var(--brand-dark);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(9, 34, 59, 0.18);
}

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

.timer-row .btn[aria-pressed="true"] {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(9, 34, 59, 0.18);
}

.timer-row .btn[aria-pressed="true"]:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.timer-row .btn[aria-pressed="true"]:disabled {
  opacity: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand-dark);
  border: 2px solid var(--brand-dark);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition:
    transform 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--brand-dark);
  color: #ffffff;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-danger {
  background: var(--danger-soft);
  border-color: var(--danger-soft);
  color: var(--danger);
}

.btn-wide {
  width: 100%;
}

.btn-small {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 0.9rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-blue);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

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

.status-open {
  background: var(--focus-soft);
  color: var(--brand-dark);
}

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

.status-idle {
  background: #fff0e2;
  color: var(--brand-blue);
}

.join-block {
  display: grid;
  gap: 12px;
}

.join-card {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.qr-box {
  display: grid;
  place-items: center;
  width: 136px;
  height: 136px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(146, 151, 153, 0.42);
  overflow: hidden;
}

.qr-box canvas,
.qr-box img {
  width: 122px;
  height: 122px;
}

.code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--brand-dark);
  color: #ffffff;
  font-size: 1.08rem;
  font-family: "Oswald", "Familjen Grotesk", Arial, sans-serif;
  font-weight: 500;
  letter-spacing: 0;
}

.code-block {
  display: grid;
  gap: 6px;
}

.join-url {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.control-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.control-span {
  grid-column: 1 / -1;
}

.timer-display {
  display: grid;
  place-items: center;
  min-height: 154px;
  border: 1px solid rgba(87, 120, 152, 0.34);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(18, 68, 117, 0.95), rgba(9, 34, 59, 0.98)),
    var(--brand-dark);
  text-align: center;
  color: #ffffff;
}

.timer-number {
  font-size: clamp(3rem, 8vw, 5rem);
  line-height: 1;
  font-family: "Oswald", "Familjen Grotesk", Arial, sans-serif;
  font-weight: 500;
}

.timer-caption {
  margin-top: 5px;
  color: var(--accent-soft);
  font-weight: 700;
}

.results-head {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 10px;
}

.metric {
  min-height: 82px;
  padding: 12px;
  border: 1px solid rgba(146, 151, 153, 0.35);
  border-radius: 12px;
  background: #ffffff;
}

.metric-value {
  display: block;
  font-size: 1.75rem;
  font-family: "Oswald", "Familjen Grotesk", Arial, sans-serif;
  font-weight: 500;
  color: var(--brand-blue);
}

.metric-label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

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

.points-negative {
  color: var(--danger);
}

.points-neutral {
  color: var(--brand-blue);
}

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

.score-rule {
  display: grid;
  gap: 3px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid rgba(87, 120, 152, 0.28);
  border-radius: 8px;
  background: #ffffff;
}

.score-rule span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.score-rule strong {
  font-family: "Oswald", "Familjen Grotesk", Arial, sans-serif;
  font-size: 1.28rem;
  font-weight: 500;
}

.score-winner-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(22, 131, 58, 0.34);
  border-radius: 8px;
  background: var(--success-soft);
}

.score-winner-card strong {
  display: block;
  color: var(--brand-dark);
  font-family: "Familjen Grotesk", "Wix Madefor Text", Arial, sans-serif;
  font-size: 1.08rem;
}

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

.leaderboard-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid rgba(146, 151, 153, 0.32);
  border-radius: 8px;
  background: #ffffff;
}

.leaderboard-row-top {
  border-color: rgba(247, 111, 0, 0.5);
  background: #fff7ef;
}

.leaderboard-row-self {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px rgba(1, 168, 230, 0.14);
}

.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand-dark);
  color: #ffffff;
  font-weight: 800;
}

.leaderboard-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.leaderboard-main strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-main span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.leaderboard-points {
  min-width: 64px;
  text-align: right;
  font-family: "Oswald", "Familjen Grotesk", Arial, sans-serif;
  font-size: 1.12rem;
  font-weight: 500;
}

.answer-bars {
  display: grid;
  gap: 10px;
}

.answer-key {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(87, 120, 152, 0.34);
  border-radius: 12px;
  background: #ffffff;
}

.key-choice-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.key-choice {
  min-height: 38px;
  border: 1px solid rgba(87, 120, 152, 0.46);
  border-radius: 8px;
  background: var(--soft);
  color: var(--brand-blue);
  font-weight: 700;
  cursor: pointer;
}

.key-choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.hint {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.bar-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
}

.bar-letter {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--brand-dark);
  color: #ffffff;
  font-weight: 700;
}

.bar-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef3;
}

.bar-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--focus);
  transition: width 180ms ease;
}

.bar-count {
  color: var(--muted);
  text-align: right;
  font-weight: 700;
}

.student-table {
  width: 100%;
  border-collapse: collapse;
}

.student-table th,
.student-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(146, 151, 153, 0.32);
  text-align: left;
  vertical-align: middle;
}

.student-table th {
  color: var(--brand-blue);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.student-table td:last-child,
.student-table th:last-child {
  text-align: right;
}

.answer-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: #fff0e2;
  color: var(--accent-strong);
  font-weight: 700;
}

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

.empty {
  display: grid;
  place-items: center;
  min-height: 190px;
  border: 1px dashed rgba(87, 120, 152, 0.48);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

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

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

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

.field input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--brand-mid);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.field input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--focus);
}

.class-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.class-filter {
  grid-auto-flow: row;
  grid-auto-columns: initial;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.class-filter button {
  white-space: nowrap;
}

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

.class-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(87, 120, 152, 0.28);
  border-radius: 8px;
  background: #ffffff;
}

.class-main,
.class-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.class-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

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

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 190px);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(146, 151, 153, 0.32);
  border-radius: 8px;
  background: #ffffff;
}

.role-select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(146, 151, 153, 0.55);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.role-select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.class-name {
  color: var(--ink);
  font-weight: 800;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.round-waiting-banner {
  display: grid;
  place-items: center;
  min-height: 58px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(18, 68, 117, 0.28);
  border-radius: 8px;
  background: var(--ok-soft);
  color: var(--brand-dark);
  font-size: 1.05rem;
  font-weight: 800;
  text-align: center;
}

.choice-btn {
  min-height: clamp(92px, 20vw, 132px);
  border: 2px solid rgba(87, 120, 152, 0.55);
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand-dark);
  font-size: clamp(2rem, 12vw, 4.2rem);
  font-family: "Oswald", "Familjen Grotesk", Arial, sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease;
}

.choice-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.choice-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.choice-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.first-award-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(9, 34, 59, 0.36);
  animation: award-backdrop 180ms ease-out;
}

.first-award-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(420px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: clamp(18px, 4vw, 26px);
  border: 2px solid rgba(247, 111, 0, 0.55);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 18px 60px rgba(9, 34, 59, 0.28);
  animation: award-pop 360ms cubic-bezier(0.2, 1.2, 0.2, 1);
}

.award-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--brand-dark);
  font-weight: 800;
  cursor: pointer;
}

.award-trophy-image {
  display: block;
  width: min(72vw, 280px);
  max-width: 100%;
  max-height: min(58vh, 430px);
  object-fit: contain;
  filter: drop-shadow(0 12px 22px rgba(9, 34, 59, 0.2));
  animation: trophy-celebrate 1100ms cubic-bezier(0.2, 1.15, 0.2, 1) both;
}

.award-copy {
  color: var(--brand-dark);
  font-family: "Familjen Grotesk", "Wix Madefor Text", Arial, sans-serif;
  font-size: clamp(1.45rem, 7vw, 2.1rem);
  font-weight: 800;
  text-align: center;
  animation: award-copy-pop 520ms ease-out 180ms both;
}

.reveal-overlay {
  position: fixed;
  inset: 0;
  z-index: 58;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  background: rgba(9, 34, 59, 0.42);
  animation: award-backdrop 180ms ease-out;
}

.reveal-card {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(430px, calc(100vw - 28px));
  padding: clamp(24px, 6vw, 40px);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 60px rgba(9, 34, 59, 0.28);
  text-align: center;
  animation: award-pop 360ms cubic-bezier(0.2, 1.2, 0.2, 1);
}

.reveal-correct .reveal-card {
  border: 3px solid var(--focus);
}

.reveal-wrong .reveal-card {
  border: 3px solid var(--danger);
  animation: award-pop 360ms cubic-bezier(0.2, 1.2, 0.2, 1), feedback-shake 280ms ease 360ms;
}

.reveal-mark {
  display: grid;
  place-items: center;
  width: clamp(74px, 20vw, 108px);
  height: clamp(74px, 20vw, 108px);
  border-radius: 50%;
  background: var(--brand-dark);
  color: #ffffff;
  font-family: "Oswald", "Familjen Grotesk", Arial, sans-serif;
  font-size: clamp(1.7rem, 9vw, 3rem);
  font-weight: 500;
  animation: reveal-mark-pop 700ms cubic-bezier(0.2, 1.2, 0.2, 1) 120ms both;
}

.reveal-correct .reveal-mark {
  background: var(--focus);
}

.reveal-wrong .reveal-mark {
  background: var(--danger);
}

.reveal-title {
  color: var(--brand-dark);
  font-family: "Familjen Grotesk", "Wix Madefor Text", Arial, sans-serif;
  font-size: clamp(2rem, 12vw, 3.6rem);
  font-weight: 800;
  line-height: 1;
}

.reveal-copy {
  color: var(--muted);
  font-size: clamp(1rem, 5vw, 1.25rem);
  font-weight: 800;
}

@keyframes award-backdrop {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes award-pop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes trophy-celebrate {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.82) rotate(-7deg);
  }
  45% {
    opacity: 1;
    transform: translateY(-10px) scale(1.08) rotate(5deg);
  }
  70% {
    transform: translateY(4px) scale(0.98) rotate(-3deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

@keyframes award-copy-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes reveal-mark-pop {
  0% {
    opacity: 0;
    transform: scale(0.55) rotate(-10deg);
  }
  55% {
    opacity: 1;
    transform: scale(1.12) rotate(4deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

@keyframes feedback-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-5px);
  }
  70% {
    transform: translateX(5px);
  }
}

.student-status {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(146, 151, 153, 0.38);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.student-name {
  font-size: 1.2rem;
  font-family: "Familjen Grotesk", "Wix Madefor Text", Arial, sans-serif;
  font-weight: 700;
}

.student-status-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

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

.comparison-item {
  display: grid;
  gap: 2px;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid rgba(87, 120, 152, 0.28);
  border-radius: 8px;
  background: #ffffff;
}

.comparison-item strong {
  color: var(--brand-blue);
  font-family: "Oswald", "Familjen Grotesk", Arial, sans-serif;
  font-size: 1.12rem;
  font-weight: 500;
}

.comparison-item strong.points-positive {
  color: var(--success);
}

.comparison-item strong.points-negative {
  color: var(--danger);
}

.comparison-item strong.points-neutral {
  color: var(--brand-blue);
}

.comparison-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
}

.trophy-collection {
  display: grid;
  gap: 7px;
  padding-top: 2px;
}

.trophy-collection-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 24px;
}

.trophy-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
  align-items: center;
}

.mini-trophy {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
}

.trophy-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.trophy-cup {
  fill: #f6b83f;
  stroke: #8d5a00;
  stroke-width: 2;
  stroke-linejoin: round;
}

.trophy-handle,
.trophy-stem,
.trophy-shadow {
  fill: none;
  stroke: #8d5a00;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trophy-shadow {
  stroke: rgba(9, 34, 59, 0.24);
}

.trophy-badge circle {
  stroke: #ffffff;
  stroke-width: 2;
}

.trophy-badge path {
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trophy-badge-correct circle {
  fill: var(--success);
}

.trophy-badge-wrong circle {
  fill: var(--danger);
}

.trophy-empty {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.reveal-trophy-callout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--brand-dark);
  font-size: 0.92rem;
  font-weight: 800;
}

.reveal-trophy-callout .trophy-svg {
  width: 42px;
  height: 42px;
  animation: trophy-celebrate 900ms cubic-bezier(0.2, 1.15, 0.2, 1) both;
}

.student-leaderboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 59;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(9, 34, 59, 0.42);
  animation: award-backdrop 180ms ease-out;
}

.student-leaderboard-card {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(540px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: clamp(18px, 4vw, 26px);
  border: 2px solid rgba(1, 168, 230, 0.38);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 60px rgba(9, 34, 59, 0.28);
  animation: award-pop 260ms cubic-bezier(0.2, 1.2, 0.2, 1);
}

.leaderboard-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-right: 36px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(146, 151, 153, 0.38);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow);
  font-weight: 700;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

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

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .topbar-actions {
    justify-content: stretch;
    width: 100%;
  }

  .topbar-actions .btn {
    flex: 1 1 120px;
  }
}

@media (max-width: 560px) {
  .container,
  .entry-wrap,
  .student-wrap {
    width: min(100vw - 22px, 620px);
  }

  .entry-wrap,
  .class-create-form,
  .class-row,
  .user-row,
  .name-grid {
    grid-template-columns: 1fr;
  }

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

  .class-main,
  .class-actions,
  .student-status-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .class-actions .btn,
  .student-status-actions .btn {
    width: 100%;
  }

  .join-card {
    grid-template-columns: 1fr;
  }

  .qr-box {
    width: 100%;
    height: 170px;
  }

  .results-head,
  .control-actions,
  .timer-row {
    grid-template-columns: 1fr 1fr;
  }

  .leaderboard-row {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .leaderboard-points {
    grid-column: 2;
    text-align: left;
  }

  .choice-grid {
    gap: 9px;
  }

  .key-choice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .first-award-overlay {
    padding: 10px;
  }

  .first-award-card {
    width: min(360px, calc(100vw - 20px));
    gap: 10px;
    padding: 18px 14px 20px;
  }

  .reveal-card {
    width: min(360px, calc(100vw - 20px));
    padding: 24px 16px 28px;
  }

  .award-trophy-image {
    width: min(82vw, 250px);
    max-height: 58vh;
  }

  .student-table th:nth-child(2),
  .student-table td:nth-child(2),
  .student-table th:nth-child(5),
  .student-table td:nth-child(5) {
    display: none;
  }

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