/* bysoft-games — Game Portal Styles */

:root {
  --bg: #0f0f1a;
  --bg-2: #1a1a2e;
  --bg-3: #252540;
  --ink: #e8e8f0;
  --ink-soft: #9a9ab0;
  --line: #2a2a3f;
  --accent: #45a188;
  --accent-glow: rgba(69, 161, 136, 0.25);
  --card-radius: 14px;
  --modal-radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: ui-rounded, "Nunito", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}
a { color: var(--ink); text-decoration: none; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15, 15, 26, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 20px;
  display: flex; align-items: center; gap: 16px;
  height: 60px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; letter-spacing: -0.01em; flex: none;
}
.brand-dot {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, #7fae5a, #2fae8f);
  box-shadow: 0 0 12px var(--accent-glow);
}
.search-box {
  flex: 1; max-width: 420px; position: relative;
}
.search-toggle {
  display: none;
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--ink); width: 36px; height: 36px;
  border-radius: 8px; font-size: 15px; cursor: pointer;
}
.search-input {
  width: 100%; padding: 9px 14px 9px 36px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink);
  font-size: 14px; font-family: inherit; outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(69, 161, 136, 0.18);
}
.search-input::placeholder { color: var(--ink-soft); opacity: 0.7; }
.search-box::before {
  content: '🔍'; position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%); font-size: 13px; opacity: 0.6; pointer-events: none;
}
.nav-links {
  margin-left: auto; display: flex; gap: 4px; flex: none;
}
.nav-links a {
  color: var(--ink-soft); font-size: 14px;
  padding: 6px 14px; border-radius: 999px;
  transition: color 0.18s, background 0.18s;
}
.nav-links a:hover { color: var(--ink); background: var(--bg-3); }
.nav-links a.active { color: var(--accent); background: var(--accent-glow); }

