:root {
  --bg: #0b1020;
  --surface: #131b31;
  --surface-raised: #1a2540;
  --surface-soft: #202e4d;
  --line: #31415f;
  --text: #f5f8ff;
  --muted: #aebbd3;
  --blue: #4ca3ff;
  --violet: #8b6cff;
  --green: #4dd6a3;
  --gold: #ffd166;
  --danger: #ff6e7f;
  --shadow: 0 20px 54px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  background:
    radial-gradient(circle at 11% 2%, rgba(76, 163, 255, 0.2), transparent 28%),
    radial-gradient(circle at 88% 5%, rgba(139, 108, 255, 0.18), transparent 28%),
    var(--bg);
}

button, input { font: inherit; }
button { border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); font-size: 13px; }

.topbar { border-bottom: 1px solid rgba(174, 187, 211, 0.14); }
.topbar-inner {
  width: min(1100px, calc(100% - 48px));
  min-height: 250px;
  margin: 0 auto;
  padding: 58px 0 48px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 42px;
}
.eyebrow, .section-label { color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: 0.16em; }
.eyebrow { display: flex; align-items: center; gap: 8px; }
.eyebrow span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); }
.brand-copy h1 { margin-top: 12px; font-size: clamp(38px, 5vw, 58px); letter-spacing: -0.06em; }
.subtitle { max-width: 540px; margin-top: 15px; color: var(--muted); font-size: 15px; }
.stats { display: flex; gap: 10px; }
.stat { min-width: 96px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: rgba(19, 27, 49, 0.7); }
.stat strong { display: block; color: var(--text); font-size: 18px; }
.stat span { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; }

