@import url("https://fonts.googleapis.com/css2?family=Chivo:wght@300;400;600;700&family=DM+Serif+Display&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  color-scheme: light;
  --bg: #f7efe6;
  --bg-alt: #eff4f7;
  --surface: #fffaf2;
  --ink: #1d1a16;
  --muted: #6c6259;
  --accent: #f25c2a;
  --accent-2: #0e7c7b;
  --accent-3: #f2c14e;
  --border: rgba(29, 26, 22, 0.14);
  --shadow: 0 20px 60px rgba(29, 26, 22, 0.12);
  --radius: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Chivo", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: var(--bg);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(242, 92, 42, 0.22), transparent 45%),
    radial-gradient(circle at 85% 0%, rgba(14, 124, 123, 0.2), transparent 42%),
    radial-gradient(circle at 20% 90%, rgba(242, 193, 78, 0.18), transparent 46%),
    linear-gradient(120deg, var(--bg), var(--bg-alt));
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(0deg, rgba(29, 26, 22, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 26, 22, 0.035) 1px, transparent 1px);
  background-size: 90px 90px;
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.hero {
  display: block;
  margin-bottom: 18px;
  animation: fade-in 0.7s ease both;
}

.hero-text h1 {
  margin: 8px 0 12px;
  font-family: "DM Serif Display", "Times New Roman", serif;
  font-size: clamp(2.6rem, 4vw, 4.2rem);
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}

.subtitle {
  margin: 0;
  max-width: 44ch;
  color: var(--muted);
  line-height: 1.6;
  font-size: 1rem;
}

.hero-panel {
  background: rgba(255, 250, 242, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.search-bar {
  position: sticky;
  top: 16px;
  z-index: 6;
  margin-bottom: 28px;
}

.search-field {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: var(--muted);
}

.search-field span {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.search-field input {
  width: 100%;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(242, 92, 42, 0.2);
}

.counts {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-weight: 600;
  color: var(--muted);
}

.counts span {
  color: var(--ink);
  font-size: 1.2rem;
}

.status {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(242, 92, 42, 0.12);
  border: 1px solid transparent;
  display: none;
  color: var(--ink);
}

.status.is-visible {
  display: block;
}

.status.is-error {
  border-color: rgba(242, 92, 42, 0.6);
  background: rgba(242, 92, 42, 0.2);
}

.game-list {
  display: grid;
  gap: 32px;
}

.letter-group {
  display: grid;
  gap: 18px;
}

.letter-title {
  margin: 0;
  font-family: "DM Serif Display", "Times New Roman", serif;
  font-size: clamp(1.8rem, 2.5vw, 2.6rem);
  color: var(--accent-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.group-grid {
  display: grid;
  gap: 24px;
}

.card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.6s ease both;
  animation-delay: calc(var(--index, 0) * 0.03s);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 70px rgba(29, 26, 22, 0.16);
}

.card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.game-title {
  margin: 8px 0 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(14, 124, 123, 0.12);
  color: var(--accent-2);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-content {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 20px;
  margin-top: 16px;
}

.code-stack {
  display: grid;
  gap: 14px;
}

.code-block {
  background: #21201d;
  border-radius: 14px;
  padding: 16px;
  color: #f8f0e6;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.code-label {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(248, 240, 230, 0.7);
  font-weight: 600;
}

.copy-btn {
  border: 1px solid rgba(248, 240, 230, 0.4);
  background: transparent;
  color: #f8f0e6;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.copy-btn:hover {
  background: rgba(248, 240, 230, 0.1);
  transform: translateY(-1px);
}

.copy-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.copy-btn.is-copied {
  background: rgba(14, 124, 123, 0.35);
  border-color: rgba(14, 124, 123, 0.6);
  color: #e8faf8;
}

.copy-btn.is-failed {
  background: rgba(242, 92, 42, 0.35);
  border-color: rgba(242, 92, 42, 0.6);
  color: #fff5ef;
}

.code-block pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-block code {
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.media {
  display: flex;
  gap: 14px;
  align-items: center;
}

.game-image {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 24px rgba(29, 26, 22, 0.14);
  background: #f1e6d7;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 22px rgba(242, 92, 42, 0.3);
  white-space: nowrap;
}

.download-btn:hover {
  transform: translateY(-1px);
}

.download-btn.is-disabled {
  opacity: 0.5;
  pointer-events: none;
  box-shadow: none;
}

.noscript {
  margin: 24px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(242, 92, 42, 0.2);
  color: var(--ink);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .search-bar {
    top: 12px;
  }
}

@media (max-width: 860px) {
  .card-content {
    grid-template-columns: 1fr;
  }

  .media {
    justify-content: flex-start;
  }

  .game-image {
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  .page {
    padding: 24px 18px 60px;
  }

  .counts {
    gap: 10px;
  }

  .media {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
