/* Minimal warm-dark theme: system font, tight bold headings, near-monochrome palette,
   thin-bordered rounded cards and a single green "live" accent. */
:root {
  color-scheme: dark;
  --bg: #0e0e0d;
  --surface: #171715;
  --surface-2: #1d1d1b;
  --line: #232320;
  --line-strong: #34342f;
  --text: #ecebe7;
  --muted: #96958f;
  --dim: #5f5e59;
  --live: #22c55e;
  --bad: #f2705f;
  --warn: #e3b341;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: 0.9em; }
button { font: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(236, 235, 231, 0.2); }

.wrap { width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- header / footer ---------- */
.top .wrap { display: flex; align-items: center; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; letter-spacing: -0.015em; }
.brand:hover { text-decoration: none; }
main.wrap { flex: 1; padding-top: 72px; padding-bottom: 64px; }
.foot { color: var(--dim); font-size: 13px; }
.foot .wrap { border-top: 1px solid var(--line); padding-top: 20px; padding-bottom: 28px; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: transparent; color: var(--text);
  font-weight: 600; letter-spacing: -0.01em; cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--surface); border-color: var(--line-strong); text-decoration: none; }
.btn.primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.primary:hover { background: #fff; border-color: #fff; }
.btn:disabled { opacity: 0.5; cursor: default; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 13px; }
.link-btn:hover { color: var(--text); }

input[type="text"], input[type="search"] {
  min-width: 0; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  transition: border-color 0.15s;
}
input:focus { outline: none; border-color: var(--muted); }
input::placeholder { color: var(--dim); }

.icon { width: 15px; height: 15px; fill: currentColor; flex: none; }
.ph { display: block; background: var(--surface-2); }

/* ---------- intro / search ---------- */
.intro h1 { margin: 0 0 18px; font-size: clamp(40px, 7vw, 61px); line-height: 1.02; font-weight: 600; letter-spacing: -0.04em; }
.intro h1 span { color: var(--dim); }
.intro p { margin: 0 0 32px; color: var(--muted); max-width: 560px; }
.search { display: flex; gap: 10px; }
.search input { flex: 1; height: 54px; padding: 0 18px; font-size: 16px; }
.search .btn { height: 54px; padding: 0 24px; border-radius: 14px; font-size: 15px; }

/* ---------- status line ---------- */
.status {
  display: flex; align-items: center; gap: 10px;
  margin-top: 24px; padding: 14px 18px; border-radius: 14px;
  border: 1px solid var(--line); color: var(--muted);
}
.status.error { color: var(--bad); border-color: rgba(242, 112, 95, 0.3); }
.status.ok { color: var(--live); border-color: rgba(34, 197, 94, 0.3); }
.status.loading::before {
  content: ""; width: 14px; height: 14px; flex: none;
  border: 2px solid var(--line-strong); border-top-color: var(--text); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- cards ---------- */
.card { border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.07em; color: var(--dim); }
.card-meta { font-size: 13px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.card.wide { grid-column: 1 / -1; }

.locked { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); }
.locked .icon { color: var(--dim); }

/* ---------- profile ---------- */
.profile { display: flex; gap: 24px; align-items: flex-start; margin-top: 48px; }
.avatar { width: 112px; height: 112px; border-radius: 14px; flex: none; background: var(--surface); }
.profile-main { flex: 1; min-width: 0; }
.profile h2 { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 600; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.presence { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; color: var(--muted); }
.presence.ingame { color: var(--text); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dim); flex: none; }
.online .dot, .ingame .dot { background: var(--live); }
.who { margin: 4px 0 0; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 0; }
.chip { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.chip.good { color: var(--live); border-color: rgba(34, 197, 94, 0.3); }
.chip.warn { color: var(--warn); border-color: rgba(227, 179, 65, 0.3); }
.chip.bad { color: var(--bad); border-color: rgba(242, 112, 95, 0.35); }
.headline { margin: 16px 0 0; font-style: italic; color: var(--muted); }
.bio { margin: 16px 0 0; white-space: pre-line; overflow-wrap: anywhere; padding: 14px 16px; background: var(--surface); border-radius: 14px; color: var(--muted); }
.bio.clamped { max-height: 9.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.bio + .link-btn { margin-top: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.action-hint { margin: 10px 0 0; color: var(--dim); }

/* ---------- key/value rows ---------- */
.rows { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px 20px; margin: 0; }
.rows dt { color: var(--muted); }
.rows dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.rows.ids dd { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rows.ids code { overflow-wrap: anywhere; }
.copy {
  flex: none; height: 26px; padding: 0 10px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.copy:hover { color: var(--text); background: var(--surface); }
.bad-text { color: var(--bad); font-weight: 600; }

.level { display: grid; gap: 6px; }
.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--text); border-radius: 2px; opacity: 0.85; }

/* ---------- bans ---------- */
.ban-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 17px; font-weight: 600; letter-spacing: -0.015em; }
.ban-banner::before { content: ""; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.ban-banner.good::before { background: var(--live); }
.ban-banner.bad { color: var(--bad); }
.ban-banner.bad::before { background: var(--bad); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat strong { display: block; font-size: 30px; line-height: 1.15; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); }
.note { margin: 0 0 14px; font-size: 13px; color: var(--warn); }

/* ---------- lists ---------- */
.filter { width: 100%; height: 42px; padding: 0 14px; margin-bottom: 10px; border-radius: 12px; }
ul.games, ul.friends, ul.groups { list-style: none; margin: 0; padding: 0; }
.empty { padding: 8px 0; }
.more { margin-top: 12px; }

.game { display: grid; grid-template-columns: 32px minmax(0, 1fr) 150px; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.game:first-child { border-top: 0; }
.game img, .game .ph { width: 32px; height: 32px; border-radius: 8px; display: block; }
.game-main { min-width: 0; }
.game-main a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.game-main .bar { margin-top: 8px; height: 3px; }
.game-time { text-align: right; display: grid; }
.game-time strong { font-weight: 600; font-variant-numeric: tabular-nums; }

ul.names { list-style: none; margin: 0; padding: 0; }
.name-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.name-row:first-child { border-top: 0; }
.name-main { display: grid; min-width: 0; }
.name { font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.copy { display: inline-flex; align-items: center; }
a.copy:hover { text-decoration: none; }

ul.friends { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.friend {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; align-items: center;
  padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid transparent;
  transition: border-color 0.15s, background-color 0.15s;
}
.friend:hover { border-color: var(--line-strong); background: var(--surface-2); text-decoration: none; }
.friend img, .friend .ph { grid-row: span 2; width: 40px; height: 40px; border-radius: 10px; border: 2px solid transparent; }
.friend img.online { border-color: rgba(34, 197, 94, 0.55); }
.friend img.ingame { border-color: var(--live); }
.friend-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; letter-spacing: -0.01em; }
.friend .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

ul.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.group { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; align-items: center; padding: 10px; border-radius: 14px; background: var(--surface); }
.group img, .group .ph { grid-row: span 2; width: 40px; height: 40px; border-radius: 10px; }
.group a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; letter-spacing: -0.01em; }
.unnamed { margin-top: 14px; font-size: 14px; color: var(--muted); }
.unnamed summary { cursor: pointer; }
.unnamed summary:hover { color: var(--text); }
.unnamed ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 12px; }
.unnamed a { font-family: var(--mono); font-size: 13px; color: var(--muted); }

.fetched { margin: 24px 0 0; font-size: 13px; color: var(--dim); }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  main.wrap { padding-top: 40px; }
  .search .btn { padding: 0 18px; }
  .profile { flex-direction: column; gap: 16px; margin-top: 36px; }
  .avatar { width: 88px; height: 88px; }
  .profile h2 { font-size: 28px; }
  .card { padding: 18px; }
  .rows { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .rows dd { margin-bottom: 10px; }
  .game { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .stat strong { font-size: 24px; }
}