.container {
  width: min(1100px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 68px;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.sidebar { position: sticky; top: 24px; }
.content-area { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.card { padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: rgba(19, 27, 49, 0.92); box-shadow: var(--shadow); }
.card h2 { margin-top: 6px; font-size: 22px; letter-spacing: -0.03em; }

.add-form { margin-top: 24px; display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label:first-child { color: var(--muted); font-size: 13px; font-weight: 700; }
.field input[type="text"], .search-section input {
  width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); outline: 0; background: #0e1527; transition: border-color 0.18s, box-shadow 0.18s;
}
.field input[type="text"]:focus, .search-section input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(76, 163, 255, 0.16); }
.field input::placeholder, .search-section input::placeholder { color: #7886a1; }
.avatar-file-input { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.avatar-file-input:focus-visible + .avatar-uploader { outline: 3px solid var(--blue); outline-offset: 4px; }
.avatar-uploader {
  width: 92px; height: 92px; display: grid; place-items: center; overflow: hidden; border: 2px dashed #52678f; border-radius: 50%;
  color: var(--muted); text-align: center; background: linear-gradient(145deg, #1e2b47, #10182a); cursor: pointer; transition: border-color 0.18s, transform 0.18s;
}
.avatar-uploader:hover { border-color: var(--blue); transform: translateY(-2px); }
.avatar-uploader img { width: 100%; height: 100%; display: none; object-fit: cover; }
.avatar-uploader img.show { display: block; }
.avatar-uploader span { font-size: 12px; line-height: 1.35; }
.avatar-uploader span.hide { display: none; }

.btn { min-height: 45px; padding: 11px 16px; border-radius: 10px; font-size: 14px; font-weight: 800; transition: transform 0.18s, box-shadow 0.18s, background 0.18s; }
.btn-primary { color: #071121; background: linear-gradient(115deg, var(--blue), #73c7ff); box-shadow: 0 8px 22px rgba(76, 163, 255, 0.25); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(76, 163, 255, 0.34); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { color: var(--text); border: 1px solid var(--line); background: var(--surface-soft); }
.btn-ghost:hover { background: #293b60; }
.msg { min-height: 18px; font-size: 13px; font-weight: 700; }
.msg.error { color: var(--danger); }
.msg.success { color: var(--green); }

.search-section input { padding-left: 44px; background-image: linear-gradient(45deg, transparent 45%, var(--muted) 47%, var(--muted) 54%, transparent 56%), radial-gradient(circle, transparent 44%, var(--muted) 47%, var(--muted) 53%, transparent 56%); background-position: 29px 29px, 15px 13px; background-size: 9px 9px, 18px 18px; background-repeat: no-repeat; }
.ranking-header { margin-bottom: 18px; padding-bottom: 17px; display: flex; align-items: end; justify-content: space-between; border-bottom: 1px solid var(--line); }
.ranking-header h2 { margin-top: 6px; }
.rank-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.rank-item { position: relative; min-height: 76px; padding: 12px 16px; display: flex; align-items: center; gap: 13px; overflow: hidden; border: 1px solid transparent; border-radius: 12px; background: var(--surface-raised); transition: transform 0.18s, border-color 0.18s, background 0.18s; }
.rank-item:hover { border-color: #5278b9; background: #202e4e; transform: translateX(3px); }
.rank-item::after { content: "赠送礼物"; margin-left: auto; padding: 5px 9px; border-radius: 7px; color: var(--blue); background: rgba(76, 163, 255, 0.1); font-size: 11px; font-weight: 800; opacity: 0; transition: opacity 0.18s; }
.rank-item:hover::after, .rank-item:focus-visible::after { opacity: 1; }
.rank-index { width: 36px; height: 36px; display: grid; place-items: center; flex-shrink: 0; border-radius: 10px; color: var(--muted); background: #283653; font-weight: 900; }
.top-1 .rank-index { color: #332600; background: var(--gold); }
.top-2 .rank-index { color: #19212f; background: #c6d1dc; }
.top-3 .rank-index { color: #29150c; background: #d89568; }
.rank-avatar { width: 48px; height: 48px; flex-shrink: 0; border: 2px solid #52678f; border-radius: 50%; object-fit: cover; background: #263552; }
.top-1 .rank-avatar { border-color: var(--gold); }
.rank-info { min-width: 0; flex: 1; }
.rank-name { overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.rank-score { margin-top: 3px; color: var(--muted); font-size: 12px; }
.rank-score .num { margin-left: 3px; color: var(--blue); font-size: 16px; font-weight: 900; }
.empty { padding: 54px 0 34px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); text-align: center; }
.empty-icon { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--gold); font-size: 20px; }
.empty.hidden { display: none; }

.modal-mask { position: fixed; inset: 0; z-index: 100; padding: 16px; display: flex; align-items: center; justify-content: center; background: rgba(2, 6, 16, 0.76); backdrop-filter: blur(8px); }
.modal-mask.hidden { display: none; }
.modal { position: relative; width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto; padding: 28px; border: 1px solid #40567f; border-radius: 18px; background: var(--surface); box-shadow: 0 26px 80px rgba(0,0,0,0.48); }
.modal-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; display: grid; place-items: center; margin: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 22px; }
.modal-close:hover { color: var(--text); background: var(--surface-soft); }
.modal-header { margin-bottom: 22px; padding-bottom: 20px; display: flex; align-items: center; gap: 15px; border-bottom: 1px solid var(--line); }
.modal-header img { width: 68px; height: 68px; border: 2px solid #52678f; border-radius: 50%; object-fit: cover; background: #263552; }
.modal-header h3 { margin-top: 3px; font-size: 22px; }
.modal h4 { margin-bottom: 14px; font-size: 16px; }
.gift-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gift-btn { min-height: 102px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: var(--surface-raised); font-size: 12px; transition: transform 0.18s, border-color 0.18s, background 0.18s; }
.gift-btn:hover { border-color: var(--blue); background: #243557; transform: translateY(-3px); }
.gift-emoji { font-size: 30px; }.gift-points { color: var(--green); font-size: 14px; font-weight: 900; }
.bump { display: inline-block; animation: bump 0.4s ease; } @keyframes bump { 50% { transform: scale(1.35); color: var(--green); } }

.crop-title { margin-top: 5px; font-size: 22px; }.crop-hint { margin-top: 3px; margin-bottom: 18px; }
.crop-body { margin-bottom: 20px; display: flex; align-items: flex-start; gap: 20px; }.crop-stage { position: relative; flex: 1; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #0e1527; cursor: grab; touch-action: none; user-select: none; }.crop-stage:active { cursor: grabbing; }
.crop-stage::after { content: ""; position: absolute; inset: 9%; z-index: 2; border: 1px dashed rgba(255,255,255,0.8); border-radius: 50%; box-shadow: 0 0 0 100vmax rgba(0,0,0,0.2); pointer-events: none; }
#crop-image { position: absolute; left: 0; top: 0; max-width: none; max-height: none; pointer-events: none; will-change: transform; }
.crop-preview-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }.crop-preview { width: 88px; height: 88px; border: 2px solid #52678f; border-radius: 50%; background: #263552 center / cover; }.crop-actions { display: flex; justify-content: flex-end; gap: 12px; }
@media (max-width: 820px) {
  .topbar-inner { min-height: auto; padding: 42px 0; flex-direction: column; align-items: flex-start; gap: 28px; }
  .stats { width: 100%; }.stat { flex: 1; }
  .container { grid-template-columns: 1fr; }.sidebar { position: static; }
}
@media (max-width: 520px) {
  .topbar-inner, .container { width: calc(100% - 28px); }.topbar-inner { padding: 32px 0; }.brand-copy h1 { font-size: 37px; }.subtitle { font-size: 14px; }.stat { min-width: 0; padding: 11px 9px; }.stat strong { font-size: 15px; }.stat span { font-size: 10px; }
  .container { padding-top: 20px; gap: 14px; }.card, .modal { padding: 20px; }.ranking-header { align-items: center; }.rank-item { padding: 11px; gap: 10px; }.rank-item::after { display: none; }.rank-info { min-width: 0; }.crop-body { flex-direction: column; align-items: center; }.crop-stage { width: 100%; max-width: 290px; }.gift-btn { min-height: 92px; }.gift-emoji { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; } }
