.teacher-hub-tabs {
  position: sticky;
  top: 4.15rem;
  z-index: 24;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0 auto 2rem;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 1.2rem;
  background: rgba(10, 13, 20, 0.9);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
}

.teacher-hub-tab {
  min-height: 3.25rem;
  border: 1px solid transparent;
  border-radius: 0.85rem;
  background: transparent;
  color: var(--text-2);
  font: 800 0.78rem/1.25 var(--font-body);
  letter-spacing: 0.035em;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.teacher-hub-tab:hover,
.teacher-hub-tab:focus-visible {
  border-color: var(--border-h);
  color: var(--text);
  transform: translateY(-1px);
}

.teacher-hub-tab[aria-selected="true"] {
  border-color: rgba(126, 212, 201, 0.38);
  background: linear-gradient(135deg, rgba(126, 212, 201, 0.18), rgba(251, 191, 36, 0.12));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.teacher-hub-panel {
  min-height: 32rem;
  scroll-margin-top: 9.5rem;
}

.teacher-hub-panel[hidden] {
  display: none !important;
}

.tes-resources-panel {
  padding-bottom: 3rem;
}

.tes-resource-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  width: 100%;
  max-width: none;
  margin: 0;
}

.tes-resource-card {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(17rem, 0.75fr);
  min-width: 0;
  align-items: stretch;
  overflow: hidden;
  border-color: rgba(251, 191, 36, 0.25);
  background:
    linear-gradient(145deg, rgba(251, 191, 36, 0.08), rgba(126, 212, 201, 0.04)),
    var(--surface);
}

.tes-resource-image-link {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-width: 0;
  border-right: 1px solid var(--border);
  background: #071735;
}

.tes-resource-image-link img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  transition: transform 240ms ease;
}

.tes-resource-image-link:hover img,
.tes-resource-image-link:focus-visible img {
  transform: scale(1.018);
}

.tes-resource-image-link:focus-visible {
  outline: 4px solid rgba(56, 189, 248, 0.65);
  outline-offset: -4px;
}

.tes-resource-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  padding: 1.35rem;
}

.tes-resource-level {
  color: var(--accent-4);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.tes-resource-copy h3 {
  margin: 0.45rem 0 0.55rem;
  font: 800 clamp(1.15rem, 2vw, 1.45rem)/1.25 var(--font-display);
}

.tes-resource-copy p {
  flex: 1;
  margin: 0 0 1.1rem;
  color: var(--text-2);
  font-size: 0.88rem;
  line-height: 1.65;
}

.tes-resource-note {
  max-width: 760px;
  margin: 1.25rem auto 0;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(126, 212, 201, 0.22);
  border-radius: 0.9rem;
  background: rgba(126, 212, 201, 0.07);
  color: var(--text-2);
  font-size: 0.8rem;
  line-height: 1.6;
  text-align: center;
}

/* Purchasing information must stay legible throughout page load. */
.tes-resource-card.reveal,
.tes-resource-note.reveal {
  opacity: 1;
  transform: none;
  transition: none;
}

.wheel-panel {
  padding-bottom: 3rem;
}

.wheel-intro {
  max-width: 870px;
  margin: 0 auto 1.4rem;
  text-align: center;
}

.wheel-intro h2 {
  margin: 0.35rem 0 0.7rem;
  font: 800 clamp(1.8rem, 4vw, 3rem)/1.12 var(--font-display);
}

.wheel-intro p {
  margin: 0 auto;
  max-width: 760px;
  color: var(--text-2);
  line-height: 1.75;
}

.wheel-privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  max-width: 940px;
  margin: 0 auto 1.5rem;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(126, 212, 201, 0.25);
  border-radius: 1rem;
  background: rgba(126, 212, 201, 0.08);
  color: var(--text-2);
  font-size: 0.87rem;
  line-height: 1.65;
}

.wheel-privacy-note strong {
  color: var(--text);
}

.wheel-privacy-icon {
  display: grid;
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #07131b;
  font-weight: 900;
}

:root.light-mode .wheel-privacy-icon,
:root.focus-mode .wheel-privacy-icon {
  background: #0f766e;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

:root.light-mode .teacher-section-kicker,
:root.focus-mode .teacher-section-kicker {
  color: #704400 !important;
  -webkit-text-fill-color: #704400 !important;
}

:root.light-mode .tes-resource-level,
:root.focus-mode .tes-resource-level,
:root.light-mode .wheel-count,
:root.focus-mode .wheel-count {
  color: #704400 !important;
  -webkit-text-fill-color: #704400 !important;
}

.wheel-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(440px, 1.22fr);
  gap: 1.25rem;
  align-items: stretch;
}

.wheel-roster,
.wheel-stage,
.wheel-attendance-card,
.wheel-history-card {
  border-color: rgba(126, 212, 201, 0.18);
}

.wheel-roster {
  padding: 1.35rem;
}

