.tools-page {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 80px;
}

body[data-page^="tool-"] {
  overflow: hidden;
}

body[data-page^="tool-"] .site-header {
  min-height: 58px;
  padding-top: 8px;
  padding-bottom: 8px;
}

body[data-page^="tool-"] .nav-links {
  display: none;
}

body[data-page^="tool-"] .brand img {
  width: 108px;
  height: 34px;
}

body[data-page^="tool-"] .nav-links a,
body[data-page^="tool-"] .nav-action,
body[data-page^="tool-"] .nav-logout {
  min-height: 30px;
  padding: 0 12px;
  font-size: 13px;
}

.tools-cover-hero {
  margin-bottom: 24px;
}

.tool-cover-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.tool-cover-card {
  position: relative;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 60px rgba(17, 24, 39, 0.08);
  overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.tool-cover-card:hover {
  transform: translateY(-4px);
  border-color: rgba(17, 24, 39, 0.16);
  box-shadow: 0 28px 80px rgba(17, 24, 39, 0.13);
}

.tool-cover-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .9;
  pointer-events: none;
}

.rollcall-cover::before {
  background: radial-gradient(circle at 78% 18%, rgba(147, 197, 253, .34), transparent 34%), linear-gradient(145deg, rgba(255,255,255,.3), rgba(239,246,255,.76));
}

.rollcall-wheel-cover::before {
  background: radial-gradient(circle at 80% 18%, rgba(253, 186, 116, .34), transparent 34%), linear-gradient(145deg, rgba(255,255,255,.3), rgba(255,251,235,.82));
}

.galaxy-cover::before {
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,.86), transparent 12%),
    radial-gradient(circle at 80% 18%, rgba(125, 211, 252, .38), transparent 34%),
    linear-gradient(145deg, rgba(255,255,255,.16), rgba(219,234,254,.78));
}

.timer-cover::before {
  background: radial-gradient(circle at 80% 18%, rgba(253, 186, 116, .34), transparent 34%), linear-gradient(145deg, rgba(255,255,255,.3), rgba(255,247,237,.78));
}

.wheel-cover::before {
  background: radial-gradient(circle at 80% 18%, rgba(240, 171, 252, .34), transparent 34%), linear-gradient(145deg, rgba(255,255,255,.3), rgba(253,244,255,.78));
}

.redpacket-cover::before {
  background: radial-gradient(circle at 80% 18%, rgba(239, 68, 68, .3), transparent 34%), linear-gradient(145deg, rgba(255,255,255,.3), rgba(254,242,242,.84));
}

.scratch-cover::before {
  background: radial-gradient(circle at 80% 18%, rgba(250, 204, 21, .32), transparent 34%), linear-gradient(145deg, rgba(255,255,255,.3), rgba(255,251,235,.84));
}

.group-cover::before {
  background: radial-gradient(circle at 80% 18%, rgba(134, 239, 172, .34), transparent 34%), linear-gradient(145deg, rgba(255,255,255,.3), rgba(240,253,244,.78));
}

.score-cover::before {
  background: radial-gradient(circle at 80% 18%, rgba(196, 181, 253, .34), transparent 34%), linear-gradient(145deg, rgba(255,255,255,.3), rgba(245,243,255,.78));
}

.tool-cover-card > * {
  position: relative;
  z-index: 1;
}

.cover-kicker {
  color: #111827;
  font-size: 13px;
  font-weight: 800;
}

.tool-cover-card h2 {
  margin: 10px 0 12px;
  font-size: clamp(30px, 3.2vw, 44px);
}

.tool-cover-card p {
  color: #555b66;
  line-height: 1.75;
}

.tool-cover-card b {
  width: fit-content;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 999px;
  color: #fff;
  background: #111827;
}

.cover-visual {
  min-height: 156px;
  display: grid;
  place-items: center;
  margin: 20px 0;
  border: 1px solid rgba(17, 24, 39, .08);
  border-radius: 24px;
  background: rgba(255,255,255,.72);
}

.name-visual strong,
.timer-visual strong {
  display: block;
  color: #111827;
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1;
}

.name-visual em,
.timer-visual em,
.score-visual em {
  color: #6b7280;
  font-style: normal;
}

.wheel-visual {
  position: relative;
  display: block;
}

