/* Apel Hub — тёмная «стеклянная» тема. Все параметры вида — в токенах ниже. */

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --page: #0a0a0a;
  --panel: rgba(21, 21, 20, 0.72);
  --panel-solid: #151514;
  --panel-hover: rgba(255, 255, 255, 0.045);
  --field: rgba(0, 0, 0, 0.45);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #f4f3f1;
  --text-2: #b9b7b1;
  --muted: #8b8983;

  --grid: rgba(255, 255, 255, 0.055);
  --baseline: rgba(255, 255, 255, 0.14);

  --accent: #f57e3e;          /* оранжевый из логотипа: UI-акцент */
  --accent-data: #e86a27;     /* шаг темнее — бары данных на тёмном */
  --accent-wash: rgba(245, 126, 62, 0.13);
  --accent-text-on: #1a1208;  /* текст на акцентной кнопке */
  --danger: #e66767;

  --radius: 14px;
  --radius-s: 10px;
  --blur: 22px;
  --shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

.glass {
  background: var(--panel);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--panel-solid); }
  .topnav { background: var(--page); }
}

/* navbar */
.topnav {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--border);
}
.topnav-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  font-size: 15.5px;
  letter-spacing: -0.01em;
}
.brand img { width: 27px; height: 27px; border-radius: 50%; display: block; }
.brand span { white-space: nowrap; }
.topnav-links { display: flex; align-items: center; gap: 3px; }
.topnav-links a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 9px;
  transition: background 0.15s, color 0.15s;
}
.topnav-links a:hover { color: var(--text); background: var(--panel-hover); }
.topnav-links a.active { color: var(--accent); background: var(--accent-wash); }

/* hero (главная) */
.hero { text-align: center; padding: 52px 0 34px; }
.hero-logo { width: 88px; height: 88px; border-radius: 50%; margin-bottom: 16px; }
.hero h1 {
  margin: 0;
  font-size: 42px;
  font-weight: 750;
  letter-spacing: -0.03em;
}
.tagline {
  margin: 10px auto 0;
  max-width: 460px;
  color: var(--text-2);
  font-size: 15.5px;
}

/* карточки-метрики */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.tile {
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.tile-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tile-value { font-size: 27px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tile-value.xl { font-size: 36px; }

/* терминал с loadstring */
.terminal {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-align: left;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.r { background: #995550; }
.dot.y { background: #99824e; }
.dot.g { background: #56885a; }
.terminal-title {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12.5px;
  flex: 1;
}
.terminal-body {
  margin: 0;
  padding: 16px 18px;
  background: var(--field);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--baseline) transparent;
}
.terminal-body::-webkit-scrollbar { height: 8px; }
.terminal-body::-webkit-scrollbar-thumb { background: var(--baseline); border-radius: 4px; }
.terminal-body::-webkit-scrollbar-track { background: transparent; }
.terminal-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
}

/* кнопки */
.btn {
  appearance: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  border-radius: var(--radius-s);
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
}
.btn.ghost:hover { color: var(--text); background: var(--panel-hover); }
.btn.icon { padding: 7px 11px; }
.btn.accent {
  background: var(--accent);
  border: 1px solid transparent;
  color: var(--accent-text-on);
  font-weight: 650;
}
.btn.accent:hover { background: #ff8d4e; }
.btn.sm { padding: 5px 12px; font-size: 12.5px; border-radius: 8px; }
.btn.big { padding: 11px 22px; font-size: 14px; }
.cta-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}

/* заголовок страницы */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}
.header h1 { margin: 0; font-size: 25px; font-weight: 700; letter-spacing: -0.02em; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.updated { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* фильтры периодов */
.filters {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-s);
}
.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--accent-wash); color: var(--accent); }
.segmented.small button { padding: 4px 10px; font-size: 12px; }
.range-label { color: var(--muted); font-size: 13px; }

/* карточка со списком игр */
.card {
  border-radius: var(--radius);
  padding: 8px 10px 12px;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 12px 8px;
}
.card-head h2 { margin: 0; font-size: 15.5px; font-weight: 650; }
.card-head-note { color: var(--muted); font-size: 12px; }

.game-list { list-style: none; margin: 0; padding: 0; }
.game-row {
  appearance: none;
  border: 0;
  background: transparent;
  width: 100%;
  display: grid;
  grid-template-columns: 26px 34px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-s);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.game-row:hover { background: var(--panel-hover); }
.rank {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.row-icon {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--field);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  flex-shrink: 0;
}
.row-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.game-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.game-name {
  font-weight: 550;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track { height: 6px; width: 100%; border-radius: 0 3px 3px 0; }
.bar-fill {
  display: block;
  height: 100%;
  background: var(--accent-data);
  border-radius: 0 3px 3px 0;
  min-width: 2px;
}
.game-row.unsupported .bar-fill { background: var(--muted); }
.game-row.unsupported .game-name { color: var(--text-2); }
.game-value {
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
}

.empty { padding: 26px 12px 20px; color: var(--muted); text-align: center; }
.footer { margin-top: 26px; color: var(--muted); font-size: 12px; text-align: center; }

.error-banner {
  border: 1px solid rgba(230, 103, 103, 0.3);
  background: rgba(230, 103, 103, 0.07);
  color: var(--danger);
  border-radius: var(--radius-s);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.loading { opacity: 0.55; transition: opacity 0.15s; }

/* модалка с деталями игры */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 16px;
  z-index: 10;
}
.modal {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  overflow: auto;
  padding: 18px 20px 20px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.modal-titles { min-width: 0; display: flex; align-items: center; gap: 12px; }
.game-icon {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--field);
  flex-shrink: 0;
}
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 650; overflow-wrap: break-word; }
.modal-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.modal-actions { display: flex; gap: 8px; flex-shrink: 0; }
.modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.modal-total { color: var(--text-2); font-size: 13px; }
.modal-total b { color: var(--text); font-variant-numeric: tabular-nums; }

.chart-box { height: 280px; position: relative; }

.table-view { margin-top: 14px; }
.table-view summary {
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}
.table-view summary:hover { color: var(--text-2); }
.table-scroll { max-height: 240px; overflow: auto; margin-top: 10px; }
.table-scroll table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-scroll th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--panel-solid);
}
.table-scroll td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--grid);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.table-scroll td:last-child { color: var(--text); }

/* shop */
.coming-soon {
  min-height: 58vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.coming-soon h1 {
  margin: 0;
  font-size: clamp(40px, 9vw, 72px);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.coming-soon .tagline { margin-top: 12px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 640px) {
  .topnav-inner { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .topnav-links { gap: 2px; }
  .topnav-links a { padding: 6px 9px; font-size: 13px; }
  .brand { font-size: 14.5px; gap: 8px; }
  .tiles { grid-template-columns: 1fr; }
  .header { flex-direction: column; align-items: flex-start; }
  .hero h1 { font-size: 34px; }
  .tile-value.xl { font-size: 30px; }
  .game-row { grid-template-columns: 20px 30px 1fr auto; gap: 9px; }
  .row-icon { width: 30px; height: 30px; }
  .modal-head { flex-direction: column-reverse; }
  .modal-actions { align-self: flex-end; }
  .modal-titles { width: 100%; }
}
