:root {
  color-scheme: dark;
  /* the same colors as the PC app; the PC's own Appearance colors replace these (phone.js) */
  --bg: #0d070b;
  --panel: #170e14;
  --panel-2: #1f1319;
  --panel-3: #2a1a23;
  --line: #321f2a;
  --text: #fbeef6;
  --muted: #c3a5b7;
  --faint: #8a6d7e;
  --accent: #ff4fc3;
  --accent-ink: #1a0613;
  --gold: #f2c14e;
  --gold-soft: color-mix(in srgb, var(--gold) 12%, transparent);
  --good: #4cd6b4;
  --warn: #f2a33a;
  --bad: #ff5f4f;
  --info: #38bdf8;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

.top {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.top img { border-radius: 8px; }
.top-text { flex: 1; min-width: 0; }
.title { font-weight: 700; font-size: 17px; }
.sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.live.on { background: var(--good); box-shadow: 0 0 0 4px rgba(76, 214, 180, .18); }

.banner { margin: 12px 16px 0; padding: 10px 12px; border-radius: 10px; background: rgba(255, 95, 79, .12); border: 1px solid rgba(255, 95, 79, .35); color: #ffc2c8; font-size: 13px; }
main { padding: 14px 16px 24px; display: grid; gap: 14px; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi-value { font-size: 22px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.kpi.gold .kpi-value { color: var(--gold); }
.good { color: var(--good); }

h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 6px 2px 0; }
.list { display: grid; gap: 8px; }
.acct { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--panel-2); object-fit: cover; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.acct-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.acct-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pill { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); color: var(--faint); white-space: nowrap; }
.pill.ingame { color: var(--good); background: rgba(76, 214, 180, .12); }
.pill.disconnected, .pill.error { color: var(--bad); background: rgba(255, 95, 79, .12); }
.pill.launched, .pill.launching { color: var(--warn); background: rgba(242, 163, 58, .12); }
.pill.running { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.pill.queued { color: var(--info); background: rgba(90, 169, 255, .12); }
.acct-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 14px; font-variant-numeric: tabular-nums; }
.acct-stats .money { color: var(--gold); font-weight: 700; }
.acct-meta { color: var(--faint); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.events { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; }
.event { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.event:first-child { border-top: 0; }
.event time { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.event b { font-weight: 600; }
.event.hl .msg { color: var(--gold); font-weight: 600; }
.event.k-item .msg { color: var(--good); }
.event.k-disconnect .msg, .event.k-error .msg, .event.k-ban .msg { color: var(--bad); }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; }

.login { padding: 40px 24px; text-align: center; max-width: 420px; margin: 0 auto; }
.login img { border-radius: 14px; }
.login h1 { font-size: 22px; margin: 16px 0 8px; }
.login p { color: var(--muted); margin: 0 0 20px; }
.login form { display: grid; gap: 14px; text-align: left; }
.login label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
/* 16px+ text stops iPhone Safari from zooming in when a field is tapped */
.login input { width: 100%; font: 400 17px/1.2 var(--font); padding: 13px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); outline: none; }
.login input:focus { border-color: var(--accent); }
.login button { border: 0; border-radius: 12px; padding: 14px 22px; margin-top: 4px; font: 700 16px var(--font); background: var(--accent); color: var(--accent-ink); }
.login button:disabled { opacity: .5; }
.err { color: var(--bad); margin-top: 14px !important; white-space: pre-line; }  /* reason, then the dm line */

.wait-row { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; margin: 4px 0 14px; }
.faint { color: var(--faint); font-weight: 400; }
.hint { font-size: 13px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ghost-btn, .login .ghost-btn { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 10px; padding: 10px 20px; font: 600 15px var(--font); }

.list-head { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.list-head h2 { margin: 0 2px; }
.note { color: var(--muted); font-size: 13px; margin: 0 2px; }
.acct-actions { margin-top: 8px; display: flex; gap: 8px; }
.act { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 9px; padding: 7px 16px; font: 700 13px var(--font); }
.act.launch { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.act.close { color: var(--bad); border-color: rgba(255, 95, 79, .45); background: rgba(255, 95, 79, .08); }
.act:disabled { opacity: .45; }

.toast { white-space: pre-line; position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); max-width: calc(100vw - 32px); background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 11px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); z-index: 5; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { border-color: var(--bad); }

.foot { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 16px 28px; }
.get-app { display: inline-block; margin-top: 18px; padding: 10px 18px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text); font: 600 14px var(--font); text-decoration: none; }
.foot .get-app { margin-top: 0; }
/* inside an older Android app: the new one (new icon and name) */
.app-new { display: grid; gap: 2px; margin: 12px 16px 0; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent); font-size: 13px; }
.app-new span { color: var(--muted); }
/* a new Kagi RAM for the PC, and what's in it (phone.js updCard) */
.upd { margin: 12px 16px 0; padding: 12px; border-radius: 10px; font-size: 13px; color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.upd p { margin: 4px 0 0; color: var(--muted); line-height: 1.45; }
.upd details { margin-top: 8px; }
.upd summary { cursor: pointer; font-weight: 600; color: var(--text); }
.upd h3 { margin: 10px 0 4px; font-size: 12px; font-weight: 650; color: var(--muted); }
.upd ul { margin: 0; padding-left: 18px; color: var(--muted); }
.upd li { margin: 4px 0; line-height: 1.4; }
.upd-ok { margin-top: 10px; border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 10px;
  padding: 7px 16px; font: 600 13px var(--font); }
.foot button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 10px; padding: 9px 18px; font: 600 14px var(--font); }

/* groups */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 2px 0; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 99px;
  padding: 6px 12px; font: 600 13px var(--font); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip { display: inline-flex; align-items: center; gap: 6px; }
.chip .gdot { width: 8px; height: 8px; border-radius: 3px; background: var(--gc, currentColor); flex: none; }
.chip.on[class*="c-"] { background: color-mix(in srgb, var(--gc) 22%, var(--panel)); border-color: var(--gc); color: var(--text, #fff); }
.c-purple { --gc: #a970ff; } .c-blue { --gc: #5aa9ff; } .c-cyan { --gc: #3fd0d4; } .c-green { --gc: #3ecf8e; } .c-gold { --gc: #f2c14e; }
.c-orange { --gc: #f2913a; } .c-red { --gc: #ff5c6c; } .c-pink { --gc: #ff6fb5; } .c-gray { --gc: #8d89a3; }
.sheet-card .check { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text); font-weight: 500; }
.sheet-card .check input { width: 22px; height: 22px; }

/* account controls */
.head-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.head-btns .act { padding: 7px 12px; }
.sheet { position: fixed; inset: 0; z-index: 6; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { width: 100%; max-width: 520px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 85vh; overflow: auto; }
.sheet-card h3 { margin: 0 0 6px; font-size: 18px; }
.sheet-card p { color: var(--muted); margin: 6px 0 12px; font-size: 14px; }
.sheet-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.sheet-card input, .sheet-card textarea { width: 100%; font: 400 16px/1.3 var(--font); padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); outline: none; resize: vertical; }
.sheet-card input:focus, .sheet-card textarea:focus { border-color: var(--accent); }
.sheet-btns { display: grid; gap: 8px; margin-top: 6px; }
.sheet-btns button { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 12px;
  padding: 13px 16px; font: 600 15px var(--font); text-align: center; }
.sheet-btns button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sheet-btns button.danger { color: var(--bad); border-color: rgba(255, 95, 79, .45); background: rgba(255, 95, 79, .08); }
