:root {
  color-scheme: dark;
  --bg: #0c0a0b;
  --panel: #161319;
  --panel-light: #1b171b;
  --gold: #e5a33d;
  --gold-light: #f5c86b;
  --cream: #f5efe6;
  --muted: rgba(245, 239, 230, 0.58);
  --line: rgba(229, 163, 61, 0.22);
  --danger: #ff9a88;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 0, rgba(140, 54, 23, 0.16), transparent 30rem),
    linear-gradient(160deg, #0d0a0b, #090809);
  color: var(--cream);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.admin-shell {
  width: min(100%, 1440px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.admin-header {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid rgba(245, 200, 107, 0.48);
  border-radius: 10px;
  background: rgba(229, 163, 61, 0.08);
  color: var(--gold-light);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 23px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  letter-spacing: 0.05em;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.ghost-button,
.outline-button,
.primary-button,
.icon-button {
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.ghost-button {
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.ghost-button:hover:not(:disabled) {
  border-color: rgba(229, 163, 61, 0.42);
  color: var(--gold-light);
}

.ghost-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.outline-button {
  padding: 10px 16px;
  border: 1px solid rgba(229, 163, 61, 0.37);
  background: rgba(229, 163, 61, 0.06);
  color: var(--gold-light);
  font-size: 12px;
  white-space: nowrap;
}

.outline-button:hover {
  background: rgba(229, 163, 61, 0.11);
}

.primary-button {
  min-height: 44px;
  padding: 10px 22px;
  border: 1px solid #f4cb76;
  background: linear-gradient(110deg, #d9902c, #f5c86b);
  color: #271707;
  font-weight: 800;
}

.primary-button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.primary-button.compact {
  min-height: 40px;
  padding-inline: 18px;
}

.login-view {
  display: grid;
  min-height: calc(100vh - 88px);
  place-items: center;
  padding: 30px 0;
}

.login-card {
  width: min(100%, 430px);
  padding: 38px;
  border: 1px solid rgba(229, 163, 61, 0.25);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 0, rgba(229, 163, 61, 0.09), transparent 15rem),
    var(--panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

.eyebrow {
  margin: 0;
  color: rgba(229, 163, 61, 0.64);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.25em;
}

.login-card h1,
.dashboard-heading h1 {
  margin: 7px 0 10px;
  color: var(--gold-light);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 31px;
  letter-spacing: 0.04em;
}

.login-card > p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.login-card form {
  display: grid;
  gap: 15px;
  margin-top: 26px;
}

.login-card label {
  display: grid;
  gap: 8px;
  color: var(--cream);
  font-size: 13px;
}

.login-card input,
.search-form input {
  height: 46px;
  padding: 0 13px;
  border: 1px solid rgba(229, 163, 61, 0.28);
  border-radius: 10px;
  outline: none;
  background: #0f0d10;
  color: var(--cream);
}

.login-card input:focus,
.search-form input:focus {
  border-color: rgba(245, 200, 107, 0.7);
  box-shadow: 0 0 0 3px rgba(229, 163, 61, 0.09);
}

.alert {
  padding: 10px 12px;
  border: 1px solid rgba(255, 154, 136, 0.3);
  border-radius: 8px;
  background: rgba(87, 30, 23, 0.3);
  color: var(--danger);
  font-size: 12px;
}

.dashboard {
  padding-top: 38px;
}

.dashboard-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.dashboard-heading h1 {
  font-size: 38px;
}

.dashboard-heading > div:first-child > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.stat-card {
  min-width: 150px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(130deg, rgba(229, 163, 61, 0.08), rgba(22, 19, 25, 0.96));
  text-align: right;
}

.stat-card span,
.stat-card small {
  color: var(--muted);
  font-size: 11px;
}

.stat-card strong {
  display: inline-block;
  margin: 0 5px;
  color: var(--gold-light);
  font-family: Georgia, serif;
  font-size: 30px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 28px 0 13px;
}

.search-form {
  display: flex;
  width: min(100%, 580px);
  gap: 9px;
}

.search-form input {
  flex: 1;
  min-width: 0;
}

.table-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 15px;
  background: rgba(20, 17, 21, 0.86);
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

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

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

td {
  color: rgba(245, 239, 230, 0.77);
}

tbody tr:hover {
  background: rgba(229, 163, 61, 0.035);
}

.registration-number,
.game-id {
  color: var(--gold-light);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.team-name {
  color: var(--cream);
  font-weight: 700;
}

.detail-button {
  padding: 7px 11px;
  border: 1px solid rgba(229, 163, 61, 0.25);
  border-radius: 7px;
  background: transparent;
  color: var(--gold-light);
  cursor: pointer;
}

.empty-state {
  padding: 60px 20px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 11px;
}

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

.pagination span {
  min-width: 48px;
  text-align: center;
}

dialog {
  width: min(92vw, 760px);
  max-height: 88vh;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(229, 163, 61, 0.33);
  border-radius: 18px;
  background: #151216;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.65);
  color: var(--cream);
}

dialog::backdrop {
  background: rgba(5, 5, 7, 0.78);
  backdrop-filter: blur(7px);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 23px 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.dialog-header h2 {
  margin: 5px 0 0;
  color: var(--gold-light);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 27px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: var(--muted);
  font-size: 21px;
}

.detail-content {
  max-height: calc(88vh - 91px);
  padding: 24px;
  overflow-y: auto;
}

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

.detail-summary div {
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.detail-summary span,
.person-row span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.detail-summary strong {
  color: var(--cream);
  font-size: 13px;
}

.person-list {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.person-row {
  padding: 15px;
  border: 1px solid rgba(229, 163, 61, 0.16);
  border-radius: 11px;
  background: rgba(229, 163, 61, 0.025);
}

.person-row h3 {
  margin: 0 0 11px;
  color: var(--gold-light);
  font-size: 14px;
}

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

.person-grid strong {
  color: rgba(245, 239, 230, 0.82);
  font-size: 12px;
  font-weight: 500;
  word-break: break-all;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  padding: 11px 16px;
  border: 1px solid rgba(229, 163, 61, 0.36);
  border-radius: 10px;
  background: #1c1718;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.42);
  color: var(--cream);
  font-size: 12px;
}

@media (max-width: 720px) {
  .admin-shell {
    padding-inline: 14px;
  }

  .admin-header {
    min-height: 74px;
  }

  .brand small,
  #logout-button {
    display: none;
  }

  .login-card {
    padding: 28px 20px;
  }

  .dashboard {
    padding-top: 27px;
  }

  .dashboard-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .stat-card {
    width: 100%;
    text-align: left;
  }

  .toolbar,
  .search-form {
    align-items: stretch;
    flex-direction: column;
  }

  .table-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-summary,
  .person-grid {
    grid-template-columns: 1fr;
  }
}
