/* GameFinder — спокойная тёмная тема. Без градиентов, свечения и декоративных анимаций. */

:root {
  /* Цвет */
  --bg: #14181f;
  --surface: #1c222b;
  --surface-2: #232b36;
  --border: #303a48;
  --text: #e8edf4;
  --text-muted: #97a3b4;
  --accent: #4c9aff;
  --accent-text: #0d1117;
  --good: #3fa66b;
  --danger: #d9534f;

  /* Типографика: 6 размеров, без промежуточных */
  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-base: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;

  /* Радиусы: три токена */
  --r-sm: 6px;
  --r-md: 10px;
  --r-pill: 999px;

  --gutter: 16px;
  --maxw: 1140px;
}

[data-theme="light"] {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --border: #d3dae3;
  --text: #161c24;
  --text-muted: #5d6875;
  --accent: #1667d6;
  --accent-text: #ffffff;
  --good: #2c7a50;
}

* { box-sizing: border-box; }

html { font-size: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

body.modal-open { overflow: hidden; }

h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.2em; }

.muted { color: var(--text-muted); font-size: var(--fs-sm); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter) 64px;
}

/* ---------- Шапка ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.logo { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.01em; }
.topbar-actions { display: flex; gap: 8px; }

/* ---------- Кнопки ---------- */
.btn {
  font: inherit;
  font-size: var(--fs-sm);
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
  min-height: 44px;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }

.btn-ghost.is-on { border-color: var(--accent); color: var(--accent); }

.btn-link {
  background: none; border: none; color: var(--accent);
  padding: 8px 4px; text-decoration: underline; min-height: 44px;
}
.btn-link:hover { background: none; }