.wheel-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.wheel-card-heading h3 {
  margin: 0;
  font: 800 1.15rem/1.25 var(--font-display);
}

.wheel-card-heading p {
  margin: 0.3rem 0 0;
  color: var(--text-2);
  font-size: 0.82rem;
  line-height: 1.55;
}

.wheel-count {
  flex: 0 0 auto;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.1);
  color: var(--accent-4);
  font-size: 0.75rem;
  font-weight: 900;
}

.wheel-field {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.wheel-field label {
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 800;
}

.wheel-field input,
.wheel-field select,
.wheel-field textarea {
  width: 100%;
  border: 1px solid var(--border-h);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font: 600 0.88rem/1.55 var(--font-body);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.wheel-field input,
.wheel-field select {
  min-height: 2.9rem;
  padding: 0.65rem 0.8rem;
}

.wheel-field textarea {
  min-height: 15.5rem;
  resize: vertical;
  padding: 0.8rem;
}

.wheel-field input:focus,
.wheel-field select:focus,
.wheel-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(126, 212, 201, 0.12);
}

.wheel-field small {
  color: var(--text-3);
  font-size: 0.72rem;
  line-height: 1.5;
}

.wheel-actions,
.wheel-spin-actions,
.wheel-stage-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.wheel-actions button,
.wheel-spin-actions button,
.wheel-stage-tools button {
  min-height: 2.75rem;
}

.wheel-save-btn,
.wheel-spin-btn {
  border: 0;
  border-radius: 0.8rem;
  background: linear-gradient(135deg, #7ed4c9, #f6c65c);
  color: #07131b;
  font: 900 0.82rem var(--font-body);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(126, 212, 201, 0.16);
}

.wheel-save-btn {
  flex: 1 1 9rem;
  padding: 0.7rem 1rem;
}

.wheel-spin-btn {
  flex: 1 1 13rem;
  padding: 0.85rem 1.3rem;
  font-size: 0.92rem;
  letter-spacing: 0.035em;
}

.wheel-secondary-btn {
  border: 1px solid var(--border-h);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  padding: 0.68rem 0.9rem;
  font: 800 0.78rem var(--font-body);
  cursor: pointer;
}

.wheel-save-btn:hover,
.wheel-spin-btn:hover,
.wheel-secondary-btn:hover {
  filter: brightness(1.06);
}

.wheel-save-btn:focus-visible,
.wheel-spin-btn:focus-visible,
.wheel-secondary-btn:focus-visible,
.teacher-hub-tab:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.5);
  outline-offset: 2px;
}

.wheel-save-btn:disabled,
.wheel-spin-btn:disabled,
.wheel-secondary-btn:disabled {
  cursor: not-allowed;
  filter: grayscale(0.5);
  opacity: 0.58;
}

.wheel-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  min-height: 690px;
  padding: 1.25rem;
  background:
    radial-gradient(circle at 50% 38%, rgba(126, 212, 201, 0.13), transparent 21rem),
    radial-gradient(circle at 12% 10%, rgba(251, 191, 36, 0.11), transparent 17rem),
    var(--surface);
}

.wheel-stage.is-fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  background: #090d16;
}

.wheel-stage-top {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.wheel-round-status {
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 800;
}

.wheel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.wheel-toggle input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.wheel-canvas-wrap {
  position: relative;
  display: grid;
  width: min(100%, 520px);
  margin: 1rem auto 0.65rem;
  place-items: center;
  aspect-ratio: 1;
}

.wheel-canvas-wrap::before {
  position: absolute;
  inset: 4.5%;
  z-index: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.22);
  box-shadow: 0 28px 55px rgba(0, 0, 0, 0.38);
  content: "";
}

#coldCallWheelCanvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transition: transform 4.2s cubic-bezier(0.12, 0.72, 0.05, 1);
  will-change: transform;
}

.wheel-pointer {
  position: absolute;
  top: -0.15rem;
  left: 50%;
  z-index: 3;
  width: 0;
  height: 0;
  border-right: 20px solid transparent;
  border-left: 20px solid transparent;
  border-top: 42px solid #f6c65c;
  border-bottom: 0;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.32));
  transform: translateX(-50%);
}

.wheel-result {
  width: min(100%, 560px);
  min-height: 5.4rem;
  margin: 0.25rem auto 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(126, 212, 201, 0.24);
  border-radius: 1rem;
  background: rgba(126, 212, 201, 0.08);
  text-align: center;
}

.wheel-result span {
  display: block;
  color: var(--text-3);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.wheel-result strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 0.2rem;
  color: var(--text);
  font: 800 clamp(1.35rem, 3vw, 2rem)/1.2 var(--font-display);
}

.wheel-spin-actions {
  width: min(100%, 560px);
  justify-content: center;
}

.wheel-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.wheel-attendance-card,
.wheel-history-card {
  padding: 1.3rem;
}

.wheel-attendance-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  max-height: 22rem;
  overflow: auto;
  padding-right: 0.25rem;
}

