:root {
  color-scheme: dark light;
  --bg: #0b1220;
  --fg: #e2e8f0;
  --accent: #38bdf8;
  --card-bg: rgba(15, 23, 42, 0.65);
  --card-border: rgba(148, 163, 184, 0.18);
  --muted: rgba(226, 232, 240, 0.7);
  --tile-bg: #0f172a;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7fafc;
    --fg: #0f172a;
    --card-bg: rgba(148, 163, 184, 0.14);
    --card-border: rgba(30, 41, 59, 0.18);
    --muted: rgba(30, 41, 59, 0.7);
    --tile-bg: #e2e8f0;
  }
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.18), transparent 55%), var(--bg);
  color: var(--fg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 3rem clamp(1rem, 4vw, 3rem) 2rem;
  text-align: center;
}

header h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  letter-spacing: 0.02em;
}

header p {
  margin: 0.75rem auto 0;
  max-width: 42rem;
  color: var(--muted);
  line-height: 1.65;
}

header .hint {
  font-size: 0.95rem;
}

main {
  width: min(72rem, 94vw);
  margin: 0 auto 3rem;
  display: grid;
  gap: 2.5rem;
}

section.category {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

section.category h2 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.tile-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}

.tile-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 18px 30px rgba(8, 14, 29, 0.35);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.tile-card:hover,
.tile-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 26px 42px rgba(8, 14, 29, 0.55);
  border-color: rgba(56, 189, 248, 0.55);
  outline: none;
}

.tile-preview {
  width: 100%;
  display: grid;
  place-items: center;
}

.tile-preview canvas {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.tile-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.tile-name {
  margin: 0;
  font-size: 1.05rem;
}

.tile-id {
  background: rgba(15, 23, 42, 0.4);
  color: var(--accent);
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  align-self: flex-start;
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%) translateY(40px);
  background: rgba(15, 23, 42, 0.85);
  color: var(--fg);
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.4);
}

.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
