*, *::before, *::after { box-sizing: border-box; }

html { min-width: 320px; background: var(--background); }
body.wheel-page {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 7% 22%, #f3f5f9 0 80px, transparent 81px),
    var(--background);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .46; }
a { color: inherit; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20000;
  padding: 10px 13px;
  border-radius: 5px;
  background: #fff;
  color: var(--blue);
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.wheel-main {
  width: min(1260px, 100%);
  margin: 0 auto;
  padding: 34px 32px 52px;
}
.wheel-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.eyebrow {
  margin-bottom: 7px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
}
.wheel-intro h1 {
  max-width: 720px;
  font: 700 clamp(38px, 5vw, 66px)/.95 'OffBit', monospace;
}
.wheel-intro h1 span { color: var(--blue); }
.active-class-label {
  flex: none;
  max-width: 300px;
  padding: 8px 12px;
  border: 1px solid #c9d2e3;
  border-radius: 999px;
  background: #f7f9fd;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wheel-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, .72fr);
  gap: 18px;
  align-items: stretch;
}
.wheel-card,
.remaining-card {
  min-width: 0;
  border: 1px solid #d0d4dc;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 18px #15243d08;
}
.wheel-card { padding: 24px 28px 26px; }
.wheel-card-heading,
.remaining-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.section-number {
  margin-bottom: 3px;
  color: var(--blue);
  font: 700 18px/1 'OffBit', monospace;
}
.wheel-card h2,
.remaining-card h2 {
  font: 700 27px/1.05 'OffBit', monospace;
}
.wheel-card-heading > p {
  max-width: 210px;
  padding-top: 22px;
  color: var(--muted);
  text-align: right;
}

.wheel-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 570px);
  aspect-ratio: 1;
  margin: 12px auto 6px;
  isolation: isolate;
}
.wheel-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.wheel-shadow { fill: #17243d18; filter: blur(7px); transform: translateY(7px); }
.wheel-rim { fill: none; stroke: #fff; stroke-width: 7; pointer-events: none; }
.wheel-hub-outer { fill: #fff; stroke: #17243d25; stroke-width: 2; }
.wheel-hub { fill: var(--blue); }
.wheel-hub-dot { fill: #fff; }
#wheel-rotor {
  transform-box: view-box;
  transform-origin: center;
  will-change: transform;
}
.wheel-segment { stroke: #fff; stroke-width: 2.4; }
.wheel-name {
  font-family: var(--body-font);
  font-weight: 700;
  letter-spacing: .1px;
  pointer-events: none;
  paint-order: stroke;
  stroke: #ffffff45;
  stroke-width: .5px;
  stroke-linejoin: round;
}
.wheel-pointer {
  position: absolute;
  top: 1.7%;
  left: 50%;
  z-index: 3;
  width: 0;
  height: 0;
  border-right: 18px solid transparent;
  border-left: 18px solid transparent;
  border-top: 39px solid #17243d;
  filter: drop-shadow(0 3px 2px #17243d35);
  transform: translateX(-50%);
}
.wheel-visual.is-spinning .wheel-pointer { animation: wheel-pointer-tick 110ms ease-in-out infinite alternate; }
@keyframes wheel-pointer-tick {
  from { transform: translateX(-50%) rotate(-3deg); }
  to { transform: translateX(-50%) rotate(3deg); }
}
.wheel-empty {
  position: absolute;
  inset: 13%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  border: 1px dashed #9fb3d7;
  border-radius: 50%;
  background: #f4f7fcf2;
  text-align: center;
}
.wheel-empty-icon { margin-bottom: 8px; color: var(--blue); font-size: 32px; }
.wheel-empty strong { font: 700 25px/1.1 'OffBit', monospace; }
.wheel-empty p { max-width: 250px; margin-top: 8px; color: var(--muted); }
.wheel-empty a {
  margin-top: 15px;
  color: var(--blue);
  font-weight: 700;
  text-underline-offset: 3px;
}
.winner-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  margin: -2px auto 15px;
  padding: 9px 16px;
  border: 1px solid #c5d7c7;
  border-radius: 8px;
  background: #edf6ee;
  text-align: center;
}
.winner-card span { color: #46584a; }
.winner-card strong { color: #175d28; font-size: 16px; }
.wheel-actions { display: flex; justify-content: center; gap: 8px; }
.wheel-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 43px;
  padding: 9px 15px;
  border: 1px solid #c7ccd6;
  border-radius: 6px;
  background: #f8f9fb;
  transition: background 150ms, border-color 150ms, transform 150ms;
}
.wheel-button:hover:not(:disabled) { border-color: #8ea9d6; background: #eaf0fb; }
.wheel-button:active:not(:disabled) { transform: translateY(1px); }
.wheel-button-primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.wheel-button-primary:hover:not(:disabled) { border-color: #003da3; background: #003da3; }
.wheel-button-primary > span:first-child { font-size: 10px; }

.remaining-card {
  display: flex;
  flex-direction: column;
  min-height: 530px;
  max-height: 760px;
  padding: 24px 20px 20px;
}
.remaining-count {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 40px;
  height: 40px;
  padding: 0 9px;
  border-radius: 50%;
  background: #e9effb;
  color: var(--blue);
  font: 700 20px/1 'OffBit', monospace;
}
.remaining-class {
  margin: 13px 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e0e3e9;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.remaining-list {
  min-height: 0;
  margin: 0;
  padding: 0 3px 0 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-color: #b8c3d5 transparent;
}
.remaining-list li {
  display: grid;
  grid-template-columns: 10px 28px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 7px 6px;
  border-bottom: 1px solid #eceef2;
}
.remaining-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--student-color);
}
.remaining-index { color: #7a818d; font: 700 14px/1 'OffBit', monospace; }
.remaining-name { min-width: 0; overflow-wrap: anywhere; }
.remaining-empty {
  display: grid;
  place-items: center;
  flex: 1;
  align-content: center;
  gap: 10px;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
}
.remaining-empty span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #e8f3e9;
  color: #246532;
  font-size: 21px;
}

@media (max-width: 900px) {
  .wheel-main { padding-inline: 22px; }
  .wheel-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .wheel-card { padding-inline: 20px; }
}
@media (max-width: 760px) {
  .wheel-main { padding: 25px 16px 38px; }
  .wheel-intro { align-items: flex-start; flex-direction: column; gap: 13px; }
  .active-class-label { max-width: 100%; }
  .wheel-layout { grid-template-columns: 1fr; }
  .wheel-card { padding: 20px 16px 22px; }
  .remaining-card { min-height: 0; max-height: none; }
  .remaining-list { max-height: 420px; }
}
@media (max-width: 480px) {
  .wheel-main { padding-inline: 10px; }
  .wheel-intro { padding-inline: 5px; }
  .wheel-intro h1 { font-size: 39px; }
  .wheel-card-heading { display: block; }
  .wheel-card-heading > p { max-width: none; padding-top: 8px; text-align: left; }
  .wheel-visual { margin-top: 9px; }
  .wheel-pointer { border-right-width: 13px; border-left-width: 13px; border-top-width: 29px; }
  .wheel-empty { inset: 10%; padding: 22px; }
  .wheel-empty strong { font-size: 22px; }
  .wheel-actions { flex-direction: column; }
  .wheel-button { width: 100%; }
  .winner-card { align-items: flex-start; flex-direction: column; gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
@media print {
  .compact-header, .wheel-actions, .wheel-pointer { display: none !important; }
  body.wheel-page { background: #fff; }
  .wheel-main { padding: 0; }
  .wheel-card, .remaining-card { box-shadow: none; }
}
