/* 翻牌配对专属样式（公共组件、变量见 ../../style.css）
   复用护眼童趣主题：暖色底、降饱和柔和配色、大圆角 */

#app {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: 760px;
}

#sidebar {
  background: var(--panel);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.actions { display: flex; flex-direction: column; gap: 8px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row .btn { padding: 10px 8px; }

/* 进度圆点 */
.progress-dots { display: flex; flex-wrap: wrap; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); transition: background .15s; }
.dot.done { background: var(--primary); }

/* 已辅助时最佳栏灰显 */
.stat-value.muted { color: var(--primary); opacity: 0.4; }

/* 主区 */
#play-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  min-height: 380px;
  background: var(--panel);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

/* 卡片网格 */
.mem-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), 1fr);
  gap: 10px;
  width: 100%;
  max-width: 480px;
}

/* 卡片：3D 翻转 */
.mem-card {
  aspect-ratio: 1;
  perspective: 600px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
  container-type: size;
}
.mem-card:disabled { cursor: default; }

.mem-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .3s cubic-bezier(.2,.7,.3,1);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.mem-card.flipped .mem-card-inner,
.mem-card.matched .mem-card-inner,
.mem-card.hint .mem-card-inner {
  transform: rotateY(180deg);
}

.mem-card-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* 背面：护眼柔和渐变 + 淡淡波点纹理 */
.mem-card-back {
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.18) 0 8px, transparent 9px),
    radial-gradient(circle at 80% 75%, rgba(255,255,255,0.12) 0 6px, transparent 7px),
    linear-gradient(135deg, #7fb3d5, #5b9bd5);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(91, 155, 213, 0.35);
  overflow: hidden;
}
.mem-card-back-mark {
  font-size: 55cqw;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 2px 4px rgba(43, 70, 104, 0.25);
  opacity: 0.85;
}
@media (hover: hover) {
  .mem-card:not(:disabled):not(.flipped):not(.matched):not(.hint):hover .mem-card-back {
    box-shadow: 0 8px 20px -6px rgba(91, 155, 213, 0.5);
  }
}
.mem-card:not(:disabled):not(.flipped):not(.matched):not(.hint):active .mem-card-back {
  transform: scale(0.96);
}

/* 正面：SVG 矢量图标，任意分辨率绝对清晰 */
.mem-card-front {
  background: var(--panel);
  border: 2px solid var(--border);
  transform: rotateY(180deg) translateZ(1px);
  will-change: transform;
}
.mem-svg {
  width: 88%;
  height: 88%;
  pointer-events: none;
}

/* 配对成功 */
.mem-card.matched .mem-card-front {
  border-color: #43a047;
  background: #e8f5e9;
}
.mem-card.matched .mem-card-inner {
  animation: matchPop .3s ease;
}
@keyframes matchPop {
  0% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.08); }
  100% { transform: rotateY(180deg) scale(1); }
}

/* 提示高亮 */
.mem-card.hint .mem-card-front {
  border-color: #ff9800;
  background: #fff3e0;
  animation: hintPulse .6s ease-in-out infinite alternate;
}
@keyframes hintPulse {
  from { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.4); }
  to { box-shadow: 0 0 0 6px rgba(255, 152, 0, 0); }
}

/* 胜利弹窗 */
.modal-content .win-record { color: var(--primary); font-size: 15px; min-height: 1.2em; }

/* 响应式 */
@media (max-width: 640px) {
  #app { grid-template-columns: 1fr; }
  #play-area { padding: 22px 16px; min-height: 300px; }
  .mem-grid { gap: 8px; max-width: 100%; }
}
