:root {
  --bg: #0d0f14;
  --panel: #171a22;
  --line: #262b36;
  --text: #f2f4f8;
  --muted: #8b93a7;
  --user: #7cc4ff;
  --tip-bg: #3a2b05;
  --tip-line: #f5b301;
  --tip-text: #ffd65c;
  --ok: #34d17a;
  --warn: #f5b301;
  --bad: #ff5c5c;
  --font: 28px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }

.screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
}
.card { max-width: 420px; }
.card h1 { font-size: 32px; margin: 0 0 12px; }
.card p { font-size: 18px; color: var(--muted); }
.big-btn {
  font-size: 28px;
  padding: 24px 48px;
  border-radius: 20px;
  border: 0;
  background: var(--user);
  color: #001a2e;
  font-weight: 700;
}
.hint { color: var(--muted); margin-top: 16px; }

#live { display: flex; flex-direction: column; height: 100%; }
#bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.spacer { flex: 1; }
#status { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--warn); flex: none; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.icon-btn {
  min-width: 44px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 18px;
}
#menu {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}
#menu input { width: 22px; height: 22px; vertical-align: middle; margin-right: 8px; }
.link-btn { align-self: flex-start; background: none; border: 0; color: var(--bad); font-size: 16px; padding: 0; }

#messages {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
  font-size: var(--font);
  line-height: 1.25;
  overscroll-behavior: contain;
}
#messages li {
  padding: 0.35em 0.4em;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
#messages li.fresh { animation: flash 1.5s ease-out; }
@keyframes flash { from { background: #24324a; } to { background: transparent; } }
.who { color: var(--user); font-weight: 700; margin-right: 0.35em; }
.who::after { content: ":"; }
.time { color: var(--muted); font-size: 0.45em; margin-left: 0.5em; vertical-align: middle; }
li.system { color: var(--muted); font-size: 0.7em; font-style: italic; }
li.tip {
  background: var(--tip-bg);
  border-left: 0.25em solid var(--tip-line);
  border-radius: 6px;
  margin: 0.2em 0;
}
li.tip .who { color: var(--tip-text); }
.amount {
  display: inline-block;
  background: var(--tip-line);
  color: #1f1600;
  font-weight: 800;
  border-radius: 0.3em;
  padding: 0 0.3em;
  margin-right: 0.35em;
}

#jump {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  font-size: 18px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 0;
  background: var(--user);
  color: #001a2e;
  font-weight: 700;
  box-shadow: 0 4px 16px #0008;
}
