/* Цвета берём из темы Telegram (--tg-theme-*), с запасными значениями для обычного браузера. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f1f1f4);
  --text: var(--tg-theme-text-color, #1a1a1a);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --link: var(--tg-theme-link-color, #2a7bd6);
  --button: var(--tg-theme-button-color, #2a7bd6);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --destructive: var(--tg-theme-destructive-text-color, #d24a44);
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
}

#app { max-width: 640px; margin: 0 auto; padding: 12px 14px 40px; }

#topbar { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
#hello { font-weight: 500; }
#status { font-size: 12px; color: var(--hint); text-align: right; }

#tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.tab {
  flex: 1; padding: 9px 3px; border: none; border-radius: var(--radius);
  background: var(--secondary-bg); color: var(--text); font-size: 13px; cursor: pointer; white-space: nowrap;
}
.tab.active { background: var(--button); color: var(--button-text); }

.card {
  background: var(--secondary-bg); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px;
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--hint); font-size: 13px; }
h2 { font-size: 16px; font-weight: 500; margin: 4px 0 10px; }

/* Кнопки */
button { font-family: inherit; }
.btn {
  border: none; border-radius: var(--radius); padding: 11px 16px;
  background: var(--button); color: var(--button-text); font-size: 15px; cursor: pointer; width: 100%;
}
.btn.secondary { background: var(--secondary-bg); color: var(--text); }
.btn.small { width: auto; padding: 7px 12px; font-size: 13px; }

/* Степпер количества */
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button {
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: var(--button); color: var(--button-text); font-size: 22px; line-height: 1; cursor: pointer;
}
.stepper .count { font-size: 26px; font-weight: 500; min-width: 30px; text-align: center; }

/* Чипы игроков / режимов */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 13px; border-radius: var(--radius); font-size: 14px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--hint); color: var(--text);
}
.chip.on { background: var(--button); color: var(--button-text); border-color: var(--button); }

.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; padding: 9px; border: 1px solid var(--hint); background: var(--bg); color: var(--text);
  border-radius: var(--radius); font-size: 14px; cursor: pointer;
}
.seg button.on { background: var(--button); color: var(--button-text); border-color: var(--button); }

/* Список игр */
.game {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--secondary-bg); border-radius: var(--radius); padding: 11px 14px; margin-bottom: 8px;
}
.game .title { font-size: 15px; }
.game .meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: var(--radius); background: var(--bg); color: var(--hint); }
.badge.best { background: var(--button); color: var(--button-text); }
.badge.rec { background: var(--bg); color: var(--link); border: 1px solid var(--link); }
.badge.fav { background: var(--bg); color: var(--link); border: 1px solid var(--link); }
.owner { font-size: 12px; color: var(--hint); }
.thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--bg); }

/* Экран «не люблю» */
.search { width: 100%; padding: 11px 14px; border-radius: var(--radius); border: 1px solid var(--hint);
  background: var(--bg); color: var(--text); font-size: 15px; margin-bottom: 10px; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid var(--secondary-bg);
}
.toggle-row.on .title { color: var(--destructive); }
.switch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--hint); flex-shrink: 0; }
.toggle-row.on .switch { background: var(--destructive); border-color: var(--destructive); }
.favlist .toggle-row.on .title { color: var(--link); }
.favlist .toggle-row.on .switch { background: var(--link); border-color: var(--link); }

input[type="text"] { font-family: inherit; }
.tools { display: flex; gap: 8px; margin-bottom: 10px; }
.empty { text-align: center; color: var(--hint); padding: 30px 10px; }
.spin { text-align: center; color: var(--hint); padding: 20px; }
