:root {
  --bg-dark: #071128;
  --card: rgba(7, 18, 44, 0.72);
  --card-strong: rgba(3, 10, 28, 0.86);
  --line: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.7);
  --gold: #ffd166;
  --green: #52e0a3;
  --blue: #5ec7ff;
  --pink: #ff5c93;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--bg-dark);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  --shell-pad: clamp(12px, 2.6vw, 42px);
  position: relative;
  min-height: 100vh;
  padding: 0 var(--shell-pad) 26px;
  overflow-x: hidden;
  overflow-y: auto;
  isolation: isolate;
}

.background-layer,
.background-overlay {
  position: fixed;
  inset: 0;
}

.background-layer {
  z-index: -3;
  background:
    linear-gradient(180deg, rgba(4, 12, 34, 0.08), rgba(3, 8, 25, 0.92)),
    url("../assets/leaderboard-bg.webp"),
    radial-gradient(circle at 50% 10%, #24498f 0%, #081736 42%, #030817 100%);
  background-size: cover;
  background-position: center;
}

.background-overlay {
  z-index: -2;
  background:
    radial-gradient(
      circle at 12% 22%,
      rgba(255, 209, 102, 0.22),
      transparent 20%
    ),
    radial-gradient(
      circle at 82% 18%,
      rgba(94, 199, 255, 0.22),
      transparent 22%
    ),
    radial-gradient(
      circle at 18% 78%,
      rgba(255, 92, 147, 0.2),
      transparent 24%
    ),
    radial-gradient(
      circle at 86% 74%,
      rgba(82, 224, 163, 0.18),
      transparent 24%
    ),
    linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(2, 8, 25, 0.72));
}

.background-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.5) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(255, 255, 255, 0.28) 0 1px, transparent 2px);
  background-size:
    170px 170px,
    250px 250px;
  background-position:
    20px 30px,
    100px 80px;
  opacity: 0.38;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.leaderboard-screen,
.admin-screen {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.brand,
.live-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.sound-button,
.admin-link,
.admin-primary-button,
.admin-secondary-button {
  border: 0;
  font-weight: 900;
  text-decoration: none;
}

/* =========================
   PUBLIC LEADERBOARD
========================= */

.leaderboard-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 84px;

  width: 100vw;
  margin: 0 calc(50% - 50vw) 18px;
  padding: 14px clamp(16px, 3vw, 44px);

  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(2, 8, 25, 0.88), rgba(2, 8, 25, 0.62)),
    rgba(2, 8, 25, 0.7);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

