* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  background: #f7f7f9;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
body { padding-bottom: 40px; }

.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center;
  height: 52px; padding: 0 14px;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid #eee;
}
.nav-back {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; margin-right: 6px;
  border-radius: 50%; color: #6b6b6b; cursor: pointer;
}
.nav-back:active { background: #f5f5f5; }
.nav-title { font-size: 16px; font-weight: 700; }

.need-login {
  padding: 100px 20px; text-align: center; color: #9a9a9a;
}
.need-login button {
  margin-top: 16px; padding: 10px 24px;
  background: #ff2442; color: #fff; border: 0;
  border-radius: 22px; font-size: 15px;
}

/* 游戏 */
.game {
  margin: 14px; padding: 16px;
  background: #fff; border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.game-tip { font-size: 13px; color: #6b6b6b; margin-bottom: 12px; }
.legend { margin-top: 6px; font-size: 12px; color: #9a9a9a; display: flex; gap: 14px; }
.legend .dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.legend .dot.green { background: #4caf50; }
.legend .dot.yellow { background: #f5b32f; }

.input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.input-row input {
  flex: 1; height: 44px; padding: 0 14px;
  border: 1.5px solid #e4e4e4; border-radius: 10px;
  font-size: 20px; letter-spacing: 8px; text-align: center;
  font-family: monospace;
}
.input-row input:focus { outline: none; border-color: #ff2442; }
.input-row button {
  min-width: 70px; padding: 0 16px;
  background: #ff2442; color: #fff; border: 0;
  border-radius: 10px; font-size: 15px; font-weight: 600;
}
.input-row button:disabled { background: #e0e0e0; }

.status { font-size: 12px; color: #9a9a9a; margin-bottom: 12px; text-align: center; }

.history { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.history-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; background: #fafafa; border-radius: 8px;
}
.chars { display: flex; gap: 6px; }
.ch {
  width: 32px; height: 32px; line-height: 32px;
  text-align: center; border-radius: 8px;
  background: #ececec; color: #6b6b6b; font-weight: 700;
  font-family: monospace; font-size: 16px;
}
.ch.green { background: #4caf50; color: #fff; }
.ch.yellow { background: #f5b32f; color: #fff; }
.meta { font-size: 12px; color: #9a9a9a; }

.actions { text-align: center; }
.actions .primary {
  padding: 12px 32px; border: 0; border-radius: 24px;
  background: #ff2442; color: #fff; font-size: 15px; font-weight: 600;
}

/* 榜单 */
.board {
  margin: 0 14px 14px;
  background: #fff; border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.board-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.board-list { display: flex; flex-direction: column; gap: 6px; }
.board-empty { color: #9a9a9a; font-size: 13px; padding: 8px 0; }
.board-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 6px 0;
  border-bottom: 1px solid #f3f3f3;
}
.board-row:last-child { border-bottom: 0; }
.board-row .rk {
  width: 22px; height: 22px; line-height: 22px;
  border-radius: 50%; text-align: center;
  font-weight: 700; font-size: 12px;
  background: #f0f0f0; color: #6b6b6b;
}
.board-row .rk1 { background: #ffd76a; color: #7a5b00; }
.board-row .rk2 { background: #d8d8d8; color: #5a5a5a; }
.board-row .rk3 { background: #ffcc99; color: #7a4b00; }
.board-row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .sc { font-weight: 700; color: #ff2442; }
.board-row .tm { color: #9a9a9a; font-size: 12px; }
.board-row.me { background: #fff5f7; border-radius: 8px; padding: 6px 8px; }

/* 骨架占位 */
.board-skeleton { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.sk-row { display: flex; align-items: center; gap: 10px; }
.sk-circle {
  width: 22px; height: 22px; border-radius: 50%;
  background: #f0f0f0;
  animation: sk-pulse 1.4s ease-in-out infinite;
}
.sk-bar {
  flex: 1; height: 14px; border-radius: 6px;
  background: #f0f0f0;
  animation: sk-pulse 1.4s ease-in-out infinite;
}
@keyframes sk-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

/* 弹层 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: none; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-mask.show { display: flex; }
.modal {
  width: 86%; max-width: 340px; background: #fff; border-radius: 14px;
  padding: 22px 20px; text-align: center;
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.modal-body { font-size: 14px; color: #3a3a3a; line-height: 1.9; margin-bottom: 18px; }
.modal-body .hl { color: #ff2442; font-weight: 700; }
.modal-btn {
  width: 100%; padding: 12px; border: 0; border-radius: 22px;
  background: #ff2442; color: #fff; font-size: 15px; font-weight: 600;
}
/* 规则入口 */
.rule-entry {
  margin-top: 8px;
  font-size: 12px;
  color: #ff2442;
  cursor: pointer;
}
.rule-entry:active { opacity: .6; }

/* 规则弹层 */
.rule-modal {
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  overflow: hidden;
}
.rule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
}
.rule-title { font-size: 16px; font-weight: 700; }
.rule-close {
  width: 28px; height: 28px; line-height: 26px;
  text-align: center; border-radius: 50%;
  color: #9a9a9a; font-size: 20px; cursor: pointer;
}
.rule-close:active { background: #f5f5f5; }

.rule-body {
  padding: 16px 20px 22px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.75;
  color: #3a3a3a;
}
.rule-body h4 {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 16px 0 8px;
  padding-left: 10px;
  border-left: 3px solid #ff2442;
}
.rule-body h4:first-child { margin-top: 0; }
.rule-body p { margin-bottom: 8px; }
.rule-body ul { margin: 6px 0 10px 20px; }
.rule-body li { margin-bottom: 4px; }
.rule-body code {
  background: #f5f5f5; padding: 1px 5px; border-radius: 4px;
  font-family: monospace; font-size: 12px; color: #c8102e;
}
.rule-note { color: #9a9a9a; font-size: 12px; }
.rule-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: 12px;
}
.rule-table th, .rule-table td {
  border: 1px solid #eee;
  padding: 6px 8px;
  text-align: left;
}
.rule-table th {
  background: #fafafa;
  font-weight: 700;
  color: #1a1a1a;
}