/* 最好的五个人 · BEST FIVE —— 独立站样式（浅色，与主站同主题） */
:root {
  --bg: #f2f4f9;
  --panel: #ffffff;
  --panel-2: #eef1f7;
  --line: #d9dee8;
  --text: #1c202a;
  --text-dim: #5d6678;
  --red: #ff4655;
  --green: #14b866;
  --gold: #d99a1b;
  --radius: 12px;
}

html { -webkit-text-size-adjust: 100%; }
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(620px 340px at 12% -2%, rgba(255,70,85,.18), transparent 60%),
    radial-gradient(700px 380px at 90% 4%, rgba(60,120,255,.18), transparent 60%),
    radial-gradient(560px 440px at 50% 116%, rgba(255,70,85,.12), transparent 60%),
    linear-gradient(160deg, #eef1f8 0%, #f4f6fb 55%, #e9eef7 100%);
}

button { cursor: pointer; font-family: inherit; }

/* ---------- Top bar ---------- */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 16px;
  max-width: 1080px; margin: 0 auto; padding: 20px 24px 8px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; justify-self: start; margin-right: auto; }
.brand-mark { font-size: 26px; color: var(--red); text-shadow: 0 0 18px rgba(255,70,85,.6); }
.brand-text h1 { font-size: 22px; letter-spacing: 2px; }
.brand-sub { font-size: 11px; letter-spacing: 4px; color: var(--text-dim); }
.top-actions { display: flex; gap: 8px; align-items: center; justify-self: end; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); font-size: 15px;
  transition: .15s;
}
.icon-btn:hover { border-color: var(--red); color: var(--red); }
.lang-btn { width: auto; min-width: 38px; padding: 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; flex: none; }

.rs-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 14px; border-radius: 999px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); font-size: 13px; letter-spacing: .5px;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.rs-trigger:hover { border-color: var(--red); color: var(--red); }

/* ---------- Layout ---------- */
.layout {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px;
  max-width: 1080px; margin: 12px auto 60px; padding: 0 24px;
  align-items: stretch;
}
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.board-card, .side-card {
  background: rgba(255,255,255,.55);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 34px rgba(20,24,36,.10);
}
.side-card { display: flex; flex-direction: column; }
.side-title { font-size: 13px; letter-spacing: 3px; color: var(--text-dim); margin-bottom: 10px; }
.side-divider { height: 1px; background: var(--line); margin: 18px 0; }
.rule-list { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-dim); }
.rule-list strong { color: var(--text); }

