/* =========================================================
   微光果园 · GLIMMER GROVE
   原创三消小游戏 · 深色克制风格，与迅易达官网保持一致
   ========================================================= */

:root {
  --ink: #0a0f0d;
  --ink-soft: #111a15;
  --panel: #101a14;
  --paper: #f4f5ef;
  --white: #fbfcf8;
  --acid: #d8f36b;
  --acid-strong: #c9ee4a;
  --teal: #77e7c5;
  --coral: #ff8377;
  --muted: #9aa8a0;
  --muted-dim: #64706a;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC",
    "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #070b09;
  color: var(--paper);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

svg {
  display: block;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(120% 55% at 50% 42%, rgba(38, 70, 52, 0.24) 0%, rgba(7, 11, 9, 0) 62%),
    #070b09;
}

@media (min-width: 620px) {
  .app {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

/* ---------------- 顶栏 ---------------- */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 50px;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0c130f 0%, #090e0b 100%);
}

.back-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.back-links a {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 30px;
  padding: 0 7px;
  border-radius: 999px;
  color: rgba(251, 252, 248, 0.62);
  font-size: 11.5px;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease;
}

.back-links a svg {
  width: 12px;
  height: 12px;
}

.back-links a:hover {
  color: var(--acid);
  background: rgba(216, 243, 107, 0.08);
}

.title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.title-mark {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.title-mark i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--acid);
  opacity: 0.42;
}

.title-mark i:nth-child(2) {
  width: 7px;
  height: 7px;
  opacity: 1;
  box-shadow: 0 0 8px rgba(216, 243, 107, 0.65);
}

.title-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.title-copy strong {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.title-copy em {
  color: rgba(251, 252, 248, 0.35);
  font-family: var(--mono);
  font-size: 7px;
  font-style: normal;
  letter-spacing: 0.18em;
  white-space: nowrap;
}

.tag {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid rgba(216, 243, 107, 0.22);
  border-radius: 4px;
  color: rgba(216, 243, 107, 0.7);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
}

/* ---------------- 状态栏 ---------------- */

.hud {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 7px 13px 9px;
  border-bottom: 1px solid var(--line);
  background: #0a110d;
}

.hud-goal {
  min-width: 0;
}

.goal-head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

#goalIcon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
}

.goal-copy {
  min-width: 0;
}

.hud-label {
  display: block;
  color: var(--muted-dim);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.16em;
  white-space: nowrap;
}

.goal-copy strong {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goal-track {
  position: relative;
  height: 5px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.goal-track i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal) 0%, var(--acid) 100%);
  box-shadow: 0 0 10px rgba(216, 243, 107, 0.35);
  transition: width 0.28s ease;
}

.hud-stat {
  min-width: 44px;
  text-align: right;
}

.hud-stat strong {
  display: block;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.hud-stat strong.bump {
  animation: stat-bump 0.24s ease;
}

.hud-score {
  min-width: 60px;
}

.hud-score em {
  display: block;
  margin-top: 1px;
  color: var(--muted-dim);
  font-family: var(--mono);
  font-size: 8px;
  font-style: normal;
  white-space: nowrap;
}

@keyframes stat-bump {
  0% { transform: scale(1); }
  45% { transform: scale(1.16); color: var(--acid); }
  100% { transform: scale(1); }
}

/* ---------------- 棋盘舞台 ---------------- */

.stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 8px 10px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#board {
  display: block;
  flex: 0 0 auto;
  border-radius: 16px;
  background: #0b120e;
  box-shadow:
    0 22px 50px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.055),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  touch-action: none;
}

.banner {
  position: absolute;
  top: 4px;
  left: 50%;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 0.26s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.banner strong {
  color: var(--acid);
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-shadow: 0 0 22px rgba(216, 243, 107, 0.45);
  white-space: nowrap;
}

.banner span {
  color: rgba(251, 252, 248, 0.62);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

/* ---------------- 结算浮层 ---------------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(4, 8, 6, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  width: min(100%, 296px);
  padding: 22px 20px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(58, 98, 72, 0.32) 0%, rgba(13, 22, 17, 0) 62%),
    linear-gradient(160deg, #122018 0%, #0b130f 100%);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
  transform: translateY(10px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.overlay.show .sheet {
  transform: translateY(0) scale(1);
}

.sheet-kicker {
  color: rgba(216, 243, 107, 0.72);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.22em;
}

.sheet h2 {
  margin-top: 7px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.sheet p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.sheet-btn {
  display: block;
  width: 100%;
  height: 40px;
  margin-top: 14px;
  border-radius: 999px;
  background: var(--acid);
  color: #10170c;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  transition: background 0.18s ease, transform 0.18s ease;
}

.sheet-btn:hover {
  background: var(--acid-strong);
}

.sheet-btn:active {
  transform: scale(0.98);
}

.sheet-btn.ghost {
  margin-top: 8px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: rgba(251, 252, 248, 0.7);
  font-weight: 600;
}

.sheet-btn.ghost:hover {
  border-color: rgba(216, 243, 107, 0.3);
  background: rgba(216, 243, 107, 0.05);
  color: var(--acid);
}

/* ---------------- 控制条 ---------------- */

.controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 9px;
  border-top: 1px solid var(--line);
  background: #080d0a;
}

.btn-restart {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(216, 243, 107, 0.2);
  border-radius: 999px;
  color: rgba(216, 243, 107, 0.74);
  font-size: 10px;
  letter-spacing: 0.06em;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.btn-restart svg {
  width: 11px;
  height: 11px;
}

.btn-restart:hover {
  border-color: rgba(216, 243, 107, 0.42);
  background: rgba(216, 243, 107, 0.06);
  color: var(--acid);
}

.tip {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--muted-dim);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-chip {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

/* ---------------- 页脚 ---------------- */

.foot {
  flex: 0 0 auto;
  padding: 7px 12px 9px;
  border-top: 1px solid var(--line);
  background: #090e0b;
}

.foot-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 15px;
}

.foot-nav a {
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: color 0.18s ease;
}

.foot-nav a:hover {
  color: var(--acid);
}

.foot p {
  margin-top: 5px;
  color: var(--muted-dim);
  font-size: 8px;
  letter-spacing: 0.03em;
  text-align: center;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #070b09;
  color: var(--paper);
  font-size: 13px;
  text-align: center;
}

/* ---------------- 小屏适配 ---------------- */

@media (max-width: 359px) {
  .tip {
    display: none;
  }

  .title-copy em {
    display: none;
  }

  .hud {
    gap: 8px;
    padding-left: 10px;
    padding-right: 10px;
  }
}

@media (max-height: 660px) {
  .topbar {
    height: 44px;
  }

  .hud {
    padding-top: 5px;
    padding-bottom: 6px;
  }

  .foot p {
    display: none;
  }

  .controls {
    padding-top: 5px;
    padding-bottom: 6px;
  }
}

/* ---------------- 减少动态效果 ---------------- */

@media (prefers-reduced-motion: reduce) {
  .banner,
  .overlay,
  .sheet,
  .sheet-btn,
  .goal-track i {
    transition-duration: 0.01ms;
  }

  .hud-stat strong.bump {
    animation: none;
  }
}
