:root {
  --font-display: "Instrument Serif", serif;
  --font-body: "Inter", "Microsoft YaHei", "PingFang SC", sans-serif;
  --background: 201 100% 13%;
  --foreground: 0 0% 100%;
  --muted-foreground: 240 4% 66%;
  --input: 0 0% 18%;
  --glass-bg: rgba(255, 255, 255, 0.035);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  overflow-x: hidden;
}

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

button {
  border: 0;
  cursor: pointer;
}

.video-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page {
  position: relative;
  z-index: 10;
  min-height: 100vh;
}

.nav {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1280px, calc(100% - 64px));
  margin: 0 auto;
  padding: 24px 0;
}

.logo {
  color: hsl(var(--foreground));
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.035em;
  text-decoration: none;
  white-space: nowrap;
}

.logo sup {
  font-family: var(--font-body);
  font-size: 12px;
  margin-left: 2px;
  vertical-align: super;
  letter-spacing: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
}

.nav-links a {
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-links a.active,
.nav-links a:hover {
  color: hsl(var(--foreground));
}

.liquid-glass {
  position: relative;
  overflow: hidden;
  border: none;
  color: hsl(var(--foreground));
  background: rgba(255, 255, 255, 0.01);
  background-blend-mode: luminosity;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transition: transform 0.2s ease, background 0.2s ease;
}

.liquid-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.45) 0%,
    rgba(255,255,255,0.15) 20%,
    rgba(255,255,255,0) 40%,
    rgba(255,255,255,0) 60%,
    rgba(255,255,255,0.15) 80%,
    rgba(255,255,255,0.45) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.liquid-glass:hover {
  transform: scale(1.03);
  background: rgba(255, 255, 255, 0.035);
}

