/* Saturn Proofs — мини-приложение Telegram. Тёмная «космическая» тема (по умолчанию) и светлая — по теме Telegram. */
:root {
  --bg: #0a0915;
  --bg-2: #13102a;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.085);
  --glass: rgba(20, 17, 40, 0.78);
  --line: rgba(255, 255, 255, 0.075);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #f4f1ff;
  --soft: #cdc7ea;
  --muted: #918ab5;
  --dim: #5f5984;
  --accent: #ffc966;
  --accent-2: #f29d3a;
  --on-accent: #2a1800;
  --accent-text: #ffc966;
  --accent-soft: rgba(255, 201, 102, 0.13);
  --mute: #ffad5a;
  --warn: #6fbcff;
  --ban: #ff6470;
  --ok: #3ddc84;
  --violet: #b99bff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f1fa;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1eef9;
  --glass: rgba(255, 255, 255, 0.86);
  --line: rgba(40, 28, 90, 0.08);
  --line-2: rgba(40, 28, 90, 0.14);
  --text: #19152e;
  --soft: #3d3760;
  --muted: #736c94;
  --dim: #a59fc2;
  --accent: #e8962a;
  --accent-2: #d97a0f;
  --on-accent: #2a1800;
  --accent-text: #9a5300; /* акцент как цвет текста на светлом фоне: контраст не ниже 4.5:1 */
  --accent-soft: rgba(232, 150, 42, 0.12);
  --mute: #d9821f;
  --warn: #2b8de0;
  --ban: #e0424f;
  --ok: #1fa864;
  --violet: #7b5cd6;
  --shadow: 0 12px 34px rgba(40, 28, 90, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 15px/1.42 var(--font); -webkit-font-smoothing: antialiased; }
body { overflow-x: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* фон */
.sky { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(70% 40% at 90% -8%, rgba(185, 155, 255, 0.20), transparent 70%),
    radial-gradient(60% 38% at -12% 18%, rgba(255, 173, 90, 0.13), transparent 70%),
    radial-gradient(80% 45% at 50% 118%, rgba(111, 188, 255, 0.10), transparent 70%), var(--bg); }
.sky::before { content: ""; position: absolute; inset: 0; opacity: .7;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff9 50%, transparent), radial-gradient(1px 1px at 72% 12%, #fff7 50%, transparent),
    radial-gradient(1.6px 1.6px at 38% 62%, #ffe2a088 50%, transparent), radial-gradient(1px 1px at 88% 48%, #fff6 50%, transparent),
    radial-gradient(1px 1px at 22% 84%, #fff5 50%, transparent), radial-gradient(1px 1px at 58% 32%, #fff6 50%, transparent),
    radial-gradient(1.6px 1.6px at 94% 82%, #b99bff88 50%, transparent), radial-gradient(1px 1px at 6% 52%, #fff5 50%, transparent);
  animation: twinkle 7s ease-in-out infinite alternate; }
:root[data-theme="light"] .sky::before { display: none; }
:root[data-theme="light"] .sky { background:
    radial-gradient(70% 40% at 90% -8%, rgba(123, 92, 214, 0.10), transparent 70%),
    radial-gradient(60% 38% at -12% 18%, rgba(232, 150, 42, 0.08), transparent 70%), var(--bg); }
@keyframes twinkle { from { opacity: .35; } to { opacity: .85; } }

#app { max-width: 680px; margin: 0 auto; padding: 12px 16px calc(100px + var(--safe-b)); }

/* загрузка и пустые состояния */
.boot { min-height: 80vh; display: grid; place-content: center; text-align: center; color: var(--muted); }
.boot-logo { width: 84px; height: 84px; margin: 0 auto 12px; animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px) rotate(-5deg); } }
.empty { text-align: center; color: var(--muted); padding: 34px 16px; }
.empty .big { font-size: 38px; margin-bottom: 6px; }
.empty b { color: var(--soft); }

/* шапка */
.top { display: flex; align-items: center; gap: 12px; margin: 2px 0 14px; }
.top img { width: 40px; height: 40px; filter: drop-shadow(0 6px 16px rgba(255, 170, 80, .35)); }
.top .title { min-width: 0; }
.top h1 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.2px; }
.top p { margin: 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--soft); }
.icon-btn:active { transform: scale(.94); }
.role { padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent-text); }

