:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #273449;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --win: #22c55e;
  --lose: #ef4444;
  --draw: #eab308;
  --accent: #38bdf8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at top, #1e293b 0%, var(--bg) 70%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}

.app {
  width: 100%;
  max-width: 420px;
}

.title {
  text-align: center;
  font-size: 28px;
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  text-align: center;
  color: var(--muted);
  margin: 8px 0 20px;
  font-size: 14px;
}

/* 得分面板 */
.scoreboard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.score-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 4px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.score-card.bump {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.score-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.score-value {
  font-size: 22px;
  font-weight: 700;
}

.win-streak .score-value { color: var(--win); }
.lose-streak .score-value { color: var(--lose); }

/* 对局区 */
.arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.spot {
  text-align: center;
}

.spot-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.spot-value {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 28px;
  min-height: 40px;
  border-radius: 12px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.25);
}

.versus {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
}

/* 结果 */
.result {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin: 8px 0 20px;
  min-height: 28px;
  white-space: nowrap;
}

.result.win { color: var(--win); }
.result.lose { color: var(--lose); }
.result.draw { color: var(--draw); }

/* 按钮 */
.choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.choice {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 18px 8px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.12s ease, border-color 0.12s ease,
    background 0.12s ease;
}

.choice:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  background: var(--panel-2);
}

.choice:active {
  transform: translateY(0);
}

.choice-icon {
  font-size: 34px;
}

.choice-name {
  font-size: 14px;
}

.choice.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* 记录区 */
.history {
  background: var(--panel);
  border-radius: 16px;
  padding: 16px;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-head h2 {
  font-size: 16px;
  color: var(--muted);
  font-weight: 600;
}

.clear-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.clear-btn:hover {
  color: var(--text);
  border-color: var(--lose);
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 2px;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 12px;
}

/* 出拳小格：颜色代表胜负 */
.cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 20px;
  border: 2px solid transparent;
  background: var(--panel-2);
  transition: transform 0.1s ease;
}

.cell:hover {
  transform: scale(1.08);
}

.cell.win {
  border-color: var(--win);
  background: rgba(34, 197, 94, 0.18);
}

.cell.lose {
  border-color: var(--lose);
  background: rgba(239, 68, 68, 0.18);
}

.cell.draw {
  border-color: var(--draw);
  background: rgba(234, 179, 8, 0.18);
}

.history-legend {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.history-legend .win { color: var(--win); }
.history-legend .lose { color: var(--lose); }
.history-legend .draw { color: var(--draw); }

/* 代币余额 */
.wallet {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  color: #1f2937;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.3);
}

.bal {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bal-label {
  font-weight: 700;
  font-size: 14px;
}

.bal-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  transition: transform 0.15s ease;
}

.bal-value.bump {
  transform: scale(1.2);
}

.bal-hint {
  font-size: 12px;
  color: rgba(31, 41, 55, 0.75);
  margin-top: 6px;
}

/* 代币说明 */
.rules {
  margin-top: 16px;
  background: var(--panel);
  border-radius: 16px;
  padding: 16px;
}

.rules h2 {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
}

.rules ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.rules .positive { color: var(--win); }
.rules .negative { color: var(--lose); }
.rules .muted { color: var(--muted); font-size: 12px; }

@media (max-width: 360px) {
  .scoreboard { grid-template-columns: repeat(3, 1fr); }
}

/* 连胜排行榜 */
.leaderboard {
  background: var(--panel);
  border-radius: 16px;
  padding: 16px;
  margin-top: 16px;
}

.leaderboard-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.leaderboard-head h2 {
  font-size: 16px;
  color: var(--muted);
  font-weight: 600;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding: 2px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  white-space: nowrap;
}

.lb-row.top-1 {
  border: 1px solid var(--draw);
  box-shadow: 0 0 12px rgba(234, 179, 8, 0. 25);
}

.lb-rank {
  flex: 0 0 auto;
  width: 36px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  color: var(--muted);
}

.lb-row.top-1 .lb-rank { color: var(--draw); }
.lb-row.top-2 .lb-rank { color: #cbd5e1; }
.lb-row.top-3 .lb-rank { color: #d97706; }

.lb-streak {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  color: var(--win);
}

.lb-loc {
  flex: 0 0 auto;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.lb-date {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
}

.lb-date {
  font-size: 12px;
  color: var(--muted);
}