.leaderboard-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-logo {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.app-logo-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.app-identity {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.app-label {
  color: rgba(255, 255, 255, 0.68);
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.app-name {
  color: #ffffff;
  font-size: clamp(16px, 1.45vw, 22px);
  font-weight: 950;
  line-height: 1.02;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.header-actions {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.live-pill {
  gap: 9px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12.5px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #52e0a3;
  box-shadow:
    0 0 0 6px rgba(82, 224, 163, 0.15),
    0 0 18px rgba(82, 224, 163, 0.65);
}

.live-pill[data-state="draft"] .live-dot {
  background: #ff5c93;
  box-shadow:
    0 0 0 6px rgba(255, 92, 147, 0.15),
    0 0 18px rgba(255, 92, 147, 0.5);
}

.sound-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 12px;
  color: #081127;
  background: #ffffff;
  font-size: 12.5px;
  font-weight: 950;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
}

.sound-state,
.sound-label {
  line-height: 1;
}

/* Summary */

.leaderboard-summary-card,
.board-card {
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.leaderboard-summary-card {
  position: relative;
  overflow: hidden;
  width: min(1180px, 100%);
  margin: 0 auto 20px;
  padding: 16px 18px 24px;
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(5, 15, 42, 0.74), rgba(5, 15, 42, 0.38)),
    rgba(5, 15, 42, 0.52);
}

.leaderboard-summary-card::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -60px;
  top: -80px;
  border-radius: 50%;
  opacity: 0.5;
  background: radial-gradient(
    circle,
    rgba(255, 209, 102, 0.32),
    transparent 68%
  );
}

.progress-card {
  --progress-marker-width: 76px;
  --progress-track-height: 24px;
  --progress-side-space: calc(var(--progress-marker-width) / 2);

  position: relative;
  width: 100%;
  padding: 0;
}

.progress-topline {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.progress-track-wrap {
  position: relative;
  padding: calc((var(--progress-orb-size) - var(--progress-track-height)) / 2)
    var(--progress-side-space)
    calc((var(--progress-orb-size) - var(--progress-track-height)) / 2);
}

.progress-track {
  position: relative;
  height: var(--progress-track-height);
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #52e0a3, #5ec7ff, #b981ff);
  box-shadow: 0 0 26px rgba(94, 199, 255, 0.55);
  transition: width 0.6s ease;
}

.progress-orb {
  position: absolute;
  left: 100%;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 76px;
  height: 46px;
  padding: 0 14px;

  border: 3px solid rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  color: #071128;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98),
    rgba(246, 250, 255, 0.98)
  );

  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.22),
    0 0 0 3px rgba(94, 199, 255, 0.18);

  text-align: center;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.progress-orb strong {
  display: block;
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.05em;
  white-space: nowrap;
}

/* Board */

.board-card {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px 28px 18px;
  border-radius: 20px;
  border-color: rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(3, 10, 28, 0.76), rgba(3, 8, 25, 0.9)),
    rgba(7, 18, 44, 0.78);
}

.board-content {
  padding-inline: clamp(10px, 2vw, 26px);
}

.table-head {
  display: grid;
  grid-template-columns: 28px 72px 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  padding: 0 18px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.table-head span:nth-child(1) {
  grid-column: 1 / 3;
}

.table-head span:nth-child(2) {
  grid-column: 4;
}

.table-head span:nth-child(3) {
  grid-column: 5;
  justify-self: end;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
}

.rank-row {
  position: relative;
  display: grid;
  grid-template-columns: 28px 72px 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px 18px;
  border: 0;
  border-radius: 13px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transition:
    opacity 0.42s ease,
    transform 0.42s cubic-bezier(0.2, 0.9, 0.25, 1),
    background 0.25s ease;
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.rank-row.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.rank-row.rank-1 {
  background:
    linear-gradient(90deg, rgba(141, 95, 38, 0.92), rgba(96, 54, 58, 0.9)),
    rgba(141, 95, 38, 0.92);
}

.rank-row.rank-2 {
  background:
    linear-gradient(90deg, rgba(91, 84, 128, 0.92), rgba(70, 65, 106, 0.9)),
    rgba(91, 84, 128, 0.92);
}

.rank-row.rank-3 {
  margin-bottom: 6px;
  background:
    linear-gradient(90deg, rgba(120, 55, 92, 0.92), rgba(92, 48, 74, 0.9)),
    rgba(120, 55, 92, 0.92);
}

.rank-row.rank-normal {
  grid-template-columns: 22px 58px 38px minmax(0, 1fr) auto;
  min-height: 54px;
  gap: 11px;
  padding: 9px 16px;
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(35, 36, 74, 0.78), rgba(18, 22, 48, 0.88)),
    rgba(18, 22, 48, 0.86);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.rank-row.rank-normal:hover {
  transform: translateY(-1px) scale(1.002);
  background:
    linear-gradient(90deg, rgba(46, 49, 94, 0.84), rgba(24, 29, 58, 0.92)),
    rgba(24, 29, 58, 0.9);
}

.rank-icon {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
}

.rank-icon svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.rank-1 .rank-icon {
  color: #ffd700;
}

.rank-2 .rank-icon {
  color: #d6d8e7;
}

.rank-3 .rank-icon {
  color: #ff9a36;
}

.rank-normal .rank-icon {
  color: rgba(255, 255, 255, 0.42);
}

.rank-row.rank-normal .rank-icon,
.rank-row.rank-normal .rank-icon svg {
  width: 17px;
  height: 17px;
}

.rank-row.rank-normal .rank-icon {
  opacity: 0.55;
}

.rank-number {
  display: block;
  color: rgba(255, 255, 255, 0.95);
  font-size: clamp(32px, 3.6vw, 46px);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.07em;
}

.rank-row.rank-normal .rank-number {
  font-size: 26px;
  letter-spacing: -0.065em;
  opacity: 0.95;
}

.initial-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: #ffffff;
  background:
    radial-gradient(
      circle at 35% 25%,
      rgba(255, 255, 255, 0.18),
      transparent 32%
    ),
    rgba(2, 8, 25, 0.5);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0.02em;
}

.rank-1 .initial-avatar {
  border-color: rgba(255, 209, 102, 0.45);
}

.rank-2 .initial-avatar {
  border-color: rgba(220, 220, 235, 0.45);
}

.rank-3 .initial-avatar {
  border-color: rgba(255, 154, 54, 0.45);
}

.rank-row.rank-normal .initial-avatar {
  width: 34px;
  height: 34px;
  border-width: 2px;
  background:
    radial-gradient(
      circle at 35% 25%,
      rgba(255, 255, 255, 0.12),
      transparent 34%
    ),
    rgba(2, 8, 25, 0.48);
  font-size: 10px;
}

.student-block {
  min-width: 0;
}

.student-name {
  color: rgba(255, 255, 255, 0.96);
  font-size: clamp(16px, 1.65vw, 21px);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: 0.01em;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.rank-row.rank-normal .student-name {
  font-size: clamp(13px, 1.2vw, 15.5px);
  font-weight: 850;
  letter-spacing: 0.015em;
}

.badge {
  justify-self: end;
  min-width: 0;
  padding: 7px 14px;
  border-radius: 999px;
  color: #071128;
  font-size: 10px;
  font-weight: 950;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
}

.rank-row.rank-normal .badge {
  padding: 5px 10px;
  font-size: 8.7px;
}

.tier-mythic-immortal .badge {
  color: #3c2900;
  background: #ffd166;
}

.tier-mythic-glory .badge {
  color: #24113f;
  background: #d6b6ff;
}

.tier-mythic-honor .badge {
  color: #00364d;
  background: #9fe2ff;
}

.tier-mythic .badge {
  color: #052f21;
  background: #9ff5cf;
}

.tier-legend .badge {
  color: #3c1800;
  background: #ffb86b;
}

.tier-epic .badge {
  color: #420018;
  background: #ffb8cf;
}

.tier-grandmaster .badge {
  color: #10203f;
  background: #c8d4ff;
}

.tier-master .badge {
  color: #071128;
  background: #e8ecff;
}

.tier-elite .badge {
  color: #082b30;
  background: #b7f7ff;
}

.tier-warrior .badge {
  color: #261b0b;
  background: #f1d7a6;
}

.empty-state {
  padding: 28px 18px;
  border-radius: 18px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.22);
  text-align: center;
  font-weight: 700;
}

/* Footer */

.board-footer {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  color: var(--muted);
}

.board-footer strong {
  color: #fff;
}

.redesigned-footer {
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 12px;
}

.leaderboard-note {
  max-width: 620px;
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.45;
}

.updated-info {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

/* =========================
   ADMIN PAGE
========================= */

.admin-shell {
  padding: 10px 18px 22px;
}

.admin-shell .background-overlay {
  background:
    radial-gradient(
      circle at 50% 16%,
      rgba(106, 183, 255, 0.12),
      transparent 28%
    ),
    linear-gradient(180deg, rgba(2, 8, 25, 0.2), rgba(2, 8, 25, 0.7));
}

.admin-shell .topbar {
  margin-bottom: 10px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  gap: 10px;
}

.brand-icon {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--gold), #ff9f1c);
  color: #281500;
  font-weight: 900;
}

.brand-text {
  font-weight: 900;
  letter-spacing: -0.03em;
}

.admin-shell .brand {
  gap: 8px;
  padding: 7px 11px;
  border-radius: 11px;
}

.admin-shell .brand-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-size: 12px;
}

.admin-shell .brand-text {
  font-size: 18px;
  line-height: 1;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  color: #081127;
  background: #ffffff;
  font-size: 12px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
}

.admin-card {
  padding: 22px 28px 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(5, 15, 39, 0.78);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.admin-card h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.admin-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.admin-shell .eyebrow {
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: 0.14em;
}

.admin-form,
.textarea-label {
  display: grid;
  gap: 16px;
  margin-top: 26px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 170px;
  gap: 12px;
  margin-top: 14px;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 12px;
  margin-top: 13px;
}

.admin-form label,
.admin-grid label,
.admin-toolbar label,
.textarea-label {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.admin-form input,
.admin-grid input,
.admin-toolbar input,
.admin-toolbar select,
.textarea-label textarea,
.admin-details textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  background-color: rgba(2, 8, 25, 0.72);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.admin-form input,
.admin-grid input,
.admin-toolbar input,
.admin-toolbar select {
  min-height: 38px;
  height: 38px;
  margin-top: 6px;
  padding: 0 12px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
}

.textarea-label textarea {
  min-height: 260px;
  margin-top: 8px;
  padding: 16px;
  border-radius: 16px;
  resize: vertical;
  line-height: 1.7;
}

.admin-toolbar select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10L12 15L17 10' stroke='%23FFD166' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
}

.admin-toolbar select::-ms-expand,
.select-shell select::-ms-expand {
  display: none;
}

.select-shell {
  position: relative;
  display: block;
}

.select-shell select {
  padding-right: 38px;
  background-image: none;
}

.select-shell::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 16px;
  height: 16px;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10L12 15L17 10' stroke='%23FFD166' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
}

.admin-toolbar select:hover,
.admin-toolbar input:hover,
.admin-grid input:hover,
.admin-form input:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background-color: rgba(2, 8, 25, 0.76);
}

.admin-form input:focus,
.admin-grid input:focus,
.admin-toolbar input:focus,
.admin-toolbar select:focus,
.textarea-label textarea:focus,
.admin-details textarea:focus {
  border-color: rgba(255, 209, 102, 0.72);
  box-shadow:
    0 0 0 3px rgba(255, 209, 102, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.admin-help {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(2, 8, 25, 0.5);
  font-size: 12.5px;
  line-height: 1.45;
}

.admin-help strong {
  color: #ffffff;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.admin-actions.compact {
  margin-top: 12px;
}

.admin-primary-button,
.admin-secondary-button {
  min-height: 36px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 12.5px;
  transition:
    transform 0.18s ease,
    filter 0.18s ease,
    opacity 0.18s ease,
    background 0.18s ease;
}

.admin-primary-button {
  color: #071128;
  background: linear-gradient(135deg, #ffd166, #ffb703);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
}

.admin-secondary-button {
  color: #ffffff;
  background: #1b2a49;
  border: 1px solid #344463;
}

.admin-primary-button:hover,
.admin-secondary-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.admin-secondary-button:hover {
  background: #25365a;
}

.admin-message {
  min-height: 18px;
  margin: 9px 0 0;
  color: #dbe7ff;
  font-size: 12.5px;
  font-weight: 800;
}

.admin-message.success {
  color: #8ff0c5;
}

.admin-message.error {
  color: #ffb4c8;
}

.admin-details {
  margin-top: 22px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: rgba(2, 8, 25, 0.46);
  overflow: hidden;
}

.admin-details summary {
  padding: 16px 18px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 950;
}

.admin-details-note {
  margin: 0;
  padding: 0 18px 14px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.55;
}

.admin-details textarea {
  display: block;
  width: calc(100% - 36px);
  margin: 0 18px 14px;
  padding: 16px;
  border-radius: 16px;
  resize: vertical;
  line-height: 1.7;
}

.students-table-card {
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(2, 8, 25, 0.6);
  overflow: hidden;
}

.students-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.students-table-header strong {
  font-size: 15px;
}

.students-table-header span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 800;
}

.students-table-wrap {
  max-height: 420px;
  overflow: auto;
}

.students-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.students-table th,
.students-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: middle;
}

.students-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: rgba(255, 255, 255, 0.68);
  background: rgba(4, 12, 32, 0.96);
  font-size: 10.5px;
  font-weight: 950;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.students-table th:first-child,
.students-table td:first-child {
  width: 48px;
  text-align: center;
}

.students-table th:nth-child(3),
.students-table td:nth-child(3) {
  width: 110px;
}

.students-table th:nth-child(4),
.students-table td:nth-child(4) {
  width: 130px;
}

.students-table th:nth-child(5),
.students-table td:nth-child(5) {
  width: 140px;
}

.student-name-cell {
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 850;
}

.score-input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.35);
  outline: none;
  font-weight: 850;
}

