:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-2: #818cf8;
  --good: #22c55e;
  --bad: #ef4444;
  --warn: #eab308;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans Devanagari", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 48px;
}

header {
  text-align: center;
  max-width: 900px;
  width: 100%;
}

h1 {
  margin: 0 0 6px;
  font-size: 2.4rem;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

header > p {
  margin: 0 0 14px;
  color: var(--muted);
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 10px;
}

#progress {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-2);
}

#new-game {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

#new-game:hover {
  background: var(--accent-2);
}

#new-game:active {
  transform: scale(0.96);
}

.message {
  min-height: 1.4em;
  margin: 4px 0 0;
  font-weight: 600;
}

.message.good { color: var(--good); }
.message.bad { color: var(--bad); }
.message.info { color: var(--muted); }

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  width: 100%;
  max-width: 900px;
  margin-top: 22px;
}

.column {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 320px;
}

.column h2 {
  margin: 0 0 4px;
  font-size: 1rem;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cell {
  background: var(--panel-2);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  font-size: 1.15rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, color 0.15s ease;
}

.cell:hover {
  background: #3f4d6b;
}

.cell:active {
  transform: scale(0.98);
}

.cell.selected {
  border-color: var(--warn);
  background: #43386a;
}

.cell.matched {
  background: rgba(34, 197, 94, 0.18);
  border-color: var(--good);
  color: #bbf7d0;
  cursor: default;
}

.cell.wrong {
  animation: shake 0.4s ease;
  border-color: var(--bad);
  background: rgba(239, 68, 68, 0.2);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

footer {
  margin-top: auto;
  padding-top: 28px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

footer code {
  background: var(--panel);
  padding: 2px 6px;
  border-radius: 6px;
}

.win {
  font-size: 1.3rem;
  color: var(--good);
}

@media (max-width: 640px) {
  .board {
    grid-template-columns: 1fr;
  }
  h1 { font-size: 1.8rem; }
}
