/* ==========================================================================
   连连看 · 页面样式
   ========================================================================== */

.game-shell { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }

.llk-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  align-items: start;
}

.board-zone { min-width: 0; }

.status-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 18px;
  margin-bottom: 14px;
  font-size: 14.5px;
  min-height: 50px;
}

.llk-stat { color: var(--text-dim); }
.llk-stat b { color: var(--accent); font-size: 16px; font-variant-numeric: tabular-nums; }

.status-text { color: var(--text); font-weight: 600; }

/* 棋盘区：网格 + SVG 连线层 */
.board-area {
  position: relative;
  width: 100%;
  aspect-ratio: 10 / 8;
}

.board-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 4px;
}

.tile {
  font-size: clamp(16px, 4.2vw, 34px);
  line-height: 1;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
  padding: 0;
  font-family: inherit;
}

.tile:hover:not(.empty) { transform: translateY(-2px); border-color: rgba(245, 176, 74, 0.45); }

.tile.empty { visibility: hidden; }

.tile.sel {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(245, 176, 74, 0.5), 0 6px 18px rgba(240, 113, 61, 0.3);
  transform: translateY(-2px) scale(1.04);
}

.tile.hinted {
  border-color: rgba(74, 222, 128, 0.7);
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.4);
  animation: hintPulse 0.6s ease-in-out 2;
}

@keyframes hintPulse {
  50% { transform: translateY(-3px) scale(1.06); }
}

.tile.matched {
  animation: matchPop 0.24s ease-in forwards;
}

@keyframes matchPop {
  40% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(0.4); opacity: 0; }
}

#lines {
  position: absolute;
  left: -10%;
  top: -12.5%;
  width: 120%;
  height: 125%;
  pointer-events: none;
  overflow: visible;
  z-index: 5;
}

/* ---------- 侧栏 ---------- */
.panel { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card.grow { flex: 1; }

.card-title { font-size: 14px; font-weight: 700; letter-spacing: 0.04em; color: var(--text-dim); margin-bottom: 14px; }

.field-note { font-size: 12px; color: var(--text-faint); margin-top: 8px; line-height: 1.6; }

.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.llk-tips { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.llk-tips li { font-size: 13px; color: var(--text-dim); line-height: 1.6; padding-left: 14px; position: relative; }
.llk-tips li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); opacity: 0.7; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(6, 8, 12, 0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity 0.25s;
}

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

.dialog {
  width: min(420px, calc(100vw - 40px));
  background: linear-gradient(165deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border-strong); border-radius: 22px; padding: 36px 32px 30px;
  text-align: center; box-shadow: 0 40px 90px -20px rgba(0, 0, 0, 0.8);
  transform: translateY(14px) scale(0.96); transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.3, 1.2);
}

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

.dialog-icon { font-size: 52px; line-height: 1; margin-bottom: 14px; }
.dialog h2 { font-size: 24px; font-weight: 800; }
.dialog > p { color: var(--text-dim); font-size: 14.5px; margin-top: 8px; }
.dialog-btns { display: flex; gap: 12px; margin-top: 26px; justify-content: center; }
.dialog-btns .btn { min-width: 120px; }

.rules-body { text-align: left; margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.rules-body p { font-size: 13.5px; color: var(--text-dim); line-height: 1.7; }
.rules-body b { color: var(--text); }

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text);
  font-size: 14px; font-weight: 600; padding: 11px 22px; border-radius: 999px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s; z-index: 400;
}

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

@media (max-width: 960px) {
  .llk-layout { grid-template-columns: 1fr; }
  .panel { position: static; }
  .game-shell { padding: 20px 14px 48px; }
}