.wheel-visual i {
  position: absolute;
  inset: 24px;
  border-radius: 999px;
  background: conic-gradient(from 0deg, #fca5a5, #fdba74, #fde68a, #86efac, #93c5fd, #c4b5fd, #f0abfc, #fca5a5);
}

.wheel-visual i:nth-child(2) {
  inset: 54px;
  background: #fff;
}

.wheel-visual i:nth-child(3) {
  top: 12px;
  left: 50%;
  right: auto;
  bottom: auto;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 26px solid #111827;
  border-radius: 0;
  background: transparent;
  transform: translateX(-50%);
}

.wheel-visual span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.redpacket-visual {
  position: relative;
  color: #fff;
  background: linear-gradient(160deg, #ef4444, #991b1b);
  box-shadow: inset 0 -26px 60px rgba(127, 29, 29, .32);
}

.redpacket-visual::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 52%;
  border-radius: 24px 24px 55% 55%;
  background: linear-gradient(180deg, rgba(248, 113, 113, .96), rgba(185, 28, 28, .82));
}

.redpacket-visual span {
  position: relative;
  z-index: 1;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #7f1d1d;
  background: radial-gradient(circle at 34% 26%, #fff7ed, #fbbf24 72%);
  font-size: 34px;
  font-weight: 900;
}

.redpacket-visual strong {
  position: absolute;
  bottom: 20px;
  z-index: 1;
  letter-spacing: .18em;
}

.scratch-visual {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #fef3c7, #fff7ed);
}

.scratch-visual::before {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: 18px;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.42) 0 12px, rgba(156,163,175,.18) 12px 24px),
    linear-gradient(135deg, #d1d5db, #f9fafb, #9ca3af);
  box-shadow: inset 0 0 0 1px rgba(17,24,39,.08), 0 18px 36px rgba(17,24,39,.1);
}

.scratch-visual strong,
.scratch-visual span {
  position: relative;
  z-index: 1;
}

.scratch-visual strong {
  color: #92400e;
  font-size: 36px;
}

.scratch-visual span {
  color: #6b7280;
  font-weight: 800;
}

.rollcall-wheel-visual {
  position: relative;
  display: block;
}

.rollcall-wheel-visual i {
  position: absolute;
  inset: 24px;
  border-radius: 999px;
  background: conic-gradient(#bfdbfe, #fecdd3, #fde68a, #bbf7d0, #ddd6fe, #bfdbfe);
}

.rollcall-wheel-visual i:nth-child(2) {
  inset: 54px;
  background: #fff;
}

.rollcall-wheel-visual i:nth-child(3) {
  top: 12px;
  left: 50%;
  right: auto;
  bottom: auto;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 26px solid #111827;
  border-radius: 0;
  background: transparent;
  transform: translateX(-50%);
}

.rollcall-wheel-visual span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.galaxy-visual {
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #e0f2fe, #60a5fa 34%, #1e1b4b 72%);
}

.galaxy-visual i {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 20px rgba(255,255,255,.85);
}

.galaxy-visual i:nth-child(1) { top: 22%; left: 25%; }
.galaxy-visual i:nth-child(2) { top: 62%; left: 70%; }
.galaxy-visual i:nth-child(3) { top: 76%; left: 34%; }

.galaxy-visual strong {
  color: #fff;
  font-size: 24px;
}

.group-visual {
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px;
}

.group-visual span {
  min-height: 100px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #fff;
  color: #111827;
  font-weight: 800;
}

.score-visual strong {
  color: #111827;
  font-size: 34px;
}

.score-visual em {
  font-size: 52px;
  font-weight: 900;
}

.single-tool-page {
  width: min(1680px, calc(100% - 12px));
  height: calc(100dvh - 58px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  align-items: center;
  justify-content: center;
  padding: 6px 0;
}

.single-tool-cover {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-bottom: 24px;
  padding: clamp(26px, 5vw, 52px);
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 34px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.1);
  overflow: hidden;
}

.single-tool-cover h1 {
  max-width: 780px;
}

.single-tool-cover p:not(.eyebrow) {
  max-width: 720px;
  color: #51545d;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.65;
}

.tool-back-link {
  width: fit-content;
  margin-bottom: auto;
  padding: 9px 14px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: #374151;
  font-weight: 700;
}

.tool-card-full {
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
}

.compact-back-link {
  display: none;
  margin: 0;
}

.tools-hero {
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 24px;
  align-items: stretch;
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 34px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 126, 95, 0.2), transparent 32%),
    radial-gradient(circle at 86% 18%, rgba(61, 169, 252, 0.22), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(244, 247, 255, 0.84));
  box-shadow: 0 28px 90px rgba(17, 24, 39, 0.1);
  overflow: hidden;
}

.tools-hero-copy {
  align-self: center;
}

.tools-hero h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-size: clamp(46px, 6vw, 82px);
}

.tools-hero p:not(.eyebrow) {
  max-width: 680px;
  color: #51545d;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.65;
}

