/* Общий стиль страниц amagi.social (документы, поддержка, пополнение, эфир в браузере, блог).
   Фирменная тёмная тема (brand/README.md). Главная дополнительно подключает landing.css. */
:root {
  --bg: #020a18;
  --surface: rgba(12, 32, 66, 0.55);
  --surface-solid: #0b1f40;
  --text: #eef4ff;
  --muted: #9bb0cf;
  --border: rgba(150, 185, 255, 0.16);
  --primary: #3d8bff;
  --primary-text: #ffffff;
  --sky: #7fb0ea;
  --warn-bg: rgba(255, 197, 77, 0.12);
  --warn-text: #ffd987;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 16px/1.65 var(--font); -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 85% -10%, rgba(31, 95, 174, 0.35), transparent 70%),
    radial-gradient(700px 480px at -10% 20%, rgba(58, 63, 216, 0.18), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--sky); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 780px; }

/* Шапка документов */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(2, 10, 24, 0.7); border-bottom: 1px solid var(--border); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 66px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { height: 28px; width: auto; display: block; }
.site-nav { display: flex; gap: 6px; flex-wrap: wrap; font-size: 15px; align-items: center; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 999px; font-weight: 600; }
.site-nav a:hover { color: var(--text); background: rgba(127, 176, 234, 0.1); }
.site-nav a.cta-mini { color: #fff; background: linear-gradient(135deg, #2f7cf6, #1f5fae 60%, #3a3fd8); box-shadow: 0 6px 20px rgba(47, 124, 246, 0.4); }

.stores { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; gap: 8px;
  border-radius: 14px; font-weight: 650; text-decoration: none; border: 1px solid var(--border); cursor: pointer; font: inherit; font-weight: 650;
  background: var(--surface); color: var(--text); transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(127, 176, 234, 0.45); }
.btn.primary { background: linear-gradient(135deg, #2f7cf6, #1f5fae 60%, #3a3fd8); color: var(--primary-text); border-color: transparent; box-shadow: 0 8px 26px rgba(47, 124, 246, 0.4); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.card h2, .card h3 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); }

.doc { padding-top: 48px; padding-bottom: 80px; }
.doc h1 { font-size: clamp(24px, 7.4vw, 46px); overflow-wrap: break-word; line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 10px; background: linear-gradient(180deg, #fff 30%, #b9cff0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.doc h2 { font-size: 22px; letter-spacing: -0.015em; margin: 36px 0 10px; }
.doc .meta { color: var(--muted); margin: 0 0 24px; }
.doc li { margin: 5px 0; }
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; display: block; overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--border); padding: 9px 11px; text-align: left; vertical-align: top; }
.doc th { background: rgba(31, 95, 174, 0.18); }
.draft { background: var(--warn-bg); color: var(--warn-text); border: 1px solid rgba(255, 197, 77, 0.3); border-radius: 14px; padding: 12px 16px; margin: 0 0 26px; font-size: 15px; }
/* Документ на сайте: «показан на английском» / «при расхождении действует английская версия» (страницы с сервера). */
.doc-note { background: rgba(127, 176, 234, 0.1); color: var(--muted); border: 1px solid rgba(127, 176, 234, 0.25); border-radius: 14px; padding: 12px 16px; margin: 0 0 22px; font-size: 15px; }
.langs { flex-wrap: wrap; }

.site-footer { border-top: 1px solid var(--border); padding: 34px 0 40px; color: var(--muted); font-size: 14px; background: rgba(2, 8, 20, 0.6); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 14px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.site-footer .foot-logo { height: 26px; width: auto; display: block; margin-bottom: 16px; opacity: 0.9; }
.langs { display: flex; gap: 14px; margin-bottom: 10px; }
.center { text-align: center; }
.muted { color: var(--muted); }

/* Пополнение криптовалютой (/topup/) */
.topup .card { margin: 16px 0; }
.topup .row { display: flex; gap: 8px; margin-top: 12px; }
.topup input { flex: 1; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-solid); color: var(--text); font: inherit; }
.topup .found { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-weight: 600; }
.topup .found img { border-radius: 50%; object-fit: cover; }
.topup .packages { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.topup .package { flex-direction: column; min-height: 72px; cursor: pointer; }
.topup .package span { color: var(--muted); font-weight: 400; }
.topup .package em { color: var(--sky); font-style: normal; font-size: 13px; }
.topup h3 { margin: 16px 0 0; font-size: 15px; }
.topup .notice { padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.topup .small { font-size: 13px; }
.topup .package { position: relative; gap: 2px; padding-top: 14px; }
.topup .package strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.topup .package.featured { border-color: rgba(127, 176, 234, 0.55); box-shadow: 0 0 0 1px rgba(61, 139, 255, 0.35) inset; }
.topup .package .badge { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); padding: 1px 10px; border-radius: 99px; background: var(--primary); color: var(--primary-text); font: 600 11px/18px var(--font); font-style: normal; white-space: nowrap; }
.topup .custom { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.topup .custom h3 { margin: 0; }
.topup .seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-solid); border: 1px solid var(--border); }
.topup .seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 600 14px var(--font); cursor: pointer; }
.topup .seg button[aria-selected="true"] { background: var(--primary); color: var(--primary-text); }
.topup .custom-row { display: flex; gap: 8px; }
.topup .custom-input { flex: 1; display: flex; align-items: center; gap: 6px; padding-left: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-solid); }
.topup .custom-input input { border: 0; background: transparent; padding-left: 0; font-size: 18px; font-variant-numeric: tabular-nums; min-width: 0; }
.topup .custom-input input:focus { outline: none; }
.topup .custom-input:focus-within { outline: 2px solid var(--primary); outline-offset: 1px; }
.topup .custom-result { margin: 0; min-height: 22px; font-weight: 600; color: var(--text); }
.topup .custom-result.pending { color: var(--muted); }
.topup .btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.topup .recent { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.topup .recent li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-solid); font-size: 14px; }
.topup .recent .r-price { text-align: right; font-variant-numeric: tabular-nums; }
.topup .recent .r-state, .topup .recent .r-date { color: var(--muted); font-size: 13px; }
.topup .recent .r-date { text-align: right; }
.topup .recent .r-state.succeeded { color: #5fd39a; }
.topup .recent .r-state.failed { color: #ff8a80; }
.topup [hidden], .sheet-backdrop[hidden], .sheet [hidden] { display: none !important; }
.topup .card h2 { margin-top: 0; }
.topup .row input { min-width: 0; }
.topup .row .btn { flex: none; }
.topup .package strong { white-space: nowrap; }
body.sheet-open { overflow: hidden; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(2, 10, 24, 0.72); }
.sheet { position: relative; width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px; border-radius: 22px; background: var(--surface-solid); border: 1px solid var(--border); display: grid; gap: 14px; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5); }
.sheet h2 { margin: 0; font-size: 18px; }
.sheet-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; }
.sheet-summary { display: grid; gap: 2px; padding: 14px; border-radius: 14px; background: var(--surface); }
.sheet-summary strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.sheet-summary .bonus { color: var(--sky); font-weight: 600; }
.sheet-summary .sum-to { color: var(--muted); font-size: 13px; }
.sheet-summary .sum-price { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sheet .express:empty, .sheet .payment-element:empty { min-height: 0; }
.sheet-pay { width: 100%; min-height: 50px; justify-content: center; }
.sheet-error { margin: 0; color: #ff8a80; font-size: 14px; }
.success { display: grid; justify-items: center; gap: 8px; padding: 8px 0; text-align: center; }
.success p { margin: 0; color: var(--muted); }
.success-amount { font: 800 40px/1.1 var(--font); color: #ffd36a; font-variant-numeric: tabular-nums; }
.coins-burst { position: relative; width: 72px; height: 72px; }
.coins-burst span { position: absolute; left: 24px; top: 24px; width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c4, #ffc83d 45%, #c98a00); box-shadow: 0 0 12px rgba(255, 200, 61, 0.6); }
@media (prefers-reduced-motion: no-preference) {
  .coins-burst span { animation: coin-burst 900ms cubic-bezier(.2, .8, .2, 1) both; }
  .coins-burst span:nth-child(1) { --dx: -34px; --dy: -30px; }
  .coins-burst span:nth-child(2) { --dx: 34px; --dy: -30px; animation-delay: 60ms; }
  .coins-burst span:nth-child(3) { --dx: -40px; --dy: 10px; animation-delay: 120ms; }
  .coins-burst span:nth-child(4) { --dx: 40px; --dy: 10px; animation-delay: 90ms; }
  .coins-burst span:nth-child(5) { --dx: 0; --dy: -42px; animation-delay: 30ms; }
  .coins-burst span:nth-child(6) { --dx: 0; --dy: 30px; animation-delay: 150ms; }
}
@keyframes coin-burst { 0% { transform: translate(0, 0) scale(0.4); opacity: 0; } 40% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 1; } }
@media (max-width: 640px) {
  .sheet-backdrop { place-items: end stretch; padding: 0; }
  .sheet { width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
  .topup .packages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topup .package strong { font-size: 15px; }
  .topup .custom-row { flex-direction: column; }
  .topup .custom-row .btn { min-height: 48px; justify-content: center; }
}

/* Просмотр эфира в браузере (/live/) */
.live .card { margin: 16px 0; }
.live .found { display: flex; align-items: center; gap: 12px; }
.live .found img { border-radius: 50%; object-fit: cover; }
.live .player, .live .cover { width: 100%; aspect-ratio: 9 / 16; max-height: 70vh; margin-top: 12px; border-radius: 18px; background: #000; object-fit: cover; overflow: hidden; }
.live .player video { width: 100%; height: 100%; object-fit: contain; }

/* Приглашение /r/<код> */
.code-box { display: flex; gap: .5rem; align-items: center; justify-content: center; flex-wrap: wrap; font-size: 1.1rem; }
.code-box strong { letter-spacing: .08em; }

@media (max-width: 640px) {
  .site-nav a:not(.cta-mini) { display: none; }
}

/* Документы на телефоне: поля по краям как у главной, с учётом выреза iPhone. */
@media (max-width: 719px) {
  .wrap { padding-inline: max(22px, env(safe-area-inset-left)) max(22px, env(safe-area-inset-right)); }
}