.btn.block { display: block; width: 100%; margin-top: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- Вступление ---------- */
.intro { padding: 28px 0 20px; }
.intro h1 { font-size: var(--fs-xl); }
.intro-sub { margin-top: 8px; color: var(--text-muted); font-size: var(--fs-sm); max-width: 56ch; }

/* ---------- Подбор ---------- */
.picker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
}
.question + .question { margin-top: 18px; }
.question-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: 8px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  font: inherit;
  font-size: var(--fs-sm);
  padding: 9px 14px;
  min-height: 44px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.chip:hover { border-color: var(--accent); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
.chip-any { color: var(--text-muted); }
.chip-any.is-active { color: var(--accent-text); }

.picker-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border);
}
.picker-summary { font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- Панель инструментов ---------- */
.toolbar { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.search {
  font: inherit;
  font-size: var(--fs-base);
  width: 100%;
  padding: 12px 14px;
  min-height: 48px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sort { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-muted); }
select {
  font: inherit; font-size: var(--fs-sm); padding: 10px 12px; min-height: 44px;
  border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}

.extra-filters {
  margin-top: 12px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
}

/* ---------- Результаты ---------- */
.results-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 28px 0 12px;
}
.results-head h2 { font-size: var(--fs-lg); }

.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.card.is-played { opacity: .62; }

.art { position: relative; display: flex; align-items: center; justify-content: center; }
.art-emoji { font-size: var(--fs-2xl); opacity: .5; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.card-body { padding: 14px; flex: 1; }
.card-title { font-size: var(--fs-base); font-weight: 600; }
.card-desc { margin-top: 8px; font-size: var(--fs-sm); color: var(--text-muted); }
.card-plat { margin-top: 8px; font-size: var(--fs-xs); color: var(--text-muted); }

.card-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge {
  font-size: var(--fs-xs);
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}
.badge-good { color: var(--good); border-color: var(--good); }
.badge-ok { color: var(--text); }
.badge-muted { opacity: .8; }

.card-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px 14px; border-top: 1px solid var(--border);
}
.card-actions .btn { flex: 1 1 auto; }

.empty { padding: 48px 0; text-align: center; }
.empty h3 { font-size: var(--fs-lg); }
.empty p { margin-top: 8px; }

/* ---------- Модалки ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-start; justify-content: center;
  padding: var(--gutter);
  background: rgba(0, 0, 0, .6);
  overflow-y: auto;
}
.modal[hidden] { display: none; }
.modal-box {
  position: relative;
  width: 100%; max-width: 620px;
  margin: 24px 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.modal-box h2 { font-size: var(--fs-lg); padding-right: 40px; }
.modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 44px; height: 44px;
  font-size: var(--fs-lg); line-height: 1;
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  border-radius: var(--r-sm);
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.detail-title { margin-top: 14px; font-size: var(--fs-xl); }
.detail-desc { margin-top: 10px; color: var(--text-muted); font-size: var(--fs-sm); }
.detail-h3 { margin-top: 22px; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.detail-list { margin-top: 8px; font-size: var(--fs-sm); }
.detail-list li + li { margin-top: 6px; }
.detail-plat { margin-top: 6px; font-size: var(--fs-sm); }
.store-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }

.note-input, textarea, .field input {
  font: inherit; font-size: var(--fs-sm); width: 100%;
  margin-top: 8px; padding: 10px 12px;
  border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--bg); color: var(--text); resize: vertical;
}
.field { display: block; margin-top: 16px; font-size: var(--fs-sm); font-weight: 600; }
.field select { width: 100%; margin-top: 8px; }
.status { margin-top: 10px; font-size: var(--fs-sm); color: var(--good); min-height: 1.4em; }

.list-block + .list-block { margin-top: 24px; }
.list-rows { margin-top: 8px; }
.list-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.list-name {
  font: inherit; font-size: var(--fs-sm); font-weight: 600;
  background: none; border: none; padding: 0; color: var(--accent);
  cursor: pointer; text-align: left;
}
.list-note { flex-basis: 100%; font-size: var(--fs-xs); color: var(--text-muted); }

.help-list { margin-top: 12px; font-size: var(--fs-sm); }
.help-list li + li { margin-top: 8px; }
.news { margin-top: 8px; list-style: none; padding: 0; font-size: var(--fs-sm); }
.news li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.news time { color: var(--text-muted); font-size: var(--fs-xs); margin-right: 8px; }
.disclaimer { margin-top: 20px; font-size: var(--fs-xs); }

.footer { padding: 24px var(--gutter) 40px; text-align: center; border-top: 1px solid var(--border); }

.next-sub { margin-top: 4px; font-size: var(--fs-sm); font-weight: 600; }

.next-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.next-row .art { width: 120px; flex: none; border-radius: var(--r-sm); overflow: hidden; }
.next-info { flex: 1 1 180px; min-width: 0; }
.next-name { font-size: var(--fs-base); font-weight: 600; }
.next-reason { margin-top: 4px; font-size: var(--fs-xs); color: var(--text-muted); }
.next-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.next-actions .btn { flex: 1 1 auto; }

/* ---------- Планшет ---------- */
@media (min-width: 640px) {
  :root { --gutter: 24px; }
  .intro { padding: 40px 0 24px; }
  .intro h1 { font-size: var(--fs-2xl); }
  .picker { padding: 24px; }
  .toolbar { flex-direction: row; align-items: center; }
  .search { flex: 1; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .card-actions .btn { flex: 0 1 auto; }
}

/* ---------- Десктоп ---------- */
@media (min-width: 1000px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Поиск по описанию ---------- */
.search-hero { margin-top: 4px; }
.hints { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.hints-label { font-size: var(--fs-xs); color: var(--text-muted); }
.hint {
  font: inherit; font-size: var(--fs-xs); cursor: pointer;
  padding: 6px 12px; min-height: 32px;
  border-radius: var(--r-pill); border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
}
.hint:hover { border-color: var(--accent); color: var(--text); }
.hint:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card-why {
  margin-top: 8px; font-size: var(--fs-xs); color: var(--text);
  padding: 6px 10px; border-radius: var(--r-sm);
  background: var(--surface-2); border-left: 2px solid var(--accent);
}
.card-why span { color: var(--text-muted); }