.tools-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.tools-live-panel {
  position: relative;
  min-height: 390px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 30px;
  border-radius: 30px;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(17, 24, 39, 0.88), rgba(42, 50, 70, 0.94)),
    radial-gradient(circle at 50% 20%, rgba(124, 214, 255, 0.5), transparent 42%);
  overflow: hidden;
}

.tools-live-panel::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
}

.live-orb {
  position: absolute;
  top: 62px;
  left: 50%;
  width: 190px;
  height: 190px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 30%, rgba(255,255,255,0.95), rgba(111, 199, 255, 0.72) 26%, rgba(93, 79, 255, 0.8) 58%, rgba(8, 16, 32, 0.9) 100%);
  box-shadow: 0 0 70px rgba(74, 158, 255, 0.5);
  transform: translateX(-50%);
  animation: floatOrb 5s ease-in-out infinite;
}

@keyframes floatOrb {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -18px); }
}

.tools-live-panel span,
.tools-live-panel strong,
.tools-live-panel p,
.live-meter {
  position: relative;
  z-index: 1;
}

.tools-live-panel span {
  color: rgba(255,255,255,0.72);
  font-size: 14px;
}

.tools-live-panel strong {
  margin-top: 10px;
  font-size: clamp(38px, 5vw, 64px);
}

.tools-live-panel p {
  margin: 8px 0 24px;
  color: rgba(255,255,255,0.72);
}

.live-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
}

.live-meter i {
  display: block;
  width: 64%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7dd3fc, #fda4af, #fde68a);
}

.class-roster-panel,
.tool-card {
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 18px 60px rgba(17, 24, 39, 0.08);
}

.class-roster-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.65fr) minmax(320px, 1fr);
  gap: 24px;
  align-items: stretch;
  margin: 24px 0;
  padding: 28px;
}

.class-roster-panel h2,
.tool-card h2 {
  font-size: clamp(25px, 2.6vw, 34px);
}

.class-roster-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.roster-editor textarea,
.wheel-tool textarea {
  width: 100%;
  min-height: 154px;
  resize: vertical;
  padding: 16px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 18px;
  outline: none;
  background: rgba(248, 250, 252, 0.9);
  line-height: 1.7;
}

.roster-actions,
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.tool-card-full > .tool-actions {
  margin-top: clamp(6px, 1vh, 12px);
}

.tool-card-full .history-list {
  max-height: 42px;
  overflow: hidden;
}

.tool-data-actions {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 36px rgba(17, 24, 39, 0.06);
}

.single-tool-page > .tool-data-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  max-width: min(460px, calc(100% - 24px));
  margin: 0;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(18px);
}

.single-tool-page > .tool-data-actions span {
  display: none;
}

.tool-data-actions div {
  display: grid;
  gap: 4px;
}

.tool-data-actions strong {
  color: #111827;
  font-size: 18px;
}

.tool-data-actions span,
.roster-tip,
.import-status {
  color: var(--muted);
  line-height: 1.65;
}

.quick-tool-select {
  display: grid;
  min-width: 210px;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.quick-tool-select select {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  font: inherit;
  outline: none;
}

.roster-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(14px);
}

.roster-sheet.is-hidden {
  display: none;
}

.roster-dialog {
  width: min(720px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 28px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 90px rgba(17, 24, 39, 0.22);
}

.roster-dialog .tool-head {
  margin-bottom: 12px;
}

.roster-library {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto auto auto;
  gap: 10px;
  align-items: end;
  margin: 16px 0 14px;
  padding: 14px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.86);
}

.roster-library label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.roster-library select,
.roster-library input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 12px;
  background: #fff;
  color: #111827;
  font: inherit;
  outline: none;
}

.file-import-button {
  position: relative;
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  padding: 11px 16px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 999px;
  color: #111827;
  background: #f8fafc;
  font-weight: 700;
  cursor: pointer;
}

.file-import-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.import-status {
  min-height: 24px;
  margin: 8px 0 0;
  font-size: 14px;
}

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

.tool-card {
  min-height: 520px;
  padding: 24px;
}

.tool-card-full {
  position: relative;
  width: min(calc(100dvw - 16px), calc((100dvh - 86px) * 16 / 9));
  max-height: calc(100dvh - 70px);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  padding: clamp(12px, 1.5vw, 22px);
}

.tool-card:nth-child(5) {
  grid-column: 1 / -1;
}

.tool-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: clamp(8px, 1.2vh, 14px);
}

.tool-card-full > .tool-head h2 {
  font-size: clamp(22px, 2.2vw, 34px);
}

