/* ═══════════════════════════════════════
   PlayMini — theme.css
   Единый файл стилей проекта.
   Подключается во ВСЕХ страницах.
   ═══════════════════════════════════════ */

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

/* ── CSS Variables ── */
:root {
  /* Фон */
  --bg:       #181a20;
  --surface:  #1f2128;
  --border:   #2a2c35;
  --border2:  #33353f;

  /* Текст */
  --text:     #e8e8f0;
  --muted:    #8a8aa0;
  --muted2:   #55556a;

  /* Акцент */
  --accent:     #4df0b4;
  --accent-dim: rgba(77, 240, 180, 0.08);
  --accent-glow: rgba(77, 240, 180, 0.2);

  /* Семантика */
  --danger:     #ff5c5c;
  --danger-dim: rgba(255, 92, 92, 0.1);
  --warn:       #f0e040;

  /* Категории игр */
  --c-logic:    #f0e040;
  --c-strategy: #ff5c5c;
  --c-words:    #4df0b4;
  --c-arcade:   #60b4ff;
  --c-cards:    #c084fc;

  /* Шрифты */
  --font-display: 'Unbounded', sans-serif;
  --font-body:    'Onest', sans-serif;
}

/* ── Base ── */
html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: hidden;
}

/* ── Noise overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 999;
  opacity: 0.6;
}

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.4); opacity: 0.6; }
}

/* ── Common layout ── */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* Game pages use centered column layout */
.page-game {
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 48px;
}

/* Info pages (about, updates, support) use narrower layout */
.page-info {
  max-width: 960px;
  padding: 0 24px 80px;
}

/* Profile page */
.page-narrow {
  max-width: 720px;
}

/* ── Top bar (games & info pages) ── */
.top-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 14px;
}

/* In game pages, constrain top bar width */
.page-game .top-bar {
  max-width: 520px;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  transition: color 0.2s;
}
.back-link:hover { color: var(--text); }
.back-link:hover svg { transform: translateX(-3px); }
.back-link svg { transition: transform 0.2s; }

/* ── Page navigation (about, updates, support) ── */
.page-nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s;
}
.nav-link:hover {
  color: var(--text);
  border-color: var(--border2);
}
.nav-link.active {
  color: var(--accent);
  border-color: rgba(77, 240, 180, 0.3);
  background: var(--accent-dim);
}

/* ── Game title (in top-bar of games) ── */
.game-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.03em;
}

/* ── Common stats row (games) ── */
.stats-row {
  width: 100%;
  max-width: 520px;
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.stat-box {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: center;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 7px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* ── Common buttons ── */
.btn {
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn:hover {
  color: var(--text);
  border-color: var(--border2);
}
.btn-accent {
  color: var(--accent);
  border-color: rgba(77, 240, 180, 0.3);
  background: rgba(77, 240, 180, 0.06);
}
.btn-accent:hover {
  background: rgba(77, 240, 180, 0.12);
}
.btn-danger {
  color: var(--danger);
  border-color: rgba(255, 92, 92, 0.3);
  background: var(--danger-dim);
}

/* ── Toast ── */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Overlay (game result / win / game-over) ── */
/* Default: positioned inside board-wrap (absolute) */
.overlay {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: rgba(24, 26, 32, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 20;
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}
.overlay.show {
  opacity: 1;
  pointer-events: all;
}

/* Fullscreen variant (used via .overlay-fullscreen or when outside board-wrap) */
.overlay-fullscreen {
  position: fixed;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 100;
}
.overlay-fullscreen .overlay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 36px 32px;
  text-align: center;
  max-width: 340px;
  width: 90%;
  animation: fadeUp 0.4s ease both;
}

.overlay-emoji,
.overlay-icon {
  font-size: 40px;
  line-height: 1;
}

.overlay-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.02em;
  text-align: center;
}

.overlay-sub {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* Overlay stats (used in fifteen, sudoku, etc.) */
.overlay-stats {
  display: flex;
  gap: 22px;
  margin: 4px 0 8px;
}

.ov-stat {
  text-align: center;
}

.ov-stat-label {
  font-family: var(--font-display);
  font-size: 7px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.ov-stat-val {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

/* Overlay buttons get more padding */
.overlay .btn {
  flex: none;
  padding: 13px 30px;
}

/* ── Footer (shared across info pages & index) ── */
.footer {
  border-top: 1px solid var(--border);
  padding-top: 32px;
  margin-top: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-text {
  font-size: 12px;
  color: var(--muted);
  font-weight: 300;
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-link {
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-link:hover { color: var(--text); }

/* ── Section (about, updates, support) ── */
.section-label {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Prose ── */
.prose {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.8;
  font-weight: 300;
}
.prose p + p { margin-top: 14px; }
.prose strong { color: var(--text); font-weight: 500; }

/* ── Responsive: mobile top-bar & nav ── */
@media (max-width: 600px) {
  .top-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 0 10px;
  }

  .back-link { flex: 1; }

  .page-nav {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .page-nav::-webkit-scrollbar { display: none; }

  .nav-link {
    white-space: nowrap;
    font-size: 7px;
    padding: 6px 9px;
  }
}