/* ── Main ─────────────────────────────────────────────────────────────────── */
.main { max-width: 1200px; margin: 0 auto; padding: 32px 20px 80px; }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  text-align: center; margin-bottom: 40px;
  padding: 48px 20px;
  background: linear-gradient(135deg, rgba(69,161,136,0.08) 0%, rgba(112,142,94,0.06) 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800; letter-spacing: -0.02em; margin-bottom: 14px; line-height: 1.2;
}
.hero .accent {
  background: linear-gradient(135deg, #45a188, #2fae8f);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero .lede { font-size: 17px; color: var(--ink-soft); max-width: 520px; margin: 0 auto 20px; }
.hero-stats {
  display: flex; justify-content: center; gap: 32px; flex-wrap: wrap;
}
.hero-stat { text-align: center; }
.hero-stat-num { font-size: 28px; font-weight: 800; color: var(--accent); }
.hero-stat-label { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Recently Played ──────────────────────────────────────────────────────── */
.recently-played { margin-bottom: 40px; }
.recently-played-title {
  font-size: 16px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
  color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em;
}
.recently-played-title span { color: var(--accent); }
.recently-played-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.recently-played-grid .game-card { cursor: pointer; }

/* ── Section titles ───────────────────────────────────────────────────────── */
.section-title {
  font-size: 20px; font-weight: 800; margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 24px; flex-wrap: wrap;
}
.toolbar-left { font-size: 14px; color: var(--ink-soft); }
.toolbar-right { display: flex; gap: 8px; }
.toolbar-select {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; color: var(--ink); font-size: 13px;
  font-family: inherit; padding: 8px 12px; cursor: pointer; outline: none;
  transition: border-color 0.15s;
}
.toolbar-select:hover, .toolbar-select:focus { border-color: var(--accent); }
.toolbar-select option { background: var(--bg-2); }

/* ── Game Grid ────────────────────────────────────────────────────────────── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* ── Game Card ─────────────────────────────────────────────────────────────── */
.game-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex; flex-direction: column;
}
.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  border-color: var(--card-accent, var(--accent));
}
.game-card-thumb {
  width: 100%; aspect-ratio: 16/9;
  background-size: cover; background-position: center;
  background-color: var(--bg-3); position: relative;
}
.game-card-thumb::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 55%);
}
.game-card-draft {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: #ffd479;
  background: rgba(0,0,0,0.7); border: 1px solid rgba(255,212,121,0.35);
  border-radius: 6px; padding: 2px 8px; backdrop-filter: blur(4px);
}
.game-card-body {
  padding: 14px 16px 10px; flex: 1; display: flex; flex-direction: column;
}
.game-card-name {
  font-size: 16px; font-weight: 700; margin-bottom: 4px;
  letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.game-card-tagline {
  font-size: 12px; color: var(--ink-soft); line-height: 1.5;
  margin-bottom: 10px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.game-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.game-card-tag {
  font-size: 10px; font-weight: 600; letter-spacing: 0.03em;
  color: var(--card-accent, var(--accent));
  background: rgba(69,161,136,0.1); border: 1px solid rgba(69,161,136,0.25);
  border-radius: 999px; padding: 1px 7px; text-transform: capitalize;
}
.game-card-rating { margin-bottom: 6px; }
.game-card-rating .star { font-size: 13px; color: #ffd479; }
.game-card-rating .star.filled { color: #ffd479; }
.game-card-rating .star:not(.filled) { color: #555; }
.game-card-stats { font-size: 11px; color: var(--ink-soft); }
.game-card-play {
  margin: 0 16px 16px; padding: 10px;
  border: none; border-radius: 8px;
  background: var(--card-accent, var(--accent));
  color: #fff; font-size: 14px; font-weight: 700;
  font-family: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  gap: 6px; transition: filter 0.15s, transform 0.1s;
}
.game-card-play:hover { filter: brightness(1.12); transform: scale(1.02); }
.play-icon { font-size: 11px; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-frame {
  width: 100%; max-width: 1100px; height: 90vh; max-height: 800px;
  background: var(--bg-2); border-radius: var(--modal-radius);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  animation: slideUp 0.25s ease;
}
.modal-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--bg-3);
  border-bottom: 1px solid var(--line); flex: none;
}
.modal-title {
  flex: 1; font-size: 16px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.modal-meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--ink-soft); flex: none;
}
.modal-rating {
  display: flex; align-items: center; gap: 4px;
  font-size: 13px; color: var(--ink-soft);
}
.modal-rating .rate-btn {
  background: transparent; border: none; cursor: pointer;
  font-size: 16px; color: #555; padding: 2px 4px;
  transition: color 0.1s, transform 0.1s;
}
.modal-rating .rate-btn:hover { color: #ffd479; transform: scale(1.2); }
.modal-rating .rate-btn.active { color: #ffd479; }
.modal-actions { display: flex; gap: 6px; flex: none; }
.modal-back, .modal-close, .modal-fullscreen {
  background: transparent; border: 1px solid var(--line);
  color: var(--ink-soft); border-radius: 8px;
  padding: 6px 12px; font-size: 13px; cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.modal-back:hover, .modal-close:hover, .modal-fullscreen:hover {
  color: var(--ink); background: rgba(255,255,255,0.06);
}
.modal-body { flex: 1; overflow: hidden; background: #000; }
.modal-body iframe { width: 100%; height: 100%; border: none; display: block; }
.modal-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--bg-3);
  border-top: 1px solid var(--line); gap: 12px; flex: none;
}
.modal-external-link {
  font-size: 13px; color: var(--accent); text-decoration: none;
  transition: opacity 0.15s;
}
.modal-external-link:hover { opacity: 0.8; }
.modal-hint { font-size: 12px; color: var(--ink-soft); opacity: 0.7; }

/* ── Empty / Error ────────────────────────────────────────────────────────── */
.empty-msg, .error-msg {
  grid-column: 1 / -1; text-align: center; padding: 48px 20px;
  color: var(--ink-soft); font-size: 15px;
}
.error-msg { color: #f85149; }
.loading {
  grid-column: 1 / -1; text-align: center; padding: 48px;
  color: var(--ink-soft);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 32px 16px; margin-bottom: 28px; }
  .hero h1 { font-size: 26px; }
  .hero-stats { gap: 20px; }
  .hero-stat-num { font-size: 22px; }
  .game-grid { grid-template-columns: 1fr; gap: 16px; }
  .recently-played-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .recently-played { margin-bottom: 28px; }
  .search-box { display: none; }
  .search-box.open {
    display: block; position: absolute; top: 60px; left: 0; right: 0;
    padding: 10px 16px; background: var(--bg);
    border-bottom: 1px solid var(--line); z-index: 50;
  }
  .search-toggle { display: flex; }
  .nav-links { display: none; }
  .header-inner { padding: 0 14px; gap: 10px; }
  .modal-frame { height: 95vh; border-radius: 12px; }
  .modal-header { padding: 10px 12px; }
  .modal-back { display: none; }
  .modal-footer { flex-direction: column; align-items: flex-start; gap: 6px; }
}