:root {
  /* 各游戏的标识色：卡片顶部细条用 */
  --g-maimai: #ff9fd0;
  --g-chunithm: #ffd166;
  --g-phigros: #9be7ff;
  --g-arcaea: #c6a8ff;
  --g-osu: #ffb3c1;
  --g-malody: #a8f0c6;
  --g-other: #c3cddd;
}

/* ============================================================================
   战队成绩 · 列表与录入
   ----------------------------------------------------------------------------
   卡片墙按游戏着色，筛选条固定在页头下方。
   ========================================================================== */

.scores-page {
  padding-block: clamp(36px, 5vw, 68px);
}

/* --- 页头 ---------------------------------------------------------------- */
.scores-head {
  margin-bottom: clamp(24px, 3vw, 36px);
}
.scores-head__kicker {
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  color: var(--cyan);
  font-weight: 700;
  margin-bottom: 10px;
}
.scores-head h1 {
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  margin-bottom: 10px;
}
.scores-head p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.8;
  max-width: 60ch;
}
.scores-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* --- 筛选条 -------------------------------------------------------------- */
.scores-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 16px 18px;
  margin-bottom: clamp(20px, 3vw, 30px);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  background: rgba(12, 18, 34, 0.55);
}
.scores-filter .field {
  min-width: 130px;
  gap: 6px;
}
.scores-filter select,
.scores-filter input {
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 20, 0.72);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
}
.scores-filter select:focus,
.scores-filter input:focus {
  outline: none;
  border-color: rgba(127, 216, 255, 0.5);
}
.scores-filter__count {
  margin-left: auto;
  font-size: 0.8rem;
  color: rgba(148, 166, 198, 0.75);
  padding-bottom: 8px;
}

/* --- 卡片墙 -------------------------------------------------------------- */
.scores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.score-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: linear-gradient(165deg, rgba(20, 30, 54, 0.7), rgba(9, 13, 24, 0.8));
  overflow: hidden;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.score-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

/* 顶部一条游戏色 */
.score-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--game-color, var(--cyan));
}

