/* PlayPulse — main stylesheet */
:root {
  --bg: #0a0f1f;
  --surface: #141d38;
  --border: #253158;
  --text: #e9eefb;
  --muted: #92a0c6;
  --accent: #22d3ee;
  --accent2: #a855f7;
  --radius: 16px;
  --shadow: 0 8px 32px rgba(0,0,0,.35);
}
[data-theme="light"] {
  --bg: #eef1f8;
  --surface: #ffffff;
  --border: #d4dbe8;
  --text: #0e1630;
  --muted: #5a6a8a;
  --shadow: 0 8px 32px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.container { width: min(1120px, 92%); margin-inline: auto; }
.section { padding: 3.5rem 0; }
.grad-text {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; font-size: 1.15rem; color: var(--text);
  text-decoration: none;
}
.brand-badge {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid; place-items: center; color: #0a0f1f;
}
.nav-links { display: flex; align-items: center; gap: 1.25rem; }
.nav-links a { color: var(--muted); font-weight: 500; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.theme-toggle {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--border); display: grid; place-items: center;
}
.theme-toggle svg { width: 18px; height: 18px; }
.icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: block; }

/* Hero */
.hero { padding: 4rem 0 2.5rem; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); margin: 0 0 1rem; line-height: 1.15; }
.hero p { color: var(--muted); max-width: 560px; margin: 0 auto 1.75rem; font-size: 1.05rem; }
.hero-cta { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem; padding: .7rem 1.25rem; border-radius: 12px;
  font-weight: 600; font-size: .95rem; text-decoration: none;
  transition: transform .15s, background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  color: #0a0f1f; border: none;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Toolbar */
.toolbar { margin-bottom: 1.75rem; }
.search-wrap {
  position: relative; margin-bottom: 1rem;
}
.search-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--muted); pointer-events: none;
}
.search-input {
  width: 100%; padding: .8rem 1rem .8rem 2.6rem;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 1rem;
  outline: none;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.categories { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  padding: .45rem .9rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: .875rem; font-weight: 500;
}
.chip.active, .chip[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  border-color: var(--accent); color: var(--accent);
}

/* Game grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}
.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  display: flex; flex-direction: column; gap: .65rem;
  box-shadow: var(--shadow);
  animation: cardIn .45s ease both;
  transition: border-color .2s, transform .2s;
}
.game-card:hover { border-color: var(--accent); transform: translateY(-3px); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.card-top { position: relative; }
.game-logo { width: 100%; aspect-ratio: 1; border-radius: 14px; }
.category-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.45); color: #fff;
  font-size: .7rem; font-weight: 600; padding: .25rem .55rem;
  border-radius: 999px; backdrop-filter: blur(6px);
}
.game-card h3 { margin: 0; font-size: 1.1rem; }
.game-card p { margin: 0; color: var(--muted); font-size: .9rem; flex: 1; }
.play-btn { width: 100%; margin-top: .35rem; }

/* Empty state */
.empty-state {
  display: none; text-align: center; padding: 3rem 1rem;
  border: 1px dashed var(--border); border-radius: var(--radius);
  margin-top: 1.5rem;
}
.empty-state.visible { display: block; }
.empty-state h3 { margin: 0 0 .5rem; }
.empty-state p { color: var(--muted); margin: 0 0 1.25rem; }

/* How to */
.howto { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.howto h2 { text-align: center; margin: 0 0 .5rem; }
.howto .lead { text-align: center; color: var(--muted); max-width: 520px; margin: 0 auto 2rem; }
.steps {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}
.step {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.35rem; text-align: center;
}
.step-num {
  width: 36px; height: 36px; margin: 0 auto .75rem;
  border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0a0f1f; font-weight: 800; display: grid; place-items: center;
}
.step h3 { margin: 0 0 .4rem; font-size: 1rem; }
.step p { margin: 0; color: var(--muted); font-size: .9rem; }
.howto-note {
  margin-top: 2rem; text-align: center; color: var(--muted);
  font-size: .9rem; max-width: 600px; margin-inline: auto;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border); padding: 2.5rem 0 1.5rem;
  margin-top: 2rem;
}
.footer-grid {
  display: flex; flex-wrap: wrap; gap: 2rem;
  justify-content: space-between; margin-bottom: 1.5rem;
}
.footer-brand p { color: var(--muted); max-width: 280px; font-size: .9rem; margin: .6rem 0 0; }
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { color: var(--muted); }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: .75rem;
  justify-content: space-between; color: var(--muted); font-size: .85rem;
  border-top: 1px solid var(--border); padding-top: 1.25rem;
}

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.55); display: grid; place-items: center;
  padding: 1rem; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; width: min(440px, 100%);
  box-shadow: var(--shadow); overflow: hidden;
  transform: scale(.96); transition: transform .2s;
}
.modal.open .modal-panel { transform: none; }
.modal-head {
  display: flex; align-items: center; gap: .85rem;
  padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--border);
}
.modal-logo { width: 48px; height: 48px; border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.modal-head h3 { margin: 0; font-size: 1.15rem; }
.modal-close {
  margin-left: auto; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); display: grid; place-items: center;
  font-size: 1.1rem; color: var(--muted);
}
.modal-body { padding: 1.25rem; }
.modal-body .tagline { color: var(--accent); font-weight: 600; margin: 0 0 .5rem; }
.modal-body p { margin: 0 0 .75rem; color: var(--muted); font-size: .95rem; }
.modal-meta { margin-bottom: .75rem !important; }
.modal-tips { margin: 0 0 1.25rem; padding-left: 1.2rem; color: var(--muted); font-size: .9rem; }
.modal-tips li { margin-bottom: .3rem; }
.modal-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; min-width: 120px; }
.modal-note { margin-top: .9rem !important; font-size: .8rem; color: var(--muted); }

/* Toasts */
.toasts {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 200;
  display: flex; flex-direction: column; gap: .5rem;
}
.toast {
  background: var(--surface); border: 1px solid var(--border);
  padding: .7rem 1.1rem; border-radius: 12px; box-shadow: var(--shadow);
  font-size: .9rem; animation: toastIn .25s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* Responsive */
@media (max-width: 560px) {
  .hero { padding-top: 2.5rem; }
  .nav-links a:not(.theme-toggle) { display: none; }
  .footer-bottom { flex-direction: column; text-align: center; }
}