.tool-card-full > .tool-head .eyebrow {
  margin-bottom: 4px;
  font-size: 12px;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 999px;
  color: #1d1d1f;
  background: #fff;
  box-shadow: 0 10px 26px rgba(17, 24, 39, 0.08);
}

.tool-fullscreen-dock {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  margin-top: clamp(8px, 1.2vh, 14px);
  pointer-events: auto;
}

.tool-fullscreen-button {
  min-width: 118px;
  min-height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 900;
}

.rollcall-stage {
  width: 100%;
  aspect-ratio: 16 / 9;
  flex: 0 1 auto;
  min-height: 0;
  max-height: calc(100dvh - 212px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 22%, rgba(125, 211, 252, 0.32), transparent 38%),
    linear-gradient(135deg, #f9fafb, #eef4ff);
  text-align: center;
}

.rollcall-stage span {
  color: var(--muted);
  font-size: 14px;
}

.rollcall-stage strong {
  margin: 16px 0;
  font-size: clamp(72px, 11vw, 156px);
  line-height: 1;
}

.rollcall-stage p {
  margin: 0 auto;
  max-width: 420px;
  color: var(--muted);
}

.rollcall-stage.is-rolling strong {
  animation: namePulse 0.12s linear infinite;
}

.rollcall-wheel-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,.96), transparent 22%),
    linear-gradient(135deg, #fff7ed, #eff6ff);
}

.rollcall-wheel-stage canvas {
  width: min(78%, 48dvh, 600px);
  aspect-ratio: 1 / 1;
  height: auto;
  margin: 0 auto 8px;
  border-radius: 999px;
  filter: drop-shadow(0 24px 42px rgba(17,24,39,.16));
  transition: transform 2.1s cubic-bezier(.12,.76,.18,1);
}

.rollcall-wheel-pointer {
  position: absolute;
  top: clamp(14px, 3.2vh, 34px);
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 34px solid #111827;
  filter: drop-shadow(0 8px 16px rgba(17,24,39,.18));
}

.rollcall-galaxy-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  overscroll-behavior: contain;
  cursor: grab;
  color: #fff;
  perspective: 1100px;
  perspective-origin: 50% 48%;
  background:
    linear-gradient(180deg, rgba(2,6,23,.18), rgba(2,6,23,.44)),
    url("./assets/classroom/galaxy-starfield-20260613.png?v=20260613a") center / cover no-repeat,
    #020617;
}

.rollcall-galaxy-stage::before {
  content: none;
}

.rollcall-galaxy-stage::after {
  content: none;
}

.rollcall-galaxy-stage span,
.rollcall-galaxy-stage p {
  color: rgba(255,255,255,.74);
}

.rollcall-galaxy-stage strong {
  position: absolute;
  left: 50%;
  bottom: 54px;
  z-index: 3;
  display: none;
  margin: 0;
  padding: 12px 22px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  color: #fff;
  background: rgba(15,23,42,.34);
  backdrop-filter: blur(14px);
  font-size: clamp(30px, 4.2vw, 48px);
  text-shadow: 0 18px 46px rgba(0,0,0,.42);
  transform: translateX(-50%);
}

.rollcall-galaxy-stage.has-result strong {
  display: block;
  animation: galaxyResultIn .42s cubic-bezier(.2,.9,.2,1) both;
}

.galaxy-focus-line {
  position: absolute;
  top: 72px;
  bottom: 96px;
  left: 50%;
  z-index: 2;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(transparent, rgba(255,255,255,.82), transparent);
  box-shadow: 0 0 26px rgba(125,211,252,.76);
  pointer-events: none;
}

.galaxy-focus-line::before,
.galaxy-focus-line::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.82);
  border-radius: 999px;
  transform: translateX(-50%);
}

.galaxy-focus-line::before { top: 36%; }
.galaxy-focus-line::after { top: 62%; }

.galaxy-orbit {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  transform-style: preserve-3d;
  transition: transform .045s linear;
  will-change: transform;
  --camera-angle: 0deg;
  --camera-pitch: -10deg;
  --galaxy-drift: 0deg;
}

.galaxy-orbit::before {
  content: none;
}

.galaxy-orbit::after {
  content: none;
}

