:root {
  --bg: #0f1115;
  --card: #181b22;
  --card-off: #14171d;
  --border: #262a33;
  --text: #e8eaee;
  --text-off: #b8beca;
  --muted: #8b93a1;
  --accent: #2f6df6;
  --badge-bg: #2a2f3a;
  --badge-text: #9aa3b2;
  --error: #ff8a8a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
#app { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.noscript { padding: 24px 16px; text-align: center; color: var(--muted); }

/* Шапка */
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.link-btn {
  background: none; border: 0; padding: 6px 4px; color: var(--muted);
  font: inherit; font-size: 14px; cursor: pointer;
}
.link-btn:hover { color: var(--text); }

/* Плитки */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
.tile {
  display: flex; flex-direction: column; gap: 6px; height: 100%; min-height: 128px; padding: 18px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  color: inherit; text-decoration: none;
}
.tile-title { font-size: 17px; font-weight: 600; }
.tile-desc { font-size: 14px; color: var(--muted); }
.badge {
  align-self: flex-start; margin-top: auto; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--badge-bg); color: var(--badge-text);
}
.tile.live { border-color: var(--accent); }
.tile.live .badge { background: var(--accent); color: #fff; }
.tile.off { background: var(--card-off); }
.tile.off .tile-title { color: var(--text-off); }
@media (prefers-reduced-motion: no-preference) {
  .tile.live { transition: transform 0.15s ease, box-shadow 0.15s ease; }
  .tile.live:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(47, 109, 246, 0.18); }
}

/* Вход */
.center { min-height: 80vh; display: grid; place-items: center; }
.card {
  width: 100%; max-width: 360px; padding: 28px 24px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
}
.login { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.field input {
  padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.field input:focus { border-color: var(--accent); outline: none; }
.btn {
  padding: 11px 16px; font: inherit; font-weight: 600; color: #fff;
  background: var(--accent); border: 0; border-radius: 8px; cursor: pointer;
}
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:disabled { opacity: 0.6; cursor: default; }
.form-error { min-height: 1.5em; font-size: 14px; color: var(--error); }

/* Публичные страницы Max Reels: /reels, /terms, /privacy */
.doc { max-width: 720px; margin: 0 auto; padding: 40px 16px 64px; }
.doc h1 { font-size: 28px; margin-bottom: 8px; }
.doc h2 { margin: 28px 0 8px; font-size: 18px; font-weight: 600; }
.doc p, .doc li { color: var(--text-off); }
.doc ul { margin: 0; padding-left: 20px; }
.doc li + li { margin-top: 6px; }
.doc a { color: #7ea6ff; }
.doc code { font-size: 14px; color: var(--text); }
.doc-lead { color: var(--muted); }
.doc-back { margin-bottom: 24px; font-size: 14px; }
.doc-links { margin-top: 32px; }

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  #app { padding-top: 16px; }
}
