/* ==========================================================================
   记忆翻牌 · 页面样式
   ========================================================================== */

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

.game-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: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 18px;
  margin-bottom: 14px;
  font-size: 14.5px;
  min-height: 50px;
  flex-wrap: wrap;
}

.led {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 12px;
}

.led b { color: var(--accent); }

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

.board-wrap { display: flex; justify-content: center; }

.memory-board {
  --card: 84px;
  display: grid;
  gap: 8px;
}

.mcard {
  width: var(--card);
  height: calc(var(--card) * 1.15);
  perspective: 500px;
  cursor: pointer;
}

.mcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.3, 1.1);
}

.mcard.flipped .mcard-inner, .mcard.matched .mcard-inner { transform: rotateY(180deg); }

.mcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: calc(var(--card) * 0.5);
}

.mcard-back {
  background: linear-gradient(160deg, #3a4258, #242b3d);
  border: 1px solid var(--border-strong);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}

.mcard-back::after { content: '❓'; opacity: 0.35; font-size: calc(var(--card) * 0.32); }

.mcard-front {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #f7f1e3, #e8ddc4);
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.mcard.matched .mcard-front {
  background: linear-gradient(160deg, #d3f5df, #b2ecc6);
  animation: matchPop 0.35s ease-out;
}

@keyframes matchPop {
  40% { transform: rotateY(180deg) scale(1.12); }
  100% { transform: rotateY(180deg) scale(1); }
}

/* ---------- 侧栏 ---------- */
.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: 16px; }

.segmented { display: flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 4px; gap: 4px; }

.segmented button {
  flex: 1; font-family: var(--font); font-size: 12.5px; font-weight: 600;
  color: var(--text-faint); background: transparent; border: none; border-radius: 9px;
  padding: 8px 4px; cursor: pointer; transition: background 0.2s, color 0.2s;
}

.segmented button:hover { color: var(--text-dim); }

.segmented button.on {
  color: var(--text); background: var(--surface-2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(245, 176, 74, 0.25) inset;
}

.wide { width: 100%; }

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

.best-list { display: flex; flex-direction: column; gap: 8px; }

.best-row {
  display: flex; justify-content: space-between; font-size: 13.5px;
  color: var(--text-dim); background: var(--bg-soft); border-radius: 10px; padding: 9px 14px;
}

.best-row b { color: var(--accent); font-variant-numeric: tabular-nums; }

.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; }

.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) {
  .game-layout { grid-template-columns: 1fr; }
  .panel { position: static; }
  .game-shell { padding: 20px 14px 48px; }
  .memory-board { --card: min(19vw, 84px); gap: 6px; }
}