/* ---------- Board meta ---------- */
.board-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.puzzle-label { font-size: 13px; letter-spacing: 2px; color: var(--text-dim); }
.score-box { font-size: 30px; font-weight: 800; color: var(--red); font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.score-box .score-unit { font-size: 13px; font-weight: 600; color: var(--text-dim); margin-left: 2px; }

/* ---------- 题目卡 ---------- */
.target-card {
  padding: 16px;
  margin-bottom: 14px;
  background: linear-gradient(120deg, rgba(255,70,85,.10), rgba(60,120,255,.08));
  border: 1px solid rgba(255,70,85,.35); border-radius: 14px;
}
.tg-name {
  font-size: 22px; font-weight: 800; letter-spacing: 1px; color: var(--red);
  font-variant-caps: all-small-caps;
}
.tg-meta { font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.5; }

/* ---------- 五人格子 ---------- */
.player-area {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 560px) { .player-area { grid-template-columns: repeat(2, 1fr); } .player-area .bf-slot:last-child { grid-column: 1 / -1; } }

/* 移动端：输入框与按钮同步缩窄，避免占满一行 */
@media (max-width: 560px) {
  .guess-bar { gap: 8px; }
  .guess-bar .autocomplete { height: 46px; padding: 0 12px; gap: 7px; }
  .guess-bar input { font-size: 15px; }
  .guess-bar input::placeholder { font-size: 14px; }
  .primary-btn { height: 46px; padding: 0 18px; font-size: 14px; letter-spacing: 0; }
  .suggest-list { top: calc(100% + 6px); }
}

.bf-slot {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-height: 84px; justify-content: center;
  transition: border-color .15s;
}
.bf-slot:hover { border-color: var(--red); }
.bf-idx {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(28,32,42,.10); color: var(--text-dim);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.bf-underline {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 22px; font-weight: 800; letter-spacing: 2px; color: var(--red);
  line-height: 1; word-break: break-all; text-align: center;
  user-select: none;
}
/* 已揭示字母：真实字母用红色高亮，剩余下划线保持淡色 */
.bf-underline .rv { color: var(--red); font-style: normal; }
.bf-underline.lit { color: #b8c0cf; }
.bf-len { font-size: 11px; color: var(--text-dim); white-space: nowrap; }

/* ---------- 输入区 ---------- */
.guess-bar {
  display: flex; gap: 10px; align-items: stretch;
}
/* 输入框本体：带边框/底色/圆角的规范输入框，聚焦时红色描边 */
.guess-bar .autocomplete {
  flex: 1 1 auto; position: relative; min-width: 0;
  display: flex; align-items: center; gap: 9px;
  height: 50px; padding: 0 14px;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(20,24,36,.04);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.guess-bar .autocomplete:hover { border-color: #c3cad8; }
.guess-bar .autocomplete:focus-within {
  border-color: var(--red); background: #fff;
  box-shadow: 0 0 0 3px rgba(255,70,85,.12);
}
.guess-bar .ac-icon { font-size: 16px; color: var(--text-dim); flex: none; line-height: 1; }
.guess-bar .autocomplete:focus-within .ac-icon { color: var(--red); }
.guess-bar input {
  flex: 1; min-width: 0; height: 100%;
  border: none; outline: none; background: transparent;
  font-size: 16px; color: var(--text); padding: 0; font-family: inherit;
}
.guess-bar input::placeholder { color: var(--text-dim); opacity: .65; }
.suggest-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 20;
  max-height: 240px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  display: none; box-shadow: 0 10px 28px rgba(20,24,36,.16);
}
.suggest-list.show { display: block; }
.suggest-item {
  padding: 11px 14px; font-size: 14px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.suggest-item.active, .suggest-item:hover { background: rgba(255,70,85,.15); }
.suggest-item .s-tip { color: var(--text-dim); font-size: 12px; white-space: nowrap; }
.suggest-item .s-val b { color: var(--red); }
.suggest-item + .suggest-item { border-top: 1px solid var(--line); }
.primary-btn {
  flex: none; height: 50px; padding: 0 26px; border: none; border-radius: 12px;
  background: var(--red); color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 1px;
  box-shadow: 0 3px 10px rgba(255,70,85,.28);
  transition: filter .15s, transform .05s, box-shadow .15s;
}
.primary-btn:hover { filter: brightness(1.08); box-shadow: 0 4px 14px rgba(255,70,85,.36); }
.primary-btn:active { transform: scale(.98); }

/* ---------- 反馈 ---------- */
.feedback { min-height: 26px; margin-top: 10px; }
.fb { font-size: 13px; padding: 8px 12px; border-radius: 10px; border: 1px solid transparent; }
.fb.err { background: rgba(255,70,85,.10); color: var(--red); border-color: rgba(255,70,85,.3); }
.fb.ok { background: rgba(20,184,102,.10); color: var(--green); border-color: rgba(20,184,102,.3); }

/* ---------- Footer ---------- */
.board-footer { display: flex; gap: 10px; margin-top: 14px; }
.ghost-btn {
  flex: 1; height: 42px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 13px; letter-spacing: .5px; transition: .15s;
}
.ghost-btn:hover { border-color: var(--red); color: var(--red); }
.ghost-btn:disabled { opacity: .45; cursor: not-allowed; border-color: var(--line); color: var(--text-dim); }
.ghost-btn.danger { color: var(--red); border-color: rgba(255,70,85,.35); }
.ghost-btn.danger:hover { background: rgba(255,70,85,.08); }

/* ---------- 战绩 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-box {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 6px; text-align: center;
}
.stat-box .v { font-size: 20px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-box .k { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.reset-btn {
  margin-top: 14px; width: 100%; height: 34px; border-radius: 8px;
  background: transparent; border: 1px dashed var(--line); color: var(--text-dim); font-size: 12px; letter-spacing: 1px;
  transition: .15s;
}
.reset-btn:hover { color: var(--red); border-color: var(--red); }

/* ---------- Site footer ---------- */
.site-footer {
  position: relative; z-index: 2; text-align: center; padding: 0 16px 34px;
  font-size: 12px; color: var(--text-dim); line-height: 2;
}
.foot-sep { margin: 0 6px; }

/* ---------- Modal ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15,18,26,.5);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 460px; max-height: 86vh; overflow-y: auto;
  background: #fff; border-radius: 16px; padding: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 700; font-size: 16px; }
.help-body { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; color: var(--text); line-height: 1.7; }
.help-body strong { color: var(--red); }

.result-modal { max-width: 420px; }
.result-score { font-size: 48px; font-weight: 800; color: var(--red); text-align: center; font-variant-numeric: tabular-nums; }
.result-text { text-align: center; font-size: 14px; color: var(--text); margin: 6px 0 14px; }
.result-answer {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px;
}
.result-teamline { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.result-logo { width: 38px; height: 38px; object-fit: contain; flex: none; }
.result-logo-text { font-size: 22px; font-weight: 800; color: var(--red); flex: none; }
.result-teamname { font-size: 18px; font-weight: 800; }
.result-teamname em { color: var(--text-dim); font-weight: 600; }
.result-players { display: flex; flex-wrap: wrap; gap: 8px; }
.rp {
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; font-weight: 700; color: var(--text);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  z-index: 60; background: rgba(20,24,36,.85); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); white-space: nowrap;
}

.hidden { display: none !important; }