/* Дайджест игровых новостей — тема по дизайн-контракту.
   Тёмная «фиолетово-игровая» палитра, display-шрифт для заголовков,
   Inter для текста. Signature element — фиолетовое свечение и
   градиентный логотип-словомарк в шапке. */

:root {
  --bg: #12121a;
  --surface: #1c1c28;
  --surface-2: #232333;
  --text: #e8e8f0;
  --muted: #9a9ab0;
  --text-soft: #cdcde0;
  --border: #2e2e3e;
  --accent: #7c5cff;
  --accent-hover: #9370ff;
  --success: #34d399;
  --danger: #ff6b81;

  --radius: 16px;
  --radius-sm: 11px;
  --maxw: 760px;

  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Exo 2', 'Inter', system-ui, sans-serif;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  background:
    radial-gradient(1100px 520px at 50% -8%, rgba(124, 92, 255, 0.16), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Шапка ─────────────────────────────────────────────── */

.site-header { padding: 52px 16px 8px; text-align: center; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.brand-logo {
  font-size: 46px;
  line-height: 1;
  filter: drop-shadow(0 0 16px rgba(124, 92, 255, 0.55));
}

.brand-text { min-width: 0; }

.brand-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.1;
  background: linear-gradient(92deg, #f2f2f8 0%, #b9a9ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

/* ── Контейнер / панель управления ─────────────────────── */

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 22px 0 26px;
}

/* ── Кнопки ────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }

.btn-content { display: inline-flex; align-items: center; gap: 10px; }

.btn-primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(180deg, var(--accent) 0%, #6a49f0 100%);
  box-shadow: 0 10px 26px rgba(124, 92, 255, 0.38);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--accent-hover) 0%, #7c5cff 100%); }
.btn-primary:disabled { cursor: progress; opacity: 0.8; }

.btn-generate {
  width: 100%;
  font-size: 18px;
  padding: 18px 24px;
  border-radius: 14px;
}

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--accent); }

.btn-copy { background: var(--surface-2); }
.btn-copy:hover { border-color: var(--accent); }
.btn-copy.is-copied {
  background: rgba(52, 211, 153, 0.14);
  border-color: var(--success);
  color: var(--success);
}

.spinner {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Фильтр количества ─────────────────────────────────── */

.count-filter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.count-filter-label { color: var(--muted); font-size: 14px; }

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.seg {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg:hover { color: var(--text); }
.seg:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }
.seg.is-active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 3px 12px rgba(124, 92, 255, 0.42);
}

/* ── Карточка дайджеста ────────────────────────────────── */

.result-slot { margin-top: 6px; }

.digest-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.digest-head { padding: 24px 24px 0; }
.digest-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.25;
}
.digest-date {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge-example {
  color: #c3b5ff;
  background: rgba(124, 92, 255, 0.16);
  border: 1px solid rgba(124, 92, 255, 0.42);
}

.digest-hint {
  margin: 16px 24px 0;
  padding: 12px 14px;
  color: var(--text-soft);
  font-size: 14px;
  background: rgba(124, 92, 255, 0.08);
  border: 1px dashed rgba(124, 92, 255, 0.35);
  border-radius: 10px;
}
.digest-hint i { color: var(--accent); margin-right: 6px; }

/* Список новостей */

.news-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
}

.news-item {
  display: flex;
  gap: 14px;
  padding: 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  transition: background 0.15s, border-color 0.15s;
}
.news-item:hover { background: var(--surface-2); border-color: var(--border); }

.news-emoji {
  flex: none;
  width: 36px;
  text-align: center;
  font-size: 26px;
  line-height: 1.3;
}

.news-body { min-width: 0; }

.news-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 6px;
  color: var(--text);
}

.news-desc {
  margin: 0 0 10px;
  color: var(--text-soft);
  font-size: 15px;
}

.news-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  word-break: break-word;
}
.news-source:hover { color: var(--accent-hover); }
.news-source i { font-size: 12px; }
.news-source-ext { opacity: 0.7; }
.news-source--muted { color: var(--muted); cursor: default; }

.empty-inline {
  margin: 12px 24px;
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.empty-inline i { display: block; font-size: 28px; margin-bottom: 10px; color: var(--muted); }

/* Липкая панель действий снизу карточки */

.digest-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 24px;
  margin-top: 12px;
  background: rgba(28, 28, 40, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}
.digest-actions .btn-copy { flex: 1 1 auto; }

/* ── Toast ─────────────────────────────────────────────── */

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 13px 20px;
  color: #ffdde3;
  font-size: 14px;
  font-weight: 600;
  background: #2c1d27;
  border: 1px solid rgba(255, 107, 129, 0.55);
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%) translateY(-14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .toast-icon { margin-right: 8px; color: var(--danger); }

/* ── Footer ────────────────────────────────────────────── */

.site-footer {
  margin-top: 20px;
  padding: 24px 16px 48px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
}
.site-footer p { max-width: var(--maxw); margin: 0 auto; }

/* ── Анимации ──────────────────────────────────────────── */

.fade-in { animation: fadeInUp 0.4s ease both; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ── Адаптив < 768px ───────────────────────────────────── */

@media (max-width: 768px) {
  .site-header { padding: 34px 16px 4px; }
  .brand { gap: 12px; }
  .brand-logo { font-size: 38px; }
  .brand-title { font-size: 25px; }
  .brand-subtitle { font-size: 14px; }

  .digest-head { padding: 20px 18px 0; }
  .digest-hint { margin: 14px 18px 0; }
  .news-list { padding: 10px 10px; }
  .empty-inline { margin: 12px 18px; }

  .digest-actions { flex-direction: column; padding: 14px 18px; }
  .digest-actions .btn { width: 100%; }

  .count-filter { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in { animation: none; }
  .spinner { animation-duration: 1.3s; }
  .btn:active { transform: none; }
}
