/* ===== Mahjong Solitaire Page ===== */
.game-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-height));
}

.game-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.game-info__group {
  display: flex; align-items: center; gap: 16px;
}
.game-info__label {
  display: flex; flex-direction: column; gap: 2px;
}
.game-info__label-title {
  font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
}
.game-info__label-value {
  font-size: 16px; font-weight: 600; color: var(--text-primary);
}
.game-info__label-value.timer { font-family: 'Courier New', monospace; color: var(--accent); font-size: 20px; }
.game-info__label-value.score { color: var(--accent); font-size: 20px; }
.game-info__label-value.combo { color: var(--warning); }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tag--easy { background: rgba(95, 184, 120, 0.2); color: var(--success); }
.tag--medium { background: rgba(232, 156, 79, 0.2); color: var(--warning); }
.tag--hard { background: rgba(217, 88, 88, 0.2); color: var(--danger); }

.game-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.game-canvas-wrap {
  flex: 1;
  position: relative;
  background: var(--bg-primary);
  background-image:
    radial-gradient(circle at 50% 50%, var(--bg-card), var(--bg-primary));
  overflow: hidden;
  min-height: 400px;
}
#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: none;
}

.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  z-index: 10;
}
.pause-overlay.show { display: flex; }
.pause-overlay__title {
  font-size: 32px;
  color: var(--accent);
  font-weight: 700;
}

.game-sidebar {
  width: 320px;
  flex-shrink: 0;
  padding: 16px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}
.sidebar-section {
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.sidebar-section h3 {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.sidebar-stat {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}
.sidebar-stat__label { color: var(--text-muted); }
.sidebar-stat__value { color: var(--accent); font-weight: 600; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 11px;
  min-width: 64px;
  transition: all var(--anim-fast);
}
.tool-btn:hover:not(:disabled) {
  background: var(--accent);
  color: white;
  transform: translateY(-2px);
}
.tool-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.tool-btn__icon { width: 20px; height: 20px; }
.tool-btn__count {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-primary);
  padding: 1px 4px;
  border-radius: 8px;
}
.tool-btn:hover:not(:disabled) .tool-btn__count { color: white; background: rgba(255,255,255,0.2); }
.tool-btn--reward {
  background: linear-gradient(135deg, rgba(212,175,55,0.15), rgba(212,175,55,0.05));
  border-color: var(--accent);
}

/* 布局选择网格 */
.layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 16px 4px;
}
.layout-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--anim-fast);
  position: relative;
}
.layout-card:hover:not(.locked) {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.layout-card.locked { opacity: 0.5; cursor: not-allowed; }
.layout-card__preview {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.layout-card__name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.layout-card__meta {
  font-size: 11px;
  color: var(--text-muted);
}
.layout-card__best {
  font-size: 11px;
  color: var(--accent);
  margin-top: 4px;
}
.layout-card__lock {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 20px;
  color: var(--text-muted);
}

/* 成就墙 */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px 4px;
}
.achievement {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  transition: all var(--anim-fast);
}
.achievement.unlocked {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(212,175,55,0.1), transparent);
}
.achievement.hidden-achievement { opacity: 0.7; }
.achievement__icon { font-size: 32px; margin-bottom: 8px; }
.achievement__name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.achievement__desc { font-size: 11px; color: var(--text-muted); }

/* 设置 */
.settings-list {
  display: flex; flex-direction: column; gap: 12px;
}
.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-row__label { font-size: 14px; }
.setting-row__control select {
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
}
.switch {
  position: relative;
  width: 44px; height: 24px;
  background: var(--bg-elevated);
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--anim-fast);
}
.switch.on { background: var(--accent); }
.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  transition: left var(--anim-fast);
}
.switch.on::after { left: 22px; }

/* Stats panel */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stats-card {
  background: var(--bg-elevated);
  padding: 12px;
  border-radius: var(--radius-md);
  text-align: center;
}
.stats-card__value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}
.stats-card__label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* 新手引导 */
.onboard-step {
  text-align: center;
  max-width: 400px;
}
.onboard-step__icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.onboard-step__title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--accent);
}
.onboard-step__desc {
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 1200px) {
  .game-sidebar {
    display: none;
  }
  .game-body {
    flex-direction: column;
  }
}
@media (max-width: 768px) {
  .toolbar { padding: 8px; }
  .tool-btn { min-width: 56px; padding: 6px 8px; }
  .game-info-bar { padding: 8px 12px; }
  .game-info__group { gap: 8px; }
  .game-info__label-value { font-size: 14px; }
  .game-info__label-value.timer,
  .game-info__label-value.score { font-size: 16px; }
  .pause-overlay__title { font-size: 24px; }
  .layout-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}