* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --shell-bg: #0b1020;
  --canvas-bg: #121a2f;
  --text-color: #f4f7ff;
  --overlay-bg: rgba(8, 12, 24, 0.5);
  --accent-start: #7dd3fc;
  --accent-end: #a78bfa;
}
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--shell-bg);
  color: var(--text-color);
  font-family: "Segoe UI", system-ui, sans-serif;
}
#game-container { position: relative; width: 100%; height: 100%; }
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--canvas-bg);
  touch-action: none;
  user-select: none;
}
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: linear-gradient(var(--overlay-bg), var(--overlay-bg)), var(--overlay-bg-image);
  background-size: cover;
  background-position: center;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
}
.overlay.hidden { display: none; }
.overlay::after {
  content: "게임 규칙 : 인접한 타일을 드래그해 연결하면 드래그한 원소 스킬이 전부 동시에 발동된다.";
  max-width: 520px;
  margin-top: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(125, 211, 252, 0.38);
  border-radius: 10px;
  color: rgba(244, 247, 255, 0.86);
  background: rgba(11, 16, 32, 0.72);
  font-size: 0.85rem;
  line-height: 1.5;
}
#controls-hint { opacity: 0.8; font-size: 0.95rem; }
#startButton {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 28px;
  color: var(--shell-bg);
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease;
}
#startButton:hover { filter: brightness(1.08); transform: translateY(-1px); }
#startButton:active { transform: translateY(1px); }
#startButton:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
#game-container::after {
  content: "최대 연결 3칸";
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 1;
  transform: translateX(-50%);
  color: rgba(248, 250, 255, 0.82);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}
#game-container:has(.overlay:not(.hidden))::after { display: none; }

@media (prefers-reduced-motion: reduce) {
  #startButton { transition: none; }
}
