/* =====================================================
   Indoor Games for Adults – Modern Responsive CSS
   ===================================================== */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --accent: #06b6d4;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 12px 32px rgba(15, 23, 42, 0.12);
  --easy: #10b981;
  --medium: #f59e0b;
  --hard: #ef4444;
  --header-h: 64px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --border: #334155;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.4);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-hover); }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 480px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}
.logo img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.logo-text { font-size: 1.6rem; }

.main-nav { display: flex; gap: 1.5rem; }
.main-nav a { color: var(--text-muted); font-weight: 500; }
.main-nav a:hover { color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 0.5rem; }

.theme-toggle, .nav-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px; height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, border-color .2s;
}
.theme-toggle:hover, .nav-toggle:hover { background: var(--border); }
.nav-toggle { display: none; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  color: #fff;
  padding: 3.5rem 0 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2rem;
  text-align: left;
}
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 0.5rem; font-weight: 800; }
.hero p { opacity: 0.92; margin-bottom: 1.5rem; font-size: 1.1rem; }
.hero-eyebrow {
  display: inline-block;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.9rem;
}
.hero-art {
  position: relative;
  width: 170px;
  height: 150px;
}
.hero-dice {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7rem;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,0.25));
  animation: floatY 4s ease-in-out infinite;
}
.hero-spark {
  position: absolute;
  top: 6px; right: 10px;
  font-size: 1.8rem;
  color: rgba(255,255,255,0.85);
  animation: twinkle 2.5s ease-in-out infinite;
}
.hero-stats {
  margin-top: 2.5rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: rgba(0,0,0,0.16);
  border-top: 1px solid rgba(255,255,255,0.2);
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.35rem 1.4rem;
}
.stat strong { font-size: 1.5rem; font-weight: 800; }
.stat span { font-size: 0.8rem; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.05em; }

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes twinkle {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* ---------- Category chips ---------- */
.category-chips-section { padding: 1.1rem 0; background: var(--surface); }
.category-chips { display: flex; flex-wrap: wrap; gap: 0.55rem; justify-content: center; }
.chip {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all .2s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.search-bar {
  display: flex;
  max-width: 480px;
  gap: 0.5rem;
}
.search-bar input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  background: rgba(255,255,255,0.95);
  color: #0f172a;
}
.search-bar input:focus { outline: 2px solid #fff; }

/* ---------- Filters ---------- */
.filters-section { padding: 1.25rem 0; background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.filters select {
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  background: var(--primary);
  color: #fff !important;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.btn:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.85rem; }
.btn-outline {
  background: transparent;
  color: var(--primary) !important;
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff !important; }
.btn-danger { background: var(--hard); }
.btn-danger:hover { background: #dc2626; }

/* ---------- Games Grid ---------- */
.games-section { padding: 2.5rem 0 3.5rem; flex: 1; }
.section-title { font-size: 1.35rem; margin-bottom: 1.5rem; color: var(--text-muted); font-weight: 600; }

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform .25s, box-shadow .25s;
  animation: fadeUp .4s ease both;
}
.game-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}
.card-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}
.game-card:hover .card-thumb img { transform: scale(1.06); }
.card-thumb.img-fallback::after {
  content: '🎲';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 3.5rem;
}
.card-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
}
.card-badge.easy { background: var(--easy); }
.card-badge.medium { background: var(--medium); }
.card-badge.hard { background: var(--hard); }

.card-body { padding: 1.35rem; display: flex; flex-direction: column; flex: 1; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.card-cat { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.card-body h3 { font-size: 1.15rem; margin-bottom: 0.35rem; }
.card-body h3 a { color: var(--text); }
.card-body h3 a:hover { color: var(--primary); }
.card-meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.6rem; }
.card-meta .players { font-weight: 600; }
.card-desc { font-size: 0.92rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.5; flex: 1; }
.card-body .btn { align-self: flex-start; }

.empty-state { text-align: center; padding: 3rem; color: var(--text-muted); }

/* ---------- Game Detail ---------- */
.game-detail { padding: 2rem 0 3rem; }
.breadcrumb { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.breadcrumb a { color: var(--text-muted); }
.detail-header { margin-bottom: 2rem; }
.detail-thumb {
  width: 100%;
  max-width: 560px;
  aspect-ratio: 2 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-thumb.img-fallback::after {
  content: '🎲';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 4rem;
}
.detail-header h1 { font-size: 2rem; margin-bottom: 0.75rem; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.badge {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--border);
  color: var(--text);
}
.badge.difficulty.easy { background: color-mix(in srgb, var(--easy) 20%, transparent); color: var(--easy); }
.badge.difficulty.medium { background: color-mix(in srgb, var(--medium) 20%, transparent); color: var(--medium); }
.badge.difficulty.hard { background: color-mix(in srgb, var(--hard) 20%, transparent); color: var(--hard); }
.detail-section { margin-bottom: 2rem; }
.detail-section h2 { font-size: 1.25rem; margin-bottom: 0.6rem; color: var(--primary); }
.how-to-play { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.back-link { margin-top: 2rem; }

/* ---------- Forms ---------- */
.page-content { padding: 2.5rem 0 3.5rem; flex: 1; }
.page-content h1 { margin-bottom: 1rem; }
.page-content h2 { margin: 1.5rem 0 0.75rem; font-size: 1.25rem; }
.page-content ul { margin: 0.75rem 0 1rem 1.5rem; }

.contact-form { max-width: 560px; margin-top: 1.5rem; }
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.95rem; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; }

.alert {
  padding: 0.9rem 1.1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-weight: 500;
}
.alert-success { background: color-mix(in srgb, var(--easy) 15%, transparent); color: var(--easy); border: 1px solid var(--easy); }
.alert-error { background: color-mix(in srgb, var(--hard) 15%, transparent); color: var(--hard); border: 1px solid var(--hard); }

.hint { margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted); }
.hint code { background: var(--border); padding: 0.15rem 0.4rem; border-radius: 4px; }

/* ---------- Admin ---------- */
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.admin-form-section { margin-bottom: 2.5rem; padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.admin-list-section h2 { margin-bottom: 1rem; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.admin-table th, .admin-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background: var(--bg); font-weight: 600; color: var(--text-muted); }
.admin-table tr:hover td { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.actions { display: flex; gap: 0.4rem; align-items: center; }
.inline-form { display: inline; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.75rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: auto;
}
.social-links { margin-top: 0.6rem; display: flex; justify-content: center; gap: 1.25rem; }
.social-links a { color: var(--text-muted); font-size: 1.1rem; }
.social-links a:hover { color: var(--primary); }

/* ---------- Spinner ---------- */
.spinner[hidden] { display: none; }
.spinner {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.spinner::after {
  content: '';
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.game-card:nth-child(1) { animation-delay: 0.05s; }
.game-card:nth-child(2) { animation-delay: 0.1s; }
.game-card:nth-child(3) { animation-delay: 0.15s; }
.game-card:nth-child(4) { animation-delay: 0.2s; }
.game-card:nth-child(5) { animation-delay: 0.25s; }
.game-card:nth-child(6) { animation-delay: 0.3s; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem 1.25rem;
    gap: 0.75rem;
  }
  .main-nav.open { display: flex; }
  .hero { padding: 2.5rem 0 0; }
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-art { display: none; }
  .search-bar { margin: 0 auto; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters select, .filters .btn { width: 100%; }
  .search-bar { flex-direction: column; }
  .admin-table { font-size: 0.85rem; }
  .admin-table th, .admin-table td { padding: 0.55rem 0.6rem; }
}

@media (max-width: 480px) {
  .logo .site-name { display: none; }
  .games-grid { grid-template-columns: 1fr; }
}
