/* bored. — sign in and view, the web app.
   Tokens match handoff/BOREDUI/Brand.swift and web/css/site.css exactly, so this never drifts
   from the native app or the marketing site. */

@font-face {
  font-family: "Nunito";
  src: url("Nunito.ttf") format("truetype");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --purple: #6934ED;
  --ink: #202124;
  --muted: #71717A;
  --lavender: #F5F5F7;
  --line: #E9E9EE;
  --green: #32A971;
  --go: #FFD23F;
  --go-edge: #D9A900;
  --surface: #FFFFFF;
  --danger: #E4405F;
  --display: "Nunito", ui-rounded, system-ui, -apple-system, sans-serif;
  --body: "Nunito", system-ui, -apple-system, sans-serif;
  --r-sm: 8px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 12px;
  --tabbar-h: 72px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #F7F7F8; --muted: #AAAAB2; --lavender: #171719; --line: #2B2B30; --surface: #111113;
    --purple: #AF8AFF;
  }
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0; font-family: var(--body); font-weight: 600; color: var(--ink);
  background: var(--surface); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; margin: 0; line-height: 1.08; }
p { margin: 0; line-height: 1.5; }
img { display: block; max-width: 100%; }
button {
  font: inherit; cursor: pointer; appearance: none; -webkit-appearance: none;
  border: 0; background: none; color: inherit; margin: 0;
}
a { color: inherit; }
input, select, textarea { font: inherit; }
[hidden] { display: none !important; }
#authGate form[data-view]:not([hidden]) { display: block; }
:focus-visible { outline: 3px solid #6934ed55; outline-offset: 2px; }

/* ---------- wordmark ---------- */

.wordmark {
  display: inline-flex; align-items: baseline; gap: 2px; font-family: var(--display);
  font-size: 26px; font-weight: 800; text-decoration: none;
  background: linear-gradient(110deg, #FF5A1F, #FF3D6E, #7B3CFF);
  background-clip: text; -webkit-background-clip: text; color: transparent;
}
.wordmark .dot { width: 8px; height: 8px; border-radius: 50%; background: #FFD166; display: inline-block; margin-left: 1px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border: 0; border-radius: 8px;
  font-family: var(--display); font-size: 16px; font-weight: 700;
  background: var(--ink); color: var(--surface); transition: transform .15s, filter .15s, opacity .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: var(--lavender); color: var(--ink); }
.btn.ghost.on-surface { background: var(--surface); border: 1px solid var(--line); }
.btn.mini { min-height: 40px; padding: 0 16px; font-size: 14px; }
.btn.full { width: 100%; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.link, button.link {
  background: transparent; color: var(--purple); border: 0; min-height: auto;
  padding: 4px 2px; font-family: var(--body); font-size: 14px; font-weight: 700;
  text-decoration: underline; text-underline-offset: 2px;
}
button.link:hover { color: var(--ink); }

/* ---------- segmented control ---------- */

.segmented {
  display: inline-flex; background: var(--lavender); border-radius: 999px; padding: 4px; gap: 2px;
}
.segmented button {
  border: 0; background: transparent; border-radius: 999px; padding: 9px 16px; font-size: 14px;
  font-weight: 700; color: var(--muted);
}
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px #00000014; }

/* ---------- form fields ---------- */

.field { display: grid; gap: 6px; margin-bottom: 14px; text-align: left; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 14px; padding: 13px 15px; font-size: 16px; width: 100%;
}
.field textarea { resize: vertical; }
.checkbox-field label { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; font-weight: 400; color: var(--ink); }
.checkbox-field input[type="checkbox"] {
  width: auto; margin-top: 2px; flex: none; border-radius: 4px; padding: 0;
}
.checkbox-field label span { flex: 1; min-width: 0; line-height: 1.35; }
.checkbox-field a { color: inherit; text-decoration: underline; }
.help { font-size: 13px; color: var(--muted); margin-top: 6px; }
.msg { font-size: 14px; margin-top: 12px; min-height: 1em; }
.msg.bad { color: var(--danger); }
.msg.ok { color: var(--green); }
.mini-msg { margin-top: -2px; font-size: 12px; }
.mini-msg[data-state="bad"] { color: var(--danger); }
.mini-msg[data-state="ok"] { color: var(--green); }
.mini-msg[data-state="checking"] { color: var(--muted); }

/* ---------- auth gate ---------- */

.auth-gate { min-height: 100dvh; display: grid; place-items: center; padding: 28px 24px; background: var(--surface); }
.auth-card {
  width: min(100%, 360px); background: var(--surface);
  padding: 24px 0;
}
.auth-card .wordmark { margin-bottom: 26px; font-size: 30px; }
.auth-card h1 { font-size: 28px; margin-bottom: 8px; }
.auth-card .sub { color: var(--muted); font-size: 15px; margin-bottom: 26px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 4px; font-size: 14px; }
.auth-links button.link { font-size: 14px; }
.auth-switch { text-align: center; margin-top: 22px; font-size: 14px; color: var(--muted); }
.apple-btn {
  width: 100%; min-height: 48px; border-radius: 8px; background: var(--ink); color: var(--surface);
  border: 0; font-family: var(--display); font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 16px;
}
.apple-btn:disabled { opacity: .45; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 22px 0 4px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- app shell ---------- */

.app-shell { min-height: 100dvh; background: var(--surface); }
.rail {
  display: none; position: fixed; inset: 0 auto 0 0; width: 240px; padding: 26px 16px;
  background: var(--surface); border-right: 1px solid var(--line); flex-direction: column; gap: 6px;
}
.rail .wordmark { padding: 8px 12px 26px; font-size: 24px; }
.rail-link, .navbtn {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px;
  color: var(--muted); font-weight: 700; font-size: 15px; text-decoration: none; border: 0; background: none; width: 100%; text-align: left;
}
.rail-link svg, .navbtn svg { width: 21px; height: 21px; flex: 0 0 auto; }
.rail-link[aria-current="true"], .navbtn[aria-current="true"] { background: var(--ink); color: var(--surface); }
.rail .signout { margin-top: auto; }

main { padding: max(18px, env(safe-area-inset-top)) 18px calc(var(--tabbar-h) + 34px + env(safe-area-inset-bottom)); max-width: 720px; margin-inline: auto; }
@media (min-width: 1180px) {
  .rail { display: flex; }
  main { margin-left: 240px; margin-inline: auto; max-width: 760px; padding-bottom: 40px; }
  .tabbar { display: none; }
}

#banner { max-width: 720px; margin: 0 auto 14px; }
@media (min-width: 1180px) { #banner { margin-left: 240px; } }
.banner { border-radius: 16px; padding: 13px 16px; font-size: 14px; }
.banner.warn { background: #FFF6DA; border: 1px solid var(--go); }
.banner.bad { background: #FDE7EB; border: 1px solid var(--danger); }
.banner.ok { background: #E6F7EF; border: 1px solid var(--green); }

/* floating pill tab bar, phones only */
.tabbar {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40;
  display: flex; gap: 7px; background: color-mix(in srgb, var(--surface) 92%, transparent); border-radius: 999px; padding: 7px 9px;
  box-shadow: 0 18px 44px -18px #00000045; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.tabbar a {
  display: flex; align-items: center; justify-content: center; width: 48px; height: 44px; padding: 0;
  border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 0; font-weight: 700;
}
.tabbar a span { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="true"] { color: var(--ink); background: var(--lavender); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- generic layout ---------- */

.screen-title {
  min-height: 66px; display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; margin: 0 0 18px; padding-top: 10px;
}
.screen-title.compact { min-height: 58px; }
.screen-title h1 {
  font-size: 34px; line-height: 1.12; letter-spacing: 0;
}
.icon-action {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--lavender); border: 1px solid var(--line); color: var(--ink);
  font-size: 24px; font-weight: 800; text-decoration: none;
}
.back-link {
  display: inline-flex; align-items: center; min-height: 36px; margin: 2px 0 12px;
  color: var(--muted); text-decoration: none; font-weight: 800; font-size: 14px;
}
.section-head { margin: 24px 0 10px; }
.section-head:first-child { margin-top: 4px; }
.section-head h2 { font-size: 19px; }
.section-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }

.card {
  background: var(--surface); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 0;
  margin-bottom: 10px;
}
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); font-size: 14px; }
.tag { display: inline-block; font-size: 12px; font-weight: 800; color: var(--purple); background: var(--lavender); border-radius: 999px; padding: 4px 11px; }

.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--purple); display: grid; place-items: center; flex: 0 0 auto; position: relative; }
.avatar svg { width: 74%; }
.avatar.lg { width: 76px; height: 76px; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; background: var(--green); border: 2px solid var(--surface); }

.empty-state, .error-state, .loading-state {
  text-align: center; padding: 28px 18px; border-radius: 20px; font-size: 14px; color: var(--muted);
}
.empty-state { background: var(--lavender); border: 1px solid var(--line); }
.error-state { background: #FDE7EB; color: #7a1428; }
.loading-state { color: var(--muted); }

.find-people {
  display: grid; gap: 12px; margin-bottom: 18px;
}
.people-search {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px;
  background: var(--lavender); border: 1px solid transparent; border-radius: 24px;
  padding: 8px;
}
.people-search input {
  min-width: 0; border: 0; background: transparent; color: var(--ink);
  padding: 0 6px; font-size: 15px; outline: none;
}
.people-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center;
}
.people-meta { min-width: 0; }
.people-meta a, .profile-link-avatar { color: inherit; text-decoration: none; }
.people-meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-actions {
  grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-start;
}
.people-actions .btn { flex: 1 1 116px; }
@media (min-width: 560px) {
  .people-card { grid-template-columns: auto minmax(0, 1fr) auto; }
  .people-actions { grid-column: auto; justify-content: flex-end; }
  .people-actions .btn { flex: 0 0 auto; }
}

.avatar.xl { width: 98px; height: 98px; }
.profile-hero { display: grid; gap: 16px; margin-top: 14px; }
.profile-main { display: flex; align-items: center; gap: 15px; min-width: 0; }
.profile-title { min-width: 0; }
.profile-title h2 {
  font-size: 26px; line-height: 1.15; overflow-wrap: anywhere;
}
.profile-bio { color: var(--ink); font-size: 15px; }
.profile-about { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-about span {
  border: 1px solid var(--line); background: var(--lavender); color: var(--muted);
  border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 800;
}
.profile-actions { grid-column: auto; justify-content: stretch; }
.profile-actions .btn { flex: 1 1 120px; }
.profile-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 14px 0 12px;
  border-bottom: 1px solid var(--line);
}
.profile-tabs span, .profile-tabs button {
  text-align: center; padding: 12px 4px 10px; color: var(--muted); font-size: 13px; font-weight: 800;
  border-bottom: 2px solid transparent;
}
.profile-tabs span.active, .profile-tabs button.active,
.profile-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { text-align: center; padding: 14px 8px; }
.stat b { display: block; font-family: var(--display); font-size: 24px; }
.stat span { font-size: 12px; color: var(--muted); }

/* ---------- games ---------- */

.game-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .game-grid { grid-template-columns: repeat(3, 1fr); } }
.game-tile { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.game-tile button { width: 100%; height: 100%; border: 0; background: transparent; padding: 18px 14px; text-align: left; }
.game-tile h4 { font-size: 17px; }
.game-tile p { margin-top: 4px; font-size: 13px; }
#gameHost { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; flex-direction: column; }
#gameHost .game-toolbar { display: flex; align-items: center; padding: 10px 14px; background: var(--surface); }
#gameFrame { flex: 1; width: 100%; border: 0; background: #000; }

/* ---------- leaderboard ---------- */
/* ART: Astra — plain functional layout only; rows, header and empty state need a real pass. */

.segmented { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.segmented .btn { flex: 1 1 auto; }
#lbGameFilter {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px;
  margin-bottom: 14px; background: var(--surface); color: var(--ink); font: inherit;
}
.leaderboard-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--surface);
}
.leaderboard-row.me { border-color: var(--purple); background: var(--lavender); }
.leaderboard-row .lb-rank { font-weight: 800; width: 34px; flex: 0 0 auto; }
.leaderboard-row .lb-name { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-row .lb-points { font-weight: 800; }
.leaderboard-row .lb-wins { flex: 0 0 auto; }
.leaderboard-pinned { margin-top: 14px; }

/* ---------- chats ---------- */

.inbox-row {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left; border: 0;
  background: var(--surface); border-bottom: 1px solid var(--line); border-radius: 0; padding: 14px 0; text-decoration: none; color: inherit;
}
.inbox-row .meta { flex: 1; min-width: 0; }
.inbox-row .name { font-weight: 600; font-size: 16px; }
.inbox-row:has(.unread-dot) .name { font-weight: 800; }
.inbox-row .preview { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-row .time { font-size: 12px; color: var(--muted); flex: 0 0 auto; }
.unread-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--purple); flex: 0 0 auto; }

.thread { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.bubble { max-width: 78%; padding: 11px 15px; border-radius: 20px; font-size: 15px; }
.bubble.me { align-self: flex-end; background: var(--ink); color: var(--surface); border-bottom-right-radius: 6px; }
.bubble.them { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble.system { align-self: center; background: var(--lavender); color: var(--muted); font-size: 12px; padding: 8px 14px; }
.bubble.icebreaker { align-self: center; background: var(--lavender); border: 1px solid var(--line); font-weight: 700; text-align: center; }
.bubble.voice { padding: 10px; min-width: min(270px, 78%); }
.voice-note { display: grid; gap: 8px; }
.voice-play {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border-radius: 18px; padding: 10px 12px; background: transparent; color: inherit;
}
.voice-play:disabled { opacity: .65; cursor: default; }
.voice-icon {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: currentColor; color: var(--surface); font-size: 13px; flex: 0 0 auto;
}
.voice-play span:last-child { display: grid; gap: 2px; min-width: 0; }
.voice-play small { color: var(--muted); font-size: 12px; font-weight: 800; }
.voice-audio { width: min(260px, 100%); height: 38px; display: block; }
.voice-status { font-size: 12px; padding: 0 8px 2px; }

.composer { display: flex; gap: 10px; margin-top: 14px; align-items: flex-end; position: sticky; bottom: calc(var(--tabbar-h) + 14px); }
@media (min-width: 1180px) { .composer { bottom: 14px; } }
.composer textarea { flex: 1; border: 1px solid var(--line); border-radius: 20px; padding: 12px 16px; resize: none; min-height: 46px; max-height: 120px; background: var(--surface); color: var(--ink); }

.icebreaker-card { background: var(--lavender); border-radius: var(--r-lg); padding: 20px; text-align: center; margin-bottom: 16px; }
.icebreaker-card h3 { font-size: 18px; margin-bottom: 12px; }

/* ---------- map ---------- */

.map-honest-card { text-align: center; padding: 28px 20px; background: var(--lavender); border: 1px solid var(--line); border-radius: 24px; }
.map-honest-card .glyph { width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 50%; background: var(--lavender); display: grid; place-items: center; color: var(--purple); }

/* ---------- me ---------- */

#qr { width: 100%; max-width: 220px; margin-inline: auto; }
#qr canvas, #qr img { width: 100%; height: auto; border-radius: 12px; image-rendering: pixelated; }
.code-value { font-family: ui-monospace, Menlo, monospace; font-size: 24px; font-weight: 800; text-align: center; letter-spacing: .06em; margin-top: 14px; }
.settings-list { display: grid; gap: 2px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 15px 4px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 700; text-decoration: none; color: inherit; }
.settings-row:last-child { border-bottom: 0; }
.settings-row .muted { font-weight: 600; }

.onboarding-gate { min-height: 100dvh; display: grid; place-items: center; padding: 28px 24px; background: var(--surface); }

/* ---------- utility ---------- */

.center { text-align: center; }
.mt-16 { margin-top: 16px; }
.grow { flex: 1; }

/* ---------- remote announcements (structure only; visual design is Astra's) ---------- */
.announcements { display: grid; gap: 10px; margin-bottom: 16px; }
.announce { border-radius: 24px; padding: 14px 16px; background: var(--lavender, #F3EEFF); color: var(--ink, #202124); border: 1px solid var(--line, #E5DCF7); }
.announce.kind-fix { border-color: var(--green, #32A971); }
.announce.kind-warning { border-color: var(--go, #FFD23F); }
.announce.kind-update { border-color: var(--purple, #6934ED); }
.announce.kind-maintenance { opacity: .92; }
.announce-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.announce-title { font-weight: 800; }
.announce-close { appearance: none; border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--muted, #64646B); cursor: pointer; padding: 4px 8px; border-radius: 12px; }
.announce-body { margin: 6px 0 0; }
.announce-fixes { margin: 8px 0 0; padding-left: 18px; }
.announce-link { display: inline-block; margin-top: 10px; font-weight: 700; color: var(--purple, #6934ED); }

/* Shared native measurements, with a persistent rail on wider screens. */
main { width: 100%; max-width: 680px; padding-inline: 20px; }
.screen-title { min-height: 54px; align-items: center; margin-bottom: 20px; }
.icon-action { width: 44px; height: 44px; flex: 0 0 44px; }
.empty-state { background: transparent; border: 0; padding: 48px 20px; }
.field input, .field select, .field textarea { background: var(--lavender); border-color: transparent; border-radius: 8px; }
.auth-card h1 { margin-bottom: 24px; font-size: 26px; }
.auth-card .wordmark { display: flex; width: fit-content; margin: 0 auto 48px; }
.auth-links { gap: 16px; margin-top: 18px; flex-wrap: wrap; }
.people-search { border-radius: 12px; }
.profile-hero { border-bottom: 0; }
.profile-about span { border: 0; background: transparent; padding: 4px 0; font-weight: 600; }
.profile-about { gap: 16px; }
.profile-tabs span, .profile-tabs button { min-width: 0; overflow-wrap: anywhere; min-height: 44px; }
.avatar { background: linear-gradient(135deg, #FF4B46, #FF3D79 35%, #7B3CFF 70%, #BBA7CD); overflow: hidden; }
.avatar svg { width: 100%; height: 100%; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.bubble { overflow-wrap: anywhere; }
.composer textarea { min-width: 0; font-size: 16px; }
.tabbar { width: min(360px, calc(100% - 32px)); justify-content: space-between; }
.tabbar a { flex: 1; min-width: 0; }
.nav-face { border-radius: 50%; background: #8E8E93; }
.nav-face.branded { background: linear-gradient(135deg, #FF4B46, #FF3D79 35%, #7B3CFF 70%, #BBA7CD); }
.tabbar a .nav-face { width: 28px; height: 28px; }
.rail-link[aria-current="true"] { background: var(--lavender); color: var(--ink); }
.rail-link { min-height: 48px; border-radius: 8px; }
.rail-link:hover { background: var(--lavender); }
@media (min-width: 900px) {
  .rail { display: flex; width: 224px; padding: 32px 20px; }
  .app-shell { padding-left: 224px; }
  main { max-width: 720px; margin-inline: auto; padding: 32px 36px 48px; }
  #banner { max-width: 648px; margin: 0 auto 14px; }
  .tabbar { display: none; }
  .composer { bottom: 16px; background: var(--surface); padding: 10px 0; }
  .screen-title { margin-bottom: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
