/* 连连看游戏 */
:root {
  --bg: #1a1a2e;
  --bg-panel: #16213e;
  --bg-tile: #0f3460;
  --bg-tile-hover: #1a4a7a;
  --bg-tile-select: #e94560;
  --accent: #e94560;
  --text: #eaeaea;
  --text-muted: #a0a0a0;
  --success: #4ecca3;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  font-family: 'Noto Sans SC', system-ui, sans-serif;
  color: var(--text);
  padding: 1.5rem;
}

.game-container {
  background: var(--bg-panel);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  max-width: 100%;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.game-header h1 {
  font-size: 1.5rem;
}

.controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat {
  background: var(--bg-tile);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-weight: 600;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-right: 0.3rem;
}

.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--bg-tile);
  color: var(--text);
  transition: all 0.2s;
}

.btn:hover {
  background: var(--bg-tile-hover);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: #ff6b6b;
  box-shadow: 0 0 12px rgba(233, 69, 96, 0.4);
}

.difficulty-select {
  margin-bottom: 1rem;
}

.difficulty-select label {
  margin-right: 0.5rem;
  color: var(--text-muted);
}

.difficulty-select select {
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--bg-tile);
  background: var(--bg-tile);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
}

.game-area {
  position: relative;
  display: inline-block;
}

.game-board {
  display: grid;
  gap: 4px;
  padding: 8px;
  background: var(--bg);
  border-radius: 12px;
}

.tile {
  width: 50px;
  height: 50px;
  min-width: 50px;
  min-height: 50px;
  background: var(--bg-tile);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.tile:hover:not(.cleared) {
  background: var(--bg-tile-hover);
  transform: scale(1.05);
}

.tile.selected {
  background: var(--bg-tile-select);
  box-shadow: 0 0 0 2px white;
}

.tile.cleared {
  background: transparent;
  cursor: default;
  visibility: hidden;
}

.game-board.medium .tile {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  font-size: 1.25rem;
}

.game-board.hard .tile {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  font-size: 1rem;
}

.line-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.win-content {
  text-align: center;
  padding: 2rem;
}

.win-content h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--success);
}

.win-content p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.game-footer {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}
