:root {
  --accent: #6d28d9;
  --accent-dark: #4c1d95;
  --pink: #be185d;
  --bg: #fdfbff;
  --card: #ffffff;
  --text: #211a34;
  --muted: #574f6b;
  --line: #e7ddf3;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

img { max-width: 100%; }

a { color: var(--accent); }
a:hover { color: var(--pink); }

:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  z-index: 100;
}

.skip-link:focus { left: 12px; }

.site-header { background: #fff; border-bottom: 1px solid var(--line); }

.topbar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.wordmark {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.wordmark span { color: var(--pink); }
.wordmark:hover { color: var(--accent-dark); }

.search-wrap { flex: 1 1 170px; min-width: 0; position: relative; }

.search input {
  width: 100%;
  min-width: 0;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.search input::placeholder { color: var(--muted); }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 340px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(33, 26, 52, 0.16);
  padding: 6px;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}

.search-item:hover, .search-item:focus { background: #f5edff; }
.search-item img { width: 64px; height: 48px; border-radius: 6px; object-fit: cover; }
.search-empty { display: block; padding: 10px; color: var(--muted); }

.chips {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.chip:hover { background: #f5edff; color: var(--pink); }

.chip.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 8px; }

h1 {
  font-size: clamp(1.85rem, 6vw, 2.7rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 8px 0 12px;
}

h2 { font-size: 1.2rem; line-height: 1.3; margin: 0 0 12px; }
p { margin: 0 0 12px; }

.lead { font-size: 1.05rem; color: var(--muted); max-width: 70ch; }
.intro p { max-width: 70ch; font-size: 1.05rem; }

.crumbs { margin-bottom: 10px; font-size: 0.88rem; color: var(--muted); }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 8px; list-style: none; margin: 0; padding: 0; }
.crumbs li + li::before { content: "›"; margin-right: 8px; color: var(--muted); }
.crumbs a { color: var(--accent); text-decoration: none; }

.row { margin: 26px 0; }

.row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.row-head h2 { margin: 0; }

.more {
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 7px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(45, 24, 80, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(45, 24, 80, 0.14);
}

.thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 11px;
  background: #f2ebfa;
}

.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

.card-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.3;
  margin: 7px 3px 1px;
}

.card-cat { font-size: 0.78rem; color: var(--muted); margin: 0 3px 4px; }
.category-card { min-height: 120px; justify-content: center; }
.cat-name { font-size: 1.05rem; font-weight: 750; color: var(--accent-dark); margin: 8px 4px 0; }
.empty { color: var(--muted); background: #fff; padding: 16px; border-radius: 12px; border: 1px dashed var(--line); }

.game-frame {
  position: relative;
  width: 100%;
  max-width: 100%;
  background: #160f25;
  border-radius: 14px;
  overflow: hidden;
}

.game-frame iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.fullscreen {
  margin: 12px 0;
  padding: 10px 20px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.fullscreen:hover { background: var(--accent-dark); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin: 14px 0;
}

.panel p { max-width: 75ch; }
.panel ul { margin: 0; padding-left: 22px; }
.panel li { margin-bottom: 6px; }
.panel details { padding: 8px 0; border-top: 1px solid var(--line); }
.panel details:first-of-type { border-top: 0; }
.panel summary { cursor: pointer; font-weight: 700; }
.panel details p { margin-top: 8px; color: var(--muted); }

.meta p { font-size: 0.94rem; }
.tag {
  display: inline-block;
  padding: 4px 10px;
  margin: 3px 4px 3px 0;
  background: #f5edff;
  border-radius: 999px;
  font-size: 0.84rem;
  text-decoration: none;
}

.tag:hover { background: #eadbff; }

.pagination { display: flex; gap: 10px; margin: 18px 0; }
.pagination a {
  padding: 8px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
}

.seo-copy { margin: 34px 0 16px; color: var(--muted); }
.seo-copy p { max-width: 85ch; }

.site-footer {
  max-width: 1240px;
  margin: 30px auto 0;
  padding: 20px 16px 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer nav { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 10px; }
.site-footer a { text-decoration: none; font-weight: 600; }

@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 780px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
}

@media (min-width: 1080px) {
  .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card:hover { transform: none; }
}