.galaxy-name {
  position: absolute;
  top: 0;
  left: 0;
  min-width: clamp(48px, 5.8vw, 104px);
  padding: clamp(5px, 0.7vw, 10px) clamp(8px, 1vw, 16px);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  color: #fff;
  background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,.62), transparent 20%),
    rgba(255,255,255,.12);
  box-shadow: 0 10px 28px rgba(0,0,0,.2), inset 0 0 14px rgba(255,255,255,.06);
  backdrop-filter: blur(8px);
  font-size: clamp(14px, 1vw + 1vh, 28px);
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  transform:
    translate3d(var(--tx), var(--ty), var(--tz))
    rotateY(calc(-1 * var(--camera-angle)))
    rotateX(calc(-1 * var(--camera-pitch)))
    scale(var(--scale));
  transform-style: preserve-3d;
  cursor: pointer;
  transition: opacity .18s ease, filter .18s ease, box-shadow .18s ease;
}

.galaxy-name:nth-child(3n) {
  background: rgba(125,211,252,.18);
}

.galaxy-name:nth-child(3n + 1) {
  background: rgba(196,181,253,.18);
}

.rollcall-galaxy-stage.is-dragging .galaxy-name {
  cursor: grabbing;
}

.rollcall-galaxy-stage.is-rolling .galaxy-name {
  box-shadow: 0 16px 46px rgba(0,0,0,.3), 0 0 20px rgba(125,211,252,.18);
}

.galaxy-name.is-side {
  opacity: .58;
  filter: saturate(.92) brightness(.86);
}

.galaxy-name.is-back {
  opacity: .24;
  filter: blur(.3px) saturate(.72) brightness(.68);
}

.galaxy-name.is-front {
  z-index: 5;
  opacity: 1;
  border-color: rgba(255,255,255,.76);
  background:
    radial-gradient(circle at 28% 24%, rgba(255,255,255,.8), transparent 22%),
    rgba(255,255,255,.24);
  box-shadow: 0 18px 46px rgba(0,0,0,.32), 0 0 34px rgba(125,211,252,.38);
  filter: saturate(1.24) brightness(1.12);
}

@keyframes galaxyResultIn {
  from { opacity: 0; transform: translateX(-50%) translateY(14px) scale(.92); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes namePulse {
  50% { transform: scale(1.04); opacity: 0.82; }
}

.check-line {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  max-width: 140px;
  line-height: 1.35;
  font-size: 14px;
}

.check-line input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: #111827;
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.history-list span {
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 13px;
}

.exam-timer-board {
  width: 100%;
  aspect-ratio: 16 / 8.1;
  min-height: 0;
  max-height: calc(100dvh - 350px);
  display: grid;
  grid-template-columns: minmax(170px, .78fr) minmax(410px, 2.3fr) minmax(220px, .95fr);
  align-items: center;
  gap: clamp(14px, 2.2vw, 36px);
  padding: clamp(18px, 2.3vw, 34px) clamp(24px, 3.2vw, 52px);
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% 8%, rgba(255,255,255,.88), transparent 24%),
    radial-gradient(circle at 15% 20%, rgba(96,165,250,.18), transparent 34%),
    radial-gradient(circle at 86% 20%, rgba(251,191,36,.2), transparent 32%),
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(244, 247, 255, 0.96));
  box-shadow: inset 0 0 0 1px rgba(17,24,39,.06);
}

.exam-timer-side {
  display: grid;
  min-width: 0;
  gap: clamp(10px, 1.7vh, 22px);
  align-content: center;
  color: #374151;
  font-weight: 800;
}

.exam-timer-left {
  justify-items: start;
  text-align: left;
}

.exam-timer-right {
  justify-items: end;
  text-align: right;
}

.exam-timer-side span,
.exam-timer-side b,
.exam-timer-side em,
.exam-timer-side strong,
.timer-auto-status {
  min-height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-style: normal;
  line-height: 1.12;
}

.exam-timer-left span {
  justify-content: flex-start;
  color: #374151;
  font-size: clamp(20px, 1.65vw, 30px);
  font-weight: 900;
  white-space: nowrap;
}

.exam-timer-right b {
  justify-content: flex-end;
  color: #111827;
  font-size: clamp(34px, 3vw, 54px);
  font-weight: 950;
}

.exam-timer-right strong {
  justify-content: flex-end;
  color: #111827;
  font-size: clamp(24px, 2.25vw, 42px);
  font-weight: 950;
}

.exam-timer-left em {
  justify-content: flex-start;
  color: #1f2937;
  font-size: clamp(20px, 1.8vw, 32px);
  font-weight: 900;
}

.timer-auto-status {
  width: fit-content;
  justify-content: flex-end;
  color: #4b5563;
  font-size: clamp(19px, 1.75vw, 32px);
  font-weight: 900;
}

.timer-display {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  color: #111827;
  font-variant-numeric: tabular-nums;
  font-size: clamp(118px, 17vw, 268px);
  font-weight: 800;
  letter-spacing: 0;
}

