/* Сетевой кликер — дизайн-система в духе Apple.
   Системный шрифт, светлая и тёмная темы по настройкам системы, «стекло», мягкие тени.
   Общая для сайта и панели программы города. */

:root {
  --ink: #f5f5f7;                         /* фон страницы */
  --panel: rgba(255, 255, 255, 0.78);     /* карточки — матовое стекло */
  --panel-solid: #ffffff;
  --fill: rgba(120, 120, 128, 0.12);      /* серые кнопки и поля, как в iOS */
  --fill-strong: rgba(120, 120, 128, 0.2);
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --dim: #aeaeb2;
  --signal: #0071e3;                      /* акцент — синий Apple */
  --signal-deep: #0062c4;
  --on-signal: #ffffff;
  --live: #ff3b30;
  --ok: #34c759;
  --warn: #ff9500;
  --bad: #ff3b30;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 28px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.18);
  --f-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --f-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "SF Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #000000;
    --panel: rgba(28, 28, 30, 0.78);
    --panel-solid: #1c1c1e;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.32);
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.15);
    --text: #f5f5f7;
    --muted: #98989d;
    --dim: #636366;
    --signal: #0a84ff;
    --signal-deep: #0077ed;
    --live: #ff453a;
    --ok: #30d158;
    --warn: #ff9f0a;
    --bad: #ff453a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.47;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; letter-spacing: -0.022em; margin: 0; }
h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.1; }
h2 { font-size: 19px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--f-mono); }
.hidden, [hidden] { display: none !important; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 500 15px/1.2 var(--f-body);
  letter-spacing: -0.01em;
  padding: 11px 20px;
  border-radius: 980px;
  border: 0;
  background: var(--signal);
  color: var(--on-signal);
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease, transform .1s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--signal-deep); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .35; cursor: default; transform: none; }
.btn.ghost { background: var(--fill); color: var(--signal); }
.btn.ghost:hover { background: var(--fill-strong); }
.btn.danger { background: var(--fill); color: var(--bad); }
.btn.danger:hover { background: var(--fill-strong); }
.btn.sm { padding: 7px 14px; font-size: 13px; }
.btn.lg { padding: 14px 24px; font-size: 17px; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--fill); border: 0; color: var(--muted); cursor: pointer; font-size: 13px;
}
.icon-btn:hover { background: var(--fill-strong); color: var(--text); }

/* ---------- поля ---------- */
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], textarea, select {
  width: 100%;
  font: 400 17px var(--f-body);
  letter-spacing: -0.01em;
  color: var(--text);
  background: var(--fill);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  transition: box-shadow .15s, background .15s;
}
input::placeholder { color: var(--dim); }
input:focus, textarea:focus, select:focus { background: var(--panel-solid); box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 30%, transparent); }
input.code-input { font: 600 28px/1 var(--f-mono); letter-spacing: .06em; text-align: center; padding: 16px; }

/* ---------- поверхности ---------- */
.card {
  background: var(--panel);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---------- верхняя панель ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 17px var(--f-display); letter-spacing: -0.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: linear-gradient(180deg, #2997ff, #0071e3);
  display: grid; place-items: center;
  box-shadow: 0 1px 3px rgba(0, 113, 227, .35);
}
.brand-mark::after { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #fff; }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }

.page { max-width: 1120px; margin: 0 auto; padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 40px) 80px; }

/* ---------- эфир / статусы ---------- */
.onair {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 12px/1 var(--f-body);
  color: var(--live);
  padding: 5px 10px; border-radius: 980px;
  background: color-mix(in srgb, var(--live) 12%, transparent);
}
.onair::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: pulse 1.6s ease-in-out infinite; }
.off-label { font: 600 12px/1 var(--f-body); color: var(--muted); padding: 5px 10px; border-radius: 980px; background: var(--fill); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }
.dot.live { background: var(--live); animation: pulse 1.6s ease-in-out infinite; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 980px;
  background: var(--fill); color: var(--muted);
}
.tag.signal { color: var(--signal); background: color-mix(in srgb, var(--signal) 12%, transparent); }
.tag.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* код комнаты */
.code { display: inline-flex; gap: 4px; align-items: center; font: 600 24px/1 var(--f-mono); letter-spacing: .02em; color: var(--text); }
.code .sep { color: var(--dim); }
.code.lg { font-size: clamp(32px, 5vw, 44px); }
.code.sm { font-size: 15px; color: var(--muted); }

/* ---------- списки ---------- */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  transition: background .15s, border-color .15s;
}
.row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row.live { border-color: color-mix(in srgb, var(--live) 40%, transparent); background: color-mix(in srgb, var(--live) 6%, var(--panel-solid)); }
.empty { padding: 22px; text-align: center; color: var(--muted); border-radius: var(--radius-sm); background: var(--fill); }

/* ---------- загрузка ---------- */
.drop {
  display: grid; place-items: center; gap: 4px;
  padding: 22px; text-align: center;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm);
  color: var(--muted); cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.drop:hover, .drop.over { border-color: var(--signal); color: var(--text); background: color-mix(in srgb, var(--signal) 6%, transparent); }
.drop b { color: var(--signal); font-weight: 600; }
.bar { height: 4px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--signal); transition: width .2s; }

/* ---------- модальное окно ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, .32); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 16px;
  animation: fade .2s ease;
}
.modal { width: min(440px, 100%); background: var(--panel-solid); box-shadow: var(--shadow-lg); animation: pop .25s cubic-bezier(.2, .9, .3, 1.15); }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }

/* ---------- уведомления ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 60; display: grid; gap: 8px; max-width: calc(100vw - 32px); }
.toast {
  background: var(--panel-solid); color: var(--text);
  padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 14px;
  border: 1px solid var(--line);
  animation: rise .25s ease;
}
.toast.err { color: var(--bad); }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }

.reveal { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
.reveal:nth-child(2) { animation-delay: .04s; }
.reveal:nth-child(3) { animation-delay: .08s; }
.reveal:nth-child(4) { animation-delay: .12s; }

@media (max-width: 640px) {
  .card { padding: 18px; border-radius: 18px; }
  .who .name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
