* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b1020;
  color: #eef2ff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.topbar {
  position: absolute;
  top: 12px; left: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.tag {
  background: rgba(10, 16, 32, 0.55);
  border: 1px solid rgba(238, 242, 255, 0.28);
  border-radius: 999px;
  padding: 4px 12px;
  letter-spacing: 1px;
}

.tag b { color: #6ee7ff; font-size: 15px; }

.tag.mode { color: #ffd166; letter-spacing: 2px; }

.score {
  background: rgba(10, 16, 32, 0.55);
  border-radius: 999px;
  padding: 4px 12px;
  color: #cfd8f5;
}

.score b { color: #ffd166; }

.hearts {
  position: absolute;
  top: 48px; left: 16px;
  font-size: 18px;
  letter-spacing: 3px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.hearts .lost { opacity: 0.25; filter: grayscale(1); }

/* 题目面板 */
.question {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 240px;
  max-width: 82vw;
  padding: 14px 30px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(20, 30, 60, 0.92), rgba(12, 18, 38, 0.92));
  border: 1px solid rgba(110, 231, 255, 0.35);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45), 0 0 40px rgba(110, 231, 255, 0.10);
  font-size: clamp(20px, 3.4vw, 32px);
  font-weight: 800;
  text-align: center;
  letter-spacing: 1px;
  color: #eaf6ff;
  white-space: nowrap;
}

/* 拼写关：题面是中文，门上是同一个词的几种拼法 */
.question.spell { border-color: rgba(255, 209, 102, 0.5); font-size: clamp(19px, 3vw, 28px); }

/* 句子关：允许换行 */
.question.sentence { white-space: normal; line-height: 1.5; font-size: clamp(18px, 2.8vw, 26px); }

/* 听音关：题目面板里的喇叭按钮 */
.question.listen { padding: 10px 20px; }
.question .saybtn {
  pointer-events: auto;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(110, 231, 255, 0.45);
  background: rgba(110, 231, 255, 0.14);
  color: #eaf6ff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  margin-right: 12px;
}

.question .saybtn:active { transform: scale(0.94); }

.question .qhint {
  font-size: 0.58em;
  font-weight: 600;
  color: #9fd3ea;
  letter-spacing: 1px;
}

.toast {
  position: absolute;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  font-size: clamp(22px, 4vw, 36px);
  font-weight: 900;
  letter-spacing: 2px;
  opacity: 0;
  transition: opacity .18s, transform .18s;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.toast.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.toast.ok { color: #6bf0ae; }
.toast.no { color: #ff8a8a; }

/* 方向键 */
.arrows {
  position: absolute;
  left: 18px;
  bottom: 22px;
  display: flex;
  gap: 14px;
  pointer-events: auto;
}

.arrow {
  width: 74px; height: 74px;
  border-radius: 50%;
  border: 1px solid rgba(238, 242, 255, 0.3);
  background: rgba(10, 16, 32, 0.55);
  color: #eef2ff;
  font-size: 24px;
  cursor: pointer;
  touch-action: none;
  backdrop-filter: blur(4px);
}

.arrow:active { background: rgba(110, 231, 255, 0.28); }

@media (pointer: fine) {
  .arrows { opacity: 0.35; }
}

/* 全屏按钮 */
.fsbtn {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 30;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(238, 242, 255, 0.3);
  background: rgba(10, 16, 32, 0.6);
  color: #eef2ff;
  font-size: 13px;
  font-family: inherit;
  letter-spacing: 1px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.fsbtn:active { transform: scale(0.97); }

/* 竖屏提示：横过来才好玩 */
.rotate-tip {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  background: rgba(6, 10, 22, 0.94);
  color: #eef2ff;
  font-size: 17px;
  letter-spacing: 1px;
  text-align: center;
  padding: 30px;
}

.rotate-tip .big { font-size: 46px; }

@media (orientation: portrait) and (max-width: 820px) {
  .rotate-tip { display: flex; }
}

/* ---------- 浮层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(4, 8, 18, 0.86);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.overlay.hidden { display: none; }

.card {
  width: min(92vw, 480px);
  padding: 30px 26px 24px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(24, 34, 64, 0.98), rgba(10, 16, 32, 0.98));
  border: 1px solid rgba(110, 231, 255, 0.22);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.65);
  text-align: center;
}

.card .icon { font-size: 38px; margin-bottom: 6px; }

.card h2 { margin: 0 0 12px; font-size: 22px; letter-spacing: 1px; }

.card .line {
  margin: 0 0 22px;
  font-size: 13.5px;
  line-height: 2;
  color: rgba(238, 242, 255, 0.7);
}

button.primary {
  padding: 13px 44px;
  border-radius: 999px;
  border: 1px solid rgba(110, 231, 255, 0.5);
  background: linear-gradient(180deg, #6ee7ff, #3fa9d8);
  color: #06202c;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 3px;
  cursor: pointer;
}

button.primary:active { transform: scale(0.98); }

.keys {
  margin: 16px 0 0;
  font-size: 11px;
  line-height: 1.9;
  color: rgba(238, 242, 255, 0.4);
}