.timer-display.is-ending {
  color: #dc2626;
  text-shadow: 0 8px 32px rgba(220, 38, 38, .18);
  animation: timerWarn 1s ease-in-out infinite;
}

.tool-card-full:fullscreen,
.tool-card-full:-webkit-full-screen,
.tool-card-full.is-tool-expanded {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  margin: 0;
  padding: clamp(16px, 2.2vw, 34px);
  border: 0;
  border-radius: 0;
  background: #f6f7fb;
  box-shadow: none;
}

.tool-card-full:fullscreen .tool-head,
.tool-card-full:-webkit-full-screen .tool-head,
.tool-card-full.is-tool-expanded .tool-head {
  flex: 0 0 auto;
  margin-bottom: clamp(10px, 1.5vh, 18px);
}

.tool-card-full:fullscreen .tool-actions,
.tool-card-full:-webkit-full-screen .tool-actions,
.tool-card-full.is-tool-expanded .tool-actions,
.tool-card-full:fullscreen .timer-presets,
.tool-card-full:-webkit-full-screen .timer-presets,
.tool-card-full.is-tool-expanded .timer-presets,
.tool-card-full:fullscreen .timer-custom,
.tool-card-full:-webkit-full-screen .timer-custom,
.tool-card-full.is-tool-expanded .timer-custom,
.tool-card-full:fullscreen .exam-timer-config,
.tool-card-full:-webkit-full-screen .exam-timer-config,
.tool-card-full.is-tool-expanded .exam-timer-config {
  flex: 0 0 auto;
}

.rollcall-tool:fullscreen .rollcall-stage,
.rollcall-tool:-webkit-full-screen .rollcall-stage,
.rollcall-tool.is-tool-expanded .rollcall-stage {
  flex: 1 1 auto;
  min-height: 0;
}

.rollcall-tool:fullscreen .rollcall-wheel-stage canvas,
.rollcall-tool:-webkit-full-screen .rollcall-wheel-stage canvas,
.rollcall-tool.is-tool-expanded .rollcall-wheel-stage canvas {
  width: min(70vh, 760px);
  height: min(70vh, 760px);
}

.timer-tool:fullscreen,
.timer-tool:-webkit-full-screen,
.timer-tool.is-tool-expanded {
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,.96), rgba(238,242,255,.86) 34%, transparent 58%),
    linear-gradient(135deg, #eef2ff, #f8fafc 48%, #fff7ed);
}

.timer-tool:fullscreen .exam-timer-board,
.timer-tool:-webkit-full-screen .exam-timer-board,
.timer-tool.is-tool-expanded .exam-timer-board {
  flex: 1 1 auto;
  min-height: 0;
  margin: clamp(8px, 1.6vh, 18px) 0;
  max-height: none;
}

.timer-tool:fullscreen .timer-display,
.timer-tool:-webkit-full-screen .timer-display,
.timer-tool.is-tool-expanded .timer-display {
  font-size: clamp(120px, 20vw, 300px);
}

.timer-tool:fullscreen .timer-presets,
.timer-tool:-webkit-full-screen .timer-presets,
.timer-tool.is-tool-expanded .timer-presets,
.timer-tool:fullscreen .timer-custom,
.timer-tool:-webkit-full-screen .timer-custom,
.timer-tool.is-tool-expanded .timer-custom,
.timer-tool:fullscreen .exam-timer-config,
.timer-tool:-webkit-full-screen .exam-timer-config,
.timer-tool.is-tool-expanded .exam-timer-config,
.timer-tool:fullscreen .tool-actions,
.timer-tool:-webkit-full-screen .tool-actions,
.timer-tool.is-tool-expanded .tool-actions {
  display: none;
}

.wheel-tool:fullscreen .wheel-stage,
.wheel-tool:-webkit-full-screen .wheel-stage,
.wheel-tool.is-tool-expanded .wheel-stage {
  flex: 1 1 auto;
}

.wheel-tool:fullscreen #rewardWheel,
.wheel-tool:-webkit-full-screen #rewardWheel,
.wheel-tool.is-tool-expanded #rewardWheel {
  width: min(74vh, 820px);
}

.redpacket-tool:fullscreen .redpacket-stage,
.redpacket-tool:-webkit-full-screen .redpacket-stage,
.redpacket-tool.is-tool-expanded .redpacket-stage,
.scratch-tool:fullscreen .scratch-stage,
.scratch-tool:-webkit-full-screen .scratch-stage,
.scratch-tool.is-tool-expanded .scratch-stage {
  flex: 1 1 auto;
}

@keyframes timerWarn {
  50% { transform: scale(1.015); }
}

