/* tg.studily.org — Telegram Mini App for managing mini-circle groups. */
:root {
  --bg: #0b1220;
  --card: #111a2e;
  --card-2: #16223c;
  --border: #22304d;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #0ea5e9;
  --primary-2: #00f2fe;
  --danger: #f87171;
  --ok: #34d399;
  --warn: #fbbf24;
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 640px; margin: 0 auto; padding: 14px 14px 60px; }

.boot { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 40vh; color: var(--muted); }
.boot-logo { font-size: 42px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.12); opacity: 1; } }

.topbar { display: flex; align-items: center; gap: 10px; padding: 6px 2px 14px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.topbar .logo { font-size: 20px; }
.topbar h1 { font-size: 17px; font-weight: 700; flex: 1; }
.topbar .sub { color: var(--muted); font-size: 12px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--card-2); color: var(--muted); letter-spacing: .3px; }
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--danger); }
.pill.type { color: var(--primary-2); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; width: 100%; padding: 12px 14px; border: 0; border-radius: 13px; font-size: 14.5px; font-weight: 700; cursor: pointer; background: var(--card-2); color: var(--text); transition: transform .12s ease, opacity .12s ease; text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--primary), #6366f1); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--border); }
.btn.danger { color: var(--danger); }
.btn.sm { width: auto; padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.grow .t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grow .s { color: var(--muted); font-size: 12px; margin-top: 2px; }

.switch { position: relative; width: 46px; height: 27px; flex: none; cursor: pointer; }
.switch input { display: none; }
.switch i { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: background .15s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(19px); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--card-2); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font: inherit; padding: 11px 12px; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 70px; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg .opt { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--card-2); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg .opt.on { border-color: var(--primary); color: #fff; background: rgba(14,165,233,.18); }
.type-card { border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 8px; cursor: pointer; background: var(--card-2); }
.type-card.on { border-color: var(--primary-2); background: rgba(0,242,254,.07); }
.type-card .t { font-weight: 700; }
.type-card .s { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 8px 13px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.tab.on { color: #fff; border-color: var(--primary); background: rgba(14,165,233,.18); }

.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .x { color: var(--danger); background: none; border: 0; font-size: 16px; cursor: pointer; padding: 4px 8px; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { background: var(--card-2); border-radius: 12px; padding: 12px; }
.stat .v { font-size: 20px; font-weight: 800; }
.stat .k { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.code-box { background: #050b14; border: 1px dashed var(--primary); border-radius: 12px; padding: 14px; text-align: center; font-family: ui-monospace, 'Cascadia Code', monospace; font-size: 22px; letter-spacing: 3px; color: var(--primary-2); margin: 10px 0; }
.note { color: var(--muted); font-size: 12.5px; }
.center { text-align: center; }
.hero { text-align: center; padding: 26px 8px 8px; }
.hero .e { font-size: 40px; }
.hero h2 { font-size: 19px; margin: 8px 0 4px; }
.hero p { color: var(--muted); font-size: 13.5px; }
.back { background: none; border: 0; color: var(--primary-2); font: inherit; font-weight: 700; cursor: pointer; padding: 6px 0; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #0f1a2e; border: 1px solid var(--border); color: var(--text); padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 600; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.log-row { font-size: 12.5px; padding: 8px 0; border-bottom: 1px solid var(--border); color: var(--muted); }
.log-row b { color: var(--text); }
.log-row:last-child { border: 0; }