.score-card__top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 游戏标签 */
.game-tag {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #0b1020;
  background: var(--game-color, var(--cyan));
}
.game-tag--maimai   { --game-color: #ff9fd0; }
.game-tag--chunithm { --game-color: #ffd166; }
.game-tag--phigros  { --game-color: #9be7ff; }
.game-tag--arcaea   { --game-color: #c6a8ff; }
.game-tag--osu      { --game-color: #ffb3c1; }
.game-tag--malody   { --game-color: #a8f0c6; }
.game-tag--other    { --game-color: #c3cddd; }

.score-card__flag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 700;
  border: 1px solid rgba(127, 216, 255, 0.3);
  color: var(--cyan);
  background: rgba(127, 216, 255, 0.08);
}
.score-card__flag--ap {
  border-color: rgba(255, 207, 107, 0.4);
  color: var(--gold);
  background: rgba(255, 207, 107, 0.1);
}

.score-card__title {
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
  color: #e8f1ff;
  word-break: break-word;
}
.score-card__artist {
  font-size: 0.78rem;
  color: rgba(148, 166, 198, 0.8);
  margin-top: -6px;
}

.score-card__diff {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}
.score-card__diff b {
  color: #c3d3ea;
  font-weight: 600;
}

.score-card__score {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 2px;
}
.score-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.score-card__rank {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
}
.score-card__acc {
  font-size: 0.78rem;
  color: var(--muted);
}

.score-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.76rem;
  color: rgba(148, 166, 198, 0.8);
}
.score-card__foot a {
  color: var(--cyan);
}

/* --- 空状态 / 加载 ------------------------------------------------------- */
.scores-empty {
  grid-column: 1 / -1;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}

/* --- 录入表单 ------------------------------------------------------------ */
.score-form {
  display: grid;
  gap: 16px;
  max-width: 720px;
  padding: clamp(20px, 3vw, 28px);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(12, 18, 34, 0.6);
}
.score-form .field {
  gap: 7px;
}
.score-form select,
.score-form input,
.score-form textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 20, 0.72);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
}
.score-form select:focus,
.score-form input:focus {
  outline: none;
  border-color: rgba(127, 216, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(127, 216, 255, 0.12);
}
.score-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.score-form__checks {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.score-form__checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: #b9cbe8;
  cursor: pointer;
}
.score-form__checks input {
  width: 16px;
  height: 16px;
  accent-color: var(--cyan);
}

.scores-login {
  padding: 40px 24px;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(12, 18, 34, 0.6);
}
.scores-login p {
  color: var(--muted);
  margin-bottom: 18px;
}

@media (max-width: 620px) {
  .scores-grid {
    grid-template-columns: 1fr;
  }
  .score-form__row {
    grid-template-columns: 1fr;
  }
  .scores-filter__count {
    margin-left: 0;
  }
}

/* --- Phigros 同步卡片 ---------------------------------------------------- */
.phi-sync {
  margin-bottom: 24px;
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(155, 231, 255, 0.22);
  background: linear-gradient(160deg, rgba(20, 40, 60, 0.5), rgba(9, 13, 24, 0.65));
}
.phi-sync__head h2 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}
.phi-sync__head p {
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 14px;
}
.phi-sync__how {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 14px;
}
.phi-sync__how summary {
  cursor: pointer;
  color: var(--cyan);
  margin-bottom: 8px;
}
.phi-sync__how ol {
  margin: 0 0 8px 1.2em;
  line-height: 1.9;
}
.phi-sync__how code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(127, 216, 255, 0.1);
  color: #bfe6ff;
  font-size: 0.86em;
}
.phi-sync__warn {
  color: rgba(255, 207, 107, 0.85);
}
.phi-sync__row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.phi-sync__row input {
  flex: 1 1 240px;
  padding: 9px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 20, 0.72);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
}
.phi-sync__row input:focus {
  outline: none;
  border-color: rgba(127, 216, 255, 0.5);
}
.phi-msg {
  margin-top: 10px;
  font-size: 0.82rem;
  min-height: 1.2em;
}
.phi-msg[data-state="error"] { color: #ff9a9a; }
.phi-msg[data-state="ok"] { color: #9be7c4; }


/* --- 单曲 RKS（金色加粗带阴影）------------------------------------------ */
.score-card__rks {
  margin-left: auto;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #ffd76a;
  text-shadow: 0 0 8px rgba(255, 199, 64, 0.55), 0 1px 2px rgba(0, 0, 0, 0.85);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* --- 卡片边框：定数 ≥17.0 且 AP → 金；定数 ≥17.9 → 彩色 ---------------- */
.score-card--gold::before {
  height: 4px;
  background: linear-gradient(90deg, #ffe08a, #ffc93c, #ffb300, #ffc93c, #ffe08a);
  box-shadow: 0 0 12px rgba(255, 199, 64, 0.55);
}

.score-card--rainbow::before {
  height: 4px;
  background: linear-gradient(90deg, #ff5f6d, #ffc371, #ffe66d, #6ee7b7, #7fd8ff, #a78bfa, #ff5f6d);
  background-size: 200% 100%;
  animation: rainbow-slide 4s linear infinite;
  box-shadow: 0 0 14px rgba(167, 139, 250, 0.55);
}

@keyframes rainbow-slide {
  from { background-position: 0% 50%; }
  to   { background-position: 200% 50%; }
}

.score-card--gold,
.score-card--rainbow {
  border-color: rgba(255, 199, 64, 0.28);
}

.score-card--rainbow {
  border-color: rgba(167, 139, 250, 0.28);
}

/* --- RKS 总和：按区间变色 ------------------------------------------------ */
.rks-total {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.rks-total__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: rgba(148, 166, 198, 0.8);
  text-transform: uppercase;
}

.rks-total__value {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: -0.02em;
}

/* ≤ 16.00 白 */
.rks-total[data-tier="white"] .rks-total__value {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
}
/* 16.01 - 16.99 淡蓝 */
.rks-total[data-tier="blue"] .rks-total__value {
  color: #8fd3ff;
  text-shadow: 0 0 12px rgba(143, 211, 255, 0.45);
}
/* 17.00 - 17.10 淡紫 */
.rks-total[data-tier="purple"] .rks-total__value {
  color: #c9b3ff;
  text-shadow: 0 0 12px rgba(201, 179, 255, 0.5);
}
/* 17.11 - 17.29 金色 */
.rks-total[data-tier="gold"] .rks-total__value {
  color: #ffd76a;
  text-shadow: 0 0 14px rgba(255, 199, 64, 0.65), 0 1px 2px rgba(0, 0, 0, 0.8);
}
/* ≥ 17.30 彩虹 */
.rks-total[data-tier="rainbow"] .rks-total__value {
  background: linear-gradient(90deg, #ff5f6d, #ffc371, #ffe66d, #6ee7b7, #7fd8ff, #a78bfa);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbow-slide 4s linear infinite;
  filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.55));
}

/* --- 同步结果里的 RKS 大字号 -------------------------------------------- */
.phi-result {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 12px;
}
.phi-result .rks-total__value {
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.phi-result[data-tier="white"] .rks-total__value { color: #fff; text-shadow: 0 0 10px rgba(255,255,255,.35); }
.phi-result[data-tier="blue"] .rks-total__value { color: #8fd3ff; text-shadow: 0 0 12px rgba(143,211,255,.45); }
.phi-result[data-tier="purple"] .rks-total__value { color: #c9b3ff; text-shadow: 0 0 12px rgba(201,179,255,.5); }
.phi-result[data-tier="gold"] .rks-total__value { color: #ffd76a; text-shadow: 0 0 14px rgba(255,199,64,.65), 0 1px 2px rgba(0,0,0,.8); }
.phi-result[data-tier="rainbow"] .rks-total__value {
  background: linear-gradient(90deg,#ff5f6d,#ffc371,#ffe66d,#6ee7b7,#7fd8ff,#a78bfa);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: rainbow-slide 4s linear infinite;
  filter: drop-shadow(0 0 8px rgba(167,139,250,.55));
}

/* 卡片右上角的上传者 */
.score-card__owner {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 9px;
  border-radius: 999px;
  color: #b9cbe8;
  background: rgba(127, 216, 255, 0.08);
  border: 1px solid rgba(127, 216, 255, 0.16);
  /* 至少放得下 12 个字母/数字再加省略号；中文按两倍宽算也够用 */
  max-width: min(62%, 18ch);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* --- 自己的成绩：编辑 / 删除 -------------------------------------------- */
.score-card__actions {
  display: inline-flex;
  gap: 8px;
  margin-left: auto;
}
.score-mini-btn {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(127, 216, 255, 0.3);
  background: rgba(127, 216, 255, 0.08);
  color: #9fd8ff;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.score-mini-btn:hover {
  background: rgba(127, 216, 255, 0.2);
  color: #fff;
}
.score-mini-btn--danger {
  border-color: rgba(255, 120, 120, 0.35);
  background: rgba(255, 120, 120, 0.08);
  color: #ffb3b3;
}
.score-mini-btn--danger:hover {
  background: rgba(255, 120, 120, 0.2);
  color: #fff;
}

/* --- 编辑弹层 ------------------------------------------------------------ */
.score-editor-mask {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  background: rgba(4, 7, 14, 0.72);
  backdrop-filter: blur(4px);
}
.score-editor-mask[hidden] {
  display: none;
}
.score-editor {
  width: min(92vw, 380px);
  padding: 22px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(12, 18, 32, 0.98);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.score-editor h3 {
  font-size: 1rem;
  color: #e8f1ff;
}
.score-editor label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  color: rgba(180, 200, 225, 0.85);
}
.score-editor input[type="number"] {
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(6, 10, 20, 0.8);
  color: #e8f1ff;
  font-size: 0.9rem;
}
.score-editor__check {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}
.score-editor__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

/* --- 录入页的公开开关 ---------------------------------------------------- */
.submit-public {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(127, 216, 255, 0.06);
  font-size: 0.82rem;
  color: #c6d6ee;
  cursor: pointer;
}
.submit-public input {
  width: 16px;
  height: 16px;
  accent-color: #7fdcff;
}


/* --- 舞萌 Best 50 ---------------------------------------------------------- */
.b50 {
  margin: 22px 0 26px;
  padding: 18px 18px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(10, 16, 30, 0.72);
}
.b50__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.b50__head h2 {
  font-size: 1.05rem;
  color: #e8f1ff;
}
.b50__rating {
  font-size: 0.82rem;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}
.b50__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}
.b50__row {
  display: grid;
  grid-template-columns: 26px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 7px 6px;
  border-radius: 8px;
  border-bottom: 1px solid rgba(127, 216, 255, 0.06);
}
.b50__row:hover {
  background: rgba(127, 216, 255, 0.05);
}
.b50__row--new .b50__rank {
  color: #ffd76a;
}
.b50__rank {
  font-size: 0.72rem;
  color: rgba(150, 170, 200, 0.7);
  font-variant-numeric: tabular-nums;
}
.b50__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.b50__title {
  font-size: 0.86rem;
  color: #e2ecff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.b50__meta {
  font-size: 0.7rem;
  color: rgba(150, 170, 200, 0.65);
}
.b50__acc {
  font-size: 0.76rem;
  color: rgba(190, 210, 235, 0.9);
  font-variant-numeric: tabular-nums;
}
.b50__ra {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  text-align: right;
}
.b50__empty {
  padding: 12px 4px;
  font-size: 0.8rem;
  color: rgba(160, 180, 210, 0.7);
}

@media (max-width: 560px) {
  .b50 {
    padding: 14px 12px 6px;
  }
  .b50__row {
    grid-template-columns: 22px 1fr auto auto;
    gap: 6px;
  }
  .b50__acc {
    font-size: 0.7rem;
  }
}