.wheel-attendance-person {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.62rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}

.wheel-attendance-person input {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.wheel-attendance-person span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wheel-history {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wheel-history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.62rem 0.7rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
}

.wheel-history li span {
  color: var(--text-3);
  font-size: 0.69rem;
  font-weight: 800;
}

.wheel-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--border-h);
  border-radius: 0.8rem;
  color: var(--text-3);
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.6;
}

.wheel-live-status {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  max-width: min(25rem, calc(100vw - 2rem));
  padding: 0.8rem 1rem;
  border: 1px solid rgba(126, 212, 201, 0.34);
  border-radius: 0.85rem;
  background: #10243a;
  color: #f8fafc;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.75rem);
  transition: opacity 180ms ease, transform 180ms ease;
}

.wheel-live-status.is-visible {
  opacity: 1;
  transform: translateY(0);
}

:root.light-mode .teacher-hub-tabs,
:root.focus-mode .teacher-hub-tabs {
  border-color: rgba(17, 40, 74, 0.15);
  background: rgba(255, 252, 244, 0.94);
  box-shadow: 0 14px 35px rgba(17, 40, 74, 0.12);
}

:root.light-mode .teacher-hub-tab,
:root.focus-mode .teacher-hub-tab {
  color: #40516d;
}

:root.light-mode .teacher-hub-tab[aria-selected="true"],
:root.focus-mode .teacher-hub-tab[aria-selected="true"] {
  border-color: rgba(15, 118, 110, 0.28);
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(183, 121, 31, 0.12));
  color: #11284a;
}

:root.light-mode .wheel-privacy-note,
:root.focus-mode .wheel-privacy-note,
:root.light-mode .wheel-result,
:root.focus-mode .wheel-result {
  border-color: rgba(15, 118, 110, 0.22);
  background: rgba(15, 118, 110, 0.08);
}

:root.light-mode .wheel-field input,
:root.light-mode .wheel-field select,
:root.light-mode .wheel-field textarea,
:root.light-mode .wheel-secondary-btn,
:root.light-mode .wheel-attendance-person,
:root.focus-mode .wheel-field input,
:root.focus-mode .wheel-field select,
:root.focus-mode .wheel-field textarea,
:root.focus-mode .wheel-secondary-btn,
:root.focus-mode .wheel-attendance-person {
  border-color: rgba(17, 40, 74, 0.17);
  background: rgba(255, 255, 255, 0.94);
  color: #11284a;
}

:root.light-mode .wheel-stage,
:root.focus-mode .wheel-stage {
  background:
    radial-gradient(circle at 50% 38%, rgba(15, 118, 110, 0.11), transparent 21rem),
    radial-gradient(circle at 12% 10%, rgba(183, 121, 31, 0.1), transparent 17rem),
    rgba(255, 252, 244, 0.93);
}

:root.light-mode .wheel-intro p,
:root.light-mode .wheel-privacy-note,
:root.light-mode .wheel-card-heading p,
:root.light-mode .wheel-field small,
:root.light-mode .wheel-round-status,
:root.focus-mode .wheel-intro p,
:root.focus-mode .wheel-privacy-note,
:root.focus-mode .wheel-card-heading p,
:root.focus-mode .wheel-field small,
:root.focus-mode .wheel-round-status {
  color: #334a69 !important;
  -webkit-text-fill-color: #334a69 !important;
}

:root.light-mode .tes-resource-card,
:root.focus-mode .tes-resource-card {
  background:
    linear-gradient(145deg, rgba(183, 121, 31, 0.1), rgba(15, 118, 110, 0.04)),
    rgba(255, 252, 244, 0.96);
}

:root.light-mode .tes-resource-copy p,
:root.light-mode .tes-resource-note,
:root.focus-mode .tes-resource-copy p,
:root.focus-mode .tes-resource-note {
  color: #11284a !important;
  -webkit-text-fill-color: #11284a !important;
}

@media (max-width: 900px) {
  .teacher-hub-tabs {
    top: 4.9rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wheel-layout,
  .wheel-lower-grid {
    grid-template-columns: 1fr;
  }

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

  .tes-resource-image-link {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .wheel-stage {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .teacher-hub-tabs {
    position: static;
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .teacher-hub-tabs::-webkit-scrollbar {
    display: none;
  }

  .teacher-hub-tab {
    flex: 0 0 auto;
    min-width: 10.5rem;
    min-height: 2.8rem;
  }

  .wheel-roster,
  .wheel-stage,
  .wheel-attendance-card,
  .wheel-history-card {
    padding: 1rem;
  }

  .wheel-stage-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .wheel-canvas-wrap {
    width: min(100%, 390px);
  }

  .wheel-attendance-list {
    grid-template-columns: 1fr;
  }

  .wheel-actions button,
  .wheel-spin-actions button {
    width: 100%;
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  #coldCallWheelCanvas {
    transition-duration: 0.65s;
  }
}
