/* Same dark palette as the ChatWatch desktop app's default theme. */
:root {
  --bg: #202020;
  --panel: #2b2b2b;
  --line: #3a3a3a;
  --text: #ffffff;
  --muted: #c0c0c0;
  --accent: #9147ff;
  --hit-bg: rgba(145, 71, 255, 0.16);
  --ok: #22c55e;
  --err: #f87171;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

#app, #main-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  min-height: 0;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
code { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 0.9em; }

/* ── Connect screen ── */
#login-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + env(safe-area-inset-top));
  gap: 6px;
  text-align: center;
}
#login-view h1 { margin: 0 0 4px; font-size: 22px; }
#login-view p { margin: 0 0 14px; max-width: 320px; line-height: 1.45; font-size: 14px; }
#login-form { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
#token-input {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 16px; /* 16px stops iOS zooming the page when the field is focused */
}
#login-error { color: var(--err); font-size: 13px; min-height: 18px; }

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
button:disabled { opacity: 0.5; }
button.secondary { background: var(--bg); border: 1px solid var(--line); color: var(--muted); }

/* ── Header ── */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex-shrink: 0;
}
#header h1 { font-size: 17px; margin: 0; font-weight: 700; }
.hdr-actions { display: flex; gap: 4px; align-items: center; }
.icon-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 20px;
  line-height: 1;
}

/* ── Banners / push bar ── */
#install-banner {
  background: var(--hit-bg);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  font-size: 13px;
  line-height: 1.4;
  flex-shrink: 0;
}
#push-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  font-size: 13px;
  color: var(--muted);
}
.push-actions { display: flex; gap: 8px; flex-shrink: 0; }
#push-bar button { padding: 8px 12px; font-size: 13px; }
#push-status { min-width: 0; line-height: 1.3; }
#push-status.on { color: var(--ok); }
#push-status.problem { color: var(--err); }

/* ── Mentions list ── */
#list-view { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
#pull-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 8px;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
#mentions-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom);
}
#mentions-list { list-style: none; margin: 0; padding: 0; }
.mention-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.mention-row.highlight { background: var(--hit-bg); }
.m-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.m-channel { color: var(--accent); font-weight: 600; }
.m-user { color: var(--text); font-weight: 600; }
.m-time { white-space: nowrap; }
.m-message {
  font-size: 15px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.mention-row.expanded .m-message { -webkit-line-clamp: unset; display: block; }
.m-detail { display: none; margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.mention-row.expanded .m-detail { display: block; }

#empty-state, #load-status { text-align: center; color: var(--muted); padding: 24px; font-size: 13px; }
