:root {
  --bg: #0b0f19;
  --panel: #111a2b;
  --card: #0f1626;
  --line: #22304a;
  --text: #e7eefc;
  --muted: #a7b3cc;
  --accent: #7aa2ff;
  --good: #7dffb2;
  --bad: #ff7d7d;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Helvetica,
    Arial;
  background:
    radial-gradient(
      1200px 600px at 20% -10%,
      rgba(122, 162, 255, 0.25),
      transparent 60%
    ),
    radial-gradient(
      900px 500px at 90% 10%,
      rgba(125, 255, 178, 0.16),
      transparent 55%
    ),
    var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px;
}
.header {
  padding-top: 28px;
  padding-bottom: 8px;
}
h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.2px;
}
.sub {
  margin: 8px 0 0;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 10px;
  margin: 14px 0;
}
.tab {
  border: 1px solid var(--line);
  background: rgba(17, 26, 43, 0.7);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
}
.tab.active {
  border-color: rgba(122, 162, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, 0.18);
}
.panel {
  border: 1px solid var(--line);
  background: rgba(17, 26, 43, 0.55);
  border-radius: 18px;
  padding: 16px;
}
.hidden {
  display: none;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.label {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}
select {
  background: rgba(15, 22, 38, 0.8);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 12px;
}
.stat {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 22, 38, 0.65);
  color: var(--muted);
}
.btn {
  background: rgba(122, 162, 255, 0.15);
  border: 1px solid rgba(122, 162, 255, 0.5);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}
.btn:hover {
  filter: brightness(1.08);
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* Memory */
.memory-board {
  display: grid;
  gap: 10px;
  user-select: none;
}
.memory-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(15, 22, 38, 0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  overflow: hidden;
  transition:
    transform 0.12s ease,
    border-color 0.12s ease;
}
.memory-card:hover {
  transform: translateY(-1px);
  border-color: rgba(122, 162, 255, 0.55);
}
.memory-card[data-state="hidden"] .face {
  opacity: 0;
  transform: scale(0.85);
}
.memory-card[data-state="shown"] .face {
  opacity: 1;
  transform: scale(1);
}
.memory-card[data-state="matched"] {
  border-color: rgba(125, 255, 178, 0.55);
  box-shadow: 0 0 0 3px rgba(125, 255, 178, 0.12);
}
.face {
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
}

/* Slide puzzle */
.slide-wrap {
  display: flex;
  justify-content: center;
}
.slide-board {
  width: min(560px, 92vw);
  aspect-ratio: 1 / 1;
  display: grid;
  gap: 10px;
  user-select: none;
}
.tile {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(15, 22, 38, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 22px;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    border-color 0.12s ease;
}
.tile:hover {
  transform: translateY(-1px);
  border-color: rgba(122, 162, 255, 0.55);
}
.tile.blank {
  background: rgba(15, 22, 38, 0.25);
  border-style: dashed;
  cursor: default;
}
.tile.win {
  border-color: rgba(125, 255, 178, 0.7);
  box-shadow: 0 0 0 3px rgba(125, 255, 178, 0.12);
}

.footer {
  margin-top: 16px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.footer a {
  color: var(--accent);
  text-decoration: none;
}
.dot {
  opacity: 0.6;
}