/* плитки сводки */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.banner { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; border-radius: 15px; font-weight: 700; font-size: 14px;
  background: linear-gradient(100deg, var(--accent-soft), color-mix(in srgb, var(--violet) 12%, transparent)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); color: var(--text); text-align: left; }
.banner b { margin-left: auto; color: var(--accent-text); font-size: 18px; }
.banner .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
.tile { position: relative; overflow: hidden; padding: 12px 12px 11px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: left; }
.tile b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.tile span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.tile.hot b { color: var(--ban); }
.tile.accent b { color: var(--accent-text); }
.tile.pending { border-color: rgba(255, 201, 102, .45); background: linear-gradient(160deg, var(--accent-soft), var(--surface)); }
.tile::after { content: ""; position: absolute; right: -18px; top: -18px; width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 70%); }

/* поиск */
.search { position: sticky; top: 8px; z-index: 6; display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 8px 0 14px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--line-2); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--shadow); transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--accent); box-shadow: var(--shadow), 0 0 0 4px var(--accent-soft); }
.search svg { flex: none; color: var(--muted); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 16px; }
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { display: none; }
.clear { width: 32px; height: 32px; border-radius: 10px; display: none; place-items: center; color: var(--muted); background: var(--surface-2); }
.search.has-text .clear { display: grid; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 1px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 11px; font-size: 13px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); color: var(--soft); white-space: nowrap; }
.chip.on { background: var(--accent); color: var(--on-accent); border-color: transparent; box-shadow: 0 6px 16px rgba(242, 157, 58, .3); }
.chip small { opacity: .7; font-weight: 700; }
.chip.recent { color: var(--muted); }

.group { margin: 20px 2px 9px; display: flex; align-items: baseline; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
.group em { font-style: normal; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--dim); }

/* аватар по нику: цвет из хеша */
.ava { flex: none; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 75% 62%), hsl(calc(var(--h) + 40) 70% 46%)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.ava.sm { width: 34px; height: 34px; border-radius: 11px; font-size: 13px; }

/* карточка наказания */
.card { display: block; width: 100%; text-align: left; margin-bottom: 10px; padding: 13px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  transition: transform .15s ease, border-color .2s, background .2s; }
.card:active { transform: scale(.985); }
.card.flagged { border-color: color-mix(in srgb, var(--ban) 40%, transparent); }
.head { display: flex; align-items: center; gap: 11px; }
.head .who { min-width: 0; flex: 1; }
.head .nick { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 7px; }
.head .sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head .when { color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; }
.cmd { display: block; margin-top: 10px; padding: 8px 10px; border-radius: 11px; background: var(--surface-2); font: 12.5px/1.4 var(--mono); color: var(--soft); word-break: break-word; }

.badge { flex: none; padding: 2px 8px; border-radius: 7px; font-size: 11.5px; font-weight: 800; letter-spacing: .2px; }
.badge.mute { background: color-mix(in srgb, var(--mute) 16%, transparent); color: var(--mute); }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.badge.ban { background: color-mix(in srgb, var(--ban) 16%, transparent); color: var(--ban); }
.badge.other { background: var(--surface-2); color: var(--soft); }

.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.thumb { position: relative; aspect-ratio: 16 / 9.4; border-radius: 13px; overflow: hidden; background: var(--surface-2); }
.thumb:only-child { grid-column: 1 / -1; aspect-ratio: 16 / 8; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .35s; }
.thumb img.ready { opacity: 1; }
.thumb span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 6px; font-size: 11px; font-weight: 600; color: #fff;
  background: linear-gradient(transparent, rgba(5, 4, 12, .78)); }

.foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pill.bad { background: color-mix(in srgb, var(--ban) 13%, transparent); color: var(--ban); }
.pill.chat { background: color-mix(in srgb, var(--violet) 15%, transparent); color: var(--violet); }

.shimmer { background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton { height: 150px; border-radius: var(--radius); margin-bottom: 10px; }
.skeleton.sm { height: 72px; }

/* подробно */
.view { animation: rise .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.profile { display: flex; align-items: center; gap: 13px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.profile .ava { width: 52px; height: 52px; border-radius: 17px; font-size: 18px; }
.profile h2 { margin: 0; font-size: 20px; letter-spacing: -.3px; }
.profile p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.seg { display: flex; padding: 4px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); margin: 12px 0 10px; }
.seg button { flex: 1; height: 34px; border-radius: 10px; font-size: 13px; font-weight: 700; color: var(--muted); transition: background .2s, color .2s; }
.seg button.on { background: var(--bg-2); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); }
:root[data-theme="light"] .seg button.on { background: #fff; }

.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius); scrollbar-width: none; border: 1px solid var(--line); background: #07060f; }
.gallery::-webkit-scrollbar { display: none; }
.gallery figure { flex: 0 0 100%; margin: 0; scroll-snap-align: center; aspect-ratio: 16 / 9.4; position: relative; }
.gallery img { width: 100%; height: 100%; object-fit: contain; display: block; opacity: 0; transition: opacity .3s; }
.gallery img.ready { opacity: 1; }
.gallery .zoom { position: absolute; right: 8px; bottom: 8px; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: rgba(5, 4, 12, .6); color: #fff; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 44px; padding: 0 14px; border-radius: 13px; font-weight: 700; font-size: 14px;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--text); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: var(--on-accent); border: 0; box-shadow: 0 8px 20px rgba(242, 157, 58, .3); }
.btn.danger { color: var(--ban); }
.btn.wide { grid-column: 1 / -1; }

.list { margin-top: 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .ic { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.item .k { color: var(--muted); font-size: 13px; }
.item .v { margin-left: auto; text-align: right; font-weight: 600; word-break: break-word; max-width: 65%; }
.item .v.mono { font: 600 12.5px/1.4 var(--mono); }

.chat { margin-top: 12px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.chat h3 { margin: 0 0 12px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.chat h3 small { margin-left: auto; color: var(--muted); font-weight: 600; }
.bubble { position: relative; width: fit-content; max-width: 86%; margin: 0 0 7px; padding: 8px 12px 19px; border-radius: 18px 18px 18px 6px;
  background: color-mix(in srgb, var(--violet) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--violet) 20%, transparent); word-break: break-word; }
.bubble small { position: absolute; right: 10px; bottom: 4px; color: var(--muted); font-size: 10.5px; }
.bubble.last { background: color-mix(in srgb, var(--mute) 17%, var(--surface)); border-color: color-mix(in srgb, var(--mute) 45%, transparent); }
.bubble.last::after { content: "за это мут"; display: block; margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--mute); }
.quiet { color: var(--muted); font-size: 14px; }

.alert { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--ban) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ban) 30%, transparent); }
.alert h3 { margin: 0 0 6px; font-size: 14px; color: var(--ban); }
.alert ul { margin: 0; padding-left: 18px; }
.alert li { margin: 3px 0; }

/* модераторы */
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 2px 10px; color: var(--soft); font-size: 14px; }
.switch { width: 46px; height: 28px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-2); position: relative; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: all .2s; }
.switch.on { background: var(--accent); border-color: transparent; }
.switch.on::after { left: 22px; background: #fff; }
.stack { display: flex; height: 7px; border-radius: 4px; overflow: hidden; margin-top: 9px; background: var(--surface-2); gap: 2px; }
.stack i { display: block; height: 100%; }
.stack .m { background: var(--mute); }
.stack .w { background: var(--warn); }
.stack .b { background: var(--ban); }
.legend { display: flex; gap: 12px; margin-top: 6px; color: var(--muted); font-size: 11.5px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 4px; vertical-align: 0; }
.total { margin-left: auto; text-align: right; }
.total b { display: block; font-size: 20px; font-weight: 800; }
.total small { font-size: 11.5px; color: var(--muted); }

/* компьютеры, доступ */
.status { flex: none; font-size: 11.5px; font-weight: 800; padding: 3px 8px; border-radius: 7px; }
.status.pending { background: var(--accent-soft); color: var(--accent-text); }
.status.approved { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.status.rejected, .status.revoked { background: color-mix(in srgb, var(--ban) 13%, transparent); color: var(--ban); }
.code { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 8px 12px; border-radius: 11px; background: var(--surface-2); }
.code span { color: var(--muted); font-size: 12.5px; }
.code b { font: 800 17px/1.2 var(--mono); letter-spacing: 2px; color: var(--text); }
.note { margin: 0 2px 12px; color: var(--muted); font-size: 13.5px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form input { height: 46px; padding: 0 13px; border-radius: 13px; border: 1px solid var(--line-2); background: var(--surface); outline: 0; min-width: 0; }
.form input:focus { border-color: var(--accent); }
.form .btn { grid-column: 1 / -1; }

/* нижние вкладки */
.tabs { position: fixed; left: 50%; bottom: calc(10px + var(--safe-b)); transform: translateX(-50%); z-index: 10; display: flex; gap: 2px; padding: 6px;
  width: min(calc(100% - 24px), 520px); border-radius: 24px; background: var(--glass); border: 1px solid var(--line-2);
  backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4); box-shadow: var(--shadow); }
.tabs button { position: relative; flex: 1; display: grid; justify-items: center; gap: 2px; padding: 7px 2px 6px; border-radius: 18px; color: var(--muted); font-size: 10.5px; font-weight: 700; }
.tabs button svg { width: 22px; height: 22px; }
.tabs button.on { color: var(--accent-text); background: var(--accent-soft); }
.tabs .pip { position: absolute; top: 3px; left: calc(50% + 7px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--ban); color: #fff; font-size: 10px; line-height: 17px; }
/* пять вкладок владельца: на 360 px каждой достаётся ~65 px */
.tabs.five { gap: 0; padding: 5px; width: min(calc(100% - 16px), 520px); }
.tabs.five button { min-width: 0; padding: 7px 0 6px; font-size: 10px; letter-spacing: -.1px; white-space: nowrap; }

.btn:disabled { opacity: .45; cursor: default; pointer-events: none; }

/* полноэкранный просмотр */
.viewer { position: fixed; inset: 0; z-index: 100; background: #030208; display: flex; flex-direction: column; animation: fade .2s; }
.viewer .strip { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.viewer .strip::-webkit-scrollbar { display: none; }
.viewer figure { flex: 0 0 100%; margin: 0; display: grid; place-items: center; scroll-snap-align: center; touch-action: pinch-zoom; }
.viewer img { max-width: 100%; max-height: 100%; }
.viewer .bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px calc(14px + var(--safe-b)); color: #fff; }
.viewer .bar span { color: #c9c3e6; font-size: 14px; }
.viewer .bar button { margin-left: auto; height: 40px; padding: 0 18px; border-radius: 12px; background: rgba(255, 255, 255, .12); color: #fff; font-weight: 700; }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); z-index: 50; transform: translate(-50%, 16px); opacity: 0; max-width: 90%;
  padding: 11px 16px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line-2); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  color: var(--text); font-size: 14px; font-weight: 600; pointer-events: none; transition: all .25s; text-align: center; box-shadow: var(--shadow); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

.lock { min-height: 72vh; display: grid; place-content: center; text-align: center; gap: 12px; padding: 20px; }
.lock .big { font-size: 54px; }
.lock h2 { margin: 0; }
.lock p { margin: 0; color: var(--muted); }
.lock code { justify-self: center; padding: 8px 14px; border-radius: 12px; background: var(--surface-2); font: 700 17px var(--mono); color: var(--accent-text); }

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