.timer-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.timer-presets button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 999px;
  color: #374151;
  background: #fff;
}

.exam-timer-config,
.timer-custom,
.group-config,
.score-config {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.exam-timer-config {
  margin-top: 12px;
}

.exam-timer-config label,
.timer-custom label,
.group-config label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  white-space: nowrap;
  font-size: 14px;
}

.exam-timer-config input,
.timer-custom input,
.group-config input,
.group-config select,
.score-config input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 14px;
  background: #fff;
}

.timer-custom input {
  width: 96px;
}

.exam-timer-config input[type="text"] {
  width: 142px;
}

.exam-timer-config input[type="time"] {
  width: 126px;
}

.exam-timer-config input[type="number"] {
  width: 96px;
}

@media (max-width: 860px) {
  .exam-timer-board {
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: calc(100dvh - 420px);
    padding: 18px;
  }
  .exam-timer-left,
  .exam-timer-right {
    justify-items: center;
    text-align: center;
  }
  .exam-timer-left span,
  .exam-timer-left em,
  .exam-timer-right b,
  .exam-timer-right strong,
  .timer-auto-status {
    justify-content: center;
  }
  .timer-display {
    font-size: clamp(72px, 20vw, 150px);
  }
}

.wheel-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100dvh - 240px);
  margin-bottom: 18px;
  overflow: hidden;
}

#rewardWheel {
  width: min(78%, 48dvh, 600px);
  aspect-ratio: 1 / 1;
  height: auto;
  filter: drop-shadow(0 18px 30px rgba(17, 24, 39, 0.12));
  transition: transform 3.2s cubic-bezier(.12,.72,.12,1);
}

.wheel-pointer {
  position: absolute;
  top: clamp(12px, 3vh, 30px);
  z-index: 2;
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 28px solid #111827;
}

#wheelResult {
  position: absolute;
  bottom: clamp(14px, 3vh, 28px);
  max-width: 76%;
  padding: clamp(10px, 1.4vw, 18px) clamp(16px, 2vw, 28px);
  border-radius: 999px;
  color: #111827;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.12);
  font-size: clamp(24px, 2.8vw, 44px);
  font-weight: 900;
}

.redpacket-stage,
.scratch-stage {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100dvh - 222px);
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,.9), transparent 28%),
    linear-gradient(135deg, #fff7ed, #f8fafc 45%, #fee2e2);
}

.redpacket-envelope {
  position: relative;
  width: min(42dvh, 420px);
  min-width: 280px;
  aspect-ratio: 0.76 / 1;
  color: #fff7ed;
  filter: drop-shadow(0 36px 60px rgba(127, 29, 29, .22));
  transform-style: preserve-3d;
}

.redpacket-body,
.redpacket-flap {
  position: absolute;
  inset: 0;
  border-radius: 28px;
}

.redpacket-body {
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 55%, rgba(255, 255, 255, .18), transparent 18%),
    linear-gradient(160deg, #ef4444, #b91c1c 62%, #7f1d1d);
  box-shadow: inset 0 -40px 70px rgba(127, 29, 29, .34);
  overflow: hidden;
}

.redpacket-body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 46%;
  border-radius: 28px 28px 56% 56%;
  background: linear-gradient(180deg, #fb7185, #dc2626);
  transform-origin: top;
  transition: transform .7s cubic-bezier(.2,.8,.2,1), opacity .7s ease;
}