.score-input:focus {
  border-color: rgba(255, 209, 102, 0.8);
  box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.14);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 950;
  white-space: nowrap;
}

.status-chip.done {
  color: #06472a;
  background: rgba(82, 224, 163, 0.8);
}

.status-chip.empty {
  color: #ffffff;
  background: rgba(180, 25, 90, 0.92);
}

.table-empty {
  padding: 26px 14px;
  color: rgba(255, 255, 255, 0.68);
  text-align: center;
  font-weight: 800;
}

.spreadsheet-table td {
  user-select: text;
}

.spreadsheet-table .editable-cell {
  min-height: 32px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 13.5px;
  cursor: text;
  outline: none;
  transition:
    background 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.spreadsheet-table .editable-cell:hover {
  background: rgba(255, 255, 255, 0.075);
}

.spreadsheet-table .editable-cell:focus {
  background: rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 0 0 2px rgba(255, 209, 102, 0.82),
    0 0 0 2px rgba(255, 209, 102, 0.08);
}

.spreadsheet-table .score-cell {
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 900;
  text-align: center;
}

.spreadsheet-toolbar {
  margin-top: 18px;
}

.spreadsheet-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.025);
}

.spreadsheet-table tbody tr:hover {
  background: rgba(94, 199, 255, 0.07);
}

