:root {
  color-scheme: dark;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: #0d1019;
  color: #e7e5e4;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #0d1019; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.site-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(23, 28, 43, .95), #0d1019 42%);
}
.ambient { position: absolute; border-radius: 999px; filter: blur(80px); pointer-events: none; }
.ambient-one { width: 25rem; height: 25rem; top: -14rem; right: -10rem; background: rgba(179, 123, 45, .16); }
.ambient-two { width: 22rem; height: 22rem; top: 22rem; left: -16rem; background: rgba(73, 90, 137, .12); }
.container { position: relative; width: min(100%, 760px); margin: 0 auto; padding: 20px 16px 64px; }
.header, .brand, .leaderboard-toolbar, footer { display: flex; align-items: center; }
.header { justify-content: space-between; gap: 16px; }
.brand { min-width: 0; gap: 12px; }
.brand-copy { min-width: 0; }
.brand-mark {
  display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px;
  border: 1px solid rgba(252, 211, 77, .2); border-radius: 16px;
  color: #fcd34d; background: rgba(252, 211, 77, .1); font-size: 22px;
  box-shadow: 0 8px 30px rgba(212, 153, 63, .12);
}
.eyebrow { margin: 0; color: #78716c; font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.brand h1 { margin: 4px 0 0; overflow: hidden; color: #f5f5f4; font-size: 20px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.admin-button {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto; height: 36px; padding: 0 12px;
  border: 1px solid rgba(255,255,255,.08); border-radius: 12px;
  color: #a8a29e; background: rgba(255,255,255,.04); font-size: 12px; font-weight: 700;
  transition: .2s ease;
}
.admin-button:hover { border-color: rgba(252,211,77,.3); color: #fde68a; }

.champion-card {
  position: relative; display: flex; min-height: 192px; align-items: center; justify-content: space-between;
  margin-top: 28px; overflow: hidden; padding: 24px;
  border: 1px solid rgba(252,211,77,.15); border-radius: 28px; background: #181b27;
  box-shadow: 0 24px 70px rgba(0,0,0,.24);
}
.champion-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 90% 15%, rgba(226,170,78,.2), transparent 38%); }
.champion-card > * { position: relative; z-index: 1; }
.champion-copy { min-width: 0; }
.gold { color: rgba(252,211,77,.75); }
.champion-card h2 { margin: 7px 0 0; color: white; font-size: clamp(24px, 5vw, 30px); font-weight: 900; letter-spacing: -.03em; }
.champion-card p:last-child { max-width: 430px; margin: 10px 0 0; color: #a8a29e; font-size: 14px; line-height: 1.7; }
.trophy-orbit {
  display: grid; place-items: center; flex: 0 0 auto; width: 96px; height: 96px; margin-left: 16px;
  overflow: hidden; border: 1px solid rgba(253,230,138,.15); border-radius: 999px;
  color: #fcd34d; background: rgba(252,211,77,.08); font-size: 40px;
  box-shadow: inset 0 0 40px rgba(226,170,78,.08);
}
.trophy-orbit img { width: 100%; height: 100%; object-fit: cover; }

.leaderboard-section { margin-top: 20px; }
.leaderboard-toolbar { align-items: flex-end; justify-content: space-between; gap: 16px; }
.ranking-note { margin: 5px 0 0; color: #78716c; font-size: 12px; }
.tab-switch { display: flex; height: 40px; padding: 4px; border: 1px solid rgba(255,255,255,.07); border-radius: 12px; background: rgba(255,255,255,.04); }
.tab-trigger { min-width: 64px; height: 30px; padding: 0 12px; border: 0; border-radius: 8px; color: #78716c; background: transparent; font-size: 12px; }
.tab-trigger.active { color: #17140d; background: #fcd34d; box-shadow: 0 5px 18px rgba(220,166,76,.2); }
.ranking-card { margin-top: 16px; overflow: hidden; border: 1px solid rgba(255,255,255,.07); border-radius: 24px; background: rgba(255,255,255,.035); box-shadow: 0 16px 50px rgba(0,0,0,.16); }
.table-head { display: grid; grid-template-columns: 1fr auto; padding: 12px 20px; border-bottom: 1px solid rgba(255,255,255,.06); color: #57534e; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.ranking-list { margin: 0; padding: 0; list-style: none; }
.ranking-row { display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; border-bottom: 1px solid rgba(255,255,255,.06); transition: background .2s; }
.ranking-row:last-child { border-bottom: 0; }
.ranking-row:hover { background: rgba(255,255,255,.035); }
.player-cell { display: flex; min-width: 0; align-items: center; gap: 12px; }
.rank-number { display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; color: #57534e; font-size: 12px; font-weight: 800; }
.rank-1 { color: #fcd34d; } .rank-2 { color: #d6d3d1; } .rank-3 { color: #fb923c; }
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; color: #a8a29e; background: rgba(255,255,255,.05); font-size: 10px; font-weight: 800; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.player-copy { min-width: 0; }
.player-name { margin: 0; overflow: hidden; color: #f5f5f4; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.player-wins { margin: 3px 0 0; color: #78716c; font-size: 12px; }
.score { flex: 0 0 auto; padding: 6px 12px; border-radius: 12px; color: #fde68a; background: rgba(252,211,77,.08); font-variant-numeric: tabular-nums; }
.loading-row, .empty-row { display: grid; min-height: 224px; place-items: center; padding: 24px; color: #78716c; font-size: 13px; text-align: center; }
footer { flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.06); color: #57534e; font-size: 12px; }

.admin-dialog { width: min(calc(100% - 28px), 520px); max-height: 92vh; overflow-y: auto; padding: 24px; border: 1px solid rgba(255,255,255,.09); border-radius: 24px; color: #e7e5e4; background: #171b27; box-shadow: 0 30px 90px rgba(0,0,0,.6); }
.admin-dialog::backdrop { background: rgba(4,6,12,.76); backdrop-filter: blur(5px); }
.dialog-close-form { position: absolute; top: 14px; right: 14px; }
.icon-button { display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 10px; color: #a8a29e; background: transparent; font-size: 22px; }
.icon-button:hover { background: rgba(255,255,255,.06); }
.dialog-header h2 { margin: 0; color: #f5f5f4; font-size: 19px; }
.dialog-header p { margin: 6px 0 22px; color: #78716c; font-size: 13px; }
.field-label { display: grid; gap: 8px; color: #a8a29e; font-size: 12px; font-weight: 700; }
.field-control { width: 100%; min-height: 40px; margin-top: 7px; padding: 8px 11px; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; outline: none; color: #f5f5f4; background: rgba(255,255,255,.04); }
.field-control:focus { border-color: rgba(252,211,77,.5); box-shadow: 0 0 0 2px rgba(252,211,77,.13); }
.admin-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 18px 0; padding: 4px; border: 1px solid rgba(255,255,255,.07); border-radius: 12px; background: rgba(255,255,255,.04); }
.admin-tab { height: 32px; border: 0; border-radius: 8px; color: #78716c; background: transparent; font-size: 12px; }
.admin-tab.active { color: #f5f5f4; background: rgba(255,255,255,.08); }
.admin-panel { display: grid; gap: 16px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.winner-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; max-height: 248px; margin-top: 9px; overflow-y: auto; padding: 8px; border: 1px solid rgba(255,255,255,.07); border-radius: 12px; background: rgba(0,0,0,.1); }
.winner-choice { display: flex; min-width: 0; align-items: center; gap: 7px; padding: 8px; border-radius: 8px; color: #a8a29e; font-size: 12px; }
.winner-choice:has(input:checked) { color: #fef3c7; background: rgba(252,211,77,.1); }
.winner-choice span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.primary-button { width: 100%; height: 40px; border: 0; border-radius: 12px; color: #21190b; background: #fcd34d; font-size: 13px; font-weight: 800; }
.primary-button:disabled { cursor: wait; opacity: .55; }
.player-names { min-height: 144px; resize: vertical; }
.helper-text { margin: -5px 0 0; color: #78716c; font-size: 12px; line-height: 1.6; }
.status-message { margin: 14px 0 0; padding: 9px 12px; border: 1px solid rgba(252,211,77,.15); border-radius: 12px; color: #fef3c7; background: rgba(252,211,77,.08); font-size: 12px; line-height: 1.6; }
.hidden { display: none !important; }

@media (max-width: 560px) {
  .admin-label { display: none; }
  .champion-card { min-height: 176px; }
  .trophy-orbit { width: 76px; height: 76px; font-size: 32px; }
  .winner-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 410px) {
  .brand h1 { max-width: 205px; font-size: 17px; }
  .champion-card { padding: 21px; }
  .trophy-orbit { width: 62px; height: 62px; margin-left: 10px; }
  .ranking-row { padding-inline: 14px; }
  .field-grid { grid-template-columns: 1fr; }
}