.nav-cta {
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

.hero {
  position: relative;
  z-index: 10;
  display: flex;
  min-height: calc(100vh - 88px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 90px 24px 120px;
}

.hero h1 {
  max-width: 1180px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(56px, 10vw, 138px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -2.46px;
  text-wrap: balance;
}

.hero h1 em {
  color: hsl(var(--muted-foreground));
  font-style: normal;
}

.hero p {
  max-width: 720px;
  margin: 32px auto 0;
  color: hsl(var(--muted-foreground));
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.85;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 48px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 18px 42px;
  color: hsl(var(--foreground));
  font-size: 16px;
  text-decoration: none;
}

@keyframes fade-rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-rise {
  animation: fade-rise 0.8s ease-out both;
}

.animate-fade-rise-delay {
  animation: fade-rise 0.8s ease-out 0.2s both;
}

.animate-fade-rise-delay-2 {
  animation: fade-rise 0.8s ease-out 0.4s both;
}

.app-shell {
  position: relative;
  z-index: 10;
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
}

.page-shell {
  padding: 72px 0;
}

.section-kicker {
  margin: 0 0 18px;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.section-title {
  margin: 0 0 34px;
  font-family: var(--font-display);
  font-size: clamp(52px, 7vw, 92px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(420px, 1.08fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border-radius: 28px;
  padding: 22px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.12), 0 30px 80px rgba(0, 0, 0, 0.2);
}

.focus-panel,
.leaderboard-panel {
  max-width: 1040px;
  margin: 0 auto;
}

.class-panel {
  margin-bottom: 18px;
}

.compact-panel {
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
}

.class-tools {
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.class-tools-compact {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-title h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
}

.hint {
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  line-height: 1.75;
}

.field,
textarea,
select {
  width: 100%;
  border: 1px solid hsl(var(--input));
  border-radius: 18px;
  outline: none;
  color: hsl(var(--foreground));
  background: rgba(0, 0, 0, 0.18);
  padding: 14px 16px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.field::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

.field:focus,
textarea:focus,
select:focus {
  border-color: rgba(255, 255, 255, 0.44);
  background: rgba(0, 0, 0, 0.25);
}

textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.65;
}

select {
  appearance: none;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 13px 20px;
  color: hsl(var(--foreground));
  font-weight: 500;
  white-space: nowrap;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: hsl(var(--foreground));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.btn-danger {
  color: #fecaca;
  background: rgba(248, 113, 113, 0.14);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.22);
}

.btn-success {
  color: #dcfce7;
  background: rgba(34, 197, 94, 0.15);
  box-shadow: inset 0 0 0 1px rgba(134, 239, 172, 0.2);
}

.btn-warning {
  color: #fef3c7;
  background: rgba(245, 158, 11, 0.16);
  box-shadow: inset 0 0 0 1px rgba(253, 230, 138, 0.2);
}

.btn-large {
  width: 100%;
  min-height: 74px;
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 400;
  letter-spacing: -0.04em;
}

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

.tool-row,
.danger-row,
.score-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.tool-row .btn,
.score-actions .btn {
  flex: 1;
}

.student-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding-right: 2px;
}

.tall-list {
  max-height: 620px;
}

.student-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 18px;
  padding: 11px 12px 11px 16px;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.student-name {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-btn {
  padding: 8px 12px;
  font-size: 13px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  border-radius: 22px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.stat span {
  display: block;
  margin-top: 8px;
  color: hsl(var(--muted-foreground));
  font-size: 13px;
}

.draw-stage {
  display: grid;
  place-items: center;
  min-height: 320px;
  border-radius: 34px;
  text-align: center;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 30px;
}

.large-stage {
  min-height: 380px;
}

.stage-label {
  margin: 0 0 12px;
  color: hsl(var(--muted-foreground));
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.current-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(82px, 13vw, 156px);
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: -0.07em;
  word-break: break-all;
}

.current-subtitle {
  max-width: 620px;
  margin: 22px auto 0;
  color: hsl(var(--muted-foreground));
  line-height: 1.75;
}

.score-panel {
  margin-top: 18px;
  border-radius: 28px;
  padding: 18px;
  background: rgba(0, 0, 0, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.score-buttons {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.score-btn {
  min-height: 48px;
  border-radius: 999px;
  color: hsl(var(--muted-foreground));
  background: rgba(255, 255, 255, 0.06);
  transition: transform 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.score-btn:hover:not(:disabled),
.score-btn.active {
  color: hsl(var(--foreground));
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.score-btn:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.leaderboard-tools {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  margin-bottom: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.18);
}

th,
td {
  padding: 15px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

th {
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  font-weight: 500;
}

tr:last-child td {
  border-bottom: 0;
}

.rank {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: hsl(var(--foreground));
  background: rgba(255, 255, 255, 0.12);
  font-size: 13px;
  font-weight: 500;
}

.rank.top1 {
  color: #fef3c7;
  background: rgba(245, 158, 11, 0.24);
}

.rank.top2 {
  color: #e5e7eb;
  background: rgba(148, 163, 184, 0.22);
}

.rank.top3 {
  color: #fed7aa;
  background: rgba(249, 115, 22, 0.2);
}

.empty {
  border-radius: 22px;
  padding: 24px;
  color: hsl(var(--muted-foreground));
  text-align: center;
  background: rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 48px));
  border-radius: 20px;
  padding: 15px 18px;
  color: hsl(var(--foreground));
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 24px 60px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .nav {
    width: min(100% - 32px, 1280px);
  }

  .nav-links {
    display: none;
  }

  .app-shell {
    width: min(100% - 28px, 1280px);
  }

  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .nav {
    gap: 12px;
  }

  .logo {
    font-size: 28px;
  }

  .nav-cta {
    padding: 9px 16px;
  }

  .hero h1 {
    font-size: clamp(52px, 17vw, 78px);
  }

  .hero-actions,
  .row,
  .class-tools,
  .class-tools-compact,
  .leaderboard-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .score-buttons {
    grid-template-columns: repeat(5, 1fr);
  }

  .btn {
    width: 100%;
  }

  th,
  td {
    padding: 12px 10px;
    font-size: 13px;
  }
}
