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

html, body {
  height: 100%;
  background: #14121f;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: #f5f3ff;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  background: #1d1a30;
  border-radius: 8px;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.6);
  touch-action: none;
}

/* ---------- 覆盖层屏幕 ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 14, 28, 0.88);
  z-index: 10;
}

.hidden { display: none !important; }

.panel {
  text-align: center;
  padding: 40px 56px;
  max-width: 720px;
}

.game-title {
  font-size: 64px;
  letter-spacing: 8px;
  color: #ffd94d;
  text-shadow: 0 4px 0 #c77e1b, 0 8px 24px rgba(0, 0, 0, 0.5);
  margin-bottom: 8px;
}

.subtitle {
  font-size: 14px;
  letter-spacing: 4px;
  color: #8f8ab0;
  margin-bottom: 28px;
}

.hint { font-size: 18px; margin-bottom: 24px; color: #cfc9ee; }
.hint.dim { font-size: 13px; color: #7a7596; margin-top: 18px; }

h2 {
  font-size: 36px;
  color: #ffd94d;
  margin-bottom: 28px;
  letter-spacing: 4px;
}

/* ---------- 按钮 ---------- */
.btn {
  font-family: inherit;
  font-size: 18px;
  font-weight: bold;
  color: #2a1f00;
  background: linear-gradient(#ffe27a, #ffc93c);
  border: none;
  border-radius: 12px;
  padding: 12px 32px;
  margin: 6px;
  cursor: pointer;
  box-shadow: 0 4px 0 #c77e1b;
  transition: transform 0.06s, box-shadow 0.06s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #c77e1b; }
.btn-big { font-size: 26px; padding: 16px 56px; }

.btn-row { margin-top: 24px; }

/* ---------- 难度选择 ---------- */
.btn-diff { min-width: 130px; font-size: 22px; padding: 16px 26px; }
.btn-diff.easy { background: linear-gradient(#a8e6a1, #7de38b); box-shadow: 0 4px 0 #4a9e56; }
.btn-diff.normal { background: linear-gradient(#ffe27a, #ffc93c); box-shadow: 0 4px 0 #c77e1b; }
.btn-diff.hard { background: linear-gradient(#ff9a8a, #e85d5d); box-shadow: 0 4px 0 #a13030; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.btn-diff:active { box-shadow: 0 1px 0 rgba(0,0,0,0.3); }
#diff-best { margin-top: 16px; font-size: 15px; color: #7de38b; min-height: 22px; }
#btn-diff-back { margin-top: 22px; }
#result-mode { font-size: 15px; color: #8f8ab0; letter-spacing: 2px; margin-bottom: 10px; }

/* ---------- 移动端适配 ---------- */
#game-canvas {
  -webkit-touch-callout: none;
}

/* 竖屏时提示旋转设备（仅小屏设备显示） */
#rotate-hint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 14, 28, 0.96);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #ffd94d;
  font-size: 22px;
  text-align: center;
  padding: 30px;
}
#rotate-hint .icon { font-size: 64px; margin-bottom: 18px; }
@media (orientation: portrait) and (max-width: 900px) {
  #rotate-hint { display: flex; }
}

/* 双键关的触屏左右分区提示 */
#zone-left, #zone-right {
  position: absolute;
  bottom: 44px;
  z-index: 6;
  font-size: 15px;
  color: rgba(255,255,255,0.75);
  background: rgba(0,0,0,0.25);
  border: 2px dashed rgba(255,255,255,0.4);
  border-radius: 12px;
  padding: 10px 20px;
  pointer-events: none;
}
#zone-left { left: 26px; }
#zone-right { right: 26px; }

/* ---------- 选关卡片 ---------- */
#screen-select .panel {
  max-height: 92vh;
  overflow-y: auto;
  max-width: 1000px;
  width: 94vw;
}

#level-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 700px) {
  #level-list { grid-template-columns: 1fr; }
}

.level-card {
  text-align: left;
  font-family: inherit;
  background: #2b2745;
  color: #f5f3ff;
  border: 2px solid #4a4372;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.08s, border-color 0.08s;
}
.level-card:hover { transform: scale(1.03); border-color: #ffd94d; }
.level-card .lv-name { font-size: 19px; font-weight: bold; color: #ffd94d; margin-bottom: 4px; }
.level-card .lv-desc { font-size: 13px; color: #b9b3d8; line-height: 1.45; }
.level-card .lv-best { font-size: 12px; color: #7de38b; margin-top: 4px; }

/* ---------- 结算 ---------- */
#result-rank {
  font-size: 120px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 12px;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
}
#result-rank.rank-S { color: #ffd94d; }
#result-rank.rank-A { color: #7de38b; }
#result-rank.rank-B { color: #6cb8ff; }
#result-rank.rank-C { color: #9a94b8; }

#result-comment { font-size: 26px; margin-bottom: 22px; color: #f5f3ff; }

#result-stats {
  font-size: 16px;
  color: #b9b3d8;
  line-height: 1.9;
}
#result-stats b { color: #ffd94d; }

/* ---------- 游戏内提示条 ---------- */
#hud-tip {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: rgba(245, 243, 255, 0.55);
  z-index: 5;
  pointer-events: none;
}