.spreadsheet-table th:nth-child(2),
.spreadsheet-table td:nth-child(2) {
  min-width: 310px;
}

.spreadsheet-table th:nth-child(3),
.spreadsheet-table td:nth-child(3) {
  width: 120px;
}

.spreadsheet-table th:nth-child(4),
.spreadsheet-table td:nth-child(4) {
  width: 90px;
  text-align: center;
}

.spreadsheet-table th:nth-child(5),
.spreadsheet-table td:nth-child(5) {
  width: 105px;
}

/* =========================
   PUBLIC RESPONSIVE
========================= */

@media (max-width: 900px) {
  .app-shell {
    --shell-pad: 12px;
  }

  .leaderboard-header {
    min-height: 70px;
    gap: 12px;
    padding: 12px var(--shell-pad);
  }

  .leaderboard-summary-card {
    padding: 14px 14px 18px;
  }

  .progress-track-wrap {
    padding: 10px var(--progress-side-space);
  }

  .progress-card {
    --progress-marker-width: 72px;
    --progress-track-height: 22px;
    --progress-side-space: calc(var(--progress-marker-width) / 2);
  }

  .progress-orb {
    min-width: var(--progress-marker-width);
    height: 42px;
    padding: 0 12px;
  }

  .progress-orb strong {
    font-size: 16px;
  }

  .board-card {
    padding: 18px 16px 16px;
  }

  .board-content {
    padding-inline: 4px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    --shell-pad: 8px;
    padding-bottom: 20px;
  }

  .leaderboard-header {
    min-height: 58px;
    gap: 8px;
    padding: 9px 8px;
  }

  .leaderboard-brand {
    gap: 8px;
    min-width: 0;
  }

  .app-logo {
    width: 34px;
    height: 34px;
    padding: 5px;
    border-radius: 10px;
  }

  .app-label {
    font-size: 8px;
    letter-spacing: 0.12em;
  }

  .app-name {
    font-size: 14px;
  }

  .header-actions {
    gap: 6px;
    flex: 0 0 auto;
  }

  .live-pill {
    gap: 0;
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 11px;
  }

  .live-pill #leaderboardStatus {
    display: none;
  }

  .sound-button {
    gap: 4px;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 11px;
    font-size: 11px;
  }

  .sound-button .sound-label {
    display: none;
  }

  .leaderboard-summary-card {
    padding: 12px 10px 18px;
  }

  .progress-card {
    --progress-marker-width: 62px;
    --progress-track-height: 18px;
    --progress-side-space: calc(var(--progress-marker-width) / 2);
  }

  .board-card {
    border-radius: 16px;
    padding: 14px;
  }

  .progress-topline {
    margin-bottom: 8px;
    font-size: 8.5px;
  }

  .progress-track-wrap {
    padding-top: 10px;
    padding-right: var(--progress-side-space);
    padding-bottom: 16px;
    padding-left: var(--progress-side-space);
  }

  .progress-track {
    height: var(--progress-track-height);
  }

  .progress-orb {
    min-width: var(--progress-marker-width);
    height: 34px;
    padding: 0 9px;
    border-width: 2px;
  }

  .progress-orb strong {
    font-size: 12.5px;
    white-space: nowrap;
  }

  .table-head {
    grid-template-columns: 18px 44px 30px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 0 10px;
    font-size: 10px;
  }

  .rank-row {
    grid-template-columns: 18px 44px 30px minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 62px;
    padding: 10px;
  }

  .rank-row.rank-normal {
    grid-template-columns: 16px 42px 28px minmax(0, 1fr) auto;
    min-height: 48px;
    padding: 8px 9px;
  }

  .rank-icon,
  .rank-icon svg {
    width: 18px;
    height: 18px;
  }

  .rank-row.rank-normal .rank-icon,
  .rank-row.rank-normal .rank-icon svg {
    width: 14px;
    height: 14px;
  }

  .rank-number {
    font-size: 25px;
  }

  .rank-row.rank-normal .rank-number {
    font-size: 19px;
  }

  .initial-avatar {
    width: 36px;
    height: 36px;
    font-size: 10px;
  }

  .rank-row.rank-normal .initial-avatar {
    width: 28px;
    height: 28px;
    font-size: 9px;
  }

  .student-name {
    font-size: 13px;
  }

  .rank-row.rank-normal .student-name {
    font-size: 11.5px;
  }

  .badge {
    padding: 4px 8px;
    font-size: 7px;
    letter-spacing: 0.03em;
  }

  .rank-row.rank-normal .badge {
    padding: 4px 7px;
    font-size: 6.5px;
  }

  .redesigned-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .updated-info {
    white-space: normal;
  }
}

/* =========================
   ADMIN RESPONSIVE
========================= */

@media (max-width: 720px) {
  .admin-shell {
    padding: 8px;
  }

  .admin-shell .topbar {
    align-items: flex-start;
  }

  .admin-card {
    padding: 14px;
  }

  .admin-card h1 {
    font-size: 28px;
  }

  .admin-header-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .admin-grid,
  .admin-toolbar {
    grid-template-columns: 1fr;
  }

  .admin-actions {
    display: flex;
  }

  .admin-primary-button,
  .admin-secondary-button {
    width: auto;
  }

  .students-table-wrap {
    max-height: 560px;
  }

  .spreadsheet-table th:nth-child(2),
  .spreadsheet-table td:nth-child(2) {
    min-width: 240px;
  }
}
