@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500&display=swap');

:root {
  --bg: #14132B;
  --surface: #1E1C3D;
  --surface-2: #26234A;
  --accent: #FFB627;
  --accent-2: #FF4D6D;
  --text: #F2F0FF;
  --muted: #9C97C4;
  --border: #322F5C;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(20, 19, 43, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo .dot { color: var(--accent); }

.search-box {
  flex: 1;
  min-width: 200px;
  max-width: 420px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}
.search-box input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cat-btn {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all .15s ease;
}
.cat-btn:hover { border-color: var(--accent); color: var(--text); }
.cat-btn.active {
  background: var(--accent);
  color: #1A1400;
  border-color: var(--accent);
  font-weight: 600;
}

/* ---------- Marquee (signature element) ---------- */

.marquee-strip {
  overflow: hidden;
  background: linear-gradient(90deg, var(--surface-2), var(--surface));
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}
.marquee-track {
  display: inline-flex;
  gap: 40px;
  white-space: nowrap;
  animation: scroll-left 30s linear infinite;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.marquee-track span { color: var(--muted); }
@keyframes scroll-left {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
}

/* ---------- Ad slots ---------- */

.ad-slot {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 32px;
}
.ad-slot .ad-frame {
  min-height: 90px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

/* ---------- Grid & cards ---------- */

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 32px 64px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 8px 0 20px;
  color: var(--text);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  cursor: pointer;
}
.game-card:hover, .game-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(255, 182, 39, 0.15);
  outline: none;
}
.game-card .thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--surface-2);
  display: block;
}
.game-card .info { padding: 12px 14px; }
.game-card .title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}
.game-card .plays { font-family: var(--font-mono); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 14px;
}

/* ---------- Game page ---------- */

.player-wrap {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 32px;
}
.player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.player-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: radial-gradient(circle at center, var(--surface-2), var(--bg));
  cursor: pointer;
}
.play-overlay .play-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 8px rgba(255,182,39,0.12);
}
.play-overlay .play-btn svg { fill: #1A1400; margin-left: 4px; }
.play-overlay p { color: var(--muted); font-family: var(--font-mono); font-size: 13px; }

.game-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.game-title-row h1 {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 0;
}
.game-desc {
  color: var(--muted);
  margin-top: 12px;
  max-width: 700px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ---------- Admin ---------- */

.admin-shell {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 24px;
}
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}
.admin-card h2 {
  font-family: var(--font-display);
  font-size: 18px;
  margin-top: 0;
}
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
  font-family: var(--font-mono);
}
.form-row input[type=text],
.form-row input[type=password],
.form-row textarea,
.form-row select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
}
.form-row input[type=file] { color: var(--muted); }

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #1A1400;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn.danger { background: var(--accent-2); color: #2A0006; }

.admin-game-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.admin-game-row img { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; }
.admin-game-row .name { flex: 1; font-weight: 600; }
.admin-game-row .status { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }

.msg { font-size: 13px; margin-top: 8px; }
.msg.error { color: var(--accent-2); }
.msg.ok { color: #7CFFA0; }

footer {
  text-align: center;
  padding: 32px;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

/* ---------- Модалка предпросмотра игры ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 9, 20, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  padding: 28px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { border-color: var(--accent); }

.modal-cover {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface-2);
  margin-bottom: 18px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0 0 6px;
  padding-right: 40px;
}

.modal-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--font-mono);
  margin-bottom: 16px;
}

.modal-desc {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 18px;
}

.modal-gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 20px;
}
.modal-gallery img {
  height: 110px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.modal-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  font-size: 15px;
}

.related-section {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  padding-top: 32px;
}

.fullscreen-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(20, 19, 43, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}
.fullscreen-btn:hover { background: rgba(20, 19, 43, 0.9); }
.player-frame:fullscreen { border-radius: 0; }
.player-frame:-webkit-full-screen { border-radius: 0; }

.game-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.tag-chip {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.admin-tab {
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.upload-progress { margin-top: 14px; }
.upload-progress-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.15s ease;
}
.upload-progress-text {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.admin-tab {
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.upload-progress { margin-top: 14px; }
.upload-progress-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.15s ease;
}
.upload-progress-text {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.admin-tab {
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.upload-progress { margin-top: 14px; }
.upload-progress-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.15s ease;
}
.upload-progress-text {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
}