.redpacket-flap {
  z-index: 3;
  inset: 0 0 auto;
  height: 45%;
  border-radius: 28px 28px 58% 58%;
  background: linear-gradient(180deg, #f87171, #b91c1c);
  transform-origin: top;
  box-shadow: 0 20px 40px rgba(127, 29, 29, .18);
}

.redpacket-open {
  position: relative;
  z-index: 4;
  width: min(33%, 126px);
  aspect-ratio: 1;
  border: 0;
  border-radius: 999px;
  color: #7f1d1d;
  background: radial-gradient(circle at 36% 24%, #fff7ed, #fbbf24 62%, #b45309);
  box-shadow: 0 18px 34px rgba(127, 29, 29, .26), inset 0 2px 0 rgba(255,255,255,.55);
  font-size: clamp(38px, 6dvh, 68px);
  font-weight: 900;
  cursor: pointer;
}

.redpacket-brand {
  position: absolute;
  top: 9%;
  z-index: 4;
  color: rgba(255,247,237,.88);
  font-weight: 800;
  letter-spacing: .22em;
}

#redpacketResult {
  position: absolute;
  bottom: 15%;
  z-index: 4;
  max-width: 82%;
  color: #fff7ed;
  font-size: clamp(22px, 3.5dvh, 42px);
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 8px 24px rgba(127, 29, 29, .5);
}

.redpacket-envelope.is-opening {
  animation: redpacketShake .48s ease-in-out 2;
}

.redpacket-envelope.is-opening .redpacket-open {
  animation: redpacketButtonFlip .95s cubic-bezier(.2,.8,.2,1) forwards;
}

.redpacket-envelope.is-opened .redpacket-flap,
.redpacket-envelope.is-opened .redpacket-body::before {
  transform: rotateX(74deg) translateY(-8px);
  opacity: .62;
}

.redpacket-envelope.is-opened .redpacket-open {
  transform: scale(.72);
  opacity: .2;
}

@keyframes redpacketShake {
  25% { transform: translateX(-7px) rotate(-1.5deg); }
  50% { transform: translateX(7px) rotate(1.5deg); }
  75% { transform: translateX(-4px) rotate(-.7deg); }
}

@keyframes redpacketButtonFlip {
  0% { transform: rotateY(0) scale(1); }
  55% { transform: rotateY(180deg) scale(1.05); }
  100% { transform: rotateY(360deg) scale(.72); opacity: .2; }
}

.scratch-stage {
  background:
    radial-gradient(circle at 16% 18%, rgba(251, 191, 36, .24), transparent 34%),
    radial-gradient(circle at 84% 18%, rgba(96, 165, 250, .22), transparent 34%),
    linear-gradient(135deg, #fffbeb, #f8fafc);
}

.scratch-card {
  position: relative;
  width: min(86%, 980px);
  aspect-ratio: 16 / 7.2;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 34px;
  background:
    radial-gradient(circle at 50% 24%, rgba(255,255,255,.78), transparent 28%),
    linear-gradient(135deg, #f97316, #facc15 48%, #38bdf8);
  box-shadow: 0 34px 76px rgba(17,24,39,.18);
}

.scratch-result {
  padding: 0 40px;
  color: #111827;
  font-size: clamp(42px, 7dvh, 92px);
  font-weight: 950;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 3px 0 rgba(255,255,255,.5);
}

#scratchCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

#scratchCanvas.is-revealing {
  opacity: 0;
  transition: opacity .18s ease;
}

.groups-output {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(210px, 22vw, 340px), 1fr));
  gap: clamp(12px, 1.5vw, 22px);
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100dvh - 240px);
  margin-top: 18px;
  overflow: auto;
}

.group-box,
.score-row {
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 18px;
  background: #fff;
}

.group-box {
  padding: clamp(16px, 2vw, 28px);
}

.group-box h3 {
  margin-bottom: clamp(10px, 1.5vw, 18px);
  font-size: clamp(26px, 2.8vw, 44px);
}

.group-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  font-size: clamp(20px, 1.8vw, 32px);
}

.scoreboard-list {
  display: grid;
  gap: clamp(12px, 1.5vw, 20px);
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100dvh - 240px);
  margin-top: 18px;
  overflow: auto;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: clamp(10px, 1.4vw, 18px);
  align-items: center;
  padding: clamp(16px, 1.8vw, 26px);
}

.score-row strong {
  font-size: clamp(28px, 2.6vw, 44px);
}

.score-row em {
  min-width: clamp(86px, 8vw, 140px);
  color: #111827;
  font-style: normal;
  font-size: clamp(42px, 4.4vw, 78px);
  font-weight: 800;
  text-align: center;
}

.score-row button {
  width: clamp(50px, 4.8vw, 74px);
  height: clamp(50px, 4.8vw, 74px);
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 999px;
  background: #f9fafb;
  font-weight: 800;
  font-size: clamp(20px, 2vw, 32px);
}

@media (max-width: 900px) {
  .tools-hero,
  .class-roster-panel,
  .tool-grid,
  .tool-cover-grid,
  .tool-data-actions {
    grid-template-columns: 1fr;
  }

  .tool-data-actions {
    display: grid;
    justify-items: start;
  }

  .roster-library {
    grid-template-columns: 1fr;
  }

  .tool-card:nth-child(5) {
    grid-column: auto;
  }

  .tools-live-panel {
    min-height: 320px;
  }

  .tool-cover-card {
    min-height: 360px;
  }
}

@media (max-width: 640px) {
  .tools-page {
    width: min(100% - 24px, 1280px);
  }

  .tools-hero,
  .class-roster-panel,
  .tool-card {
    border-radius: 22px;
    padding: 18px;
  }

  .score-row {
    grid-template-columns: 1fr auto;
  }
}
