:root {
  --bg: #87ceeb;
  --ground: #6b4b27;
  --panel: #ffffff;
  --text: #1a1a1a;
  --accent: #ffcc00;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(#9be1ff, var(--bg));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.85);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; }
.scoreboard { display: flex; gap: 16px; }
.color-indicator { display: flex; align-items: center; gap: 8px; }
.swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.actions { display: flex; gap: 8px; }
.actions button {
  padding: 6px 10px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  background: white;
  color: #000;
  cursor: pointer;
}
.actions select {
  padding: 6px 8px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  background: white;
}
.actions button:hover { background: #f3f3f3; }

/* 通用按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #fff;
  color: #000;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  transition: all 160ms ease;
}
.btn:hover { transform: translateY(-1px); background: #f8fafc; }
.btn:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
.btn-primary { background: linear-gradient(180deg, #3b82f6, var(--primary)); color: #000; border-color: rgba(0,0,0,0.06); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-secondary { background: #fff; color: #000; }
.btn-secondary:hover { background: #f1f5f9; }
.btn-danger { background: linear-gradient(180deg, #f87171, var(--danger)); color: #000; }
.btn-icon { padding: 6px 10px; border-radius: 8px; }

/* 输入控件 */
.input-select, .input-date {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.1);
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.stage {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}
#gameCanvas {
  width: 100%;
  height: auto;
  display: block;
  background: transparent;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 50% 20%, rgba(255,255,255,0.35), rgba(0,0,0,0.35));
}
.overlay.hidden { display: none; }
.panel {
  width: min(92vw, 520px);
  padding: 20px 16px;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  text-align: center;
}
.panel.panel-casual { border-radius: 16px; background: linear-gradient(180deg, #ffffff, #fafafa); }
.panel h1 { margin: 6px 0 12px; }
.panel-actions { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
.panel button { padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.1); background: white; color: #000; cursor: pointer; }
.panel button:hover { background: #f3f3f3; }

.panel-wide { width: min(92vw, 720px); }
.panel-subtitle { margin: 0 0 10px; color: #4b5563; }

/* 游戏结束面板：在线荣耀榜片段 */
.honor-snippet { margin: 12px 0 10px; }
.honor-title { font-size: 18px; margin: 8px 0; color: #111827; }
.honor-rank-msg { margin: 4px 0 8px; color: #111827; font-weight: 600; }
.rank-mini li { padding: 8px 10px; }
.rank-mini li::before { width: 24px; height: 24px; font-size: 12px; }

/* 排名列表（在线荣耀榜） */
.rank-list {
  list-style: none;
  margin: 12px 0 4px;
  padding: 0;
  counter-reset: rank;
}
.rank-list li {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 6px 0;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.rank-list li::before {
  content: counter(rank);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  color: #fff;
  background: #94a3b8;
}
.rank-list li:nth-child(1)::before { background: linear-gradient(180deg, #fde047, #f59e0b); }
.rank-list li:nth-child(2)::before { background: linear-gradient(180deg, #e5e7eb, #9ca3af); }
.rank-list li:nth-child(3)::before { background: linear-gradient(180deg, #fda4af, #fb7185); }

.help { text-align: center; color: rgba(0,0,0,0.7); padding: 14px 10px; }

/* 开始界面玩法说明样式 */
.legend { margin: 8px 0 12px; padding-left: 18px; color: #374151; }
.legend li { margin: 4px 0; line-height: 1.4; }

/* 初始页像素方块装饰 */
.pixel-hero {
  width: 240px;
  height: 180px;
  margin: 6px auto 12px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-auto-rows: 1fr;
  gap: 3px;
  padding: 8px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f4f4f4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.65), 0 6px 14px rgba(0,0,0,0.08);
}
.px {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  background: transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.px.on { box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.px.c1.on { background: #ffd93b; }
.px.c2.on { background: #e74c3c; }
.px.c3.on { background: #3498db; }
.px.c4.on { background: #2ecc71; }
.px.c5.on { background: #9b59b6; }
.px.rainbow.on {
  background: linear-gradient(135deg, #ff595e, #ffca3a, #8ac926, #1982c4, #6a4c93);
}
.pixel-title { letter-spacing: 1px; font-weight: 800; }
.pixel-desc { color: #4b5563; }

@media (max-width: 480px) {
  .scoreboard { gap: 8px; }
  .actions { gap: 6px; }
  .actions button { padding: 6px 8px; }
  .actions select { padding: 6px 6px; }
}