:root {
  --ink: #1f2a37;
  --muted: #5b6b7c;
  --panel: rgba(255, 255, 255, 0.86);
  --border: rgba(31, 42, 55, 0.12);
  --accent: #3f6fd8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #cfe3f5;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
  outline: none;   /* 取得焦点时不显示难看的虚线框 */
}

/* ---------- 启动门 ---------- */
.gate {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 24, 34, 0.5);
  backdrop-filter: blur(3px);
  cursor: pointer;
}

.gate.hidden { display: none; }

.gate-panel {
  padding: 30px 44px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(16, 24, 34, 0.3);
  text-align: center;
}

.gate-panel h1 { margin: 0 0 8px; font-size: 22px; font-weight: 700; }
.gate-panel p { margin: 0; font-size: 13px; color: var(--muted); }
.gate-panel .gate-tip { margin-top: 6px; font-size: 11px; color: #93a1b0; }

/* ---------- 操作说明 ---------- */
.help {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(31, 42, 55, 0.14);
  backdrop-filter: blur(8px);
  font-size: 12px;
  color: var(--muted);
  user-select: none;
  pointer-events: none;
}

.help-row { line-height: 2; }

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  margin: 0 1px;
  border-radius: 5px;
  border: 1px solid rgba(31, 42, 55, 0.18);
  border-bottom-width: 2px;
  background: #fff;
  color: var(--ink);
  font: 600 11px/1.6 "SFMono-Regular", Consolas, monospace;
  text-align: center;
}

/* ---------- 遮罩 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 24, 34, 0.42);
  backdrop-filter: blur(3px);
  transition: opacity 0.18s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay .panel {
  padding: 28px 40px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(16, 24, 34, 0.3);
  text-align: center;
}

.overlay h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}

.overlay p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- ESC 停止游戏对话框 ---------- */
.stop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 24, 34, 0.55);
  backdrop-filter: blur(3px);
  z-index: 25;
  animation: stop-in 0.16s ease-out;
}

.stop.hidden {
  display: none;
}

@keyframes stop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.stop-panel {
  background: #ffffff;
  padding: 30px 44px 26px;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(16, 24, 34, 0.36);
  text-align: center;
  min-width: 320px;
  max-width: 90%;
}

.stop-panel h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 1px;
}

.stop-panel p {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--muted);
}

.stop-panel p b {
  color: var(--accent);
  font-weight: 700;
}

.stop-panel .stop-hint {
  margin: 14px 0 0;
  font-size: 11px;
  color: #93a1b0;
}

.stop-buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.stop-btn {
  border: none;
  padding: 10px 24px;
  border-radius: 10px;
  font: 600 14px "PingFang SC", "Microsoft YaHei", sans-serif;
  cursor: pointer;
  color: #fff;
  min-width: 130px;
  transition: transform 0.06s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.stop-btn:active {
  transform: translateY(1px);
}

.stop-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(63, 111, 216, 0.35);
}

/* 退出游戏：红色 */
.stop-btn--danger {
  background: #e0533c;
  box-shadow: 0 4px 14px rgba(224, 83, 60, 0.36);
}
.stop-btn--danger:hover {
  background: #c83f29;
}

/* 继续游戏：灰色 */
.stop-btn--default {
  background: #8a97a8;
  box-shadow: 0 4px 14px rgba(31, 42, 55, 0.18);
}
.stop-btn--default:hover {
  background: #6f7c8d;
}
